@ycodium-ai/plugin-pull-requests 0.2.5877 → 0.2.5891

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/ui.js CHANGED
@@ -38,9 +38,9 @@ ${t}`}function Eu(e,t){return[...e.filter(o=>!o.id.startsWith(Tp)),...t]}functio
38
38
  `),diff:""}}function bn(e){return{prompt:"",reviewComments:[Cn(e,Ap)]}}function Ln(e){return{prompt:"Explain this pull request.",reviewComments:[Cn(e,["Walk through this pull request as if the reader is reviewing it for the first time. Cover, in this order: what the change is for; how it goes about it, file by file where that matters; anything surprising or risky in it; and what is worth reading closely before approving.","Read the diff before answering, and say plainly where you are unsure rather than filling the gap. Explain only. Do not change any code."])]}}function Pn(e){return{prompt:gr(e.request),reviewComments:[Cn(e,[]),{...e.comment,text:""}]}}var Ap,Sn=m(()=>{"use strict";Ua();Ap=["Answer the question asked in this message. Do not change any code, and do not check anything out unless asked to."]});function Ou(e,t){return e!==null&&e.key===t.key&&e.updatedAt!==t.updatedAt}function kn(e,t){let o=new Set(e.map(r=>r.id));return[...e,...t.filter(r=>o.has(r.id)?!1:(o.add(r.id),!0))]}function Uu(e,t,o){return e.map(r=>r.id===t?{...r,body:o}:r)}function _u(e,t){return e.projectId===t.projectId&&e.repository===t.repository&&e.number===t.number}function Hu(e){return e?{fixFinding:"handoff.fixInThisThread",fixCheck:"handoff.fixInThisThread",fixFindings:"handoff.fixFindingsInThisThread"}:{fixFinding:"thread.fixInThread",fixCheck:"handoff.fix",fixFindings:"handoff.fixFindingsInAThread"}}function Gu(e,t){return e==="thread"?t??null:null}function $u(e,t,o){return e||t||o}function zu(e,t){let o=t.find(l=>l.isDefault);if(!o)return!1;if(o.isRemote!==!0)return o.name!==e;let r=`${o.remoteName??o.name.split("/")[0]}/`;return(o.name.startsWith(r)?o.name.slice(r.length):o.name)!==e}function Vu(e,t){return t==="newest"?e.toReversed():e}function _a(e){switch(e?.trim().toLowerCase().replaceAll("_","-")){case"approved":return"approved";case"changes-requested":return"changes-requested";case"dismissed":return"dismissed";default:return null}}function To(e){return Date.parse(e)}function qn(e){let t=null,o=Number.NEGATIVE_INFINITY;for(let r of e){let n=To(r.committedDate);Number.isNaN(n)||n<=o||(t=r.committedDate,o=n)}return t}function Tn(e,t){if(t===null)return!1;let o=To(e),r=To(t);return!Number.isNaN(o)&&!Number.isNaN(r)&&o<r}function hr(e,t=[]){let o=qn(t),r=new Map;for(let n of e){let l=_a(n.reviewState);if(l===null)continue;let i=n.author?.login??`ghost:${n.id}`,u=r.get(i);u!==void 0&&To(u.at)>To(n.createdAt)||r.set(i,{key:i,actor:n.author,outcome:l,at:n.createdAt,stale:Tn(n.createdAt,o)})}return[...r.values()].filter(n=>n.outcome!=="dismissed")}function Ku(e){let t=[];for(let o of e)if((o.kind==="comment"||o.kind==="review")&&_a(o.reviewState)===null){let r=t.at(-1);r?.kind==="comments"?t[t.length-1]={kind:"comments",events:[...r.events,o]}:t.push({kind:"comments",events:[o]})}else t.push({kind:"event",event:o});return t}function ju(e){return[{id:"created",at:e.createdAt,kind:"opened",titleKey:"timeline.opened",body:null,markdown:!1,url:null,actor:e.author,commitAuthors:[],additions:null,deletions:null,path:null,reviewState:null,reactions:[]},...e.commits.map(o=>({id:o.oid,at:o.committedDate,kind:"commit",titleKey:"timeline.commit",titleValues:{short:o.oid.slice(0,7)},body:o.messageHeadline||null,markdown:!1,url:null,actor:o.authors?.[0]??null,commitAuthors:o.authors??[],additions:o.additions??null,deletions:o.deletions??null,path:null,reviewState:null,reactions:[]})),...e.comments.map(o=>({id:o.id,at:o.createdAt,kind:o.kind==="review"?"review":"comment",titleKey:o.kind==="review"?"timeline.reviewed":"timeline.commented",body:ga(o.body),markdown:!0,url:o.url,actor:o.author,commitAuthors:[],additions:null,deletions:null,path:o.path,reviewState:o.reviewState,reactions:o.reactions??[]})),...e.mergedAt?[{id:"merged",at:e.mergedAt,kind:"merged",titleKey:"timeline.merged",body:null,markdown:!1,url:null,actor:null,commitAuthors:[],additions:null,deletions:null,path:null,reviewState:null,reactions:[]}]:[],...e.closedAt&&!e.mergedAt?[{id:"closed",at:e.closedAt,kind:"closed",titleKey:"timeline.closed",body:null,markdown:!1,url:null,actor:null,commitAuthors:[],additions:null,deletions:null,path:null,reviewState:null,reactions:[]}]:[]].toSorted((o,r)=>r.at.localeCompare(o.at))}function Ao(e,t){let r=(e instanceof Error?e.message:typeof e=="string"?e:"").replace(Mp,"").trim();return r.length===0||Ep.some(l=>l.test(r))?t:r.length<=Fu?r:`${r.slice(0,Fu-1)}\u2026`}function Wu(e){if(e.state!=="open"||e.baseComparison!=="behind"||e.mergeability!=="mergeable")return null;let t=e.capabilities.updateMethods??[],o=e.viewerPermissions.updateMethods??[];return{behindBy:e.behindBy??null,methods:t.filter(r=>o.includes(r))}}function Xu(e){return Dp[e]}var Mp,Ep,Fu,Dp,Ut=m(()=>{"use strict";Ua();Nu();Ua();Sn();Mp=/^Pull request operation \w+ failed:\s*/iu,Ep=[/^(github|gitlab)?\s*(cli|api)?\s*(command\s*)?failed\.?$/iu,/^exited? with (code|status) \d+\.?$/iu,/^unknown error\.?$/iu],Fu=320;Dp={"update-branch":!0,merge:!1,ready:!1,draft:!1,close:!1,reopen:!1,"enable-auto-merge":!1,"disable-auto-merge":!1}});function Ju(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function yr(e){return e.capabilities.edit?.changeRequest!==!0?!1:Ju(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes("merge")}function Ha(e,t){return e.capabilities.edit?.comment!==!0||t.kind!=="issue-comment"&&t.kind!=="review-comment"?!1:Ju(e.viewer,t.author?.login)}var Mo=m(()=>{"use strict"});function An(e){return a(fu,{...e})}var Yu=m(()=>{"use strict";N();T()});function ed(e){try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}}function $p(e){let t=Op.exec(e.trim())?.[1];return t===void 0||!ed(t)?null:Up.test(t)||_p.test(t)?{url:t,media:"video"}:null}function td(e){let t=[],o=[],r=null,n=()=>{let i=o.join(`
39
39
  `).replace(/^\n+/u,"").replace(/\s+$/u,"");o.length=0,i.trim().length>0&&t.push({id:`markdown:${t.length}`,kind:"markdown",text:i})},l=e.split(`
40
40
  `);for(let i=0;i<l.length;i+=1){let u=l[i];if(r!==null){en(u,r.char,r.length)&&(r=null),o.push(u);continue}if(r=Zr(u),r!==null||Fp.test(u)){o.push(u);continue}let f=$p(u);if(f!==null){n(),t.push({id:`attachment:${t.length}`,kind:"attachment",...f});continue}if(!Gp.test(u)){o.push(u);continue}let c=Math.min(i+Bp,l.length)-1,d=i;for(;d<c&&!Zu.test(l[d]);)d+=1;let p=Zu.test(l[d])?Hp.exec(l.slice(i,d+1).join(`
41
- `))?.[1]:void 0;p!==void 0&&ed(p)?(n(),t.push({id:`attachment:${t.length}`,kind:"attachment",url:p,media:"video"}),i=d):o.push(u)}return n(),t}var Bp,Fp,Op,Up,_p,Hp,Gp,Zu,ad=m(()=>{"use strict";bo();Bp=8,Fp=/^(?: {4}|\t)/u,Op=/^<?(https?:\/\/\S+?)>?$/u,Up=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,_p=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Hp=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,Gp=/^\s*<video\b/iu,Zu=/<\/video>\s*$/iu});function Pt({text:e,cwd:t,environmentId:o,className:r}){let{t:n}=A(),l=td(e);return a("div",{className:M("space-y-3",r),children:l.map(i=>{if(i.kind==="markdown")return a(An,{text:i.text,cwd:t,environmentId:o},i.id);let u=i.media==="video",f=u?fo:co;return s("a",{href:i.url,rel:"noreferrer noopener",target:"_blank",className:"flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/40",children:[a(f,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),a("span",{className:"min-w-0 flex-1 truncate",children:n(u?"markdown.playVideoOnHost":"markdown.openAttachmentOnHost")}),a(la,{"aria-hidden":!0,className:"size-3 shrink-0 text-muted-foreground"})]},i.id)})})}var Ga=m(()=>{"use strict";De();Ue();qe();Yu();ad();T()});function Yt({value:e,cwd:t,environmentId:o,placeholder:r,label:n,saving:l,allowEmpty:i=!1,className:u,onSave:f,onCancel:c}){let{t:d}=A(),[p,g]=C(e),[L,R]=C(!1),[I,P]=C(e);I!==e&&(P(e),g(e));let y=p.trim().length===0;return s("div",{className:M("space-y-2",u),onKeyDown:w=>{w.key!=="Escape"||l||(w.preventDefault(),c())},children:[s("div",{className:"flex items-center gap-1",children:[a(b,{size:"xs",variant:L?"ghost":"outline",disabled:l,onClick:()=>R(!1),children:d("markdownEditor.write")}),a(b,{size:"xs",variant:L?"outline":"ghost",disabled:l,onClick:()=>R(!0),children:d("markdownEditor.preview")})]}),L?a("div",{className:"rounded-lg border border-border/60 px-3 py-2",children:y?a("p",{className:"text-xs text-muted-foreground",children:d("markdownEditor.nothingToPreview")}):a(Pt,{text:p,cwd:t,environmentId:o})}):a(Rt,{autoFocus:!0,disabled:l,value:p,rows:6,placeholder:r,"aria-label":n,onChange:w=>g(w.target.value)}),s("div",{className:"flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",disabled:l,onClick:c,children:d("action.cancel")}),a(b,{size:"xs",variant:"outline",disabled:l||y&&!i,onClick:()=>f(p),children:d(l?"action.saving":"action.save")})]})]})}var Eo=m(()=>{"use strict";ce();Ue();qe();N();N();Ga();T()});function En(e){return zp[e]}function xr(e){return Vp[e]}function jp(e,t){return e.length<=1?e[0]??"":e.length===2?t("reactions.joinTwo",{first:e[0],second:e[1]}):t("reactions.joinMany",{list:e.slice(0,-1).join(t("reactions.listSeparator")),last:e.at(-1)})}function Wp(e,t,o){return o(t?"reactions.others":"reactions.people",{count:e})}function od(e,t){let o=e.actors.length<e.count,n=(e.viewerHasReacted&&o?[t("reactions.you"),...e.actors]:[...e.actors]).slice(0,Math.min(Kp,e.count)),l=Math.max(0,e.count-n.length),i=[...n,...l>0?[Wp(l,n.length>0,t)]:[]];return t("reactions.tooltip",{names:jp(i,t),emoji:t(xr(e.content))})}function rd(e,t){if(t.size===0)return e;let o=new Map(e.map(r=>[r.content,r]));for(let[r,n]of t){let l=o.get(r);if(l===void 0){n&&o.set(r,{content:r,count:1,actors:[],viewerHasReacted:!0});continue}if(l.viewerHasReacted===n)continue;let i=l.count+(n?1:-1);i<=0?o.delete(r):o.set(r,{...l,count:i,viewerHasReacted:n})}return Mn.flatMap(r=>o.get(r)??[])}var Mn,zp,Vp,Kp,nd=m(()=>{"use strict";Mn=["thumbs-up","thumbs-down","laugh","hooray","confused","heart","rocket","eyes"],zp={"thumbs-up":"\u{1F44D}","thumbs-down":"\u{1F44E}",laugh:"\u{1F604}",hooray:"\u{1F389}",confused:"\u{1F615}",heart:"\u2764\uFE0F",rocket:"\u{1F680}",eyes:"\u{1F440}"},Vp={"thumbs-up":"reactions.thumbsUp","thumbs-down":"reactions.thumbsDown",laugh:"reactions.laugh",hooray:"reactions.hooray",confused:"reactions.confused",heart:"reactions.heart",rocket:"reactions.rocket",eyes:"reactions.eyes"};Kp=3});function Xp(e){return e.map(t=>`${t.content}:${t.count}:${t.viewerHasReacted?1:0}`).join(" ")}function _t({reactions:e,canReact:t,subjectId:o,environmentId:r,reference:n,onRefresh:l,className:i}){let{t:u}=A(),[f,c]=C(!1),[d,p]=C({signature:"",values:sd}),g=Be(Se.converse,{reportFailure:!1}),L=Xp(e),R=d.signature===L?d.values:sd,I=rd(e,R),P=async(y,w)=>{if(p({signature:L,values:new Map([...R,[y,w]])}),(await g({environmentId:r,input:{op:"setReaction",...n,...o===void 0?{}:{subjectId:o},content:y,reacted:w}}))._tag==="Failure"){p(ee=>{let J=new Map(ee.values);return J.delete(y),{signature:ee.signature,values:J}}),we.error(u("notify.reactionSaveFailed"));return}l()};return I.length===0&&!t?null:s("div",{className:M("flex flex-wrap items-center gap-1",i),children:[I.map(y=>s(oe,{children:[s(ne,{render:a(b,{size:"compact",variant:"ghost","aria-pressed":y.viewerHasReacted,"aria-label":u("reactions.nameAndCount",{name:u(xr(y.content)),count:y.count}),softDisabled:!t,className:M("h-6 rounded-full px-2 sm:text-xs aria-disabled:border-inherit aria-disabled:bg-inherit aria-disabled:text-inherit",y.viewerHasReacted?"border-primary/60 bg-primary/10 text-foreground":"border-border/70 bg-muted/40 text-muted-foreground",t&&"hover:border-primary/60"),onClick:()=>{P(y.content,!y.viewerHasReacted)}}),children:[a("span",{"aria-hidden":!0,children:En(y.content)}),a("span",{className:"tabular-nums",children:y.count})]}),a(re,{side:"top",children:od(y,u)})]},y.content)),t?s(Ea,{open:f,onOpenChange:c,children:[a(Na,{render:a(b,{size:"compact",variant:"ghost","aria-label":u("reactions.addAria"),className:M("h-6 rounded-full border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground sm:text-xs",I.length===0&&!f&&"opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100")}),children:a(go,{"aria-hidden":!0})}),a(Da,{align:"start",className:"w-auto",side:"top",viewportClassName:"py-2",children:a("div",{className:"flex items-center gap-0.5",children:Mn.map(y=>{let w=I.find(S=>S.content===y)?.viewerHasReacted??!1;return a(b,{size:"icon-xs",variant:"ghost","aria-pressed":w,"aria-label":u(xr(y)),className:M("size-7 rounded-control-3 text-base sm:size-7 sm:text-base",w&&"bg-primary/10"),onClick:()=>{c(!1),P(y,!w)},children:a("span",{"aria-hidden":!0,children:En(y)})},y)})})})]}):null]})}var sd,wr=m(()=>{"use strict";De();ce();Ue();qe();Me();Me();it();N();N();N();nd();T();sd=new Map});function vd(e,t,o){return!o&&(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&t.trim().length>0}var Id=m(()=>{"use strict"});function rg(e){return t=>{t.key==="Escape"&&e.onCancel&&(t.preventDefault(),e.onCancel()),vd(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Cd({comment:e,onRemove:t}){let{t:o}=A();return s("div",{className:M(Rd,"border-dashed"),contentEditable:!1,onPointerDown:r=>r.stopPropagation(),children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a(nt,{className:"size-icon-2"}),a("span",{children:o("thread.pendingComment")}),a(b,{size:"icon-xs",variant:"ghost",className:"ml-auto","aria-label":o("action.discardCommentAria"),onClick:t,children:a(yo,{})})]}),a("p",{className:"mt-2 whitespace-pre-wrap leading-relaxed",children:e.body})]})}function bd({thread:e,workspaceRoot:t,canReply:o,canResolve:r,canReact:n,environmentId:l,reference:i,pending:u,fixPending:f,fixLabel:c,onFix:d,onReply:p,onLoadMore:g,canEditComment:L,onEditComment:R,onToggleResolved:I,onReacted:P}){let{t:y}=A(),[w,S]=C(!e.isResolved),[ee,J]=C(!1),[B,G]=C(""),[F,H]=C(null),[K,V]=C(!1),O=Ne(!1),[U,j]=C(null),[Y,he]=C(!1),le=U?.threadId===e.id?U:null,xe=kn(e.comments,le?.comments??[]),pe=le===null?e.nextCommentsCursor??null:le.nextCursor,ue=e.commentCount??xe.length,be=y(c??"thread.fixInThread"),ae=async(E,X)=>{if(K)return;V(!0);let k=await R(E,X);V(!1),k&&(j(v=>v?.threadId===e.id?{...v,comments:Uu(v.comments,E,X)}:v),H(null))},h=async()=>{let E=B.trim();if(!(E.length===0||u||O.current)){O.current=!0;try{await p(E)&&(j(X=>X?.threadId===e.id?{...X,nextCursor:X.nextCursor??e.nextCommentsCursor??null}:X),G(""),J(!1))}finally{O.current=!1}}},W=async()=>{if(!(pe===null||Y)){he(!0);try{let E=await g(pe);if(E===null)return;j(X=>({threadId:e.id,comments:kn(X?.threadId===e.id?X.comments:[],E.comments),nextCursor:E.nextCursor}))}finally{he(!1)}}};return s("div",{className:Rd,contentEditable:!1,onPointerDown:E=>E.stopPropagation(),children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.isResolved?a(Qe,{className:"size-icon-2 text-success-foreground"}):a(Za,{className:"size-icon-2"}),s("button",{type:"button",className:"hover:text-foreground","aria-expanded":w,onClick:()=>S(E=>!E),children:[e.isResolved?y("thread.resolved"):y("thread.open"),", ",ue," ",y("comment.count",{count:ue})]}),e.isOutdated?a("span",{children:y("thread.outdated")}):null,d?s(b,{size:"xs",variant:"ghost",className:"ml-auto",disabled:u||f,onClick:d,children:[a(It,{className:"size-3"}),f?y("thread.preparingFix"):be]}):null,r?a(b,{size:"xs",variant:"ghost",className:d?void 0:"ml-auto",disabled:u,onClick:I,children:e.isResolved?y("action.unresolve"):y("action.resolve")}):null]}),w?s(ve,{children:[a("div",{className:"mt-2 space-y-3",children:xe.map(E=>s("article",{className:"group min-w-0",children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a(bt,{actor:E.author,className:"text-foreground"}),a("span",{children:He(E.createdAt)})]}),F===E.id?a(Yt,{className:"mt-1",value:E.body,cwd:t,environmentId:l,label:y("action.editComment"),saving:K,onSave:X=>{ae(E.id,X)},onCancel:()=>H(null)}):s("div",{className:"mt-1 flex items-start gap-1",children:[a(Pt,{className:"min-w-0 flex-1 text-sm",text:E.body,cwd:t,environmentId:l}),L(E)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":y("action.editComment"),onClick:()=>H(E.id),children:a(st,{className:"size-3"})}):null]}),a(_t,{className:"mt-1.5",reactions:E.reactions??[],canReact:n,subjectId:E.id,environmentId:l,reference:i,onRefresh:P})]},E.id))}),pe!==null?a("div",{className:"mt-2",children:a(b,{size:"xs",variant:"ghost",className:"px-1",disabled:Y,onClick:()=>{W()},children:y(Y?"action.loading":"action.loadMoreComments")})}):null,o?ee?s("div",{className:"mt-2",children:[a(Rt,{autoFocus:!0,size:"sm",value:B,placeholder:y("action.reply"),"aria-label":y("action.replyAria"),onChange:E=>G(E.target.value),onKeyDown:rg({value:B,pending:u,onSubmit:()=>{h()},onCancel:()=>J(!1)})}),s("div",{className:"mt-2 flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",onClick:()=>J(!1),children:y("action.cancel")}),a(b,{size:"xs",disabled:u||B.trim().length===0,onClick:()=>{h()},children:y("action.reply")})]})]}):a(b,{size:"xs",variant:"ghost",className:"mt-2 px-1",onClick:()=>J(!0),children:y("action.reply")}):null]}):null]})}var Rd,Ld=m(()=>{"use strict";qe();De();ce();Xt();Ue();N();N();Id();Ut();ut();Ga();Eo();wr();T();Rd="mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm"});function Sd(){return Pd+=1,`pending-review-comment-${Pd}`}function Do(e){return`${e.projectId}/${e.repository}#${e.number}`}function ha(){for(let e of Un)e()}function kd(e){return Un.add(e),()=>{Un.delete(e)}}function _n(){return Ie}function Pr(e){let t=Do(e);return lt(o=>o.drafts[t]??Lr)}var Pd,Lr,Un,Ie,lt,Hn=m(()=>{"use strict";ce();Pd=0;Lr=[],Un=new Set;Ie={drafts:{},summaries:{},addComment:(e,t)=>{Ie={...Ie,drafts:{...Ie.drafts,[e]:[...Ie.drafts[e]??Lr,t]}},ha()},removeComment:(e,t)=>{let o=(Ie.drafts[e]??Lr).filter(r=>r.id!==t);if(o.length>0)Ie={...Ie,drafts:{...Ie.drafts,[e]:o}};else{let{[e]:r,...n}=Ie.drafts;Ie={...Ie,drafts:n}}ha()},removeComments:(e,t)=>{let o=new Set(t),r=(Ie.drafts[e]??Lr).filter(n=>!o.has(n.id));if(r.length>0)Ie={...Ie,drafts:{...Ie.drafts,[e]:r}};else{let{[e]:n,...l}=Ie.drafts;Ie={...Ie,drafts:l}}ha()},clear:e=>{let{[e]:t,...o}=Ie.drafts;Ie={...Ie,drafts:o},ha()},setSummary:(e,t)=>{Ie={...Ie,summaries:{...Ie.summaries,[e]:t}},ha()},clearSummary:(e,t)=>{if(Ie.summaries[e]!==t)return;let{[e]:o,...r}=Ie.summaries;Ie={...Ie,summaries:r},ha()}};lt=(e=>{let t=Va(kd,_n,_n);return e===void 0?t:e(t)});lt.getState=_n;lt.setState=e=>{Ie={...Ie,...e},ha()};lt.subscribe=kd});function qd({environmentId:e,reference:t,verdicts:o,onSubmitted:r}){let[n,l]=C(!1),{t:i}=A(),u=Pr(t),f=Do(t),c=lt(w=>w.summaries[f]??""),d=lt(w=>w.clear),p=lt(w=>w.removeComments),g=lt(w=>w.setSummary),L=lt(w=>w.clearSummary),R=Be(Se.converse,{reportFailure:!1}),I=ng.filter(w=>o.includes(w.value));if(I.length===0)return null;let P=async w=>{if(n)return;let S=c,ee=u;l(!0);let J=await R({environmentId:e,input:{op:"submitReview",...t,verdict:w.value,body:S,comments:ee}});if(l(!1),J._tag==="Failure"){we.error(i("bar.submitFailedTitle"));return}p(f,ee.map(B=>B.id)),L(f,S),we.success(i(w.sentKey)),r()},y=w=>w==="approve"||c.trim().length>0||u.length>0;return s("div",{className:"px-4 py-3",children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:u.length===0?i("bar.noComments"):i("bar.commentsPending",{count:u.length})}),u.length>0?a(b,{size:"xs",variant:"ghost",disabled:n,onClick:()=>d(f),children:i("action.discard")}):null]}),a(Rt,{size:"sm",className:"mt-2",value:c,placeholder:i("bar.summaryPlaceholder"),"aria-label":i("bar.summaryAria"),onChange:w=>g(f,w.target.value)}),a("div",{className:"mt-2 flex flex-wrap justify-end gap-2",children:I.map(w=>{let S=I.some(ee=>ee.value==="approve")?"approve":I.at(-1)?.value;return a(b,{size:"xs",variant:w.value===S?"default":"outline",disabled:n||!y(w.value),onClick:()=>{P(w)},children:s("span",{className:"flex items-center gap-1.5",children:[w.icon,i(w.labelKey)]})},w.value)})})]})}var ng,Td=m(()=>{"use strict";qe();De();ce();Me();Me();it();N();N();Hn();T();ng=[{value:"comment",labelKey:"action.comment",sentKey:"bar.sentComment",icon:a(nt,{className:"size-3"})},{value:"approve",labelKey:"action.approve",sentKey:"bar.sentApprove",icon:a(na,{className:"size-3"})},{value:"request-changes",labelKey:"action.requestChanges",sentKey:"bar.sentRequestChanges",icon:a(Ve,{className:"size-3"})}]});function Ad({label:e,onCancel:t,onComment:o,onAddToAgent:r,addToAgentDisabledReason:n}){let{t:l}=A(),[i,u]=C("");return s("div",{className:"mx-3 my-2 space-y-2 rounded-xl border border-border/70 bg-background p-3 text-sm",children:[a("p",{className:"text-xs text-muted-foreground",children:e}),a(Rt,{size:"sm",className:"min-h-20",value:i,"aria-label":e,onChange:f=>u(f.target.value)}),s("div",{className:"flex flex-wrap justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",onClick:t,children:l("action.cancel")}),r?n===void 0?a(b,{size:"xs",variant:"outline",onClick:()=>r(i),disabled:i.trim().length===0,children:l("code.addToAgent")}):s(oe,{children:[a(ne,{render:a(b,{size:"xs",variant:"outline",softDisabled:!0,children:l("code.addToAgent")})}),a(re,{side:"top",children:n})]}):null,a(b,{size:"xs",onClick:()=>o(i),disabled:i.trim().length===0,children:l("code.addToReview")})]})]})}var Md=m(()=>{"use strict";ce();N();qe();T()});function za(e){switch(e.kind){case"added":return{line:e.newLine,side:"right"};case"deleted":return{line:e.oldLine,side:"left"};case"context":return{line:e.side==="left"?e.oldLine:e.newLine,side:e.side};default:return{line:1,side:"right"}}}function Ed(e){return(e.match(/^diff --git /gm)??[]).length}function Dd(e){let t=0,o=0;for(let r of e.split(`
41
+ `))?.[1]:void 0;p!==void 0&&ed(p)?(n(),t.push({id:`attachment:${t.length}`,kind:"attachment",url:p,media:"video"}),i=d):o.push(u)}return n(),t}var Bp,Fp,Op,Up,_p,Hp,Gp,Zu,ad=m(()=>{"use strict";bo();Bp=8,Fp=/^(?: {4}|\t)/u,Op=/^<?(https?:\/\/\S+?)>?$/u,Up=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,_p=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Hp=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,Gp=/^\s*<video\b/iu,Zu=/<\/video>\s*$/iu});function Pt({text:e,cwd:t,environmentId:o,className:r}){let{t:n}=A(),l=td(e);return a("div",{className:M("space-y-3",r),children:l.map(i=>{if(i.kind==="markdown")return a(An,{text:i.text,cwd:t,environmentId:o},i.id);let u=i.media==="video",f=u?fo:co;return s("a",{href:i.url,rel:"noreferrer noopener",target:"_blank",className:"flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/40",children:[a(f,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),a("span",{className:"min-w-0 flex-1 truncate",children:n(u?"markdown.playVideoOnHost":"markdown.openAttachmentOnHost")}),a(la,{"aria-hidden":!0,className:"size-3 shrink-0 text-muted-foreground"})]},i.id)})})}var Ga=m(()=>{"use strict";De();Ue();qe();Yu();ad();T()});function Yt({value:e,cwd:t,environmentId:o,placeholder:r,label:n,saving:l,allowEmpty:i=!1,className:u,onSave:f,onCancel:c}){let{t:d}=A(),[p,g]=C(e),[L,R]=C(!1),[I,P]=C(e);I!==e&&(P(e),g(e));let y=p.trim().length===0;return s("div",{className:M("space-y-2",u),onKeyDown:w=>{w.key!=="Escape"||l||(w.preventDefault(),c())},children:[s("div",{className:"flex items-center gap-1",children:[a(b,{size:"xs",variant:L?"ghost":"outline",disabled:l,onClick:()=>R(!1),children:d("markdownEditor.write")}),a(b,{size:"xs",variant:L?"outline":"ghost",disabled:l,onClick:()=>R(!0),children:d("markdownEditor.preview")})]}),L?a("div",{className:"rounded-lg border border-border/60 px-3 py-2",children:y?a("p",{className:"text-xs text-muted-foreground",children:d("markdownEditor.nothingToPreview")}):a(Pt,{text:p,cwd:t,environmentId:o})}):a(Rt,{autoFocus:!0,disabled:l,value:p,rows:6,placeholder:r,"aria-label":n,onChange:w=>g(w.target.value)}),s("div",{className:"flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",disabled:l,onClick:c,children:d("action.cancel")}),a(b,{size:"xs",variant:"outline",disabled:l||y&&!i,onClick:()=>f(p),children:d(l?"action.saving":"action.save")})]})]})}var Eo=m(()=>{"use strict";ce();Ue();qe();N();N();Ga();T()});function En(e){return zp[e]}function xr(e){return Vp[e]}function jp(e,t){return e.length<=1?e[0]??"":e.length===2?t("reactions.joinTwo",{first:e[0],second:e[1]}):t("reactions.joinMany",{list:e.slice(0,-1).join(t("reactions.listSeparator")),last:e.at(-1)})}function Wp(e,t,o){return o(t?"reactions.others":"reactions.people",{count:e})}function od(e,t){let o=e.actors.length<e.count,n=(e.viewerHasReacted&&o?[t("reactions.you"),...e.actors]:[...e.actors]).slice(0,Math.min(Kp,e.count)),l=Math.max(0,e.count-n.length),i=[...n,...l>0?[Wp(l,n.length>0,t)]:[]];return t("reactions.tooltip",{names:jp(i,t),emoji:t(xr(e.content))})}function rd(e,t){if(t.size===0)return e;let o=new Map(e.map(r=>[r.content,r]));for(let[r,n]of t){let l=o.get(r);if(l===void 0){n&&o.set(r,{content:r,count:1,actors:[],viewerHasReacted:!0});continue}if(l.viewerHasReacted===n)continue;let i=l.count+(n?1:-1);i<=0?o.delete(r):o.set(r,{...l,count:i,viewerHasReacted:n})}return Mn.flatMap(r=>o.get(r)??[])}var Mn,zp,Vp,Kp,nd=m(()=>{"use strict";Mn=["thumbs-up","thumbs-down","laugh","hooray","confused","heart","rocket","eyes"],zp={"thumbs-up":"\u{1F44D}","thumbs-down":"\u{1F44E}",laugh:"\u{1F604}",hooray:"\u{1F389}",confused:"\u{1F615}",heart:"\u2764\uFE0F",rocket:"\u{1F680}",eyes:"\u{1F440}"},Vp={"thumbs-up":"reactions.thumbsUp","thumbs-down":"reactions.thumbsDown",laugh:"reactions.laugh",hooray:"reactions.hooray",confused:"reactions.confused",heart:"reactions.heart",rocket:"reactions.rocket",eyes:"reactions.eyes"};Kp=3});function Xp(e){return e.map(t=>`${t.content}:${t.count}:${t.viewerHasReacted?1:0}`).join(" ")}function _t({reactions:e,canReact:t,subjectId:o,environmentId:r,reference:n,onRefresh:l,className:i}){let{t:u}=A(),[f,c]=C(!1),[d,p]=C({signature:"",values:sd}),g=Be(Se.converse,{reportFailure:!1}),L=Xp(e),R=d.signature===L?d.values:sd,I=rd(e,R),P=async(y,w)=>{if(p({signature:L,values:new Map([...R,[y,w]])}),(await g({environmentId:r,input:{op:"setReaction",...n,...o===void 0?{}:{subjectId:o},content:y,reacted:w}}))._tag==="Failure"){p(ee=>{let J=new Map(ee.values);return J.delete(y),{signature:ee.signature,values:J}}),we.error(u("notify.reactionSaveFailed"));return}l()};return I.length===0&&!t?null:s("div",{className:M("flex flex-wrap items-center gap-1",i),children:[I.map(y=>s(oe,{children:[s(ne,{render:a(b,{size:"compact",variant:"ghost","aria-pressed":y.viewerHasReacted,"aria-label":u("reactions.nameAndCount",{name:u(xr(y.content)),count:y.count}),softDisabled:!t,className:M("h-6 rounded-full px-2 sm:text-xs aria-disabled:border-inherit aria-disabled:bg-inherit aria-disabled:text-inherit",y.viewerHasReacted?"border-primary/60 bg-primary/10 text-foreground":"border-border/70 bg-muted/40 text-muted-foreground",t&&"hover:border-primary/60"),onClick:()=>{P(y.content,!y.viewerHasReacted)}}),children:[a("span",{"aria-hidden":!0,children:En(y.content)}),a("span",{className:"tabular-nums",children:y.count})]}),a(re,{side:"top",children:od(y,u)})]},y.content)),t?s(Ea,{open:f,onOpenChange:c,children:[a(Na,{render:a(b,{size:"compact",variant:"ghost","aria-label":u("reactions.addAria"),className:M("h-6 rounded-full border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground sm:text-xs",I.length===0&&!f&&"opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100")}),children:a(go,{"aria-hidden":!0})}),a(Da,{align:"start",className:"w-auto",side:"top",viewportClassName:"py-2",children:a("div",{className:"flex items-center gap-0.5",children:Mn.map(y=>{let w=I.find(S=>S.content===y)?.viewerHasReacted??!1;return a(b,{size:"icon-xs",variant:"ghost","aria-pressed":w,"aria-label":u(xr(y)),className:M("size-7 rounded-control-3 text-base sm:size-7 sm:text-base",w&&"bg-primary/10"),onClick:()=>{c(!1),P(y,!w)},children:a("span",{"aria-hidden":!0,children:En(y)})},y)})})})]}):null]})}var sd,wr=m(()=>{"use strict";De();ce();Ue();qe();Me();Me();it();N();N();N();nd();T();sd=new Map});function vd(e,t,o){return!o&&(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&t.trim().length>0}var Id=m(()=>{"use strict"});function rg(e){return t=>{t.key==="Escape"&&e.onCancel&&(t.preventDefault(),e.onCancel()),vd(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Cd({comment:e,onRemove:t}){let{t:o}=A();return s("div",{className:M(Rd,"border-dashed"),contentEditable:!1,onPointerDown:r=>r.stopPropagation(),children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a(nt,{className:"size-icon-2"}),a("span",{children:o("thread.pendingComment")}),a(b,{size:"icon-xs",variant:"ghost",className:"ml-auto","aria-label":o("action.discardCommentAria"),onClick:t,children:a(yo,{})})]}),a("p",{className:"mt-2 select-text whitespace-pre-wrap leading-relaxed",children:e.body})]})}function bd({thread:e,workspaceRoot:t,canReply:o,canResolve:r,canReact:n,environmentId:l,reference:i,pending:u,fixPending:f,fixLabel:c,onFix:d,onReply:p,onLoadMore:g,canEditComment:L,onEditComment:R,onToggleResolved:I,onReacted:P}){let{t:y}=A(),[w,S]=C(!e.isResolved),[ee,J]=C(!1),[B,G]=C(""),[F,H]=C(null),[K,V]=C(!1),O=Ne(!1),[U,j]=C(null),[Y,he]=C(!1),le=U?.threadId===e.id?U:null,xe=kn(e.comments,le?.comments??[]),pe=le===null?e.nextCommentsCursor??null:le.nextCursor,ue=e.commentCount??xe.length,be=y(c??"thread.fixInThread"),ae=async(E,X)=>{if(K)return;V(!0);let k=await R(E,X);V(!1),k&&(j(v=>v?.threadId===e.id?{...v,comments:Uu(v.comments,E,X)}:v),H(null))},h=async()=>{let E=B.trim();if(!(E.length===0||u||O.current)){O.current=!0;try{await p(E)&&(j(X=>X?.threadId===e.id?{...X,nextCursor:X.nextCursor??e.nextCommentsCursor??null}:X),G(""),J(!1))}finally{O.current=!1}}},W=async()=>{if(!(pe===null||Y)){he(!0);try{let E=await g(pe);if(E===null)return;j(X=>({threadId:e.id,comments:kn(X?.threadId===e.id?X.comments:[],E.comments),nextCursor:E.nextCursor}))}finally{he(!1)}}};return s("div",{className:Rd,contentEditable:!1,onPointerDown:E=>E.stopPropagation(),children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.isResolved?a(Qe,{className:"size-icon-2 text-success-foreground"}):a(Za,{className:"size-icon-2"}),s("button",{type:"button",className:"hover:text-foreground","aria-expanded":w,onClick:()=>S(E=>!E),children:[e.isResolved?y("thread.resolved"):y("thread.open"),", ",ue," ",y("comment.count",{count:ue})]}),e.isOutdated?a("span",{children:y("thread.outdated")}):null,d?s(b,{size:"xs",variant:"ghost",className:"ml-auto",disabled:u||f,onClick:d,children:[a(It,{className:"size-3"}),f?y("thread.preparingFix"):be]}):null,r?a(b,{size:"xs",variant:"ghost",className:d?void 0:"ml-auto",disabled:u,onClick:I,children:e.isResolved?y("action.unresolve"):y("action.resolve")}):null]}),w?s(ve,{children:[a("div",{className:"mt-2 space-y-3",children:xe.map(E=>s("article",{className:"group min-w-0",children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a(bt,{actor:E.author,className:"text-foreground"}),a("span",{children:He(E.createdAt)})]}),F===E.id?a(Yt,{className:"mt-1",value:E.body,cwd:t,environmentId:l,label:y("action.editComment"),saving:K,onSave:X=>{ae(E.id,X)},onCancel:()=>H(null)}):s("div",{className:"mt-1 flex items-start gap-1",children:[a(Pt,{className:"min-w-0 flex-1 text-sm",text:E.body,cwd:t,environmentId:l}),L(E)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":y("action.editComment"),onClick:()=>H(E.id),children:a(st,{className:"size-3"})}):null]}),a(_t,{className:"mt-1.5",reactions:E.reactions??[],canReact:n,subjectId:E.id,environmentId:l,reference:i,onRefresh:P})]},E.id))}),pe!==null?a("div",{className:"mt-2",children:a(b,{size:"xs",variant:"ghost",className:"px-1",disabled:Y,onClick:()=>{W()},children:y(Y?"action.loading":"action.loadMoreComments")})}):null,o?ee?s("div",{className:"mt-2",children:[a(Rt,{autoFocus:!0,size:"sm",value:B,placeholder:y("action.reply"),"aria-label":y("action.replyAria"),onChange:E=>G(E.target.value),onKeyDown:rg({value:B,pending:u,onSubmit:()=>{h()},onCancel:()=>J(!1)})}),s("div",{className:"mt-2 flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",onClick:()=>J(!1),children:y("action.cancel")}),a(b,{size:"xs",disabled:u||B.trim().length===0,onClick:()=>{h()},children:y("action.reply")})]})]}):a(b,{size:"xs",variant:"ghost",className:"mt-2 px-1",onClick:()=>J(!0),children:y("action.reply")}):null]}):null]})}var Rd,Ld=m(()=>{"use strict";qe();De();ce();Xt();Ue();N();N();Id();Ut();ut();Ga();Eo();wr();T();Rd="mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm"});function Sd(){return Pd+=1,`pending-review-comment-${Pd}`}function Do(e){return`${e.projectId}/${e.repository}#${e.number}`}function ha(){for(let e of Un)e()}function kd(e){return Un.add(e),()=>{Un.delete(e)}}function _n(){return Ie}function Pr(e){let t=Do(e);return lt(o=>o.drafts[t]??Lr)}var Pd,Lr,Un,Ie,lt,Hn=m(()=>{"use strict";ce();Pd=0;Lr=[],Un=new Set;Ie={drafts:{},summaries:{},addComment:(e,t)=>{Ie={...Ie,drafts:{...Ie.drafts,[e]:[...Ie.drafts[e]??Lr,t]}},ha()},removeComment:(e,t)=>{let o=(Ie.drafts[e]??Lr).filter(r=>r.id!==t);if(o.length>0)Ie={...Ie,drafts:{...Ie.drafts,[e]:o}};else{let{[e]:r,...n}=Ie.drafts;Ie={...Ie,drafts:n}}ha()},removeComments:(e,t)=>{let o=new Set(t),r=(Ie.drafts[e]??Lr).filter(n=>!o.has(n.id));if(r.length>0)Ie={...Ie,drafts:{...Ie.drafts,[e]:r}};else{let{[e]:n,...l}=Ie.drafts;Ie={...Ie,drafts:l}}ha()},clear:e=>{let{[e]:t,...o}=Ie.drafts;Ie={...Ie,drafts:o},ha()},setSummary:(e,t)=>{Ie={...Ie,summaries:{...Ie.summaries,[e]:t}},ha()},clearSummary:(e,t)=>{if(Ie.summaries[e]!==t)return;let{[e]:o,...r}=Ie.summaries;Ie={...Ie,summaries:r},ha()}};lt=(e=>{let t=Va(kd,_n,_n);return e===void 0?t:e(t)});lt.getState=_n;lt.setState=e=>{Ie={...Ie,...e},ha()};lt.subscribe=kd});function qd({environmentId:e,reference:t,verdicts:o,onSubmitted:r}){let[n,l]=C(!1),{t:i}=A(),u=Pr(t),f=Do(t),c=lt(w=>w.summaries[f]??""),d=lt(w=>w.clear),p=lt(w=>w.removeComments),g=lt(w=>w.setSummary),L=lt(w=>w.clearSummary),R=Be(Se.converse,{reportFailure:!1}),I=ng.filter(w=>o.includes(w.value));if(I.length===0)return null;let P=async w=>{if(n)return;let S=c,ee=u;l(!0);let J=await R({environmentId:e,input:{op:"submitReview",...t,verdict:w.value,body:S,comments:ee}});if(l(!1),J._tag==="Failure"){we.error(i("bar.submitFailedTitle"));return}p(f,ee.map(B=>B.id)),L(f,S),we.success(i(w.sentKey)),r()},y=w=>w==="approve"||c.trim().length>0||u.length>0;return s("div",{className:"px-4 py-3",children:[s("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:u.length===0?i("bar.noComments"):i("bar.commentsPending",{count:u.length})}),u.length>0?a(b,{size:"xs",variant:"ghost",disabled:n,onClick:()=>d(f),children:i("action.discard")}):null]}),a(Rt,{size:"sm",className:"mt-2",value:c,placeholder:i("bar.summaryPlaceholder"),"aria-label":i("bar.summaryAria"),onChange:w=>g(f,w.target.value)}),a("div",{className:"mt-2 flex flex-wrap justify-end gap-2",children:I.map(w=>{let S=I.some(ee=>ee.value==="approve")?"approve":I.at(-1)?.value;return a(b,{size:"xs",variant:w.value===S?"default":"outline",disabled:n||!y(w.value),onClick:()=>{P(w)},children:s("span",{className:"flex items-center gap-1.5",children:[w.icon,i(w.labelKey)]})},w.value)})})]})}var ng,Td=m(()=>{"use strict";qe();De();ce();Me();Me();it();N();N();Hn();T();ng=[{value:"comment",labelKey:"action.comment",sentKey:"bar.sentComment",icon:a(nt,{className:"size-3"})},{value:"approve",labelKey:"action.approve",sentKey:"bar.sentApprove",icon:a(na,{className:"size-3"})},{value:"request-changes",labelKey:"action.requestChanges",sentKey:"bar.sentRequestChanges",icon:a(Ve,{className:"size-3"})}]});function Ad({label:e,onCancel:t,onComment:o,onAddToAgent:r,addToAgentDisabledReason:n}){let{t:l}=A(),[i,u]=C("");return s("div",{className:"mx-3 my-2 space-y-2 rounded-xl border border-border/70 bg-background p-3 text-sm",children:[a("p",{className:"text-xs text-muted-foreground",children:e}),a(Rt,{size:"sm",className:"min-h-20",value:i,"aria-label":e,onChange:f=>u(f.target.value)}),s("div",{className:"flex flex-wrap justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",onClick:t,children:l("action.cancel")}),r?n===void 0?a(b,{size:"xs",variant:"outline",onClick:()=>r(i),disabled:i.trim().length===0,children:l("code.addToAgent")}):s(oe,{children:[a(ne,{render:a(b,{size:"xs",variant:"outline",softDisabled:!0,children:l("code.addToAgent")})}),a(re,{side:"top",children:n})]}):null,a(b,{size:"xs",onClick:()=>o(i),disabled:i.trim().length===0,children:l("code.addToReview")})]})]})}var Md=m(()=>{"use strict";ce();N();qe();T()});function za(e){switch(e.kind){case"added":return{line:e.newLine,side:"right"};case"deleted":return{line:e.oldLine,side:"left"};case"context":return{line:e.side==="left"?e.oldLine:e.newLine,side:e.side};default:return{line:1,side:"right"}}}function Ed(e){return(e.match(/^diff --git /gm)??[]).length}function Dd(e){let t=0,o=0;for(let r of e.split(`
42
42
  `))r.startsWith("+")&&!r.startsWith("+++")?t+=1:r.startsWith("-")&&!r.startsWith("---")&&(o+=1);return{additions:t,deletions:o}}var Gn=m(()=>{"use strict"});function Nd({selectedCommit:e,orderedCommits:t,onSelectedCommitChange:o,visibleCommitCount:r,setVisibleCommitCount:n,fileCount:l,nextCursor:i,withheldContent:u,commit:f,review:c,lineStat:d,diffRenderMode:p,setDiffRenderMode:g,wordWrap:L,setWordWrap:R,t:I}){let P=e?e.messageHeadline:I("code.allCommits");return s("div",{className:"flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background px-4 text-xs text-muted-foreground",children:[s("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[t.length>0?s(gt,{children:[s(yt,{className:"inline-flex h-6 max-w-64 items-center gap-1 rounded-control-2 bg-accent px-2 text-xs font-medium text-accent-foreground","aria-label":I("code.diffScopeAria",{scope:P}),children:[a("span",{className:"truncate",children:P}),a(rt,{className:"size-icon-1 shrink-0 opacity-70"})]}),s(ht,{align:"start",className:"w-80",children:[a(Oe,{onClick:()=>o(null),children:a("span",{children:I("code.allCommits")})}),t.slice(0,r).map(w=>s(Oe,{onClick:()=>o(w.oid),children:[a("span",{className:"min-w-0 truncate",children:w.messageHeadline}),a("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:w.oid.slice(0,7)})]},w.oid)),t.length>r?a(Oe,{onClick:()=>n(w=>w+10),children:a("span",{className:"text-muted-foreground",children:I("code.showMore",{count:t.length-r})})}):null]})]}):null,s(Lt,{children:[s("span",{className:"shrink-0 tabular-nums",children:[I("detail.fileCount",{count:l,total:l}),i===null?"":"+"]}),u?s(oe,{children:[a(ne,{render:a("span",{className:"flex shrink-0 items-center"}),children:a(tt,{"aria-label":I("code.withheldAria"),className:"size-icon-2 text-warning-foreground"})}),a(re,{side:"bottom",children:I("code.withheldDetail")})]}):null,f!==null&&c.inlineComment?s(oe,{children:[a(ne,{render:a("span",{className:"flex shrink-0 items-center"}),children:a(io,{"aria-label":I("code.wholeChangeAria"),className:"size-icon-2"})}),a(re,{side:"bottom",children:I("code.wholeChangeHint")})]}):null]})]}),s("div",{className:"flex shrink-0 items-center gap-1",children:[a(Ot,{additions:d.additions,deletions:d.deletions,className:"mr-1"}),s(rr,{className:"shrink-0 gap-1",size:"sm",value:[p],onValueChange:w=>{let S=Array.isArray(w)?w[0]:w;(S==="stacked"||S==="split")&&g(S)},children:[a(Bt,{"aria-label":I("code.stackedViewAria"),value:"stacked",variant:"ghost",children:a(jt,{className:"size-icon-2"})}),a(Bt,{"aria-label":I("code.splitViewAria"),value:"split",variant:"ghost",children:a($t,{className:"size-icon-2"})})]}),s(oe,{children:[a(ne,{render:a(Bt,{"aria-label":I(L?"code.disableWrapAria":"code.enableWrapAria"),variant:"ghost",size:"sm",pressed:L,onPressedChange:w=>R(!!w)}),children:a(Wt,{className:"size-icon-2"})}),a(re,{side:"top",children:I(L?"code.disableWrap":"code.enableWrap")})]})]})]})}var Bd=m(()=>{"use strict";De();N();ut();Gn();T()});var Fd={};lf(Fd,{default:()=>lg});function sg({environmentId:e,reference:t,detail:o,selectedCommitOid:r,onSelectedCommitChange:n,pendingFinding:l,fixFindingLabel:i,onFixFinding:u,onAddToAgentSelection:f,addToAgentDisabledReason:c,onRefresh:d,refreshToken:p=0}){let{t:g}=A(),L=i??"thread.fixInThread",R=o.capabilities.review,I=R.inlineComment&&r===null,[P,y]=C(10),[w,S]=C("stacked"),[ee,J]=C(!0),[B,G]=C(!1),[F,H]=C(!1),[K,V]=C(!1),[O,U]=C(null),[j,Y]=C({key:"",cursor:null,slices:kr}),he=Do(t),le=Pr(t),xe=lt(q=>q.addComment),pe=lt(q=>q.removeComment),ue=Be(Se.converse,{reportFailure:!1}),be=Be(Se.threadComments,{reportFailure:!1}),ae=r,h=ae===null?he:`${he}@${ae}`;ye(()=>{U(null),y(10),H(!1),Y({key:h,cursor:null,slices:kr})},[h,p]);let W=j.key===h?j.slices:kr,E=j.key===h?j.cursor:null,X=xt(Se.diff({environmentId:e,input:{...t,...E===null?{}:{cursor:E},...ae===null?{}:{commit:ae}}}));ye(()=>{let q=X.data;q===null||q.patch===void 0||Y(fe=>{let D=fe.key===h?fe.slices:kr,Z={cursor:E,patch:q.patch??"",truncated:q.truncated===!0,nextCursor:q.nextCursor??null,omittedFileStats:q.omittedFileStats??[]},ge=D.findIndex(ke=>ke.cursor===E);return ge===-1?{key:h,cursor:E,slices:[...D,Z]}:{key:h,cursor:E,slices:[...D.slice(0,ge),Z]}})},[E,X.data,h]);let k=$(()=>W.map(q=>q.patch).join(`
43
- `),[W]),v=W.at(-1)?.nextCursor??null,de=W.some(q=>q.truncated||q.omittedFileStats.length>0),Ge=Ed(k),$e=Dd(k),ct=$(()=>o.commits.toSorted((q,fe)=>Date.parse(fe.committedDate)-Date.parse(q.committedDate)),[o.commits]),at=ct.find(q=>q.oid===ae);ye(()=>{ae!==null&&at===void 0&&n(null)},[ae,n,at]);let Le=Xe(async(q,fe)=>{if(K)return!1;V(!0);let D=await fe();return V(!1),D._tag==="Failure"?(we.error(q),!1):(d(),!0)},[d,K]),Ye=Xe(q=>a(bd,{thread:q,workspaceRoot:o.workspaceRoot,canReply:R.reply,canResolve:R.resolve,canReact:o.capabilities.reactions===!0,environmentId:e,reference:t,pending:K,fixPending:l===Jt({kind:"thread",thread:q}),fixLabel:L,...u?{onFix:()=>u({kind:"thread",thread:q})}:{},onLoadMore:async fe=>{let D=await be({environmentId:e,input:{...t,threadId:q.id,cursor:fe}});return D._tag==="Failure"?(we.error(g("notify.moreCommentsFailed")),null):D.value},onReply:fe=>Le(g("notify.replyFailed"),()=>ue({environmentId:e,input:{op:"replyToThread",...t,threadId:q.id,body:fe}})),canEditComment:fe=>Ha(o,{author:fe.author,kind:"review-comment"}),onEditComment:(fe,D)=>Le(g("notify.reviewCommentSaveFailed"),()=>ue({environmentId:e,input:{op:"updateComment",...t,commentId:fe,kind:"review-comment",body:D}})),onToggleResolved:()=>{Le(g("notify.conversationUpdateFailed"),()=>ue({environmentId:e,input:{op:"setThreadResolution",...t,threadId:q.id,resolved:!q.isResolved}}))},onReacted:d},`${t.projectId}#${t.number}:${q.id}`),[ue,o,e,L,be,u,d,l,t,R.reply,R.resolve,Le,g,K]),Ze=$(()=>{let q=new Set;for(let fe of o.reviewThreads)fe.line!==null&&q.add(fe.id);return q},[o.reviewThreads]),wt=$(()=>{let q=new Map,fe=(D,Z,ge)=>{let ke=`${D}:${ge}:${Z}`,We=q.get(ke);if(We)return We;let Ht={path:D,line:Z,side:ge==="left"?"left":"right",threads:[],pending:[],draft:!1};return q.set(ke,Ht),Ht};for(let D of o.reviewThreads)D.line!==null&&fe(D.path,D.line,D.side).threads.push(D);for(let D of le){let Z=za(D.position);fe(D.path,Z.line,Z.side).pending.push(D)}if(O){let D=za(O.position);fe(O.path,D.line,D.side).draft=!0}return[...q.entries()].map(([D,Z])=>({id:D,path:Z.path,line:Z.line,side:Z.side,children:s("div",{className:"py-1 font-sans text-foreground",children:[Z.threads.map(Ye),Z.pending.map(ge=>a(Cd,{comment:ge,onRemove:()=>pe(he,ge.id)},ge.id)),Z.draft&&O?a(Ad,{label:`${O.path}:${za(O.position).line}`,onCancel:()=>U(null),onComment:ge=>{xe(he,{id:Sd(),path:O.path,position:O.position,body:ge}),U(null)},...c===void 0?{}:{addToAgentDisabledReason:c},...f?{onAddToAgent:ge=>{f({comment:{id:`pull-request-selection:${O.path}:${za(O.position).line}`,sectionId:`pull-request:${o.number}`,sectionTitle:`PR #${o.number} review`,filePath:O.path,startIndex:0,endIndex:0,rangeLabel:`${O.path}:${za(O.position).line}`,text:ge,diff:"",fenceLanguage:pr(O.path)},request:ge}),U(null)}}:{}}):null]})}))},[xe,o.number,o.reviewThreads,O,c,f,le,pe,Ye,he]),qt=Nd({selectedCommit:at,orderedCommits:ct,onSelectedCommitChange:n,visibleCommitCount:P,setVisibleCommitCount:y,fileCount:Ge,nextCursor:v,withheldContent:de,commit:ae,review:R,lineStat:$e,diffRenderMode:w,setDiffRenderMode:S,wordWrap:ee,setWordWrap:J,t:g}),Q=R.verdicts.length===0?null:a("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-10",children:B?s("div",{className:"surface-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg",children:[a(b,{type:"button",size:"icon-sm",variant:"ghost","aria-label":g("code.closeReviewAria"),className:"absolute right-2 top-2",onClick:()=>G(!1),children:a(wo,{})}),a(qd,{environmentId:e,reference:t,verdicts:R.verdicts,onSubmitted:()=>{d(),G(!1)}})]}):s(b,{className:"pointer-events-auto absolute right-4 bottom-3 rounded-full shadow-lg",onClick:()=>G(!0),size:"compact",variant:"glass",children:[a(nt,{}),g("code.review"),le.length>0?a("span",{className:"flex size-4 items-center justify-center rounded-full bg-accent text-ui-2xs tabular-nums text-accent-foreground",children:le.length}):null]})}),Re=q=>s("div",{className:"flex h-full min-h-0 flex-col",children:[qt,s("div",{className:"relative min-h-0 flex-1",children:[a("div",{className:"h-full overflow-auto",children:q}),Q]})]});if(X.isPending&&W.length===0)return Re(a("p",{className:"p-4 text-sm text-muted-foreground",children:g("code.loadingDiff")}));if(X.error&&W.length===0)return Re(a("p",{className:"px-4 py-5 text-sm text-muted-foreground",children:X.error}));if(k.length===0&&v===null)return Re(a("p",{className:"px-4 py-5 text-sm text-muted-foreground",children:g(ae===null?"code.noChangesPullRequest":"code.noChangesCommit")}));let Ce=o.reviewThreads.filter(q=>!Ze.has(q.id)),Pe=new Map;for(let q of Ce){let fe=Pe.get(q.path);fe?fe.push(q):Pe.set(q.path,[q])}return s("div",{className:"flex h-full min-h-0 flex-col",children:[qt,Pe.size>0?s(ca,{className:"shrink-0 border-b border-border/60",open:F,onOpenChange:H,children:[a("h2",{children:s(ma,{className:"flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground",children:[a("span",{children:g(v===null?"code.offDiffConversations":"code.offDiffConversationsPartial")}),a("span",{className:"tabular-nums",children:Ce.length})]})}),a(fa,{children:a("div",{className:"max-h-64 space-y-3 overflow-auto px-4 pb-3",children:[...Pe].map(([q,fe])=>s("div",{children:[a("p",{className:"truncate px-3 text-xs text-muted-foreground",children:q}),a("div",{className:"mt-1 space-y-2",children:fe.map(Ye)})]},q))})})]}):null,s("div",{className:"relative min-h-0 flex-1",children:[a(mu,{className:"h-full overflow-auto [scrollbar-gutter:stable]",patch:k,split:w==="split",wrap:ee,annotations:wt,enableLineSelection:I&&O===null,onSelectLines:q=>{I&&U({path:q.path,position:q.side==="left"?{kind:"deleted",oldLine:q.endLine}:{kind:"added",newLine:q.endLine}})}}),v!==null?a("div",{className:"flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground",children:X.error!==null?s(ve,{children:[a("span",{children:g("code.loadFailed")}),a(b,{size:"xs",variant:"outline",onClick:()=>X.refresh(),children:g("action.retry")})]}):a(b,{size:"xs",variant:"outline",disabled:X.isPending,onClick:()=>Y(q=>({...q,cursor:v})),children:X.isPending?g("code.loadingMoreFiles"):g("code.loadMoreFiles")})}):null,Q]})]})}var kr,lg,Od=m(()=>{"use strict";De();ce();N();qe();it();Me();Mo();Ua();Ld();Td();Hn();gn();Md();Gn();Bd();T();kr=[];lg=sg});var $r=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
43
+ `),[W]),v=W.at(-1)?.nextCursor??null,de=W.some(q=>q.truncated||q.omittedFileStats.length>0),Ge=Ed(k),$e=Dd(k),ct=$(()=>o.commits.toSorted((q,fe)=>Date.parse(fe.committedDate)-Date.parse(q.committedDate)),[o.commits]),at=ct.find(q=>q.oid===ae);ye(()=>{ae!==null&&at===void 0&&n(null)},[ae,n,at]);let Le=Xe(async(q,fe)=>{if(K)return!1;V(!0);let D=await fe();return V(!1),D._tag==="Failure"?(we.error(q),!1):(d(),!0)},[d,K]),Ye=Xe(q=>a(bd,{thread:q,workspaceRoot:o.workspaceRoot,canReply:R.reply,canResolve:R.resolve,canReact:o.capabilities.reactions===!0,environmentId:e,reference:t,pending:K,fixPending:l===Jt({kind:"thread",thread:q}),fixLabel:L,...u?{onFix:()=>u({kind:"thread",thread:q})}:{},onLoadMore:async fe=>{let D=await be({environmentId:e,input:{...t,threadId:q.id,cursor:fe}});return D._tag==="Failure"?(we.error(g("notify.moreCommentsFailed")),null):D.value},onReply:fe=>Le(g("notify.replyFailed"),()=>ue({environmentId:e,input:{op:"replyToThread",...t,threadId:q.id,body:fe}})),canEditComment:fe=>Ha(o,{author:fe.author,kind:"review-comment"}),onEditComment:(fe,D)=>Le(g("notify.reviewCommentSaveFailed"),()=>ue({environmentId:e,input:{op:"updateComment",...t,commentId:fe,kind:"review-comment",body:D}})),onToggleResolved:()=>{Le(g("notify.conversationUpdateFailed"),()=>ue({environmentId:e,input:{op:"setThreadResolution",...t,threadId:q.id,resolved:!q.isResolved}}))},onReacted:d},`${t.projectId}#${t.number}:${q.id}`),[ue,o,e,L,be,u,d,l,t,R.reply,R.resolve,Le,g,K]),Ze=$(()=>{let q=new Set;for(let fe of o.reviewThreads)fe.line!==null&&q.add(fe.id);return q},[o.reviewThreads]),wt=$(()=>{let q=new Map,fe=(D,Z,ge)=>{let ke=`${D}:${ge}:${Z}`,We=q.get(ke);if(We)return We;let Ht={path:D,line:Z,side:ge==="left"?"left":"right",threads:[],pending:[],draft:!1};return q.set(ke,Ht),Ht};for(let D of o.reviewThreads)D.line!==null&&fe(D.path,D.line,D.side).threads.push(D);for(let D of le){let Z=za(D.position);fe(D.path,Z.line,Z.side).pending.push(D)}if(O){let D=za(O.position);fe(O.path,D.line,D.side).draft=!0}return[...q.entries()].map(([D,Z])=>({id:D,path:Z.path,line:Z.line,side:Z.side,children:s("div",{className:"py-1 font-sans text-foreground",children:[Z.threads.map(Ye),Z.pending.map(ge=>a(Cd,{comment:ge,onRemove:()=>pe(he,ge.id)},ge.id)),Z.draft&&O?a(Ad,{label:`${O.path}:${za(O.position).line}`,onCancel:()=>U(null),onComment:ge=>{xe(he,{id:Sd(),path:O.path,position:O.position,body:ge}),U(null)},...c===void 0?{}:{addToAgentDisabledReason:c},...f?{onAddToAgent:ge=>{f({comment:{id:`pull-request-selection:${O.path}:${za(O.position).line}`,sectionId:`pull-request:${o.number}`,sectionTitle:`PR #${o.number} review`,filePath:O.path,startIndex:0,endIndex:0,rangeLabel:`${O.path}:${za(O.position).line}`,text:ge,diff:"",fenceLanguage:pr(O.path)},request:ge}),U(null)}}:{}}):null]})}))},[xe,o.number,o.reviewThreads,O,c,f,le,pe,Ye,he]),qt=Nd({selectedCommit:at,orderedCommits:ct,onSelectedCommitChange:n,visibleCommitCount:P,setVisibleCommitCount:y,fileCount:Ge,nextCursor:v,withheldContent:de,commit:ae,review:R,lineStat:$e,diffRenderMode:w,setDiffRenderMode:S,wordWrap:ee,setWordWrap:J,t:g}),Q=R.verdicts.length===0?null:a("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-10",children:B?s("div",{className:"surface-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg",children:[a(b,{type:"button",size:"icon-sm",variant:"ghost","aria-label":g("code.closeReviewAria"),className:"absolute right-2 top-2",onClick:()=>G(!1),children:a(wo,{})}),a(qd,{environmentId:e,reference:t,verdicts:R.verdicts,onSubmitted:()=>{d(),G(!1)}})]}):s(b,{className:"pointer-events-auto absolute right-4 bottom-3 rounded-full shadow-lg",onClick:()=>G(!0),size:"compact",variant:"glass",children:[a(nt,{}),g("code.review"),le.length>0?a("span",{className:"flex size-4 items-center justify-center rounded-full bg-accent text-ui-2xs tabular-nums text-accent-foreground",children:le.length}):null]})}),Re=q=>s("div",{className:"flex h-full min-h-0 flex-col",children:[qt,s("div",{className:"relative min-h-0 flex-1",children:[a("div",{className:"h-full overflow-auto",children:q}),Q]})]});if(X.isPending&&W.length===0)return Re(a("p",{className:"p-4 text-sm text-muted-foreground",children:g("code.loadingDiff")}));if(X.error&&W.length===0)return Re(a("p",{className:"select-text px-4 py-5 text-sm text-muted-foreground",children:X.error}));if(k.length===0&&v===null)return Re(a("p",{className:"px-4 py-5 text-sm text-muted-foreground",children:g(ae===null?"code.noChangesPullRequest":"code.noChangesCommit")}));let Ce=o.reviewThreads.filter(q=>!Ze.has(q.id)),Pe=new Map;for(let q of Ce){let fe=Pe.get(q.path);fe?fe.push(q):Pe.set(q.path,[q])}return s("div",{className:"flex h-full min-h-0 flex-col",children:[qt,Pe.size>0?s(ca,{className:"shrink-0 border-b border-border/60",open:F,onOpenChange:H,children:[a("h2",{children:s(ma,{className:"flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground",children:[a("span",{children:g(v===null?"code.offDiffConversations":"code.offDiffConversationsPartial")}),a("span",{className:"tabular-nums",children:Ce.length})]})}),a(fa,{children:a("div",{className:"max-h-64 space-y-3 overflow-auto px-4 pb-3",children:[...Pe].map(([q,fe])=>s("div",{children:[a("p",{className:"select-text truncate px-3 text-xs text-muted-foreground",children:q}),a("div",{className:"mt-1 space-y-2",children:fe.map(Ye)})]},q))})})]}):null,s("div",{className:"relative min-h-0 flex-1",children:[a(mu,{className:"h-full overflow-auto [scrollbar-gutter:stable]",patch:k,split:w==="split",wrap:ee,annotations:wt,enableLineSelection:I&&O===null,onSelectLines:q=>{I&&U({path:q.path,position:q.side==="left"?{kind:"deleted",oldLine:q.endLine}:{kind:"added",newLine:q.endLine}})}}),v!==null?a("div",{className:"flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground",children:X.error!==null?s(ve,{children:[a("span",{children:g("code.loadFailed")}),a(b,{size:"xs",variant:"outline",onClick:()=>X.refresh(),children:g("action.retry")})]}):a(b,{size:"xs",variant:"outline",disabled:X.isPending,onClick:()=>Y(q=>({...q,cursor:v})),children:X.isPending?g("code.loadingMoreFiles"):g("code.loadMoreFiles")})}):null,Q]})]})}var kr,lg,Od=m(()=>{"use strict";De();ce();N();qe();it();Me();Mo();Ua();Ld();Td();Hn();gn();Md();Gn();Bd();T();kr=[];lg=sg});var $r=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
44
44
  @layer properties, theme, base, components, utilities;
45
45
  @layer properties;
46
46
  @layer utilities {
@@ -1601,4 +1601,4 @@ ${t}`}function Eu(e,t){return[...e.filter(o=>!o.id.startsWith(Tp)),...t]}functio
1601
1601
  }
1602
1602
  }
1603
1603
  }
1604
- `;ce();ja();ze();it();var Wl=()=>{};function Xl(e){Wl=e}function pt(){return{shell:{openExternal:async e=>{Wl(e)}}}}function Ql(e){try{let t=new URL(e),o=/^(.*?)\/-\/merge_requests\/\d+(?:\/|$)/iu.exec(t.pathname)?.[1]??/^(.*?)(?:\/pull\/\d+|\/-\/merge_requests\/\d+)(?:\/|$)/iu.exec(t.pathname)?.[1];return o?(t.pathname=o,t.search="",t.hash="",t.toString()):null}catch{return null}}var Qr=async()=>{};function Jl(e){Qr=e}async function Yl(e){return await Qr(e),!0}function Zl(e){return{copyToClipboard:t=>{Qr(t)},isCopied:!1}}Xt();var ai=()=>{},oi=!0;function ri(e,t=!0){ai=e,oi=t}function ni(){return oi}function si(e){ai(e)}ce();ja();ze();it();function vo(e){if(e!==null&&typeof e=="object"&&"cause"in e){let t=e.cause;return t instanceof Error?t:new Error(String(t))}return e instanceof Error?e:new Error(String(e))}function Ko(e){return{getComposerDraft:t=>e.get(t),setPrompt:(t,o)=>e.setPrompt(t,o),setReviewComments:(t,o)=>e.setReviewComments(t,o)}}var li=Ko({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function ii(e){li=Ko(e)}var wm=Ko({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function jo(){let e=me();return e.composerDraft===void 0||!ft(e,"composerDraft")?wm:Ko(e.composerDraft)}jo.getState=()=>li;function ui(){let e=me(),t=typeof e.useCreateThread=="function"?e.useCreateThread():null;return async(o,r)=>t===null||!ft(e,"createThread")?(we.error(Ka),null):t(o,r)}function di(e){let t=me(),o=typeof t.usePrepareWorkspace=="function"?t.usePrepareWorkspace():async()=>({ok:!1,error:Ka}),[r,n]=C(null);return{error:r,run:async l=>{if(e.cwd===null){let u=new Error("No workspace is available for this checkout.");return n(u),{_tag:"Failure"}}let i=await o({environmentId:e.environmentId,cwd:e.cwd,reference:l.reference,mode:l.mode,...l.threadId===void 0?{}:{threadId:l.threadId}});return i.ok?(n(null),{_tag:"Success",value:i.value}):(n(new Error(i.error)),{_tag:"Failure"})}}}var ci={listRefs:e=>({command:"listRefs",environmentId:e.environmentId,payload:e.input})};De();Pa();ce();ze();Ue();N();N();Ue();qe();T();function te({className:e}){return a("div",{"aria-hidden":!0,className:M("h-3 rounded bg-muted-foreground/15",e)})}var lr=["w-3/5","w-2/5","w-1/2","w-2/3","w-2/5","w-3/5","w-1/2"],Ba=["w-2/5","w-1/3","w-2/5","w-1/4","w-1/3","w-2/5","w-1/3"];function Fa({rows:e=7,caption:t}){let{t:o}=A();return s("div",{role:"status","aria-label":t??o("ghost.loadingList"),className:"animate-ghost-pulse space-y-0.5",children:[t?a("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground/70",children:t}):null,Array.from({length:e},(r,n)=>s("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2",children:[a(te,{className:"size-4 rounded-full"}),s("div",{className:"min-w-0 space-y-1.5",children:[a(te,{className:M("h-3.5",lr[n%lr.length])}),a(te,{className:Ba[n%Ba.length]})]}),s("div",{className:"flex flex-col items-end gap-1.5",children:[a(te,{className:"w-12"}),a(te,{className:"w-16"})]})]},n))]})}function xu(){let{t:e}=A();return s("div",{role:"status","aria-label":e("ghost.loadingDetail"),className:"animate-ghost-pulse flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[s("div",{className:"shrink-0 border-b border-border/60",children:[s("div",{className:"flex h-7 items-center justify-between gap-3 px-4",children:[s("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[a(te,{className:"w-24"}),a(te,{className:"w-9"})]}),s("div",{className:"flex shrink-0 items-center gap-1",children:[a(te,{className:"h-5 w-16 rounded-control-1"}),a(te,{className:"size-5 rounded-control-1"})]})]}),s("div",{className:"px-4 pb-4 pt-1",children:[a(te,{className:"h-5 w-4/5 max-w-md"}),s("div",{className:"mt-2 flex items-center gap-1.5",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:"w-24"})]}),s("div",{className:"mt-4 flex min-w-0 items-center gap-2",children:[a(te,{className:"h-6 w-24 rounded-control-2"}),a(te,{className:"size-3 rounded-full"}),a(te,{className:"h-6 w-32 rounded-control-2"}),s("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[a(te,{className:"w-10"}),a(te,{className:"w-20"})]})]})]}),s("div",{className:"flex min-h-10 items-center justify-between gap-3 border-t border-border/60 px-4 py-2",children:[s("div",{className:"flex items-center gap-1 p-0.5",children:[a(te,{className:"h-6 w-16 rounded-control-2"}),a(te,{className:"h-6 w-16 rounded-control-2"}),a(te,{className:"h-6 w-12 rounded-control-2"})]}),a(te,{className:"w-20"})]})]}),s("div",{className:"min-h-0 flex-1 overflow-hidden",children:[s("section",{className:"px-4 py-3",children:[s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-14"})]}),s("div",{className:"flex items-center gap-1",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:"size-4 rounded-full"}),a(te,{className:"ml-1 size-5 rounded-control-1"})]})]}),s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-10"})]}),s("div",{className:"flex items-center gap-1",children:[a(te,{className:"h-5 w-24 rounded-full"}),a(te,{className:"h-5 w-20 rounded-full"})]})]}),s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-14"})]}),a(te,{className:"w-20"})]})]}),s("section",{className:"border-t border-border/60",children:[s("div",{className:"flex min-h-11 items-center gap-1.5 px-4 py-3",children:[a(te,{className:"h-4 w-24"}),a(te,{className:"size-icon-2 rounded-full"})]}),s("div",{className:"space-y-2 px-4 pb-4",children:[a(te,{className:"w-full"}),a(te,{className:"w-11/12"}),a(te,{className:"w-4/5"}),a(te,{className:"w-2/3"})]})]})]})]})}function wu({rows:e=4}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingPeople"),className:"animate-ghost-pulse space-y-1 p-1",children:Array.from({length:e},(o,r)=>s("div",{className:"flex h-7 items-center gap-2 rounded-control-3 px-2",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:Ba[r%Ba.length]})]},r))})}function vu({rows:e=6}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingTimeline"),className:"animate-ghost-pulse px-4 py-5",children:a("div",{className:"relative ml-2 border-l border-border/70 pl-5",children:Array.from({length:e},(o,r)=>s("div",{className:"relative pb-5",children:[a(te,{className:"absolute -left-[1.55rem] top-1 size-2 rounded-full"}),a(te,{className:M("h-3.5",lr[r%lr.length])}),a(te,{className:"mt-1.5 w-16"})]},r))})})}function Iu({rows:e=3}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingConversation"),className:"animate-ghost-pulse space-y-4 py-2",children:Array.from({length:e},(o,r)=>s("div",{className:"flex items-start gap-2",children:[a(te,{className:"size-5 shrink-0 rounded-full"}),s("div",{className:"flex-1 space-y-1.5",children:[a(te,{className:Ba[r%Ba.length]}),a(te,{className:"w-full"}),a(te,{className:"w-3/4"})]})]},r))})}De();Ue();N();qe();T();function ir({error:e,onRetry:t,compact:o=!1}){let{t:r}=A();return s("div",{className:M("flex flex-col items-center justify-center gap-2 text-center",o?"py-3":"min-h-48 px-4 py-10"),children:[a("p",{className:"text-sm font-medium text-foreground",children:r("activity.loadFailed")}),a("p",{className:"max-w-md text-xs text-muted-foreground",children:e}),s(b,{size:"sm",variant:"outline",onClick:t,children:[a(et,{"aria-hidden":!0}),r("action.retry")]})]})}De();qe();N();N();T();function Lo({title:e,error:t,onRetry:o}){let{t:r}=A();return s(ka,{className:"px-4 py-16 md:px-4",children:[a(ru,{variant:"icon",children:a(Je,{})}),s(Aa,{children:[a(Ma,{children:e??r("list.loadFailedTitle")}),a(Ta,{children:t})]}),o?a(qa,{children:s(b,{size:"sm",variant:"outline",onClick:o,children:[a(et,{}),r("action.retry")]})}):null]})}De();ce();Me();Me();Ue();Xt();it();N();N();ut();qe();qe();De();ce();Me();Me();Me();it();ze();N();N();N();N();ut();Ut();T();function Np(e,t){if(t.length===0)return!0;let o=t.toLowerCase();return e.login.toLowerCase().includes(o)||(e.name??"").toLowerCase().includes(o)}function Qu({environmentId:e,reference:t,allowed:o,onRequested:r}){let[n,l]=C(!1),[i,u]=C(""),[f,c]=C(null),{t:d}=A(),p=xt(n?Se.reviewerCandidates({environmentId:e,input:t}):null),g=Be(Se.act,{reportFailure:!1}),L=$(()=>(p.data?.candidates??[]).filter(P=>Np(P,i)),[p.data,i]),R=async P=>{if(f!==null)return;c(P.id);let y=await g({environmentId:e,input:{op:"requestReviewers",...t,reviewers:[{id:P.id,kind:P.kind}],requested:!P.isRequested}});if(c(null),y._tag==="Failure"){we.error(P.isRequested?d("reviewer.withdrawFailedTitle",{login:P.login}):d("reviewer.requestFailedTitle",{login:P.login}),Ao(vo(y),d("reviewer.requestFailedHint")));return}we.success(P.isRequested?d("reviewer.withdrawnTitle",{login:P.login}):d("reviewer.requestedTitle",{login:P.login})),r(),p.refresh()},I=me().ui.SearchInput;return o?s(gt,{open:n,onOpenChange:l,children:[a(yt,{render:a(b,{size:"icon-xs",variant:"ghost","aria-label":d("action.requestReviewAria"),children:a(ba,{})})}),s(ht,{align:"start",side:"bottom",className:"w-72 p-0",children:[a("div",{className:"border-b border-border/60 p-2",children:I?a(I,{value:i,onValueChange:u,placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact",className:"ycodium-pull-requests-ui w-full"}):a(or,{value:i,onChange:P=>u(P.currentTarget.value),placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact"})}),s("div",{className:"max-h-72 overflow-y-auto p-1",children:[p.isPending?a(wu,{rows:4}):p.error!==null?a("p",{className:"p-2 text-xs text-muted-foreground",children:d("reviewer.peopleUnreadable",{error:p.error})}):L.length===0?a("p",{className:"p-2 text-xs text-muted-foreground",children:i.length>0?d("reviewer.noMatches"):d("reviewer.noAccess")}):L.map(P=>s("button",{type:"button",disabled:f!==null,onClick:()=>{R(P)},className:"relative flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent disabled:pointer-events-none disabled:text-[var(--control-disabled-foreground)] pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:[a(bt,{actor:P,className:"min-w-0 flex-1 truncate"}),P.kind==="team"?a("span",{className:"shrink-0 text-muted-foreground",children:d("reviewer.team")}):null,P.isRequested?a(na,{"aria-label":d("action.alreadyAskedAria"),className:"size-icon-2 shrink-0"}):null]},`${P.kind}:${P.id}`)),p.data?.truncated?a("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:d("reviewer.truncatedNotice")}):null]})]})]}):s(oe,{children:[a(ne,{render:a(b,{size:"icon-xs",variant:"ghost",softDisabled:!0,"aria-label":d("action.requestReviewAria"),children:a(ba,{})})}),a(re,{side:"bottom",children:d("reviewer.writeAccessRequired")})]})}Ut();Ua();Mo();Ga();Eo();wr();De();ce();Me();Me();Ue();Xt();it();N();N();N();N();ut();qe();Ga();Eo();function ld(e){let t=e.sectionTop<e.viewportTop,o=e.headingTop<=e.viewportTop+1;return!t||!o?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}T();function $a(e){return e.toLowerCase()}function id(e){let t=e?.trim().replace(/^#/,"")??"";return/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:null}function Dn({actor:e}){let t=e?.login??"ghost";return s(oe,{children:[a(ne,{render:a("span",{className:"shrink-0 rounded-full","aria-label":t}),children:a(pa,{actor:e})}),a(re,{side:"bottom",children:e?.name&&e.name!==t?`${e.name} (@${t})`:t})]})}function ud(e){let t=e.toLowerCase().replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}function Nn({comment:e,editing:t,className:o}){let{t:r}=A();return t.editingId===e.id?a(Yt,{className:o,value:e.body,cwd:t.cwd,environmentId:t.environmentId,label:r("action.editComment"),saving:t.saving,onSave:n=>t.onSave(e,n),onCancel:()=>t.onEdit(null)}):s("div",{className:M("flex items-start gap-1",o),children:[a(Pt,{className:"min-w-0 flex-1",text:e.body,cwd:t.cwd,environmentId:t.environmentId}),t.canEdit(e)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":r("action.editComment"),onClick:()=>t.onEdit(e),children:a(st,{className:"size-3"})}):null]})}function dd({comment:e,editing:t,label:o,body:r,reactionBar:n}){let[l,i]=C(!1);return a(ca,{open:l,onOpenChange:i,children:s("article",{className:"group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]",children:[s(ma,{className:M("flex w-full items-center gap-2 p-3 text-left transition-opacity hover:opacity-100",l?"opacity-100":"opacity-65"),children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[a(Dn,{actor:e.author}),a("span",{children:He(e.createdAt)}),a("span",{children:o})]}),a(rt,{"aria-hidden":!0,className:M("size-icon-1 shrink-0 text-muted-foreground transition-transform",l&&"rotate-180")})]}),a(fa,{children:l?s("div",{className:"px-3 pb-3",children:[e.path?s(oe,{children:[a(ne,{render:a("p",{className:"truncate text-xs text-muted-foreground",children:e.path})}),a(re,{side:"top",children:e.path})]}):null,r===null&&!t.canEdit(e)?null:a(Nn,{className:"mt-2",comment:e,editing:t}),n]}):null})]})})}function Bn({icon:e,label:t,children:o}){return s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 py-1.5 text-xs",children:[s("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[e,t]}),a("span",{className:"min-w-0 text-foreground",children:o})]})}function vr({title:e,count:t,defaultOpen:o=!0,actions:r,children:n}){let[l,i]=C(o),u=Ne(null);return s(ca,{open:l,onOpenChange:c=>{if(!c){let d=u.current,p=d?.closest("[data-pull-request-summary-section]"),g=d?.closest("[data-pull-request-summary-scroll]");if(d&&p&&g){let L=ld({scrollTop:g.scrollTop,viewportTop:g.getBoundingClientRect().top,sectionTop:p.getBoundingClientRect().top,headingTop:d.getBoundingClientRect().top});L!==null&&(g.scrollTop=L)}}i(c)},"data-pull-request-summary-section":!0,children:[s("div",{ref:u,className:"sticky top-0 z-10 flex w-full items-center border-t border-border/60 bg-background pr-4",children:[s(ma,{className:"flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-sm font-medium",children:[a("span",{children:e}),a(Ja,{"aria-hidden":!0,className:M("size-icon-1 text-muted-foreground transition-transform",l&&"rotate-90")}),t===void 0?null:a("span",{className:"text-xs tabular-nums text-muted-foreground",children:t})]}),l?r:null]}),a(fa,{children:a("div",{className:"px-4 pb-4",children:n})})]})}function cd({environmentId:e,detail:t,onCommented:o}){let{t:r}=A(),[n,l]=C(""),[i,u]=C(!1),f=Be(Se.converse,{reportFailure:!1}),c=async()=>{let d=n.trim();if(d.length===0||i)return;u(!0);let p=await f({environmentId:e,input:{op:"comment",projectId:t.projectId,repository:t.repository,number:t.number,body:d}});if(u(!1),p._tag==="Failure"){we.error(r("notify.commentPostFailed"));return}l(""),o()};return s("div",{className:"mt-3 space-y-2",children:[a(Rt,{disabled:i,value:n,rows:3,placeholder:r("summary.commentPlaceholder"),"aria-label":r("summary.commentAria"),onChange:d=>l(d.target.value)}),a("div",{className:"flex justify-end",children:s(b,{size:"xs",variant:"outline",disabled:n.trim().length===0||i,onClick:()=>{c()},children:[a(po,{}),r(i?"action.posting":"action.comment")]})})]})}T();var Ir=30;function fd({environmentId:e,reference:t,detail:o,activityPending:r,activityError:n,pendingFinding:l,fixFindingLabel:i,fixCheckLabel:u,onFixFinding:f,onRefresh:c}){let{t:d}=A(),p=d(i??"thread.fixInThread"),g=d(u??"handoff.fix"),[L,R]=C({url:o.url,count:Ir}),I=L.url===o.url?L.count:Ir,P=o.comments.slice(Math.max(0,o.comments.length-I)),y=o.comments.length-P.length,[w,S]=C("newest"),ee=Vu(P,w),J=hr(o.comments,o.commits),B=new Map(J.flatMap(h=>h.actor?[[$a(h.actor.login),h]]:[])),G=[...o.reviewers.map(h=>({key:h.login,actor:h,outcome:B.get($a(h.login))?.outcome??null,stale:B.get($a(h.login))?.stale??!1})),...J.filter(h=>!o.reviewers.some(W=>h.actor!==null&&$a(W.login)===$a(h.actor.login))).map(h=>({key:h.key,actor:h.actor,outcome:h.outcome,stale:h.stale}))],F=new Map(o.reviewThreads.flatMap(h=>h.comments.map(W=>[W.id,h]))),H=h=>{pt()?.shell.openExternal(h)},K=Be(Se.act,{reportFailure:!1}),V=Be(Se.converse,{reportFailure:!1}),[O,U]=C(null),[j,Y]=C(!1),[he,le]=C(null),[xe,pe]=C(!1),ue=he?.pullRequest===o.url?he.commentId:null,be=async h=>{if(j)return;Y(!0);let W=await K({environmentId:e,input:{op:"update",...t,body:h}});if(Y(!1),W._tag==="Failure"){we.error(d("notify.descriptionSaveFailed"));return}U(null),c()},ae={cwd:o.workspaceRoot,environmentId:e,canEdit:h=>Ha(o,h),editingId:ue,saving:xe,onEdit:h=>le(h===null?null:{pullRequest:o.url,commentId:h.id}),onSave:async(h,W)=>{if(xe||h.kind==="review")return;pe(!0);let E=await V({environmentId:e,input:{op:"updateComment",...t,commentId:h.id,kind:h.kind,body:W}});if(pe(!1),E._tag==="Failure"){we.error(d("notify.commentSaveFailed"));return}le(null),c()}};return s("div",{className:"h-full overflow-y-auto","data-pull-request-summary-scroll":!0,children:[a("section",{className:"px-4 py-3",children:s("div",{children:[a(Bn,{icon:a(xo,{className:"size-icon-2"}),label:d("summary.reviewers"),children:s("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[G.length===0?a("span",{className:"text-muted-foreground",children:d("summary.none")}):a("span",{className:"flex items-center -space-x-1",children:G.map(h=>{let W=h.actor?.login??"ghost",E=h.actor?.name&&h.actor.name!==W?`${h.actor.name} (@${W})`:W;return s(oe,{children:[s(ne,{render:a("span",{className:M("relative rounded-full hover:z-10",h.outcome?ku(h.outcome,h.stale):void 0)}),children:[a(bt,{actor:h.actor,tooltip:!1,className:M("gap-0 [&>span:last-child]:sr-only",h.outcome?void 0:"[&>img]:ring-2 [&>img]:ring-background [&>span:first-child]:ring-2 [&>span:first-child]:ring-background")}),h.outcome?a("span",{className:"sr-only",children:d(h.stale?ko(h.outcome):qo(h.outcome))}):null]}),a(re,{side:"bottom",children:h.outcome?`${E} \u2014 ${h.stale?d(ko(h.outcome)):d(qo(h.outcome))}`:E})]},h.key)})}),o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?a(Qu,{environmentId:e,reference:t,allowed:o.viewerPermissions.requestReviewers,onRequested:c}):null]})}),o.labels.length>0?a(Bn,{icon:a(ho,{className:"size-icon-2"}),label:d("summary.labels"),children:a("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:o.labels.map(h=>{let W=id(h.color);return s("span",{className:"inline-flex max-w-48 items-center gap-1.5 rounded-full border border-border/70 bg-muted/40 py-0.5 pl-1.5 pr-2 text-xs",children:[a("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full bg-muted-foreground",...W?{style:{backgroundColor:W}}:{}}),a("span",{className:"truncate",children:h.name})]},h.name)})})}):null]})}),a(vr,{title:d("summary.description"),children:s("div",{className:"group",children:[O===o.url?a(Yt,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:e,label:d("summary.descriptionAria"),placeholder:d("summary.descriptionPlaceholder"),saving:j,onSave:h=>{be(h)},onCancel:()=>U(null)}):s("div",{className:"flex items-start gap-1",children:[a(Pt,{className:"min-w-0 flex-1",text:o.body.trim().length>0?o.body:d("summary.noDescription"),cwd:o.workspaceRoot,environmentId:e}),yr(o)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":d("summary.editDescription"),onClick:()=>U(o.url),children:a(st,{className:"size-3"})}):null]}),a(_t,{className:"mt-2",reactions:o.reactions??[],canReact:o.capabilities.reactions===!0,environmentId:e,reference:t,onRefresh:c})]})}),a(vr,{title:d("checks.title"),count:o.checks.length,children:o.checks.length===0?a("p",{className:"text-xs text-muted-foreground",children:d("checks.noneReported")}):a("div",{className:"space-y-0.5",children:o.checks.map((h,W)=>{let E={kind:"check",check:h},X=h.status==="failure"||h.status==="cancelled";return s("div",{className:"group flex items-center gap-1 rounded-md pr-1 hover:bg-accent",children:[s("button",{type:"button",disabled:!h.url,onClick:()=>h.url&&H(h.url),className:M("relative flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",h.url?void 0:"cursor-default"),children:[a(dr,{status:h.status}),a("span",{className:"min-w-0 flex-1 truncate",children:h.name}),a("span",{className:"shrink-0 text-muted-foreground",children:d(ur(h.status))})]}),f&&X?s(b,{size:"xs",variant:"ghost",className:"shrink-0",disabled:l!=null,onClick:()=>f(E),children:[a(It,{className:"size-3"}),l===Jt(E)?d("action.preparing"):g]}):null]},`${W}:${h.name}:${h.url??""}`)})})}),s(vr,{title:d("summary.comments"),...r||n?{}:{count:o.commentCount},actions:!r&&!n&&o.comments.length>0?s(b,{size:"xs",variant:"ghost",className:"h-7 shrink-0 px-2 text-muted-foreground","aria-label":d(w==="newest"?"summary.commentsOldestAria":"summary.commentsNewestAria"),onClick:()=>S(h=>h==="newest"?"oldest":"newest"),children:[a(ra,{"aria-hidden":!0,className:"size-3"}),d(w==="newest"?"sort.newestFirst":"sort.oldestFirst")]}):null,children:[r?a(Iu,{}):n?a(ir,{compact:!0,error:n,onRetry:c}):s(ve,{children:[o.commentsTruncated?a("p",{className:"mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs",children:d("summary.conversationTruncated",{count:o.comments.length})}):null,o.comments.length===0?a("p",{className:"py-2 text-xs text-muted-foreground",children:d("summary.noComments")}):s("div",{className:"space-y-3",children:[y>0?a(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>R({url:o.url,count:I+Ir}),children:d("summary.showEarlier",{count:Math.min(y,Ir)})}):null,ee.map(h=>{let W=F.get(h.id),E=ga(h.body),X=_a(h.reviewState);if(W?.isResolved||X==="dismissed")return a(dd,{comment:h,editing:ae,label:W?.isResolved?d("thread.resolved"):d("summary.approvalDismissed"),body:E,reactionBar:a(_t,{className:"mt-2",reactions:h.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:h.id,environmentId:e,reference:t,onRefresh:c})},h.id);let k=h.kind!=="review"&&h.kind!=="review-comment"||X==="approved"?null:W===void 0?E===null?null:{kind:"comment",comment:h}:{kind:"thread",thread:W},v=a(_t,{reactions:h.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:h.id,environmentId:e,reference:t,onRefresh:c,...E===null?{}:{className:"mt-2"}});return s("article",{className:"group rounded-lg border border-border/60 p-3 [contain-intrinsic-block-size:120px] [content-visibility:auto]",children:[s("div",{className:"flex items-start gap-2",children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[a(Dn,{actor:h.author}),a("span",{children:He(h.createdAt)}),X?a(qu,{outcome:X}):h.reviewState?a("span",{children:ud(h.reviewState)}):null,E===null?v:null]}),f&&k?s(b,{size:"xs",variant:"ghost",className:"-mt-1 shrink-0",disabled:l!=null,onClick:()=>f(k),children:[a(It,{className:"size-3"}),l===Jt(k)?d("action.preparing"):p]}):null]}),h.path?s(oe,{children:[a(ne,{render:a("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:h.path})}),a(re,{side:"top",children:h.path})]}):null,E===null&&!ae.canEdit(h)?null:a(Nn,{className:"mt-2",comment:h,editing:ae}),E===null?null:v]},h.id)})]})]}),o.capabilities.comment&&o.viewerPermissions.comment?a(cd,{environmentId:e,detail:o,onCommented:c},`${e}:${o.projectId}/${o.repository}#${o.number}`):null]})]})}De();ce();Ue();qe();Me();Me();Xt();it();N();N();N();Ut();Mo();Ga();Eo();wr();ut();T();function md({body:e,markdown:t,cwd:o,environmentId:r}){return a("div",{className:"mt-3",children:t?a(Pt,{text:e,cwd:o,environmentId:r}):a("p",{className:"whitespace-pre-wrap text-xs text-muted-foreground",children:e})})}function Fn({actor:e}){let{t}=A();return a("span",{className:"font-semibold text-foreground",children:e?.login??t("actor.unknown")})}function pd({children:e,className:t}){return a("span",{className:M("absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background",t),children:e})}function gd({icon:e,className:t}){return a(pd,{className:t,children:a("span",{className:"flex size-7 items-center justify-center bg-background text-muted-foreground",children:e})})}function On({actors:e,className:t,fallback:o,muted:r=!1}){let n=e[0];return n===void 0?a(gd,{className:t,icon:o}):a(pd,{className:t,children:a(pa,{actor:n,className:M("size-7 bg-muted text-ui-2xs transition-opacity",r&&"opacity-45 grayscale")})})}function Qp(e){return e.toLowerCase().replaceAll("_"," ").replaceAll("-"," ").replace(/^\w/u,o=>o.toUpperCase())}function Jp({state:e}){return a("span",{className:"text-ui-2xs font-medium text-muted-foreground",children:Qp(e)})}function hd({url:e,onOpen:t}){let{t:o}=A();return e===null?null:a(b,{size:"icon-xs",variant:"ghost",className:"-mr-1 -mt-1 shrink-0 text-muted-foreground","aria-label":o("timeline.openActivityAria"),onClick:()=>t(e),children:a(la,{className:"size-3"})})}function Yp({event:e,editable:t,cwd:o,onOpen:r,reactions:n}){let{t:l}=A(),[i,u]=C(!1),[f,c]=C(!1),d=Be(Se.converse,{reportFailure:!1}),p=async g=>{if(t===null||f||t.kind==="review")return;c(!0);let L=await d({environmentId:n.environmentId,input:{op:"updateComment",...n.reference,commentId:t.id,kind:t.kind,body:g}});if(c(!1),L._tag==="Failure"){we.error(l("notify.commentSaveFailed"));return}u(!1),n.onRefresh()};return s("article",{className:"group py-2",children:[a("div",{className:"px-2",children:s("div",{className:"flex min-w-0 items-start gap-2",children:[s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[a(Fn,{actor:e.actor}),a("span",{className:"text-muted-foreground",children:l(e.titleKey,e.titleValues)}),e.reviewState?a(Jp,{state:e.reviewState}):null]}),s(Lt,{className:"mt-1 flex-wrap text-ui-xs text-muted-foreground",children:[a("span",{children:He(e.at)}),e.path?s("span",{className:"inline-flex min-w-0 items-center gap-1",children:[a(At,{"aria-hidden":!0,className:"size-3 shrink-0"}),a("span",{className:"truncate",children:e.path})]}):null]})]}),t!==null&&!i?a(b,{size:"icon-xs",variant:"ghost",className:"-mt-1 shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":l("action.editComment"),onClick:()=>u(!0),children:a(st,{className:"size-3"})}):null,a(hd,{url:e.url,onOpen:r})]})}),i&&t!==null?a("div",{className:"px-2 pb-2 pt-3",children:a(Yt,{value:t.body,cwd:o,environmentId:n.environmentId,label:l("action.editComment"),saving:f,onSave:g=>{p(g)},onCancel:()=>u(!1)})}):e.body?a("div",{className:"px-2 pb-2",children:a(md,{body:e.body,markdown:e.markdown,cwd:o,environmentId:n.environmentId})}):null,n.canReact||e.reactions.length>0?a("div",{className:"px-2 pb-2",children:a(_t,{reactions:e.reactions,canReact:n.canReact,subjectId:e.id,environmentId:n.environmentId,reference:n.reference,onRefresh:n.onRefresh})}):null]})}function Zp(e){let t=new Map;for(let o of e){let r=o.actor;r!==null&&!t.has(r.login)&&t.set(r.login,r)}return[...t.values()]}function eg({events:e,editable:t,cwd:o,onOpen:r,reactions:n}){let{t:l}=A(),[i,u]=C(!1),f=Zp(e),c=e[0];return c===void 0?null:s("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(On,{actors:f,className:"top-6",fallback:a(nt,{className:"size-icon-2"}),muted:!i}),a(ca,{open:i,onOpenChange:u,children:s("div",{children:[s(ma,{className:M("flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100",i?"text-foreground opacity-100":"text-muted-foreground opacity-55"),children:[s("span",{className:"min-w-0 flex-1",children:[a("span",{className:"block text-xs font-semibold",children:l("timeline.commentCount",{count:e.length,total:e.length.toLocaleString()})}),s("span",{className:"block truncate text-ui-2xs text-muted-foreground",children:[l("timeline.authorCount",{count:f.length,total:f.length.toLocaleString()}),", ",He(c.at)]})]}),a(rt,{"aria-hidden":!0,className:M("size-icon-1 shrink-0 text-muted-foreground transition-transform",i&&"rotate-180")})]}),a(fa,{children:i?a("div",{className:"mt-1 space-y-1",children:e.map(d=>a(Yp,{event:d,editable:t.get(d.id)??null,cwd:o,onOpen:r,reactions:n},`${n.reference.projectId}#${n.reference.number}:${d.id}`))}):null})]})})]})}function tg({event:e,onOpen:t}){let{t:o}=A();return s("button",{type:"button",className:"group relative mb-5 block w-full rounded-sm pl-12 text-left [contain-intrinsic-block-size:48px] [content-visibility:auto]","aria-label":o("timeline.viewCommitAria",{id:e.id}),onClick:()=>t(e.id),children:[a(On,{actors:e.commitAuthors,fallback:a(vt,{className:"size-icon-2"})}),s("div",{className:"flex min-w-0 items-center gap-2.5 py-1.5",children:[s("div",{className:"min-w-0 flex-1",children:[a("div",{className:"truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary",children:e.body??o("timeline.untitledCommit")}),s("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-ui-2xs text-muted-foreground",children:[a("code",{className:"font-mono",children:e.id.slice(0,7)}),a("span",{children:He(e.at)})]})]}),e.additions!==null&&e.deletions!==null?a(Ot,{additions:e.additions,deletions:e.deletions,className:"ml-auto shrink-0 font-mono text-ui-2xs"}):null]})]})}function ag({event:e}){let{t}=A(),o=e.kind==="opened"?{icon:a(Je,{className:"size-icon-2"}),label:t("timeline.eventOpened")}:e.kind==="merged"?{icon:a(Ke,{className:"size-icon-2"}),label:t("timeline.merged")}:{icon:a(mt,{className:"size-icon-2"}),label:t("timeline.closed")};return s("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(gd,{icon:o.icon}),s("div",{className:"py-1.5 text-xs",children:[s("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.actor?a(Fn,{actor:e.actor}):null,a("span",{className:"font-semibold text-foreground",children:o.label})]}),a("div",{className:"mt-0.5 text-ui-xs text-muted-foreground",children:He(e.at)})]})]})}function og({event:e,outcome:t,stale:o,cwd:r,onOpen:n,reactions:l}){let{t:i}=A();return s("div",{className:"group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(On,{actors:e.actor?[e.actor]:[],className:"top-6",fallback:a(fr,{outcome:t})}),s("div",{className:"flex min-w-0 items-start gap-2 py-1.5",children:[s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[a(Fn,{actor:e.actor}),s(oe,{disabled:!o,children:[s(ne,{render:a("span",{className:M("font-medium lowercase",o?"text-muted-foreground opacity-70":cr(t))}),children:[i(qo(t)),o?a("span",{className:"sr-only",children:i("reviewOutcome.beforeLatestCommits")}):null]}),a(re,{children:i(ko(t))})]})]}),s("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s(Lt,{className:"flex-wrap text-ui-xs text-muted-foreground",children:[a("span",{children:He(e.at)}),e.path?s("span",{className:"inline-flex min-w-0 items-center gap-1",children:[a(At,{"aria-hidden":!0,className:"size-3 shrink-0"}),a("span",{className:"truncate",children:e.path})]}):null]}),l.canReact||e.reactions.length>0?a(_t,{reactions:e.reactions,canReact:l.canReact,subjectId:e.id,environmentId:l.environmentId,reference:l.reference,onRefresh:l.onRefresh}):null]}),e.body?a(md,{body:e.body,markdown:e.markdown,cwd:r,environmentId:l.environmentId}):null]}),a(hd,{url:e.url,onOpen:n})]})]})}function yd({detail:e,environmentId:t,reference:o,order:r,onOpenCommit:n,onRefresh:l}){let{t:i}=A(),u=ju(e),f=qn(e.commits),c={canReact:e.capabilities.reactions===!0,environmentId:t,reference:o,onRefresh:l},d=new Map(e.comments.filter(R=>Ha(e,R)).map(R=>[R.id,R])),p=r==="newest"?u:u.toReversed(),g=Ku(p),L=R=>{pt()?.shell.openExternal(R)};return a("div",{className:"h-full overflow-y-auto px-4 py-5",children:s("div",{className:"mx-auto max-w-3xl",children:[s("div",{className:"relative",children:[a("span",{"aria-hidden":!0,className:"absolute bottom-5 left-[15px] top-1 w-px bg-border/45"}),g.map(R=>{if(R.kind==="comments")return a(eg,{events:R.events,editable:d,cwd:e.workspaceRoot,onOpen:L,reactions:c},`comments:${R.events[0]?.id??"empty"}`);let I=R.event;if(I.kind==="commit")return a(tg,{event:I,onOpen:n},I.id);let P=_a(I.reviewState);return P!==null?a(og,{event:I,outcome:P,stale:Tn(I.at,f),cwd:e.workspaceRoot,onOpen:L,reactions:c},I.id):a(ag,{event:I},I.id)})]}),u.length===0?s("div",{className:"flex flex-col items-center justify-center py-16 text-center text-muted-foreground",children:[a(Je,{className:"mb-2 size-5"}),a("p",{className:"text-xs",children:i("timeline.noActivity")})]}):null]})})}qe();De();ce();Ue();N();N();N();ze();qe();De();function Zt(e){return e==="gitlab"?{label:"GitLab",providerName:"GitLab",Icon:ro}:e==="github"?{label:"GitHub",providerName:"GitHub",Icon:oo}:{label:e,providerName:e,Icon:Mt}}function Rr(){let{t:e}=A();return t=>{let o=Zt(t).providerName;return o===t?e("link.openOnHostGeneric"):e("link.openOnHost",{host:o})}}function Cr(){return me().ui.useLinkContextMenu()}function br(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function xd(e,t,o){let r=new Map(t.map((i,u)=>[i,u])),n=new Map;for(let i of e){let u=br(i);if(!u)continue;let f=r.get(i.environmentId);if(f===void 0)continue;let c=n.get(u);if(c===void 0){n.set(u,i.environmentId);continue}c!==o&&(i.environmentId===o||f<(r.get(c)??Number.MAX_SAFE_INTEGER))&&n.set(u,i.environmentId)}let l=new Map;for(let i of e){if(!r.has(i.environmentId))continue;let u=br(i);if(u&&n.get(u)!==i.environmentId)continue;let f=l.get(i.environmentId);f===void 0?l.set(i.environmentId,[i.id]):f.push(i.id)}return l}function wd(e,t,o){let r=t.find(u=>u.environmentId===e.environmentId&&u.id===e.projectId),n=r===void 0?void 0:br(r),l=o.find(u=>u.environmentId===e.environmentId)?.label;if(r===void 0||!n||l===void 0)return[];let i=o.flatMap(u=>{if(u.environmentId===e.environmentId)return[];let f=t.find(c=>c.environmentId===u.environmentId&&br(c)===n);return f===void 0?[]:[{environmentId:u.environmentId,projectId:f.id,workspaceRoot:f.workspaceRoot,label:u.label}]});return i.length===0?[]:[{environmentId:e.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:l},...i]}T();function Ud({label:e}){let{t}=A();return a("p",{className:"p-4 text-sm text-muted-foreground",children:e??t("detail.loadingLabel")})}var _d={merge:"notify.successMerge",ready:"notify.successReady",draft:"notify.successDraft",close:"notify.successClose",reopen:"notify.successReopen","update-branch":"notify.successUpdateBranch","enable-auto-merge":"notify.successEnableAutoMerge","disable-auto-merge":"notify.successDisableAutoMerge"},ya={merge:"mergeMethod.merge",squash:"mergeMethod.squash",rebase:"mergeMethod.rebase"},Hd={merge:"notify.failureMerge",ready:"notify.failureReady",draft:"notify.failureDraft",close:"notify.failureClose",reopen:"notify.failureReopen","update-branch":"notify.failureUpdateBranch","enable-auto-merge":"notify.failureEnableAutoMerge","disable-auto-merge":"notify.failureDisableAutoMerge"},Gd={merge:"notify.hintMerge",ready:"notify.hintReady",draft:"notify.hintDraft",close:"notify.hintClose",reopen:"notify.hintReopen","update-branch":"notify.hintUpdateBranch","enable-auto-merge":"notify.hintEnableAutoMerge","disable-auto-merge":"notify.hintDisableAutoMerge"},$d="notify.hintUpdateBranchRebase",zd=[{value:"summary",labelKey:"detail.tabSummary"},{value:"timeline",labelKey:"detail.tabTimeline"},{value:"code",labelKey:"detail.tabCode"}],$n=()=>Promise.resolve().then(()=>(Od(),Fd)),Vd=is($n);function zn({environments:e,value:t,onChange:o,disabled:r}){return s(ve,{children:[a(je,{}),a(Ft,{value:t,onValueChange:n=>o(n),children:e.map(n=>a(Ct,{value:n.environmentId,disabled:r,children:a(da,{environmentId:n.environmentId,fallbackName:n.label,className:"gap-2",iconClassName:"size-icon-2"})},n.environmentId))})]})}var Kd=(e,t,o,r)=>{t.preventDefault(),t.stopPropagation(),e({url:o.url,openLabel:r,position:{x:t.clientX,y:t.clientY}})};function jd({baseBranch:e,freshness:t,pending:o,onUpdate:r,iconClassName:n}){let{t:l}=A(),i=t.behindBy===null?l("detail.outOfDate",{branch:e}):l("detail.outOfDateBehind",{branch:e,count:t.behindBy,total:t.behindBy.toLocaleString()});return s(Ea,{children:[a(Na,{openOnHover:!0,delay:0,closeDelay:120,render:a("button",{type:"button","aria-label":i,className:"inline-flex shrink-0 cursor-help items-center rounded-sm text-warning-foreground"}),children:a(tt,{"aria-hidden":!0,className:M("size-icon-2",n)})}),s(Da,{align:"start",side:"bottom",className:"max-w-80",viewportClassName:"py-2.5 [--viewport-inline-padding:--spacing(3)]",children:[a("p",{className:"text-xs text-foreground",children:i}),a("p",{className:"mt-0.5 text-xs text-muted-foreground",children:l("detail.cleanlyMergeable")}),t.methods.length>0?a("span",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:t.methods.map(u=>s(b,{size:"xs",variant:"outline",disabled:o,onClick:()=>r(u),children:[a(Ke,{"aria-hidden":!0,className:"size-3"}),l(u==="rebase"?"detail.updateWithRebase":"detail.updateBranch")]},u))}):null]})]})}De();N();N();N();N();Ut();T();function Wd({state:e,onClose:t}){let{t:o,openOnHostLabel:r,pullRequestKey:n,setMergeMethod:l,setConfirmation:i,handoff:u,detailQuery:f,detail:c,refreshFromHost:d,pendingAction:p,actionPending:g,handoffUnsupportedReason:L,handoffBlocked:R,withBlockedReason:I,pickableEnvironments:P,setActingScope:y,actingEnvironmentId:w,perform:S,attachTarget:ee,handoffLabels:J,askAboutPullRequest:B,explainPullRequest:G,startCheckout:F,startFixFindings:H,startResolveConflicts:K,allowedMergeMethods:V,selectedMergeMethod:O,selectedMergeMethodLabel:U,conflicting:j,autoMergeArmed:Y,can:he,primaryAction:le,showsDraftToggle:xe,showsAutoMerge:pe,showsMergeMethods:ue,context:be}=e;return s("div",{className:"mr-4 flex h-7 min-w-0 flex-nowrap items-center justify-end gap-1",children:[c?s(ve,{children:[be==="page"&&R?I(s(b,{size:"xs",variant:"outline",softDisabled:!0,children:[a(Mt,{"aria-hidden":!0}),o("detail.checkOut")]})):be==="page"?s(gt,{children:[a(yt,{disabled:u!==null,render:s(b,{size:"xs",variant:"outline",children:[a(Mt,{"aria-hidden":!0}),u?.startsWith("checkout")?o("detail.checkingOut"):o("detail.checkOut"),a(rt,{"aria-hidden":!0,className:"text-muted-foreground"})]})}),s(ht,{align:"end",side:"bottom",className:"min-w-72",children:[s(Oe,{onClick:()=>F("worktree"),children:[a(Mt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o("detail.checkoutInWorktreeTitle")}),a("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInWorktreeDetail")})]})]}),s(Oe,{onClick:()=>F("local"),children:[a(ao,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o("detail.checkoutInRepositoryTitle")}),a("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInRepositoryDetail")})]})]}),P.length>0?a(zn,{environments:P,value:w,onChange:ae=>y({pullRequestKey:n,environmentId:ae}),disabled:u!==null}):null]})]}):null,Y?s(oe,{children:[a(ne,{render:s(nr,{variant:"info",className:"h-5 shrink-0 gap-1 rounded px-1.5 text-ui-2xs",children:[a(Ke,{"aria-hidden":!0,className:"size-3"}),o("detail.autoMerge")]})}),a(re,{side:"top",children:o("detail.autoMergeHint")})]}):null,le==="resolve"?I(s(b,{size:"xs",variant:"destructive-outline",disabled:u!==null,softDisabled:R,onClick:K,children:[a(tt,{}),o(u==="conflicts"?"action.preparing":"detail.resolveConflicts")]})):le==="ready"?a(b,{size:"xs",disabled:g,onClick:()=>{S("ready")},children:o("detail.readyForReview")}):le==="merge"?a(b,{size:"xs",disabled:g,onClick:()=>i({open:!0,action:"merge"}),children:p==="merge"?o("detail.merging"):U}):null,s(gt,{children:[a(yt,{render:a(b,{"aria-label":o("detail.moreActionsAria"),className:"size-6",size:"icon-xs",variant:"ghost-muted"}),children:a(zt,{className:"size-4"})}),s(ht,{align:"end",side:"bottom",className:"min-w-72",children:[s(Oe,{disabled:f.isPending,onClick:()=>{d()},children:[a(et,{className:"size-icon-2"}),o("action.refresh")]}),L!==null?a(Oe,{disabled:!0,children:a("span",{className:"text-xs text-muted-foreground",children:o(L)})}):null,s(Oe,{disabled:u!==null||R,onClick:B,children:[a(Vt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o(u==="ask"?"detail.opening":"detail.askQuestion")}),a("span",{className:"text-xs text-muted-foreground",children:o(ee!==null?"detail.askQuestionInThread":"detail.askQuestionNewThread")})]})]}),s(Oe,{disabled:u!==null||R,onClick:G,children:[a(Qa,{className:"size-icon-2"}),o(u==="explain"?"detail.opening":"detail.explainPullRequest")]}),s(Oe,{disabled:u!==null||R,onClick:H,children:[a(It,{className:"size-icon-2"}),o(u==="findings"?"action.preparing":J.fixFindings)]}),P.length>0?a(zn,{environments:P,value:w,onChange:ae=>y({pullRequestKey:n,environmentId:ae}),disabled:u!==null}):null,a(je,{}),c.state==="open"?s(ve,{children:[xe?s(Oe,{disabled:g,onClick:()=>{S(c.isDraft?"ready":"draft")},children:[c.isDraft?a(Je,{className:"size-icon-2"}):a(Et,{className:"size-icon-2"}),c.isDraft?o("detail.readyForReview"):o("detail.convertToDraft")]}):null,Y&&he("disable-auto-merge")?s(Oe,{disabled:g,onClick:()=>{S("disable-auto-merge")},children:[a(Ke,{className:"size-icon-2"}),o("detail.disableAutoMerge")]}):!Y&&!c.isDraft&&!j&&he("enable-auto-merge")&&V.length>0?s(Oe,{disabled:g,onClick:()=>i({open:!0,action:"enable-auto-merge"}),children:[a(Ke,{className:"size-icon-2"}),o("detail.enableAutoMerge")]}):null,ue?s(ve,{children:[xe?a(je,{}):null,a(Ft,{value:O,onValueChange:ae=>l(ae),children:V.map(ae=>a(Ct,{value:ae,disabled:g,children:s("span",{className:"flex min-w-0 items-center gap-2",children:[a(Ke,{className:"size-icon-2"}),a("span",{children:o(ya[ae])})]})},ae))})]}):null,$u(xe,pe,ue)?a(je,{}):null]}):null,s(Oe,{onClick:()=>{pt()?.shell.openExternal(c.url)},children:[a(Xa,{className:"size-icon-2"}),r(c.provider)]}),s(Oe,{onClick:()=>{Yl(c.url)},children:[a(no,{className:"size-icon-2"}),o("detail.copyLink")]}),c.state==="open"&&he("close")?s(ve,{children:[a(je,{}),s(Oe,{variant:"destructive",disabled:g,onClick:()=>i({open:!0,action:"close"}),children:[a(mt,{className:"size-icon-2"}),o("detail.closePullRequest")]})]}):c.state==="closed"&&he("reopen")?s(ve,{children:[a(je,{}),s(Oe,{disabled:g,onClick:()=>{S("reopen")},children:[a(Je,{className:"size-icon-2"}),o("detail.reopenPullRequest")]})]}):null]})]})]}):null,t?a(b,{size:"icon-xs",variant:"ghost","aria-label":o("detail.collapsePanelAria"),onClick:t,children:a(ia,{})}):null]})}De();Ue();Xt();ze();N();N();N();N();Mo();qe();Ue();Me();Me();N();N();ut();T();function ig({environmentId:e,reference:t}){let{t:o}=A(),r=xt(Se.detail({environmentId:e,input:t}));if(r.error!==null)return a("p",{className:"text-muted-foreground text-xs",children:r.error});if(r.data===null)return a("p",{className:"text-muted-foreground text-xs",children:r.isPending?o("checks.loading"):o("checks.summaryNoneReported")});let n=r.data?.checks;return n===void 0?a("p",{className:"text-muted-foreground text-xs",children:o("checks.summaryNoneReported")}):a(Xd,{checks:n})}function Xd({checks:e}){let{t}=A();return e.length===0?a("p",{className:"text-muted-foreground text-xs",children:t("checks.summaryNoneReported")}):a("ul",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:e.map((o,r)=>s("li",{className:"flex items-center gap-2 text-xs",children:[a(dr,{status:o.status}),s(oe,{children:[a(ne,{render:a("span",{className:"min-w-0 flex-1 truncate",children:o.name})}),a(re,{side:"top",children:o.description??o.name})]}),a("span",{className:"shrink-0 text-muted-foreground",children:t(ur(o.status))}),o.url===null?null:a("button",{type:"button",className:"shrink-0 text-primary hover:underline",onClick:()=>{pt()?.shell.openExternal(o.url??"")},children:t("action.details")})]},`${r}:${o.name}`))})}function qr({checksState:e,checks:t,environmentId:o,reference:r,className:n}){let{t:l}=A(),i=Pu(e),u=t===void 0?null:mr(t);return s(Ea,{children:[a(Na,{render:a("span",{role:"button",tabIndex:0,"aria-label":l("checks.ariaWithSummary",{summary:l(i.labelKey)}),className:M("inline-flex shrink-0 cursor-[var(--control-cursor)] select-none items-center",n)}),onClick:f=>f.stopPropagation(),children:a(i.Icon,{"aria-hidden":!0,className:M("size-icon-2",i.toneClassName)})}),s(Da,{align:"start",className:"w-80 max-w-full",side:"bottom",children:[a("p",{className:"mb-2 font-medium text-sm",children:l(i.labelKey)}),u===null||u.key==="checks.summaryAllPassed"?null:a("p",{className:"mb-2 text-muted-foreground text-xs",children:l(u.key,u.values)}),t!==void 0?a(Xd,{checks:t}):o!==void 0&&r!==void 0?a(ig,{environmentId:o,reference:r}):null]})]})}ut();T();function Qd({state:e,detail:t,toneClassName:o,tabIndex:r}){let{t:n,openOnHostLabel:l,showPullRequestLinkContextMenu:i}=e;return s(oe,{children:[a(ne,{render:s("button",{type:"button",...r===void 0?{}:{tabIndex:r},onClick:()=>{pt()?.shell.openExternal(t.url)},onContextMenu:u=>Kd(i,u,t,l(t.provider)),className:M("shrink-0 font-medium underline-offset-2 hover:underline",o),"aria-label":n("detail.openOnHostAria",{number:t.number}),children:["#",t.number]})}),a(re,{side:"top",children:l(t.provider)})]})}function Jd({state:e,detail:t,freshnessIconClassName:o,arrowClassName:r}){let{t:n,isStackedPullRequest:l,freshness:i,actionPending:u,perform:f}=e;return s(ve,{children:[s(oe,{children:[a(ne,{render:s("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[l?a(Fe,{"aria-label":n("detail.stackedAria"),className:"size-3 shrink-0"}):null,a("code",{className:"min-w-0 truncate",children:t.baseBranch})]})}),a(re,{side:"top",children:l?n("detail.stackedOn",{branch:t.baseBranch}):t.baseBranch})]}),i?a(jd,{baseBranch:t.baseBranch,freshness:i,pending:u,onUpdate:c=>{f("update-branch",void 0,c)},...o===void 0?{}:{iconClassName:o}}):null,a(Wa,{"aria-label":n("detail.receivesChangesFrom"),className:r})]})}function Yd({state:e}){let{t,condensed:o,detail:r,repositoryUrl:n,statePresentation:l}=e;return s("div",{className:"ml-4 grid h-7 min-w-0 items-center",children:[a("div",{"aria-hidden":o,inert:o,className:M("col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs",o?"pointer-events-none -translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50 duration-150"),children:r&&l?s(ve,{children:[s(oe,{children:[a(ne,{render:n?a("button",{type:"button",onClick:()=>{pt()?.shell.openExternal(n)},className:"min-w-0 cursor-[var(--control-cursor)] truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:r.repository}):a("span",{className:"min-w-0 truncate font-medium text-muted-foreground",children:r.repository})}),a(re,{side:"top",children:n?t("detail.openRepositoryTooltip",{repository:r.repository}):r.repository})]}),a(Qd,{state:e,detail:r,toneClassName:l.toneClassName})]}):null}),a("div",{"aria-hidden":!o,inert:!o,className:M("col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs",o?"translate-y-0 opacity-100 delay-50 duration-150":"pointer-events-none translate-y-1 opacity-0 duration-100"),children:r&&l?s(ve,{children:[a(Qd,{state:e,detail:r,toneClassName:l.toneClassName,tabIndex:o?0:-1}),s(oe,{children:[a(ne,{render:a("span",{className:"min-w-0 truncate font-medium text-foreground",children:r.title})}),a(re,{side:"top",children:r.title})]})]}):null})]})}function Zd({state:e}){let{t,condensed:o,condensedRowRef:r,detail:n}=e;return a("div",{className:M("col-span-2 grid",o?"grid-rows-[1fr]":"grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:a("div",{ref:r,className:M("min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none",o?"translate-y-0 opacity-100 delay-50":"translate-y-1 opacity-0 duration-100"),inert:!o,children:n?a("div",{className:"col-span-2 min-w-0 px-4 pb-2 pt-1",children:s("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[s("span",{className:"flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground",children:[s(oe,{children:[a(ne,{render:a("span",{className:"shrink-0 rounded-full","aria-label":n.author?.login??t("actor.unknown")}),children:a(pa,{actor:n.author})}),a(re,{side:"top",children:n.author?.login??t("actor.unknown")})]}),a("span",{className:"shrink-0",children:He(n.updatedAt)})]}),a("span",{"aria-hidden":!0,className:"h-3 w-px shrink-0 bg-border/70"}),s("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-ui-xs text-muted-foreground/65",children:[a(Jd,{state:e,detail:n,freshnessIconClassName:"size-3",arrowClassName:"size-3 shrink-0 opacity-60"}),s(oe,{children:[a(ne,{render:a("code",{className:"min-w-0 flex-1 truncate",children:n.headBranch})}),a(re,{side:"top",children:n.headBranch})]})]}),s("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-ui-xs",children:[s("span",{className:"inline-flex items-center gap-1 tabular-nums","aria-label":t("detail.changedFilesAria",{count:n.changedFiles,total:n.changedFiles.toLocaleString()}),children:[a(Ca,{"aria-hidden":!0,className:"size-3"}),n.changedFiles.toLocaleString()]}),a(Ot,{additions:n.additions,deletions:n.deletions,className:"shrink-0 font-mono text-ui-xs"})]})]})}):null})})}function ec({state:e}){let{t,pullRequestKey:o,condensed:r,foldRef:n,copyBranchToClipboard:l,isBranchCopied:i,detail:u,setTitleScope:f,titleDraft:c,titleSaving:d,saveTitle:p}=e;return a("div",{className:M("col-span-2 grid",r?"grid-rows-[0fr]":"grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:a("div",{ref:n,className:M("min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none",r?"-translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50"),inert:r,children:u?s("div",{className:"col-span-2 mt-1 min-w-0 px-4 pb-4",children:[c===null?s("div",{className:"group flex min-w-0 items-start gap-1",children:[a("h1",{className:"min-w-0 flex-1 text-base font-semibold leading-snug",children:u.title}),yr(u)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":t("detail.editTitleAria"),onClick:()=>f({pullRequestKey:o,text:u.title}),children:a(st,{className:"size-3"})}):null]}):s("div",{className:"space-y-2",children:[a(or,{autoFocus:!0,size:"sm",disabled:d,value:c,"aria-label":t("detail.titleAria"),onChange:g=>f({pullRequestKey:o,text:g.target.value}),onKeyDown:g=>{g.key==="Enter"?(g.preventDefault(),p(c)):g.key==="Escape"&&(g.preventDefault(),f(null))}}),s("div",{className:"flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",disabled:d,onClick:()=>f(null),children:t("action.cancel")}),a(b,{size:"xs",variant:"outline",disabled:d||c.trim().length===0,onClick:()=>{p(c)},children:t(d?"action.saving":"action.save")})]})]}),s(Lt,{className:"mt-2 text-xs text-muted-foreground",children:[a(bt,{actor:u.author,className:"font-medium"}),a("span",{children:t("detail.updatedAt",{when:He(u.updatedAt)})})]}),s("div",{className:"mt-4 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70",children:[a(Jd,{state:e,detail:u,arrowClassName:"size-icon-2 shrink-0 opacity-60"}),s(oe,{children:[s(ne,{render:a(b,{size:"compact",variant:"ghost",className:"grid h-auto w-fit min-w-0 max-w-full shrink items-stretch justify-stretch gap-0 rounded px-1 py-0.5 text-left font-normal text-muted-foreground/70 text-xs sm:text-xs hover:bg-accent hover:text-foreground","aria-label":t(i?"detail.branchCopied":"detail.copyBranch"),onClick:()=>l(u.headBranch)}),children:[a("code",{className:M("col-start-1 row-start-1 min-w-0 truncate transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-0":"opacity-100"),children:u.headBranch}),a("span",{"aria-hidden":"true",className:M("col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-100":"opacity-0"),children:t("action.copied")})]}),a(re,{side:"top",children:i?t("detail.branchCopiedTooltip",{branch:u.headBranch}):t("detail.copyBranchTooltip",{branch:u.headBranch})})]})]}),s("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2",children:[s("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[a(Ca,{className:"size-icon-2"}),t("detail.fileCount",{count:u.changedFiles,total:u.changedFiles.toLocaleString()})]}),a(Ot,{additions:u.additions,deletions:u.deletions,className:"shrink-0 font-mono text-xs"})]})]})]}):null})})}function tc({state:e,tabIdPrefix:t}){let{t:o,tab:r,setTab:n,timelineOrder:l,setTimelineOrder:i,detail:u,activityPending:f,activityError:c,visibleTabs:d,checksSummary:p,checksState:g,approvalCount:L}=e,{Tabs:R,TabsList:I,TabsTab:P}=me().ui;return u?s("div",{className:"col-span-2 flex min-w-0 flex-wrap items-center gap-x-1 gap-y-2 border-t border-border/60 px-4 py-2",children:[R&&I&&P?a(R,{variant:"segmented",value:r,onValueChange:y=>{let w=d.find(S=>S.value===y)?.value;w&&n(w)},className:"ycodium-pull-requests-ui shrink-0",children:a(I,{"aria-label":o("detail.tabsAria"),children:d.map(y=>a(P,{value:y.value,id:t?`${t}-tab-${y.value}`:void 0,"aria-controls":t?`${t}-panel-${y.value}`:void 0,children:o(y.labelKey)},y.value))})}):a(rr,{className:"shrink-0",size:"segmented",variant:"segmented","aria-label":o("detail.tabsAria"),value:[r],onValueChange:y=>{let w=d.find(S=>S.value===y[0])?.value;w&&n(w)},children:d.map(y=>a(Bt,{value:y.value,children:o(y.labelKey)},y.value))}),r==="summary"?s("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":p?o("checks.ariaWithSummary",{summary:o(p.key,p.values)}):o("checks.title"),children:[g!==null?a(qr,{checks:u.checks,checksState:g}):a(sa,{"aria-hidden":!0,className:"size-icon-2"}),p?o(p.key,p.values):null]}):r==="timeline"?s("div",{className:"ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[s(Lt,{className:M("whitespace-nowrap text-ui-xs transition-opacity",(f||c)&&"opacity-35"),children:[s("span",{className:"inline-flex items-center gap-1","aria-label":c?o("detail.commentsUnavailable"):o("timeline.commentCount",{count:u.commentCount,total:u.commentCount.toLocaleString()}),children:[a(nt,{"aria-hidden":!0,className:"size-3"}),c?"\u2014":f?"\u2026":u.commentCount.toLocaleString()]}),s("span",{className:"inline-flex items-center gap-1","aria-label":c?o("detail.commitsUnavailable"):o("detail.commitCount",{count:u.commits.length,total:u.commits.length.toLocaleString()}),children:[a(vt,{"aria-hidden":!0,className:"size-3"}),c?"\u2014":f?"\u2026":u.commits.length.toLocaleString()]}),L>0?s("span",{className:M("inline-flex items-center gap-1",cr("approved")),children:[a(fr,{outcome:"approved",className:"size-3"}),L.toLocaleString(),a("span",{className:"sr-only",children:o("detail.approvalNoun",{count:L})})]}):null]}),s(b,{size:"xs",variant:"ghost",className:"h-7 px-2 text-muted-foreground","aria-label":o(l==="newest"?"detail.activityOldestAria":"detail.activityNewestAria"),onClick:()=>i(y=>y==="newest"?"oldest":"newest"),children:[a(ra,{"aria-hidden":!0,className:"size-3"}),o(l==="newest"?"sort.newestFirst":"sort.oldestFirst")]})]}):null]}):null}qe();ce();ja();Yo();ze();ce();ze();var ug=e=>e==="github"||e==="gitlab"?e:"unknown",Vn=e=>{let t=e.repositoryIdentity;return{projectId:e.id,title:e.title,workspaceRoot:e.workspaceRoot,repositoryIdentity:t==null?null:{provider:ug(t.provider),canonicalKey:t.canonicalKey,remoteName:t.locator.remoteName,remoteUrl:t.locator.remoteUrl,...t.displayName===void 0?{}:{displayName:t.displayName},...t.owner===void 0?{}:{owner:t.owner},...t.name===void 0?{}:{name:t.name},...t.rootPath===void 0?{}:{rootPath:t.rootPath}},...e.archivedAt==null?{}:{archivedAt:e.archivedAt}}};Yo();function ac(e){return e===null?[]:e.map(Vn).filter(t=>!La(t))}function Tr(e,t){let o=e?.find(r=>r.id===t);return o===void 0?null:Vn(o)}function dg(e){return e.filter(t=>t.connected&&t.pluginLoaded).map(t=>({environmentId:t.environmentId}))}function cg(e){return e.flatMap(t=>ac(t.data).map(o=>({id:o.projectId,environmentId:t.environmentId,title:o.title,workspaceRoot:o.workspaceRoot,repositoryIdentity:o.repositoryIdentity})))}function Ar(){let e=me(),t=e.useConnectedEnvironments(),o=dg(t),n=e.data.useQueryEach("projects.list",o.map(i=>({environmentId:i.environmentId,input:{}})),{refreshKey:e.useRepositoryIdentityKey()}).rows;return{projects:$(()=>cg(n),[n]),bootstrapped:o.length===0||n.every(i=>!i.isPending),rows:n}}ce();ze();function Mr(){return{environments:me().useConnectedEnvironments().map(t=>({environmentId:t.environmentId,label:t.label,displayUrl:t.label,serverConfig:t.connected?{}:null}))}}function oc(e,t){let o=me().useConnectedEnvironments();return $(()=>{let r=new Map;for(let n of t)r.set(n,o.find(l=>l.environmentId===n)?.pluginLoaded===!0);return r},[t,o])}Me();ce();function Er(e,t=!0){let o=typeof t=="boolean"?t:t.enabled!==!1,r=typeof t=="object"?t.key:void 0;ye(()=>{if(!o||typeof document>"u")return;let n=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[o,r,e])}Me();Me();it();N();Ut();ut();qe();var rc={make:e=>e};function nc(e,t){return{environmentId:e,threadId:t}}function Kn(e,t){return{environmentId:e,projectId:t}}function dt(e){return`${e.environmentId}:${e.threadId}`}it();Ut();Sn();var sc=new Map,lc=e=>typeof e=="string"?e:dt(e);function ic({t:e,detail:t,handoff:o,setHandoff:r,handoffUnsupportedReason:n,acting:l,actingEnvironmentId:i,newThread:u,prepareThread:f,context:c,composerDraftTarget:d}){let p=Gu(c,d),g=Hu(p!==null),L=In({attachAvailable:p!==null,blockedReason:n}),R=(H,K)=>{let V=Rn({supported:n===null,existing:jo.getState().getComposerDraft(H),lastHandoffPrompt:sc.get(lc(H)),task:K});if(!V.ok)return we.error(e(V.reason)),!1;let O=jo.getState();return sc.set(lc(H),K.prompt),O.setPrompt(H,V.next.prompt),O.setReviewComments(H,V.next.reviewComments),!0},I=async(H,K,V)=>{let O=V??await u(H).then(U=>U,()=>null);return O===null?null:K===null||R(O.draftId,K)?O:null},P=async(H,K)=>{if(!t||o!==null)return;if(n!==null){we.error(e(n));return}if(p!==null){if(!R(p,K))return;we.success(e("notify.addedToComposer"),K.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"));return}r(H);let V=Kn(i,l?.projectId??t.projectId),O=await I(V,K);if(r(null),O===null){we.error(e("notify.couldNotOpenThread"),void 0,{description:e("notify.threadHandoffHint")});return}we.success(e("notify.askedInThread"),K.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"))},y=async(H,K,V="worktree")=>{if(!t||o!==null)return;if(n!==null){we.error(e(n));return}if(p!==null&&K!==null){if(!R(p,K))return;we.success(e("notify.addedToComposer"),e("notify.taskInComposer"));return}r(H);let O=we.task({title:e("notify.checkoutPreparing")}),U=Kn(i,l?.projectId??t.projectId),j=await u(U).then(pe=>pe,()=>null);if(j===null){r(null),O.fail({title:e("notify.checkoutThreadFailed"),description:e("notify.threadHandoffHint")});return}let Y=await f.run({reference:t.url,mode:V,threadId:j.threadId});if(Y._tag==="Failure"){r(null);let pe=f.error instanceof Error?f.error.message:null;O.fail({title:e("notify.checkoutFailed"),...pe?{description:pe}:{}});return}if(!await u(U,{branch:Y.value.branch,worktreePath:Y.value.worktreePath}).then(pe=>pe!==null,()=>!1)){r(null),O.fail({title:e("notify.checkoutThreadUnmoved"),description:e("notify.checkoutReadyOnBranch",{branch:Y.value.branch})});return}r(null);let le={title:e("notify.checkoutStale"),description:e("notify.checkoutStaleDetail")},xe=pe=>{Y.value.isOnPullRequestHead?O.succeed(pe):O.fail(le)};if(K===null){xe({title:e(V==="local"?"notify.checkoutHereTitle":"notify.checkoutDoneTitle"),description:e(V==="local"?"notify.checkoutHereDetail":"notify.checkoutWorktreeDetail")});return}await I(U,K,j),xe({title:e("notify.checkoutReady"),description:e("notify.taskInComposer")})};return{attachTarget:p,handoffLabels:g,addToAgentEntry:L,askAboutPullRequest:()=>{t&&P("ask",{...bn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})},explainPullRequest:()=>{t&&P("explain",{...Ln({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})},addSelectionToAgent:H=>{t&&P(`selection:${H.comment.id}`,Pn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,comment:H.comment,request:H.request}))},startCheckout:H=>{t&&y(`checkout:${H}`,null,H)},startFixFinding:H=>{t&&y(Jt(H),xn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,finding:H}))},startFixFindings:()=>{t&&y("findings",yn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,reviewThreads:t.reviewThreads,comments:t.comments,checks:t.checks,commentsTruncated:t.commentsTruncated}))},startResolveConflicts:()=>{t&&y("conflicts",{prompt:Bu({number:t.number,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})}}}T();function uc({environmentId:e,reference:t,refreshToken:o=0,onActed:r,onStateChange:n,context:l="page",composerDraftTarget:i}){let{t:u}=A(),f=Rr(),c=Cr(),d=`${t.projectId}:${t.repository}#${t.number}`,[p,g]=C("summary"),[L,R]=C("newest"),[I,P]=C(()=>({pullRequestKey:d,oid:null})),y=I.pullRequestKey===d?I.oid:null,w=se=>{P({pullRequestKey:d,oid:se})},S=se=>{w(se),g("code")},[ee,J]=C(()=>new Set(["summary"]));ye(()=>{J(se=>se.has(p)?se:new Set(se).add(p))},[p]);let[B,G]=C(!1),F=Ne({});ye(()=>{G(F.current[p]??!1)},[p]);let H=B,K=Ne(null),V=Ne(null),O=Ne(null),U=Ne(null);cs(()=>{if(U.current===null)return;let se=K.current,Gt=U.current;U.current=null,se&&(se.scrollTop=Math.max(0,se.scrollTop+Gt))},[H]);let[j,Y]=C("merge"),[he,le]=C({open:!1,action:"merge"}),xe=he.action,[pe,ue]=C(null),{copyToClipboard:be,isCopied:ae}=Zl({target:u("detail.branchNameTarget"),timeout:1600});ye(()=>{$n()},[]);let h=xt(Se.detail({environmentId:e,input:t})),W=xt(Se.activity({environmentId:e,input:t})),E=xt(Se.diff({environmentId:e,input:{...t}})),X=h.data,k=W.data,v=$(()=>X===null?null:{...X,author:k?.author??X.author,reviewers:k?.reviewers??X.reviewers,comments:k?.comments??[],commentCount:k?.commentCount??0,commentsTruncated:k?.commentsTruncated??!1,reviewThreads:k?.reviewThreads??[],commits:k?.commits??[],reactions:k?.reactions??[]},[k,X]),de=v===null?null:Ql(v.url),Ge=xt(v===null?null:ci.listRefs({environmentId:e,input:{cwd:v.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),$e=v!==null&&zu(v.baseBranch,Ge.data?.refs??[]),ct=W.isPending&&k===null,at=k===null?W.error:null,Le=Xe(()=>{h.refresh(),W.refresh()},[W.refresh,h.refresh]),Ye=Ne(null);ye(()=>{if(!X)return;let se={key:d,updatedAt:X.updatedAt};Ou(Ye.current,se)&&W.refresh(),Ye.current=se},[W.refresh,X,d]),ye(()=>{v&&n?.({projectId:v.projectId,repository:v.repository,number:v.number,state:v.state,isDraft:v.isDraft})},[v,n]),Er(h.refresh,{key:`pull-request:${t.projectId}:${t.repository}#${t.number}`});let Ze=Be(Se.invalidate,{reportFailure:!1}),[wt,qt]=C(0),Q=Xe(async()=>{await Ze({environmentId:e,input:{reference:t}}),Le(),qt(se=>se+1)},[e,Ze,t,Le]),Re=Ne(o);ye(()=>{Re.current!==o&&(Re.current=o,Q())},[o,Q]);let Ce=Be(Se.act,{reportFailure:!1}),[Pe,q]=C(null),fe=Pe!==null,[D,Z]=C(null),ge=D?.pullRequestKey===d?D.text:null,[ke,We]=C(!1),Ht=ui(),No=me(),{projects:Bo,rows:Fr}=Ar(),Fo=Tr(Fr.find(se=>se.environmentId===e)?.data??null,t.projectId),Oo=Fo!==null&&La(Fo),aa=vn({canCreateThread:ft(No,"createThread"),canWriteComposerDraft:ft(No,"composerDraft"),projectArchived:Oo}),Or=aa!==null,_=se=>aa===null?se:s(oe,{children:[a(ne,{render:se}),a(re,{side:"top",children:u(aa)})]}),{environments:Ee}=Mr(),Uo=$(()=>l==="page"?wd({environmentId:e,projectId:t.projectId},Bo,Ee):[],[l,e,Ee,Bo,t.projectId]),[as,Dc]=C(null),Nc=as?.pullRequestKey===d?as.environmentId:e,Ur=Uo.find(se=>se.environmentId===Nc)??null,_r=Ur?.environmentId??e,Bc=di({environmentId:_r,cwd:Ur?.workspaceRoot??v?.workspaceRoot??null}),Fc=async(se,Gt,Ra)=>{if(Pe!==null)return;q(se);let ns=await Ce({environmentId:e,input:{op:"runAction",...t,action:se,...Gt?{mergeMethod:Gt}:{},...Ra?{updateMethod:Ra}:{}}});if(q(null),ns._tag==="Failure"){let rf=vo(ns),nf=u(Ra==="rebase"?$d:Gd[se]);we.error(u(Hd[se]),void 0,{description:Ao(rf,nf)});return}we.success(u(_d[se])),Xu(se)?Q():Le(),r?.()},Oc=async se=>{let Gt=se.trim();if(v===null||ke)return;if(Gt.length===0||Gt===v.title){Z(null);return}We(!0);let Ra=await Ce({environmentId:e,input:{op:"update",...t,title:Gt}});if(We(!1),Ra._tag==="Failure"){we.error(u("notify.titleSaveFailed"),void 0,{description:Ao(vo(Ra),u("notify.titleRefused"))});return}Z(null),Le()},{attachTarget:Uc,handoffLabels:_c,addToAgentEntry:Hc,askAboutPullRequest:Gc,explainPullRequest:$c,addSelectionToAgent:zc,startCheckout:Vc,startFixFinding:Kc,startFixFindings:jc,startResolveConflicts:Wc}=ic({t:u,detail:v,handoff:pe,setHandoff:ue,handoffUnsupportedReason:aa,acting:Ur,actingEnvironmentId:_r,newThread:Ht,prepareThread:Bc,context:l,composerDraftTarget:i}),Ia=v?v.capabilities.mergeMethods.filter(se=>v.mergeCapabilities[se]):[],os=Ia.includes(j)?j:Ia[0]??"merge",Xc=u(ya[os]),_o=v?.state==="open"&&v.mergeability==="conflicting",Hr=v?.state==="open"&&v.autoMergeEnabled===!0,Qc=v===null?null:Wu(v),Gr=zd.filter(se=>se.value!=="code"||v===null||v.capabilities.diff);ye(()=>{Gr.some(se=>se.value===p)||g("summary")},[p,Gr]);let oa=se=>v?.capabilities.actions.includes(se)===!0&&v.viewerPermissions.actions.includes(se),rs=v===null||v.state!=="open"?null:_o?"resolve":v.isDraft&&oa("ready")?"ready":oa("merge")&&Ia.length>0?"merge":null,Jc=v?.state==="open"&&oa(v.isDraft?"ready":"draft")&&!(v.isDraft&&rs==="ready"),Yc=v?.state==="open"&&(Hr&&oa("disable-auto-merge")||!Hr&&!v.isDraft&&!_o&&oa("enable-auto-merge")&&Ia.length>0),Zc=v?.state==="open"&&oa("merge")&&!v.isDraft&&!_o&&Ia.length>1,ef=v?So({state:v.state,isDraft:v.isDraft}):null,tf=v?mr(v.checks):null,af=v?Su(v.checks):null,of=v&&!v.commentsTruncated?hr(v.comments,v.commits).filter(se=>se.outcome==="approved"&&!se.stale).length:0;return{t:u,openOnHostLabel:f,showPullRequestLinkContextMenu:c,pullRequestKey:d,tab:p,setTab:g,timelineOrder:L,setTimelineOrder:R,selectedCodeCommitOid:y,selectCodeCommit:w,openCommit:S,mountedTabs:ee,setChromeCondensed:G,chromeStateByTab:F,condensed:H,scrollerRef:K,foldRef:V,condensedRowRef:O,compensationRef:U,setMergeMethod:Y,confirmation:he,setConfirmation:le,confirmAction:xe,handoff:pe,copyBranchToClipboard:be,isBranchCopied:ae,detailQuery:h,activityQuery:W,detail:v,repositoryUrl:de,isStackedPullRequest:$e,activityPending:ct,activityError:at,refreshDetail:Le,refreshToken:wt,refreshFromHost:Q,pendingAction:Pe,actionPending:fe,setTitleScope:Z,titleDraft:ge,titleSaving:ke,projectArchived:Oo,handoffUnsupportedReason:aa,handoffBlocked:Or,withBlockedReason:_,pickableEnvironments:Uo,setActingScope:Dc,actingEnvironmentId:_r,perform:Fc,saveTitle:Oc,attachTarget:Uc,handoffLabels:_c,addToAgentEntry:Hc,askAboutPullRequest:Gc,explainPullRequest:$c,addSelectionToAgent:zc,startCheckout:Vc,startFixFinding:Kc,startFixFindings:jc,startResolveConflicts:Wc,allowedMergeMethods:Ia,selectedMergeMethod:os,selectedMergeMethodLabel:Xc,conflicting:_o,autoMergeArmed:Hr,freshness:Qc,visibleTabs:Gr,can:oa,primaryAction:rs,showsDraftToggle:Jc,showsAutoMerge:Yc,showsMergeMethods:Zc,statePresentation:ef,checksSummary:tf,checksState:af,approvalCount:of,context:l}}T();function Dr(e){let{environmentId:t,reference:o,onClose:r}=e,n=uc(e),{t:l,tab:i,timelineOrder:u,selectedCodeCommitOid:f,selectCodeCommit:c,openCommit:d,mountedTabs:p,setChromeCondensed:g,chromeStateByTab:L,scrollerRef:R,foldRef:I,condensedRowRef:P,compensationRef:y,confirmation:w,setConfirmation:S,confirmAction:ee,handoff:J,detailQuery:B,activityQuery:G,detail:F,activityPending:H,activityError:K,refreshDetail:V,refreshToken:O,actionPending:U,projectArchived:j,perform:Y,handoffLabels:he,addToAgentEntry:le,addSelectionToAgent:xe,startFixFinding:pe,selectedMergeMethod:ue,selectedMergeMethodLabel:be}=n,ae=ds(),h=me().ui.TabsDetachedPanel,W=h??"div";return B.isPending&&!F?a(xu,{}):s("div",{className:"flex h-full min-h-0 w-full flex-col bg-background",children:[s("div",{className:"grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60",children:[a(Yd,{state:n}),a(Wd,{state:n,onClose:r}),a(Zd,{state:n}),a(ec,{state:n}),a(tc,{state:n,tabIdPrefix:ae})]}),a("div",{className:"relative min-h-0 flex-1 overflow-hidden",onScrollCapture:E=>{let X=E.target;R.current=X;let k=X.scrollTop;g(v=>{let de=v,Ge=I.current?.scrollHeight??0,$e=Ge-(P.current?.scrollHeight??0);return v?k<4&&Ge>0&&(de=!1):Ge>0&&k>Ge+32&&(y.current=-$e,de=!0),L.current[i]=de,de})},children:B.error&&!F?a(Lo,{error:B.error,onRetry:V}):F?s(ve,{children:[p.has("summary")?a(W,{id:`${ae}-panel-summary`,...h?{tabId:i==="summary"?`${ae}-tab-summary`:void 0}:{},className:M("absolute inset-0",i!=="summary"&&"invisible"),children:a(fd,{environmentId:t,reference:o,detail:F,activityPending:H,activityError:K,pendingFinding:J,fixFindingLabel:he.fixFinding,fixCheckLabel:he.fixCheck,...j?{}:{onFixFinding:pe},onRefresh:V})}):null,p.has("timeline")?a(W,{id:`${ae}-panel-timeline`,...h?{tabId:i==="timeline"?`${ae}-tab-timeline`:void 0}:{},className:M("absolute inset-0",i!=="timeline"&&"invisible"),children:H?a(vu,{}):K?a(ir,{error:K,onRetry:G.refresh}):a(yd,{detail:F,environmentId:t,reference:o,order:u,onOpenCommit:d,onRefresh:V})}):null,p.has("code")?a(W,{id:`${ae}-panel-code`,...h?{tabId:i==="code"?`${ae}-tab-code`:void 0}:{},className:M("absolute inset-0",i!=="code"&&"invisible"),children:a(ls,{fallback:a(Ud,{label:l("code.loadingDiff")}),children:a(Vd,{...le.kind==="hidden"?{}:{onAddToAgentSelection:xe},...le.kind==="disabled"?{addToAgentDisabledReason:l(le.reason)}:{},environmentId:t,reference:o,detail:F,selectedCommitOid:f,onSelectedCommitChange:c,pendingFinding:J,fixFindingLabel:he.fixFinding,...j?{}:{onFixFinding:pe},onRefresh:V,refreshToken:O})})}):null]}):null}),a(nu,{open:w.open,onOpenChange:E=>{!E&&U||S(X=>({...X,open:E}))},onOpenChangeComplete:E=>{E||S({open:!1,action:"merge"})},children:s(du,{children:[s(uu,{children:[a(cu,{children:l(ee==="merge"?"detail.confirmMergeTitle":ee==="enable-auto-merge"?"detail.confirmAutoMergeTitle":"detail.confirmCloseTitle")}),a(lu,{children:ee==="merge"?l("detail.confirmMergeBody",{number:o.number,method:l(ya[ue])}):ee==="enable-auto-merge"?l("detail.confirmAutoMergeBody",{number:o.number,method:l(ya[ue])}):l("detail.confirmCloseBody",{number:o.number})})]}),s(iu,{children:[a(su,{render:a(b,{variant:"outline",size:"sm",disabled:U}),children:l("action.cancel")}),a(b,{size:"sm",variant:ee==="close"?"destructive":"default",disabled:U,onClick:()=>{let E=ee;S(X=>({...X,open:!1})),E==="merge"&&Y("merge",ue),E==="enable-auto-merge"&&Y("enable-auto-merge",ue),E==="close"&&Y("close")},children:ee==="merge"?be:l(ee==="enable-auto-merge"?"detail.enableAutoMerge":"detail.close")})]})]})})]})}De();Ue();ze();qe();N();N();N();N();T();function fc(e,t){return e.filter(r=>r.kind===t.kind).length>1?t.host:Zt(t.kind).providerName}function mc({value:e,busy:t,onChange:o}){let{t:r}=A(),n=me().ui.SearchInput;return n!==void 0?a(n,{busy:t,value:e,onValueChange:o,placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria"),className:"ycodium-pull-requests-ui min-w-0 flex-1"}):s(dn,{className:"min-w-0 flex-1 **:[input]:h-9 sm:**:[input]:h-8",children:[a(cn,{children:t?a("span",{className:"inline-flex shrink-0 animate-spin",children:a(Dt,{"aria-hidden":!0})}):a(Nt,{"aria-hidden":!0})}),a(fn,{type:"search",value:e,onChange:l=>o(l.currentTarget.value),placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria")})]})}var jn="all",dc="",cc="",wa="all",St=e=>JSON.stringify([e.environmentId,e.id]),fg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"only",labelKey:"filter.draftsOnly",Icon:Et},{value:"hide",labelKey:"filter.hideDrafts",Icon:eo}],mg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"approved",labelKey:"filter.reviewApproved",Icon:Qe},{value:"changes-requested",labelKey:"filter.reviewChangesRequested",Icon:Ve},{value:"review-required",labelKey:"filter.reviewRequired",Icon:Tt},{value:"none",labelKey:"filter.reviewNone",Icon:Ya}],pg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"passing",labelKey:"filter.checksPassing",Icon:Qe},{value:"failing",labelKey:"filter.checksFailing",Icon:Ve}];function xa({label:e,value:t,options:o,onChange:r}){let{t:n}=A();return s(Ft,{value:t,onValueChange:l=>{l!==t&&r(l)},children:[a(mn,{children:e}),o.map(l=>{let i=a(Ct,{value:l.value,className:l.unavailable?"data-disabled:pointer-events-auto":void 0,disabled:l.unavailable!==void 0,children:l.environmentId!==void 0?a(da,{environmentId:l.environmentId,fallbackName:l.label,className:"gap-2",iconClassName:"size-icon-2"}):s("span",{className:"flex min-w-0 items-center gap-2",children:[l.Icon===void 0?null:a(l.Icon,{"aria-hidden":!0,className:"size-icon-2"}),l.labelKey!==void 0?n(l.labelKey):l.label]})},l.value);return l.unavailable?s(oe,{children:[a(ne,{render:i}),a(re,{side:"top",className:"max-w-80",children:l.unavailable})]},l.value):i})]})}function pc({state:e,stateOptions:t,onState:o,involvement:r,involvementOptions:n,onInvolvement:l,filters:i,onFilters:u,host:f,hostOptions:c,onHost:d,server:p,serverOptions:g,onServer:L,projects:R,projectId:I,projectEnvironmentId:P,unavailable:y,onProject:w}){let{t:S}=A(),ee=e!=="open"||r!=="all"||f!==void 0||p!==void 0||I!==void 0||Object.keys(i).length>0,J=(B,G)=>Object.fromEntries(Object.entries({...i,[B]:G===wa?void 0:G}).filter(([,F])=>F!==void 0));return s(gt,{children:[s(yt,{render:a(b,{className:M("relative",ee&&"[--control-icon-color:currentColor]"),size:"icon",variant:"outline","aria-label":S("list.filterAria")}),children:[a(so,{className:"size-4"}),ee?a("span",{"aria-hidden":!0,className:"absolute top-0.5 right-0.5 size-1.5 rounded-full bg-primary"}):null]}),s(ht,{align:"end",side:"bottom",children:[a(xa,{label:S("filter.groupState"),value:e,options:t,onChange:o}),a(je,{}),a(xa,{label:S("filter.groupInvolvement"),value:r,options:n,onChange:l}),a(je,{}),a(xa,{label:S("filter.groupDraft"),value:i.draft??wa,options:fg,onChange:B=>u(J("draft",B))}),a(je,{}),a(xa,{label:S("filter.groupReview"),value:i.review??wa,options:mg,onChange:B=>u(J("review",B))}),a(je,{}),a(xa,{label:S("filter.groupChecks"),value:i.checks??wa,options:pg,onChange:B=>u(J("checks",B))}),c.length>2?s(ve,{children:[a(je,{}),a(xa,{label:S("filter.groupHost"),value:f??dc,options:c,onChange:B=>d(B===dc?void 0:B)})]}):null,g.length>1?s(ve,{children:[a(je,{}),a(xa,{label:S("filter.groupServer"),value:p??cc,options:g,onChange:B=>L(B===cc?void 0:B)})]}):null,a(je,{}),s(Ft,{value:I===void 0||P===void 0?jn:St({id:I,environmentId:P}),onValueChange:B=>{if(B===jn){I!==void 0&&w(void 0,void 0);return}let G=R.find(F=>St(F)===B);G!==void 0&&(G.id!==I||G.environmentId!==P)&&w(G.id,G.environmentId)},children:[a(mn,{children:S("filter.groupProject")}),a(Ct,{value:jn,children:s("span",{className:"flex min-w-0 items-center gap-2",children:[a(Fe,{"aria-hidden":!0,className:"size-icon-2"}),S("filter.allProjects")]})}),R.toSorted((B,G)=>Number(y.has(St(B)))-Number(y.has(St(G)))).map(B=>{let G=y.get(St(B)),F=a(Ct,{value:St(B),className:G!==void 0?"data-disabled:pointer-events-auto":void 0,disabled:G!==void 0,children:s("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a(tu,{projectRef:{environmentId:B.environmentId,projectId:B.id},fallbackName:B.title,className:"min-w-0 flex-1 gap-2",iconClassName:"size-icon-2"}),B.showMachine===!0?a(da,{environmentId:B.environmentId,className:"min-w-0 shrink text-muted-foreground",iconClassName:"size-3"}):null,G===void 0?null:a("span",{className:"shrink-0 rounded-full border border-warning/40 bg-warning-surface px-1.5 py-px text-ui-2xs font-medium text-warning-foreground",children:S("filter.unavailable")})]})},St(B));return G===void 0?F:s(oe,{children:[a(ne,{render:F}),a(re,{side:"top",className:"max-w-80",children:G})]},St(B))})]})]})]})}qe();De();N();N();T();function Wn({joined:e}){return s("svg",{"aria-hidden":!0,viewBox:"0 0 120 72",className:"h-20 w-32 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[a("path",{d:"M10 58h100",className:"text-muted-foreground/30",stroke:"currentColor"}),a("circle",{cx:"10",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),a("circle",{cx:"110",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),e?a("path",{d:"M30 58c0-18 8-26 24-26h12c16 0 24 8 24 26"}):s(ve,{children:[a("path",{d:"M30 58c0-18 8-26 24-26h4"}),a("path",{d:"M90 58c0-18-8-26-24-26h-4",strokeDasharray:"2 7",className:"text-muted-foreground/50"})]}),a("circle",{cx:"60",cy:"32",r:e?5:4,fill:e?"currentColor":"none",fillOpacity:.25,className:e?void 0:"text-muted-foreground/45"})]})}function gc({query:e,filtered:t,searching:o,hasProjects:r,canLoadMore:n,loadingMore:l,refreshing:i,onClearQuery:u,onLoadMore:f,onRefresh:c}){let d=ni(),{t:p}=A();return r?o?a(Fa,{rows:5,caption:p("emptyState.searchingCaption",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}):e.length>0?s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p("emptyState.nothingMatches",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}),a(Ta,{children:p("emptyState.nothingMatchesDetail")})]}),s(qa,{className:"flex-row flex-wrap justify-center gap-2",children:[s(b,{size:"sm",variant:"outline",onClick:u,children:[a(Nt,{}),p("emptyState.clearSearch")]}),s(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[a(et,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p(t?"emptyState.nothingUnderFilters":"emptyState.noPullRequests")}),t?a(Ta,{children:p("emptyState.widenFilters")}):null]}),s(qa,{className:"flex-row flex-wrap justify-center gap-2",children:[n?a(b,{size:"sm",variant:"outline",disabled:l,onClick:f,children:p(l?"action.loading":"emptyState.loadMore")}):null,s(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[a(et,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p("emptyState.noProjectsTitle")}),a(Ta,{children:p(d?"emptyState.noProjectsDetail":"empty.addProjectWithoutPalette")})]}),d?a(qa,{children:s(b,{size:"sm",onClick:()=>si({open:"add-project"}),children:[a(mo,{}),p("emptyState.addProject")]})}):null]})}ce();Ue();qe();Xt();N();ut();T();function gg({entry:e,selected:t,showProjectTitle:o,showProvider:r,showEnvironment:n,environmentFallbackName:l,matchedElsewhere:i,onSelect:u}){let{t:f}=A(),c=Rr(),d=Cr(),{Icon:p,providerName:g}=Zt(e.provider);return s("button",{type:"button","aria-current":t?"true":void 0,onClick:()=>u(e),className:M("grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors","[contain-intrinsic-block-size:54px] [content-visibility:auto]",t?"bg-accent":"hover:bg-accent"),children:[a(bu,{state:e.state,isDraft:e.isDraft,mergeability:e.mergeability,baseBranch:e.baseBranch}),s("span",{className:"min-w-0",children:[a("span",{className:"block truncate text-sm font-medium text-foreground",children:e.title}),s(Lt,{className:"mt-0.5 text-xs text-muted-foreground/70",children:[s("span",{className:"flex shrink-0 items-center gap-1",children:[r?s(oe,{children:[a(ne,{render:a("span",{className:"inline-flex shrink-0"}),children:a(p,{"aria-label":g,className:"size-3"})}),a(re,{children:g})]}):null,s("span",{onContextMenu:L=>{L.preventDefault(),L.stopPropagation(),d({url:e.url,openLabel:c(e.provider),position:{x:L.clientX,y:L.clientY}})},children:["#",e.number]})]}),o?a("span",{className:"truncate",children:e.repository}):null,n?a(da,{environmentId:e.environmentId,fallbackName:l,className:"max-w-32 shrink-0",iconClassName:"size-3"}):null,a(bt,{actor:e.author,className:"max-w-40 shrink-0"}),e.reviewDecision==="approved"||e.reviewDecision==="changes-requested"?a("span",{className:M("shrink-0",e.reviewDecision==="approved"?"text-success-foreground":"text-warning-foreground"),children:e.reviewDecision==="approved"?f("reviewOutcome.approved"):f("reviewOutcome.changesRequested")}):null,e.checksState===void 0?null:a(qr,{checksState:e.checksState,environmentId:e.environmentId,reference:{projectId:e.projectId,repository:e.repository,number:e.number}}),i?a("span",{className:"shrink-0 rounded-full border border-border/60 px-1.5 text-ui-2xs",children:f("row.matchedInDescription")}):null]})]}),s("span",{className:"flex shrink-0 flex-col items-end gap-0.5 text-xs text-muted-foreground/70 tabular-nums",children:[a("span",{children:He(e.updatedAt)}),a(Ot,{additions:e.additions,deletions:e.deletions})]})]})}var hc=zr(gg);N();ut();T();function yc({children:e,documents:t,activeDocumentId:o,widthStorageKey:r,defaultWidth:n,pullRequestStatuses:l,onActivate:i,onCloseDocument:u,onCloseOtherDocuments:f,onCloseDocumentsToRight:c,onCloseAllDocuments:d}){let p=(g,L)=>{let R=t.find(I=>I.id===g);R&&L(R)};return a(au,{tabs:t.map(g=>{let L=l[g.id],R=L?So(L):null;return{id:g.id,title:`${g.repository.split("/").at(-1)} #${g.number}`,description:`${g.repository} #${g.number}`,...R?{icon:a(R.Icon,{className:`size-3 ${R.toneClassName}`,"aria-hidden":!0})}:{}}}),activeId:o,widthStorageKey:r,...n===void 0?{}:{defaultWidth:n},onActivate:g=>p(g,i),onClose:g=>p(g,u),onCloseOthers:g=>p(g,f),onCloseToRight:g=>p(g,c),onCloseAll:d,children:e})}De();N();qe();T();function xc({rightPanelAvailable:e,rightPanelOpen:t,rightPanelUnavailableLabel:o,rightPanelMaximized:r,onToggleRightPanelMaximized:n,onToggleRightPanel:l}){let{t:i}=A();return s("div",{className:"flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]","data-panel-layout-controls":!0,children:[r!==void 0&&n!==void 0?s(oe,{children:[a(ne,{render:a(Bt,{className:"shrink-0",pressed:r,onPressedChange:n,"aria-label":i(r?"panel.restore":"panel.maximize"),variant:"ghost",size:"sm"}),children:r?a(uo,{className:"size-4"}):a(lo,{className:"size-4"})}),a(re,{side:"bottom",children:i(r?"panel.restore":"panel.maximize")})]}):null,s(oe,{children:[a(ne,{render:a(Bt,{className:"shrink-0",pressed:t,onPressedChange:l,"aria-label":i("panel.toggleRight"),variant:"ghost",size:"sm",disabled:!e}),children:a(ia,{className:"size-4"})}),a(re,{side:"bottom",children:e?i("panel.toggleRight"):o??i("panel.rightUnavailable")})]})]})}N();N();ce();var Nr={isOpen:!1,activeDocumentId:null,documents:[]},Xn=new Set;function ea(){for(let e of Xn)e()}function hg(e){return Xn.add(e),()=>{Xn.delete(e)}}function yg(e){return`pull-request:${e.environmentId===void 0?"":`${encodeURIComponent(e.environmentId)}:`}${encodeURIComponent(e.projectId)}:${encodeURIComponent(e.repository)}:${e.number}`}function xg(e){return{id:yg(e),kind:"pull-request",...e.environmentId===void 0?{}:{environmentId:e.environmentId},projectId:e.projectId,repository:e.repository,number:e.number}}function ta(e,t,o){let r=o(e[t]??Nr);return{...e,[t]:r}}function wg(e,t){let o=e.documents.find(r=>r.id===t.id);return{...e,isOpen:!0,activeDocumentId:t.id,documents:o?e.documents.map(r=>r.id===t.id?t:r):[...e.documents,t]}}function vg(e,t,o){let r=e.documents.findIndex(u=>u.id===t);if(r<0)return e;let n=e.documents.filter((u,f)=>o(f,r)),l=n.some(u=>u.id===e.activeDocumentId),i=n[Math.min(r,n.length-1)]??null;return{...e,documents:n,activeDocumentId:l?e.activeDocumentId:i?.id??null,isOpen:n.length>0?e.isOpen:!1}}var Ae={byThreadKey:{},openPullRequest:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>wg(o,xg(t)))},ea()},activateDocument:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>o.documents.some(r=>r.id===t)?{...o,isOpen:!0,activeDocumentId:t}:o)},ea()},closeDocument:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>vg(o,t,(r,n)=>r!==n))},ea()},closeOtherDocuments:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>({...o,documents:o.documents.filter(r=>r.id===t),activeDocumentId:t}))},ea()},closeDocumentsToRight:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>{let r=o.documents.findIndex(n=>n.id===t);return r<0?o:{...o,documents:o.documents.slice(0,r+1),activeDocumentId:t}})},ea()},closeAllDocuments:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),()=>Nr)},ea()},show:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),t=>({...t,isOpen:t.documents.length>0}))},ea()},close:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),t=>({...t,isOpen:!1}))},ea()}};function Qn(){return Ae}var _e=(e=>{let t=Va(hg,Qn,Qn);return e(t)});_e.getState=Qn;function Br(e,t){return t?e[dt(t)]??Nr:Nr}function Jn(e,t){let o=Br(e,t);return o.documents.find(r=>r.id===o.activeDocumentId)??null}function Yn(e,t){return Br(e,t).isOpen?Jn(e,t):null}function wc(e,t,o){return e[t]?.state===o.state&&e[t]?.isDraft===o.isDraft?e:{...e,[t]:o}}qe();De();ce();N();N();N();N();N();N();N();Ue();T();var es=[{value:"all",labelKey:"filter.all",Icon:Fe},{value:"reviewing",labelKey:"filter.reviewing",Icon:to},{value:"authored",labelKey:"filter.authored",Icon:Kt}],ts=[{value:"all",labelKey:"filter.all",Icon:Fe},{value:"open",labelKey:"filter.open",Icon:Je},{value:"closed",labelKey:"filter.closed",Icon:mt},{value:"merged",labelKey:"filter.merged",Icon:Ke}];function Zn({label:e,value:t,options:o,onChange:r}){let{t:n}=A(),l=o.find(i=>i.value===t)??o[0];return l?s(gt,{children:[s(yt,{"aria-label":e,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-control-3 px-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground",children:[l.labelKey!==void 0?n(l.labelKey):l.label,a(rt,{"aria-hidden":!0,className:"size-3 text-muted-foreground/70"})]}),a(ht,{align:"start",side:"bottom",children:a(Ft,{value:t,onValueChange:i=>r(i),children:o.map(i=>{let u=a(Ct,{value:i.value,disabled:i.unavailable!==void 0,className:"data-disabled:pointer-events-auto",children:s("span",{className:"flex min-w-0 items-center gap-2",children:[i.Icon===void 0?null:a(i.Icon,{"aria-hidden":!0,className:"size-icon-2"}),i.labelKey!==void 0?n(i.labelKey):i.label]})},i.value);return i.unavailable===void 0?u:s(oe,{children:[a(ne,{render:u}),a(re,{side:"right",className:"max-w-64 break-words",children:i.unavailable})]},i.value)})})})]}):null}function Ig({searchInput:e,searchValue:t,open:o,onOpenChange:r,focusToken:n,onFocusWithin:l}){let{t:i}=A(),u=Ne(null);ye(()=>{o&&u.current?.querySelector("input")?.focus()},[o]);let f=Ne(n);return ye(()=>{if(f.current===n)return;f.current=n;let c=u.current?.querySelector("input");c?.focus(),c?.select()},[n]),o||t.length>0?a("div",{ref:u,className:"w-56 shrink-0",onFocus:()=>l?.(!0),onBlur:()=>{l?.(!1),t.length===0&&r(!1)},children:e}):a(b,{size:"icon-sm",variant:"ghost","aria-label":i("list.searchAria"),onClick:()=>r(!0),children:a(Nt,{className:"size-4"})})}function Ic({masterVisible:e,onMasterVisibilityChange:t,onBack:o,refreshing:r,onRefresh:n,searchValue:l,involvement:i,state:u,host:f,hostMenuOptions:c,onInvolvement:d,onState:p,onHost:g,searchInput:L,filtersMenu:R,rightPanelControl:I,rightPanel:P,listBody:y}){let{t:w}=A(),S=Ne(null),ee=Ne(null),[J,B]=C(!1);ye(()=>{let U=ee.current;if(!U||!e)return;let j=new IntersectionObserver(([Y])=>B(Y?!Y.isIntersecting:!1),{root:S.current});return j.observe(U),()=>j.disconnect()},[e]);let G=Ne(!1),F=Ne(null),[H,K]=C(!1),[V,O]=C(0);return ye(()=>{if(!e)return;let U=j=>{if(j.defaultPrevented||j.key.toLowerCase()!=="f"||!(j.metaKey||j.ctrlKey)||j.altKey||j.shiftKey)return;if(j.preventDefault(),J){K(!0),O(he=>he+1);return}let Y=F.current?.querySelector("input");Y?.focus(),Y?.select()};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[J,e]),ye(()=>{if(J||!e||(K(!1),!G.current))return;G.current=!1;let U=F.current?.querySelector("input");U&&(U.focus(),U.setSelectionRange(U.value.length,U.value.length))},[J,e]),s("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[s(yu,{className:"bg-background",children:[J&&e?s(pn,{ariaLabel:w("page.scopeAria"),children:[a(sr,{current:!0,children:a("h1",{className:"truncate",children:w("page.title")})}),a(gu,{}),s(sr,{className:"gap-1.5 overflow-hidden",children:[a(Zn,{label:w("list.filterByState"),value:u,options:ts,onChange:p}),a(Zn,{label:w("list.filterByInvolvement"),value:i,options:es,onChange:d}),c.length>2?a(Zn,{label:w("list.filterByHost"),value:f??"",options:c,onChange:U=>g(U===""?void 0:U)}):null]})]}):a(pn,{ariaLabel:w("breadcrumb.ariaLabel"),children:a(sr,{current:!0,children:a("h1",{className:"truncate",children:w("page.title")})})}),a("div",{className:"min-w-0 flex-1"}),J&&e?s("div",{className:"flex shrink-0 items-center gap-1.5",children:[a(Ig,{searchInput:L,searchValue:l,open:H,onOpenChange:K,focusToken:V,onFocusWithin:U=>{G.current=U}}),a(vc,{compact:!0,refreshing:r,onRefresh:n})]}):null,I]}),a(ou,{detail:P,onBack:o,onMasterVisibilityChange:t,children:a("div",{ref:S,className:"topbar-scroll-fade scrollbar-gutter-both min-h-0 min-w-0 flex-1 overflow-y-auto [--topbar-scroll-fade-height:1.5rem] sm:[--topbar-scroll-fade-height:1.5rem]",children:s(hu,{className:"gap-4",children:[s("div",{className:"flex flex-col gap-3",children:[s("div",{ref:F,className:"flex items-center gap-2",children:[L,R,J?null:a(vc,{refreshing:r,onRefresh:n})]}),a("div",{ref:ee,"aria-hidden":!0,className:"-mt-3 h-px w-full"})]}),y]})})})]})}function vc({compact:e=!1,refreshing:t,onRefresh:o}){let{t:r}=A();return a(b,{size:e?"icon-sm":"icon",variant:e?"ghost":"outline","aria-label":r("list.refreshAria"),onClick:o,disabled:t,children:a("span",{className:M("inline-flex shrink-0",t&&"animate-spin"),children:a(et,{className:"size-4"})})})}ce();Pa();ce();function Rc(e,t){let[o,r]=C(e);return ye(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[t,e]),o}Me();Me();var Rg=250,kt=99,va=500,Cc=[];function bc(e){let{search:t,environmentIds:o,environmentKey:r,pullRequestsSupported:n,projectsKnown:l,projects:i,scopedProjectId:u,scopedProject:f}=e,c=(t.q??"").trim(),d=Rc(c,Rg),p=c===d,g=$(()=>Zo(c),[c]),L=$(()=>Zo(d),[d]),R=$(()=>({...t.draft?{draft:t.draft}:{},...t.review?{review:t.review}:{},...t.checks?{checks:t.checks}:{}}),[t.checks,t.draft,t.review]),I=Object.keys(R).length>0,P=$(()=>({...R,...L.filters}),[R,L.filters]),y=Object.keys(P).length>0,w=$(()=>({...R,...g.filters}),[R,g.filters]),S=Object.keys(w).length>0,ee=$(()=>Yi(o,i,f,u,l),[o,i,l,f,u]),J=$(()=>{let D=ee.map(ke=>({environmentId:ke}));if(!l||u!==void 0)return D;let Z=xd(i,ee,ee[0]),ge=new Map;for(let ke of i)ge.set(ke.environmentId,(ge.get(ke.environmentId)??0)+1);return ee.flatMap(ke=>{let We=Z.get(ke);return We===void 0?[]:We.length===(ge.get(ke)??0)?[{environmentId:ke}]:[{environmentId:ke,projectIds:We}]})},[i,l,ee,u]),B=$(()=>J.map(({environmentId:D,projectIds:Z})=>`${D}#${Z?.join("+")??"*"}`).join("|"),[J]),G=`${r}:${B}:${t.state}:${t.involvement}:${u??""}:${t.host??""}:${t.draft??""}:${t.review??""}:${t.checks??""}`,F=`${G}:${d}`,[H,K]=C({key:F,size:kt,cursors:null,regrown:[]}),V=H.key===F?H.size:kt,O=H.key===F?H.cursors:null,U=H.key===F?H.regrown:[];ye(()=>{K({key:F,size:kt,cursors:null,regrown:[]})},[F]);let j=$(()=>J.flatMap(({environmentId:D,projectIds:Z})=>{let ge=O?.[D];return O!==null&&ge===void 0&&!U.includes(D)?[]:[{environmentId:D,input:{state:t.state,involvement:t.involvement,limit:V,...u?{projectId:u}:{},...Z?{projectIds:Z}:{},...t.host?{host:t.host}:{},...y?{filters:P}:{},...L.text?{query:L.text}:{},...ge===void 0?{}:{cursors:ge}}}]}),[P,y,V,J,u,t.host,t.involvement,t.state,O,U,L.text]),Y=Po(j),he=$(()=>J.map(({environmentId:D,projectIds:Z})=>({environmentId:D,input:{state:t.state,involvement:t.involvement,limit:kt,...u?{projectId:u}:{},...Z?{projectIds:Z}:{},...t.host?{host:t.host}:{},...I?{filters:R}:{}}})),[I,R,J,u,t.host,t.involvement,t.state]),le=Po(he),xe=t.involvement==="all"&&c.length===0,pe=$(()=>{if(!xe)return{authored:Cc,reviewing:Cc};let D=Z=>J.map(({environmentId:ge,projectIds:ke})=>({environmentId:ge,input:{state:t.state,involvement:Z,limit:kt,...u?{projectId:u}:{},...ke?{projectIds:ke}:{},...t.host?{host:t.host}:{},...I?{filters:R}:{}}}));return{authored:D("authored"),reviewing:D("reviewing")}},[I,R,xe,J,u,t.host,t.state]),ue=Po(pe.authored),be=Po(pe.reviewing),ae=Be(Se.invalidate,{reportFailure:!1}),[h,W]=C(0),[E,X]=C(!1),k=async D=>{X(!0);try{await Promise.all(ee.map(Z=>ae({environmentId:Z,input:{}})))}finally{X(!1)}fe(),le.refresh(),ue.refresh(),be.refresh(),D(),W(Z=>Z+1)},v=E||Y.isPending,[de,Ge]=C(null),[$e,ct]=C(null);ye(()=>{r.length!==0&&Ge(D=>{if(D!==null&&D.environmentKey===r)return D;let Z=Xi(typeof window>"u"?void 0:window.localStorage,r);return Z===null?null:{environmentKey:r,scope:Z.scope,query:"",data:Z.data,...Z.partitions===void 0?{}:{partitions:Z.partitions}}})},[r]),ye(()=>{if(!Y.data||Y.isPending)return;let D=Y.data;Ge(Z=>{let ge=xe&&ue.data!==null&&be.data!==null?{authored:ue.data.entries,reviewing:be.data.entries}:Z!==null&&Z.environmentKey===r&&Z.scope===G?Z.partitions:void 0;if(r.length>0&&d.length===0){let ke=$e?.key===F?$e.entries:D.entries;Qi(typeof window>"u"?void 0:window.localStorage,r,{scope:G,data:{...D,entries:ke,viewers:le.data?.viewers??D.viewers,providers:le.data?.providers??D.providers},...ge===void 0?{}:{partitions:ge}})}return{environmentKey:r,scope:G,query:d,data:D,...ge===void 0?{}:{partitions:ge}}})},[r,G,d,Y.data,Y.isPending,xe,ue.data,be.data,$e,F,le.data]);let at=$(()=>{if(de===null||de.environmentKey!==r||de.scope===G)return null;let D=Hi(de.data.entries,{state:t.state,projectId:u,host:t.host});return D.length===0?null:{...de.data,entries:D}},[r,de,G,u,t.host,t.state]),Le=(d.length===0&&O===null&&V===kt?le.data:Y.data)??(de?.scope===G&&de.query===d?de.data:null),Ye=(d.length===0?le.data:void 0)??(de?.scope===G?de.data:null)??at,Ze=Le??Ye,wt=Le===null&&Ye!==null,qt=Y.isPending&&Ze!==null,Q=Y.isPending&&Ze===null;ye(()=>{Le&&ct(D=>{if(D===null||D.key!==F)return{key:F,entries:ar(Le.entries,L.text)};if(O!==null){let Z=new Set(D.entries.map(Qt)),ge=Le.entries.filter(We=>!Z.has(Qt(We))),ke=ar(ge.toSorted((We,Ht)=>Ht.updatedAt.localeCompare(We.updatedAt)),L.text);return{key:F,entries:[...D.entries,...ke]}}return{key:F,entries:ar(Le.entries,L.text)}})},[Le,F,O,L.text]);let Re=Le?.nextCursors??{},Ce=(Le?.truncatedEnvironments??[]).filter(D=>Re[D]===void 0),Pe=!wt&&Object.keys(Re).length>0,q=()=>{if(Pe){K({key:F,size:Ce.length===0?V:Math.min(V+kt,va),cursors:Re,regrown:Ce});return}K({key:F,size:Math.min(V+kt,va),cursors:null,regrown:[]})},fe=()=>{if(O===null){Y.refresh();return}let D=$e?.key===F?$e.entries.length:V;K({key:F,regrown:[],size:Math.min(Math.max(V,Math.ceil(D/kt)*kt),va),cursors:null})};return Er(()=>{fe(),ue.refresh(),be.refresh()},{enabled:n}),{typedQuery:c,querySettled:p,typedParsed:g,menuFilters:R,localFilters:w,hasLocalFilters:S,scopeKey:G,filterKey:F,pageSize:V,listQuery:Y,baselineQuery:le,partitionsWanted:xe,authoredQuery:ue,reviewingQuery:be,detailRefreshToken:h,refreshing:v,loaded:de,ordered:$e,answered:Le,listData:Ze,showingCarried:wt,loadingMore:qt,firstLoad:Q,canContinue:Pe,loadMore:q,refreshList:fe,refreshFromHost:k}}bo();ce();ze();function Lc(e){let{search:t}=me().useLocation();return $(()=>{let o=new URLSearchParams(t.startsWith("?")?t.slice(1):t),r={};for(let[n,l]of o.entries())r[n]=l;return r},[t])}function Cg(e){let t=new URLSearchParams;for(let[o,r]of Object.entries(e))r==null||r===""||t.set(o,String(r));return t.toString()}function Pc(){let e=me(),t=e.useLocation();return Xe(o=>{let r=new URLSearchParams(t.search.startsWith("?")?t.search.slice(1):t.search),n={};for(let[c,d]of r.entries())n[c]=d;let l=typeof o.search=="function"?o.search(n):o.search??n,i=Cg(l),u="/x/pull-requests",f=t.pathname===u||t.pathname.startsWith(`${u}/`)?t.pathname:u;e.navigate(i.length>0?`${f}?${i}`:f)},[e,t.pathname,t.search])}qe();ce();Pa();Me();function Sc(e){return{involvement:e.involvement==="reviewing"||e.involvement==="authored"?e.involvement:"all",state:e.state==="closed"||e.state==="merged"||e.state==="all"?e.state:"open",...typeof e.repository=="string"&&e.repository?{repository:e.repository.slice(0,200)}:{},...typeof e.number=="number"&&Number.isInteger(e.number)&&e.number>0?{number:e.number}:{},...typeof e.projectId=="string"&&e.projectId?{projectId:e.projectId}:{},...typeof e.environmentId=="string"&&e.environmentId?{environmentId:e.environmentId}:{},...typeof e.host=="string"&&e.host?{host:e.host.slice(0,200)}:{},...typeof e.selectedProjectId=="string"&&e.selectedProjectId?{selectedProjectId:e.selectedProjectId}:{},...typeof e.selectedEnvironmentId=="string"&&e.selectedEnvironmentId?{selectedEnvironmentId:e.selectedEnvironmentId}:{},...typeof e.q=="string"&&e.q?{q:e.q.slice(0,200)}:{},...e.draft==="only"||e.draft==="hide"?{draft:e.draft}:{},...e.review==="approved"||e.review==="changes-requested"||e.review==="review-required"||e.review==="none"?{review:e.review}:{},...e.checks==="passing"||e.checks==="failing"?{checks:e.checks}:{}}}function kc(e,t){let o={...e,...t};return{involvement:o.involvement??e.involvement,state:o.state??e.state,...o.repository?{repository:o.repository}:{},...o.number?{number:o.number}:{},...o.projectId?{projectId:o.projectId}:{},...o.environmentId?{environmentId:o.environmentId}:{},...o.host?{host:o.host}:{},...o.selectedProjectId?{selectedProjectId:o.selectedProjectId}:{},...o.selectedEnvironmentId?{selectedEnvironmentId:o.selectedEnvironmentId}:{},...o.q?{q:o.q}:{},...o.draft?{draft:o.draft}:{},...o.review?{review:o.review}:{},...o.checks?{checks:o.checks}:{}}}var bg=rc.make("pull-requests-panel"),Lg="pull-requests-panel";function qc(){let[e,t]=C(!0),o=Lc({strict:!1}),r=$(()=>Sc(o),[o]),n=Pc(),{t:l}=A(),{environments:i}=Mr(),u=$(()=>i.filter(k=>k.serverConfig!==null).map(k=>k.environmentId),[i]),f=oc(Ru,u),c=$(()=>i.filter(k=>f.get(k.environmentId)===!0).toSorted((k,v)=>k.environmentId.localeCompare(v.environmentId)),[i,f]),d=c.find(k=>k.environmentId===r.environmentId)?.environmentId??null,p=$(()=>new Set(i.map(k=>k.environmentId)),[i]),g=$(()=>c.filter(k=>d===null||k.environmentId===d).map(k=>k.environmentId),[c,d]),L=$(()=>ji(g),[g]),R=f.size>0,I=g.length>0,{projects:P,bootstrapped:y,rows:w}=Ar(),S=$(()=>P.filter(k=>g.includes(k.environmentId)),[P,g]),ee=$(()=>new Map(i.map(k=>[k.environmentId,k.label])),[i]),J=$(()=>{let k=new Map;for(let v of S)k.set(v.title,(k.get(v.title)??0)+1);return S.map(v=>({id:v.id,environmentId:v.environmentId,title:v.title,workspaceRoot:v.workspaceRoot,showMachine:(k.get(v.title)??0)>1})).toSorted((v,de)=>v.title.localeCompare(de.title))},[S]),B=$(()=>ln(r.projectId,S,y),[S,y,r.projectId]),G=$(()=>un(S,d,B),[S,d,B]),F=$(()=>{let k=r.repository?.toLowerCase();return k===void 0?void 0:S.find(de=>de.repositoryIdentity?.owner&&de.repositoryIdentity.name&&`${de.repositoryIdentity.owner}/${de.repositoryIdentity.name}`.toLowerCase()===k&&(r.host===void 0||Co(de.repositoryIdentity,de.repositoryIdentity.provider)===r.host.toLowerCase()))?.id},[S,r.host,r.repository]),H=$(()=>ln(r.selectedProjectId,S,y),[S,y,r.selectedProjectId]),K=H??F??B,V=Zi(r.selectedEnvironmentId,p,d),O=$(()=>{let k=r.selectedProjectId,v=k===void 0||!y||H!==void 0?[]:w.flatMap(de=>!g.includes(de.environmentId)||V!==null&&de.environmentId!==V?[]:[{environmentId:de.environmentId,project:Tr(de.data,k)}]);return Ji({projectId:k,environmentId:V,rows:v})},[g,H,w,y,r.selectedProjectId,V]),U=$(()=>O??un(S,V,K),[O,S,V,K]),j=$(()=>c.length===0?null:nc(Lg,bg),[c.length]),Y=_e(k=>Br(k.byThreadKey,j)),he=_e(k=>Jn(k.byThreadKey,j)),le=he?.kind==="pull-request"?he:null,xe=Y.isOpen?le:null,pe=xe?.environmentId??U?.environmentId??null,[ue,be]=C({}),ae=xe?.id,h=Xe(k=>{let v=ae;v!==void 0&&be(de=>wc(de,v,k))},[ae]),W=Xe(k=>{n({search:kc(r,k)})},[n,r]),E={repository:void 0,number:void 0,selectedProjectId:void 0,selectedEnvironmentId:void 0};return{masterVisible:e,setMasterVisible:t,search:r,t:l,capableEnvironments:c,scopedEnvironmentId:d,environmentIds:g,environmentKey:L,capabilityKnown:R,pullRequestsSupported:I,projectsKnown:y,projects:S,environmentLabels:ee,scopedProjects:J,scopedProjectId:B,scopedProject:G,selectedProject:U,rightPanelRef:j,rightPanelState:Y,selectedPullRequestDocument:le,activePullRequestDocument:xe,panelEnvironmentId:pe,pullRequestTabStatuses:ue,handlePullRequestTabStatusChange:h,updateSearch:W,clearedSelection:E,updateListScope:k=>{j!==null&&_e.getState().close(j),W({...k,...E})}}}bo();ce();Pa();Me();var Pg={};function Tc(e,t){let{masterVisible:o,search:r,environmentKey:n,pullRequestsSupported:l,projects:i,selectedProject:u,rightPanelRef:f,rightPanelState:c,selectedPullRequestDocument:d,activePullRequestDocument:p,updateSearch:g,clearedSelection:L}=e,{querySettled:R,typedParsed:I,localFilters:P,hasLocalFilters:y,scopeKey:w,filterKey:S,pageSize:ee,listQuery:J,baselineQuery:B,partitionsWanted:G,authoredQuery:F,reviewingQuery:H,loaded:K,ordered:V,answered:O,listData:U,showingCarried:j,canContinue:Y,loadMore:he}=t,le=B.data?.viewers??U?.viewers??Pg,xe=B.data?.errors??U?.errors??[],pe=$(()=>new Set((B.data?.providers??U?.providers??[]).flatMap(Q=>Q.searchesOnHost?[Q.host]:[])),[B.data?.providers,U?.providers]),ue=$(()=>{let Q=V?.key===S?V.entries:U?.entries??[],Re=_i(Q,le,r.involvement),Ce=y?Re.filter(q=>sn(q,P,tr(q,le))):Re;if(I.text.length===0)return Ce.toSorted((q,fe)=>fe.updatedAt.localeCompare(q.updatedAt));let Pe=R&&!j;return Ce.filter(q=>Pe&&pe.has(q.host)||rn(q,I.text))},[S,y,P,U,V,R,r.involvement,pe,j,I.text,le]),be=Ne(null);ye(()=>{let Q=be.current;if(!o||!Q||ue.length===0||U?.truncated!==!0||J.isPending||J.error!==null||j||!Y&&ee>=va)return;let Re=new IntersectionObserver(Ce=>{Ce.some(Pe=>Pe.isIntersecting)&&he()},{rootMargin:"240px"});return Re.observe(Q),()=>Re.disconnect()},[o,ue.length,S,Y,U?.truncated,J.error,J.isPending,ee,j]);let ae=$(()=>{if(r.involvement!=="all")return[{key:"others",entries:ue}];let Q=K!==null&&K.environmentKey===n&&K.scope===w?K.partitions:void 0,Re=q=>q===void 0||!y?q:q.filter(fe=>sn(fe,P,tr(fe,le))),Ce=Re(G?F.data?.entries??Q?.authored:void 0),Pe=Re(G?H.data?.entries??Q?.reviewing:void 0);return Ce===void 0||Pe===void 0?Gi(ue,le):$i(ue,Ce,Pe)},[y,P,F.data?.entries,ue,n,K,G,H.data?.entries,w,r.involvement,le]),h=$(()=>{let Q=new Map;for(let Re of ae)for(let Ce of Re.entries){let Pe=Q.get(Ce.environmentId)??[];Pe.push({projectId:Ce.projectId,repository:Ce.repository,number:Ce.number}),Q.set(Ce.environmentId,Pe)}return[...Q].map(([Re,Ce])=>({environmentId:Re,input:{refs:Ce}}))},[ae]),W=Cu(h),[E,X]=C(()=>new Map);ye(()=>{let Q=W.stats;Q!==null&&X(Re=>zi(Re,Q))},[W.stats]);let k=$(()=>r.repository&&r.number&&u?{environmentId:u.environmentId,repository:r.repository,number:r.number,projectId:u.id}:null,[r.number,r.repository,u]),v=d!==null;ye(()=>{!l||f===null||k===null||_e.getState().openPullRequest(f,k)},[k,l,f]);let de=c.isOpen&&p!==null?{environmentId:p.environmentId,repository:p.repository,number:p.number,projectId:p.projectId}:null,Ge=Q=>g(Q===null?L:{repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,...Q.environmentId===void 0?{}:{selectedEnvironmentId:Q.environmentId}}),$e=()=>{if(f!==null){if(c.isOpen){_e.getState().close(f),g(L);return}d!==null&&(_e.getState().show(f),Ge(d))}},[ct,at]=C([]);ye(()=>{O!==null&&at(Q=>r.host===void 0||Q.length===0?O.providers:Q)},[O,r.host]);let Le=ct.length>1,Ye=$(()=>{let Q=new Map;for(let Re of i){let Ce=Re.repositoryIdentity?.provider;if(Ce===void 0)continue;let Pe=Co(Re.repositoryIdentity,Ce);Q.has(Pe)||Q.set(Pe,{host:Pe,kind:Ce})}return[...Q.values()]},[i]),Ze=$(()=>new Map(xe.map(Q=>[St({id:Q.projectId,environmentId:Q.environmentId}),Q.message])),[xe]),wt=Xe(Q=>{f!==null&&(_e.getState().openPullRequest(f,Q),g({repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,selectedEnvironmentId:Q.environmentId}))},[f,g]);return{entries:ue,sentinelRef:be,groups:ae,statsByRow:E,rightPanelAvailable:v,selected:de,selectSurfaceInUrl:Ge,toggleRightPanel:$e,hosts:ct,showProvider:Le,expectedHosts:Ye,unavailableProjects:Ze,selectEntry:wt,refreshStats:()=>W.refresh()}}T();var Sg=10;function Ac(){let e=qc(),t=bc(e),o=Tc(e,t),{masterVisible:r,setMasterVisible:n,search:l,t:i,capableEnvironments:u,scopedEnvironmentId:f,capabilityKnown:c,pullRequestsSupported:d,projectsKnown:p,projects:g,environmentLabels:L,scopedProjects:R,scopedProjectId:I,scopedProject:P,rightPanelRef:y,rightPanelState:w,activePullRequestDocument:S,panelEnvironmentId:ee,pullRequestTabStatuses:J,handlePullRequestTabStatusChange:B,updateSearch:G,updateListScope:F}=e,{typedQuery:H,querySettled:K,typedParsed:V,menuFilters:O,pageSize:U,listQuery:j,baselineQuery:Y,authoredQuery:he,reviewingQuery:le,detailRefreshToken:xe,refreshing:pe,listData:ue,showingCarried:be,loadingMore:ae,firstLoad:h,canContinue:W,loadMore:E,refreshList:X,refreshFromHost:k}=t,{entries:v,sentinelRef:de,groups:Ge,statsByRow:$e,rightPanelAvailable:ct,selected:at,selectSurfaceInUrl:Le,toggleRightPanel:Ye,hosts:Ze,showProvider:wt,expectedHosts:qt,unavailableProjects:Q,selectEntry:Re,refreshStats:Ce}=o,Pe=()=>k(Ce),q=a(mc,{value:l.q??"",busy:H.length>0&&(!K||be),onChange:_=>G({q:_||void 0})}),fe=a(xc,{showTerminalControl:!1,terminalAvailable:!1,terminalOpen:!1,terminalShortcutLabel:null,rightPanelAvailable:ct,rightPanelOpen:w.isOpen,rightPanelShortcutLabel:null,rightPanelUnavailableLabel:i("list.selectFirst"),onToggleTerminal:()=>{},onToggleRightPanel:Ye}),D=be&&j.isPending&&v.length===0&&H.length===0,Z=s(ve,{children:[c?d?h?a(Fa,{rows:7}):j.error&&ue===null?a(Lo,{error:j.error,onRetry:()=>j.refresh()}):D?a(Fa,{rows:7}):v.length===0?a(gc,{hasProjects:!p||g.length>0,refreshing:pe,onRefresh:()=>{Pe()},query:H,filtered:l.state!=="open"||l.involvement!=="all"||I!==void 0||l.host!==void 0,searching:H.length>0&&(!K||be),canLoadMore:ue?.truncated===!0&&(W||U<va),loadingMore:ae,onClearQuery:()=>G({q:void 0}),onLoadMore:E}):a("div",{className:"space-y-3",children:Ge.map(_=>s("div",{className:"space-y-0.5",children:[_.labelKey?a("h2",{className:"px-3 pb-0.5 text-xs font-medium text-muted-foreground/70",children:i(_.labelKey)}):null,_.entries.map(Ee=>a(hc,{entry:eu(Ee,$e),showProjectTitle:!0,showProvider:wt,showEnvironment:u.length>0,environmentFallbackName:L.get(Ee.environmentId),matchedElsewhere:V.text.length>0&&er(Ee,V.text)<=Sg,selected:at?.environmentId===Ee.environmentId&&at.repository===Ee.repository&&at.number===Ee.number,onSelect:Re},Qt(Ee)))]},_.key))}):a(Lo,{title:i("list.unavailableTitle"),error:i("page.notEnabled")}):a(Fa,{rows:7}),j.error&&ue!==null?s("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-warning/30 bg-warning-surface px-3 py-2 text-xs",children:[a("span",{children:i("list.staleNotice")}),a(b,{size:"xs",variant:"outline",onClick:()=>j.refresh(),children:i("action.retry")})]}):null,ue?.truncated&&v.length>0?a("div",{ref:de,className:"flex justify-center py-2 text-xs text-muted-foreground",children:ae?s("span",{className:"flex items-center gap-2",children:[a("span",{className:"inline-flex size-icon-2 shrink-0 animate-spin",children:a(Dt,{"aria-hidden":!0,className:"size-icon-2"})}),i("list.loadingMore")]}):null}):null]}),ge=Ze.length>0?Ze:qt,ke=[{value:"",labelKey:"list.allHosts",Icon:Fe},...ge.map(_=>{let Ee=Ze.find(Uo=>Uo.host===_.host);return{value:_.host,label:fc(ge,_),Icon:Zt(_.kind).Icon,...Ee===void 0||Ee.configured?{}:{unavailable:Ee.detail??i("list.hostUnreadable")}}})],We=[{value:"",labelKey:"list.allServers",Icon:Fe},...u.map(_=>({value:_.environmentId,environmentId:_.environmentId,label:_.label}))],Ht=a(pc,{state:l.state,stateOptions:ts,onState:_=>F({state:_}),involvement:l.involvement,involvementOptions:es,onInvolvement:_=>F({involvement:_}),filters:O,onFilters:_=>F({draft:_.draft,review:_.review,checks:_.checks}),host:l.host,hostOptions:ke,onHost:_=>F({host:_}),server:f??void 0,serverOptions:We,onServer:_=>F({environmentId:_,projectId:void 0}),projects:R,projectId:I,projectEnvironmentId:P?.environmentId,unavailable:Q,onProject:(_,Ee)=>F(Ee===void 0?{projectId:_}:{projectId:_,environmentId:Ee})}),No={masterVisible:r,onMasterVisibilityChange:n,onBack:Ye,refreshing:pe,onRefresh:()=>{Pe()},searchValue:l.q??"",involvement:l.involvement,state:l.state,host:l.host,hostMenuOptions:ke,onInvolvement:_=>F({involvement:_}),onState:_=>F({state:_}),onHost:_=>F({host:_}),searchInput:q,filtersMenu:Ht,rightPanelControl:d?fe:null,listBody:Z},Bo=_=>{y!==null&&(_e.getState().activateDocument(y,_.id),Le(_))},Fr=_=>{if(y===null)return;_e.getState().closeDocument(y,_.id);let Ee=Yn(_e.getState().byThreadKey,y);Le(Ee?.kind==="pull-request"?Ee:null)},Fo=_=>{y!==null&&(_e.getState().closeOtherDocuments(y,_.id),Le(_))},Oo=_=>{if(y===null)return;_e.getState().closeDocumentsToRight(y,_.id);let Ee=Yn(_e.getState().byThreadKey,y);Le(Ee?.kind==="pull-request"?Ee:null)},aa=()=>{y!==null&&(_e.getState().closeAllDocuments(y),Le(null))},Or=w.isOpen&&S&&ee!==null?a(yc,{widthStorageKey:"ycodium:pull-request-panel-width",defaultWidth:typeof window>"u"?640:Math.floor(window.innerWidth/2),documents:w.documents,activeDocumentId:S.id,onActivate:_=>{_.kind==="pull-request"&&Bo(_)},onCloseDocument:_=>{_.kind==="pull-request"&&Fr(_)},onCloseOtherDocuments:_=>{_.kind==="pull-request"&&Fo(_)},onCloseDocumentsToRight:_=>{_.kind==="pull-request"&&Oo(_)},onCloseAllDocuments:aa,pullRequestStatuses:J,children:a(Dr,{environmentId:ee,reference:{projectId:S.projectId,repository:S.repository,number:S.number},refreshToken:xe,onActed:()=>{X(),Y.refresh(),he.refresh(),le.refresh()},onStateChange:B},S.id)}):null;return a(pu,{className:"h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground",children:a(Ic,{...No,rightPanel:Or})})}Ut();T();function Ec(e){jl(typeof e.notify=="function"?e.notify:()=>{},typeof e.notifyTask=="function"?e.notifyTask:void 0),typeof e.openExternal=="function"&&Xl(e.openExternal),typeof e.writeClipboard=="function"&&Jl(e.writeClipboard),ri(t=>{if(typeof e.openCommandPalette=="function"&&ft(e,"commandPalette")){e.openCommandPalette(t);return}typeof e.notify=="function"&&e.notify(ms,"warning")},ft(e,"commandPalette")),e.composerDraft!==void 0&&ii(e.composerDraft)}function Mc({bridge:e}){let t=e.useFormatTimestamp();return ye(()=>{Ec(e),ti(t)},[e,t]),null}function kg(e){if(["InputGroup","InputGroupAddon","InputGroupInput","DocumentPanel","MasterDetail","useLinkContextMenu"].some(r=>e.ui[r]===void 0)){let r=function(){let n=e.i18n.usePluginTranslation();return a("p",{role:"status",className:"p-6 text-sm text-muted-foreground",children:n("page.hostUpgradeRequired")})};var o=r;return{pages:{"pull-requests":r},panels:{},views:{detail:r}}}return Ec(e),{pages:{"pull-requests":function(){return s(Vr,{value:e,children:[a(Mc,{bridge:e}),a("style",{children:$r}),a("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:a(Ac,{})})]})}},panels:{},views:{detail:function({threadReference:n,...l}){return s(Vr,{value:e,children:[a(Mc,{bridge:e}),a("style",{children:$r}),a("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:a(Dr,{...l,context:n?_u(n,l.reference)?"thread":"page":l.context??"page"})})]})}}}}export{kg as default};
1604
+ `;ce();ja();ze();it();var Wl=()=>{};function Xl(e){Wl=e}function pt(){return{shell:{openExternal:async e=>{Wl(e)}}}}function Ql(e){try{let t=new URL(e),o=/^(.*?)\/-\/merge_requests\/\d+(?:\/|$)/iu.exec(t.pathname)?.[1]??/^(.*?)(?:\/pull\/\d+|\/-\/merge_requests\/\d+)(?:\/|$)/iu.exec(t.pathname)?.[1];return o?(t.pathname=o,t.search="",t.hash="",t.toString()):null}catch{return null}}var Qr=async()=>{};function Jl(e){Qr=e}async function Yl(e){return await Qr(e),!0}function Zl(e){return{copyToClipboard:t=>{Qr(t)},isCopied:!1}}Xt();var ai=()=>{},oi=!0;function ri(e,t=!0){ai=e,oi=t}function ni(){return oi}function si(e){ai(e)}ce();ja();ze();it();function vo(e){if(e!==null&&typeof e=="object"&&"cause"in e){let t=e.cause;return t instanceof Error?t:new Error(String(t))}return e instanceof Error?e:new Error(String(e))}function Ko(e){return{getComposerDraft:t=>e.get(t),setPrompt:(t,o)=>e.setPrompt(t,o),setReviewComments:(t,o)=>e.setReviewComments(t,o)}}var li=Ko({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function ii(e){li=Ko(e)}var wm=Ko({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function jo(){let e=me();return e.composerDraft===void 0||!ft(e,"composerDraft")?wm:Ko(e.composerDraft)}jo.getState=()=>li;function ui(){let e=me(),t=typeof e.useCreateThread=="function"?e.useCreateThread():null;return async(o,r)=>t===null||!ft(e,"createThread")?(we.error(Ka),null):t(o,r)}function di(e){let t=me(),o=typeof t.usePrepareWorkspace=="function"?t.usePrepareWorkspace():async()=>({ok:!1,error:Ka}),[r,n]=C(null);return{error:r,run:async l=>{if(e.cwd===null){let u=new Error("No workspace is available for this checkout.");return n(u),{_tag:"Failure"}}let i=await o({environmentId:e.environmentId,cwd:e.cwd,reference:l.reference,mode:l.mode,...l.threadId===void 0?{}:{threadId:l.threadId}});return i.ok?(n(null),{_tag:"Success",value:i.value}):(n(new Error(i.error)),{_tag:"Failure"})}}}var ci={listRefs:e=>({command:"listRefs",environmentId:e.environmentId,payload:e.input})};De();Pa();ce();ze();Ue();N();N();Ue();qe();T();function te({className:e}){return a("div",{"aria-hidden":!0,className:M("h-3 rounded bg-muted-foreground/15",e)})}var lr=["w-3/5","w-2/5","w-1/2","w-2/3","w-2/5","w-3/5","w-1/2"],Ba=["w-2/5","w-1/3","w-2/5","w-1/4","w-1/3","w-2/5","w-1/3"];function Fa({rows:e=7,caption:t}){let{t:o}=A();return s("div",{role:"status","aria-label":t??o("ghost.loadingList"),className:"animate-ghost-pulse space-y-0.5",children:[t?a("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground/70",children:t}):null,Array.from({length:e},(r,n)=>s("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2",children:[a(te,{className:"size-4 rounded-full"}),s("div",{className:"min-w-0 space-y-1.5",children:[a(te,{className:M("h-3.5",lr[n%lr.length])}),a(te,{className:Ba[n%Ba.length]})]}),s("div",{className:"flex flex-col items-end gap-1.5",children:[a(te,{className:"w-12"}),a(te,{className:"w-16"})]})]},n))]})}function xu(){let{t:e}=A();return s("div",{role:"status","aria-label":e("ghost.loadingDetail"),className:"animate-ghost-pulse flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[s("div",{className:"shrink-0 border-b border-border/60",children:[s("div",{className:"flex h-7 items-center justify-between gap-3 px-4",children:[s("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[a(te,{className:"w-24"}),a(te,{className:"w-9"})]}),s("div",{className:"flex shrink-0 items-center gap-1",children:[a(te,{className:"h-5 w-16 rounded-control-1"}),a(te,{className:"size-5 rounded-control-1"})]})]}),s("div",{className:"px-4 pb-4 pt-1",children:[a(te,{className:"h-5 w-4/5 max-w-md"}),s("div",{className:"mt-2 flex items-center gap-1.5",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:"w-24"})]}),s("div",{className:"mt-4 flex min-w-0 items-center gap-2",children:[a(te,{className:"h-6 w-24 rounded-control-2"}),a(te,{className:"size-3 rounded-full"}),a(te,{className:"h-6 w-32 rounded-control-2"}),s("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[a(te,{className:"w-10"}),a(te,{className:"w-20"})]})]})]}),s("div",{className:"flex min-h-10 items-center justify-between gap-3 border-t border-border/60 px-4 py-2",children:[s("div",{className:"flex items-center gap-1 p-0.5",children:[a(te,{className:"h-6 w-16 rounded-control-2"}),a(te,{className:"h-6 w-16 rounded-control-2"}),a(te,{className:"h-6 w-12 rounded-control-2"})]}),a(te,{className:"w-20"})]})]}),s("div",{className:"min-h-0 flex-1 overflow-hidden",children:[s("section",{className:"px-4 py-3",children:[s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-14"})]}),s("div",{className:"flex items-center gap-1",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:"size-4 rounded-full"}),a(te,{className:"ml-1 size-5 rounded-control-1"})]})]}),s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-10"})]}),s("div",{className:"flex items-center gap-1",children:[a(te,{className:"h-5 w-24 rounded-full"}),a(te,{className:"h-5 w-20 rounded-full"})]})]}),s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[s("div",{className:"flex items-center gap-1.5",children:[a(te,{className:"size-icon-2 rounded-full"}),a(te,{className:"w-14"})]}),a(te,{className:"w-20"})]})]}),s("section",{className:"border-t border-border/60",children:[s("div",{className:"flex min-h-11 items-center gap-1.5 px-4 py-3",children:[a(te,{className:"h-4 w-24"}),a(te,{className:"size-icon-2 rounded-full"})]}),s("div",{className:"space-y-2 px-4 pb-4",children:[a(te,{className:"w-full"}),a(te,{className:"w-11/12"}),a(te,{className:"w-4/5"}),a(te,{className:"w-2/3"})]})]})]})]})}function wu({rows:e=4}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingPeople"),className:"animate-ghost-pulse space-y-1 p-1",children:Array.from({length:e},(o,r)=>s("div",{className:"flex h-7 items-center gap-2 rounded-control-3 px-2",children:[a(te,{className:"size-4 rounded-full"}),a(te,{className:Ba[r%Ba.length]})]},r))})}function vu({rows:e=6}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingTimeline"),className:"animate-ghost-pulse px-4 py-5",children:a("div",{className:"relative ml-2 border-l border-border/70 pl-5",children:Array.from({length:e},(o,r)=>s("div",{className:"relative pb-5",children:[a(te,{className:"absolute -left-[1.55rem] top-1 size-2 rounded-full"}),a(te,{className:M("h-3.5",lr[r%lr.length])}),a(te,{className:"mt-1.5 w-16"})]},r))})})}function Iu({rows:e=3}){let{t}=A();return a("div",{role:"status","aria-label":t("ghost.loadingConversation"),className:"animate-ghost-pulse space-y-4 py-2",children:Array.from({length:e},(o,r)=>s("div",{className:"flex items-start gap-2",children:[a(te,{className:"size-5 shrink-0 rounded-full"}),s("div",{className:"flex-1 space-y-1.5",children:[a(te,{className:Ba[r%Ba.length]}),a(te,{className:"w-full"}),a(te,{className:"w-3/4"})]})]},r))})}De();Ue();N();qe();T();function ir({error:e,onRetry:t,compact:o=!1}){let{t:r}=A();return s("div",{className:M("flex flex-col items-center justify-center gap-2 text-center",o?"py-3":"min-h-48 px-4 py-10"),children:[a("p",{className:"text-sm font-medium text-foreground",children:r("activity.loadFailed")}),a("p",{className:"max-w-md text-xs text-muted-foreground",children:e}),s(b,{size:"sm",variant:"outline",onClick:t,children:[a(et,{"aria-hidden":!0}),r("action.retry")]})]})}De();qe();N();N();T();function Lo({title:e,error:t,onRetry:o}){let{t:r}=A();return s(ka,{className:"px-4 py-16 md:px-4",children:[a(ru,{variant:"icon",children:a(Je,{})}),s(Aa,{children:[a(Ma,{children:e??r("list.loadFailedTitle")}),a(Ta,{children:t})]}),o?a(qa,{children:s(b,{size:"sm",variant:"outline",onClick:o,children:[a(et,{}),r("action.retry")]})}):null]})}De();ce();Me();Me();Ue();Xt();it();N();N();ut();qe();qe();De();ce();Me();Me();Me();it();ze();N();N();N();N();ut();Ut();T();function Np(e,t){if(t.length===0)return!0;let o=t.toLowerCase();return e.login.toLowerCase().includes(o)||(e.name??"").toLowerCase().includes(o)}function Qu({environmentId:e,reference:t,allowed:o,onRequested:r}){let[n,l]=C(!1),[i,u]=C(""),[f,c]=C(null),{t:d}=A(),p=xt(n?Se.reviewerCandidates({environmentId:e,input:t}):null),g=Be(Se.act,{reportFailure:!1}),L=$(()=>(p.data?.candidates??[]).filter(P=>Np(P,i)),[p.data,i]),R=async P=>{if(f!==null)return;c(P.id);let y=await g({environmentId:e,input:{op:"requestReviewers",...t,reviewers:[{id:P.id,kind:P.kind}],requested:!P.isRequested}});if(c(null),y._tag==="Failure"){we.error(P.isRequested?d("reviewer.withdrawFailedTitle",{login:P.login}):d("reviewer.requestFailedTitle",{login:P.login}),Ao(vo(y),d("reviewer.requestFailedHint")));return}we.success(P.isRequested?d("reviewer.withdrawnTitle",{login:P.login}):d("reviewer.requestedTitle",{login:P.login})),r(),p.refresh()},I=me().ui.SearchInput;return o?s(gt,{open:n,onOpenChange:l,children:[a(yt,{render:a(b,{size:"icon-xs",variant:"ghost","aria-label":d("action.requestReviewAria"),children:a(ba,{})})}),s(ht,{align:"start",side:"bottom",className:"w-72 p-0",children:[a("div",{className:"border-b border-border/60 p-2",children:I?a(I,{value:i,onValueChange:u,placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact",className:"ycodium-pull-requests-ui w-full"}):a(or,{value:i,onChange:P=>u(P.currentTarget.value),placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact"})}),s("div",{className:"max-h-72 overflow-y-auto p-1",children:[p.isPending?a(wu,{rows:4}):p.error!==null?a("p",{className:"p-2 text-xs text-muted-foreground",children:d("reviewer.peopleUnreadable",{error:p.error})}):L.length===0?a("p",{className:"p-2 text-xs text-muted-foreground",children:i.length>0?d("reviewer.noMatches"):d("reviewer.noAccess")}):L.map(P=>s("button",{type:"button",disabled:f!==null,onClick:()=>{R(P)},className:"relative flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent disabled:pointer-events-none disabled:text-[var(--control-disabled-foreground)] pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:[a(bt,{actor:P,className:"min-w-0 flex-1 truncate"}),P.kind==="team"?a("span",{className:"shrink-0 text-muted-foreground",children:d("reviewer.team")}):null,P.isRequested?a(na,{"aria-label":d("action.alreadyAskedAria"),className:"size-icon-2 shrink-0"}):null]},`${P.kind}:${P.id}`)),p.data?.truncated?a("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:d("reviewer.truncatedNotice")}):null]})]})]}):s(oe,{children:[a(ne,{render:a(b,{size:"icon-xs",variant:"ghost",softDisabled:!0,"aria-label":d("action.requestReviewAria"),children:a(ba,{})})}),a(re,{side:"bottom",children:d("reviewer.writeAccessRequired")})]})}Ut();Ua();Mo();Ga();Eo();wr();De();ce();Me();Me();Ue();Xt();it();N();N();N();N();ut();qe();Ga();Eo();function ld(e){let t=e.sectionTop<e.viewportTop,o=e.headingTop<=e.viewportTop+1;return!t||!o?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}T();function $a(e){return e.toLowerCase()}function id(e){let t=e?.trim().replace(/^#/,"")??"";return/^[0-9a-fA-F]{6}$/.test(t)?`#${t}`:null}function Dn({actor:e}){let t=e?.login??"ghost";return s(oe,{children:[a(ne,{render:a("span",{className:"shrink-0 rounded-full","aria-label":t}),children:a(pa,{actor:e})}),a(re,{side:"bottom",children:e?.name&&e.name!==t?`${e.name} (@${t})`:t})]})}function ud(e){let t=e.toLowerCase().replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}function Nn({comment:e,editing:t,className:o}){let{t:r}=A();return t.editingId===e.id?a(Yt,{className:o,value:e.body,cwd:t.cwd,environmentId:t.environmentId,label:r("action.editComment"),saving:t.saving,onSave:n=>t.onSave(e,n),onCancel:()=>t.onEdit(null)}):s("div",{className:M("flex items-start gap-1",o),children:[a(Pt,{className:"min-w-0 flex-1",text:e.body,cwd:t.cwd,environmentId:t.environmentId}),t.canEdit(e)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":r("action.editComment"),onClick:()=>t.onEdit(e),children:a(st,{className:"size-3"})}):null]})}function dd({comment:e,editing:t,label:o,body:r,reactionBar:n}){let[l,i]=C(!1);return a(ca,{open:l,onOpenChange:i,children:s("article",{className:"group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]",children:[s(ma,{className:M("flex w-full items-center gap-2 p-3 text-left transition-opacity hover:opacity-100",l?"opacity-100":"opacity-65"),children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[a(Dn,{actor:e.author}),a("span",{children:He(e.createdAt)}),a("span",{children:o})]}),a(rt,{"aria-hidden":!0,className:M("size-icon-1 shrink-0 text-muted-foreground transition-transform",l&&"rotate-180")})]}),a(fa,{children:l?s("div",{className:"px-3 pb-3",children:[e.path?s(oe,{children:[a(ne,{render:a("p",{className:"truncate text-xs text-muted-foreground",children:e.path})}),a(re,{side:"top",children:e.path})]}):null,r===null&&!t.canEdit(e)?null:a(Nn,{className:"mt-2",comment:e,editing:t}),n]}):null})]})})}function Bn({icon:e,label:t,children:o}){return s("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 py-1.5 text-xs",children:[s("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[e,t]}),a("span",{className:"min-w-0 text-foreground",children:o})]})}function vr({title:e,count:t,defaultOpen:o=!0,actions:r,children:n}){let[l,i]=C(o),u=Ne(null);return s(ca,{open:l,onOpenChange:c=>{if(!c){let d=u.current,p=d?.closest("[data-pull-request-summary-section]"),g=d?.closest("[data-pull-request-summary-scroll]");if(d&&p&&g){let L=ld({scrollTop:g.scrollTop,viewportTop:g.getBoundingClientRect().top,sectionTop:p.getBoundingClientRect().top,headingTop:d.getBoundingClientRect().top});L!==null&&(g.scrollTop=L)}}i(c)},"data-pull-request-summary-section":!0,children:[s("div",{ref:u,className:"sticky top-0 z-10 flex w-full items-center border-t border-border/60 bg-background pr-4",children:[s(ma,{className:"flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-sm font-medium",children:[a("span",{children:e}),a(Ja,{"aria-hidden":!0,className:M("size-icon-1 text-muted-foreground transition-transform",l&&"rotate-90")}),t===void 0?null:a("span",{className:"text-xs tabular-nums text-muted-foreground",children:t})]}),l?r:null]}),a(fa,{children:a("div",{className:"px-4 pb-4",children:n})})]})}function cd({environmentId:e,detail:t,onCommented:o}){let{t:r}=A(),[n,l]=C(""),[i,u]=C(!1),f=Be(Se.converse,{reportFailure:!1}),c=async()=>{let d=n.trim();if(d.length===0||i)return;u(!0);let p=await f({environmentId:e,input:{op:"comment",projectId:t.projectId,repository:t.repository,number:t.number,body:d}});if(u(!1),p._tag==="Failure"){we.error(r("notify.commentPostFailed"));return}l(""),o()};return s("div",{className:"mt-3 space-y-2",children:[a(Rt,{disabled:i,value:n,rows:3,placeholder:r("summary.commentPlaceholder"),"aria-label":r("summary.commentAria"),onChange:d=>l(d.target.value)}),a("div",{className:"flex justify-end",children:s(b,{size:"xs",variant:"outline",disabled:n.trim().length===0||i,onClick:()=>{c()},children:[a(po,{}),r(i?"action.posting":"action.comment")]})})]})}T();var Ir=30;function fd({environmentId:e,reference:t,detail:o,activityPending:r,activityError:n,pendingFinding:l,fixFindingLabel:i,fixCheckLabel:u,onFixFinding:f,onRefresh:c}){let{t:d}=A(),p=d(i??"thread.fixInThread"),g=d(u??"handoff.fix"),[L,R]=C({url:o.url,count:Ir}),I=L.url===o.url?L.count:Ir,P=o.comments.slice(Math.max(0,o.comments.length-I)),y=o.comments.length-P.length,[w,S]=C("newest"),ee=Vu(P,w),J=hr(o.comments,o.commits),B=new Map(J.flatMap(h=>h.actor?[[$a(h.actor.login),h]]:[])),G=[...o.reviewers.map(h=>({key:h.login,actor:h,outcome:B.get($a(h.login))?.outcome??null,stale:B.get($a(h.login))?.stale??!1})),...J.filter(h=>!o.reviewers.some(W=>h.actor!==null&&$a(W.login)===$a(h.actor.login))).map(h=>({key:h.key,actor:h.actor,outcome:h.outcome,stale:h.stale}))],F=new Map(o.reviewThreads.flatMap(h=>h.comments.map(W=>[W.id,h]))),H=h=>{pt()?.shell.openExternal(h)},K=Be(Se.act,{reportFailure:!1}),V=Be(Se.converse,{reportFailure:!1}),[O,U]=C(null),[j,Y]=C(!1),[he,le]=C(null),[xe,pe]=C(!1),ue=he?.pullRequest===o.url?he.commentId:null,be=async h=>{if(j)return;Y(!0);let W=await K({environmentId:e,input:{op:"update",...t,body:h}});if(Y(!1),W._tag==="Failure"){we.error(d("notify.descriptionSaveFailed"));return}U(null),c()},ae={cwd:o.workspaceRoot,environmentId:e,canEdit:h=>Ha(o,h),editingId:ue,saving:xe,onEdit:h=>le(h===null?null:{pullRequest:o.url,commentId:h.id}),onSave:async(h,W)=>{if(xe||h.kind==="review")return;pe(!0);let E=await V({environmentId:e,input:{op:"updateComment",...t,commentId:h.id,kind:h.kind,body:W}});if(pe(!1),E._tag==="Failure"){we.error(d("notify.commentSaveFailed"));return}le(null),c()}};return s("div",{className:"h-full overflow-y-auto","data-pull-request-summary-scroll":!0,children:[a("section",{className:"px-4 py-3",children:s("div",{children:[a(Bn,{icon:a(xo,{className:"size-icon-2"}),label:d("summary.reviewers"),children:s("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[G.length===0?a("span",{className:"text-muted-foreground",children:d("summary.none")}):a("span",{className:"flex items-center -space-x-1",children:G.map(h=>{let W=h.actor?.login??"ghost",E=h.actor?.name&&h.actor.name!==W?`${h.actor.name} (@${W})`:W;return s(oe,{children:[s(ne,{render:a("span",{className:M("relative rounded-full hover:z-10",h.outcome?ku(h.outcome,h.stale):void 0)}),children:[a(bt,{actor:h.actor,tooltip:!1,className:M("gap-0 [&>span:last-child]:sr-only",h.outcome?void 0:"[&>img]:ring-2 [&>img]:ring-background [&>span:first-child]:ring-2 [&>span:first-child]:ring-background")}),h.outcome?a("span",{className:"sr-only",children:d(h.stale?ko(h.outcome):qo(h.outcome))}):null]}),a(re,{side:"bottom",children:h.outcome?`${E} \u2014 ${h.stale?d(ko(h.outcome)):d(qo(h.outcome))}`:E})]},h.key)})}),o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?a(Qu,{environmentId:e,reference:t,allowed:o.viewerPermissions.requestReviewers,onRequested:c}):null]})}),o.labels.length>0?a(Bn,{icon:a(ho,{className:"size-icon-2"}),label:d("summary.labels"),children:a("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:o.labels.map(h=>{let W=id(h.color);return s("span",{className:"inline-flex max-w-48 items-center gap-1.5 rounded-full border border-border/70 bg-muted/40 py-0.5 pl-1.5 pr-2 text-xs",children:[a("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full bg-muted-foreground",...W?{style:{backgroundColor:W}}:{}}),a("span",{className:"truncate",children:h.name})]},h.name)})})}):null]})}),a(vr,{title:d("summary.description"),children:s("div",{className:"group",children:[O===o.url?a(Yt,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:e,label:d("summary.descriptionAria"),placeholder:d("summary.descriptionPlaceholder"),saving:j,onSave:h=>{be(h)},onCancel:()=>U(null)}):s("div",{className:"flex items-start gap-1",children:[a(Pt,{className:"min-w-0 flex-1",text:o.body.trim().length>0?o.body:d("summary.noDescription"),cwd:o.workspaceRoot,environmentId:e}),yr(o)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":d("summary.editDescription"),onClick:()=>U(o.url),children:a(st,{className:"size-3"})}):null]}),a(_t,{className:"mt-2",reactions:o.reactions??[],canReact:o.capabilities.reactions===!0,environmentId:e,reference:t,onRefresh:c})]})}),a(vr,{title:d("checks.title"),count:o.checks.length,children:o.checks.length===0?a("p",{className:"text-xs text-muted-foreground",children:d("checks.noneReported")}):a("div",{className:"space-y-0.5",children:o.checks.map((h,W)=>{let E={kind:"check",check:h},X=h.status==="failure"||h.status==="cancelled";return s("div",{className:"group flex items-center gap-1 rounded-md pr-1 hover:bg-accent",children:[s("button",{type:"button",disabled:!h.url,onClick:()=>h.url&&H(h.url),className:M("relative flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",h.url?void 0:"cursor-default"),children:[a(dr,{status:h.status}),a("span",{className:"min-w-0 flex-1 truncate",children:h.name}),a("span",{className:"shrink-0 text-muted-foreground",children:d(ur(h.status))})]}),f&&X?s(b,{size:"xs",variant:"ghost",className:"shrink-0",disabled:l!=null,onClick:()=>f(E),children:[a(It,{className:"size-3"}),l===Jt(E)?d("action.preparing"):g]}):null]},`${W}:${h.name}:${h.url??""}`)})})}),s(vr,{title:d("summary.comments"),...r||n?{}:{count:o.commentCount},actions:!r&&!n&&o.comments.length>0?s(b,{size:"xs",variant:"ghost",className:"h-7 shrink-0 px-2 text-muted-foreground","aria-label":d(w==="newest"?"summary.commentsOldestAria":"summary.commentsNewestAria"),onClick:()=>S(h=>h==="newest"?"oldest":"newest"),children:[a(ra,{"aria-hidden":!0,className:"size-3"}),d(w==="newest"?"sort.newestFirst":"sort.oldestFirst")]}):null,children:[r?a(Iu,{}):n?a(ir,{compact:!0,error:n,onRetry:c}):s(ve,{children:[o.commentsTruncated?a("p",{className:"mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs",children:d("summary.conversationTruncated",{count:o.comments.length})}):null,o.comments.length===0?a("p",{className:"py-2 text-xs text-muted-foreground",children:d("summary.noComments")}):s("div",{className:"space-y-3",children:[y>0?a(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>R({url:o.url,count:I+Ir}),children:d("summary.showEarlier",{count:Math.min(y,Ir)})}):null,ee.map(h=>{let W=F.get(h.id),E=ga(h.body),X=_a(h.reviewState);if(W?.isResolved||X==="dismissed")return a(dd,{comment:h,editing:ae,label:W?.isResolved?d("thread.resolved"):d("summary.approvalDismissed"),body:E,reactionBar:a(_t,{className:"mt-2",reactions:h.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:h.id,environmentId:e,reference:t,onRefresh:c})},h.id);let k=h.kind!=="review"&&h.kind!=="review-comment"||X==="approved"?null:W===void 0?E===null?null:{kind:"comment",comment:h}:{kind:"thread",thread:W},v=a(_t,{reactions:h.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:h.id,environmentId:e,reference:t,onRefresh:c,...E===null?{}:{className:"mt-2"}});return s("article",{className:"group rounded-lg border border-border/60 p-3 [contain-intrinsic-block-size:120px] [content-visibility:auto]",children:[s("div",{className:"flex items-start gap-2",children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[a(Dn,{actor:h.author}),a("span",{children:He(h.createdAt)}),X?a(qu,{outcome:X}):h.reviewState?a("span",{children:ud(h.reviewState)}):null,E===null?v:null]}),f&&k?s(b,{size:"xs",variant:"ghost",className:"-mt-1 shrink-0",disabled:l!=null,onClick:()=>f(k),children:[a(It,{className:"size-3"}),l===Jt(k)?d("action.preparing"):p]}):null]}),h.path?s(oe,{children:[a(ne,{render:a("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:h.path})}),a(re,{side:"top",children:h.path})]}):null,E===null&&!ae.canEdit(h)?null:a(Nn,{className:"mt-2",comment:h,editing:ae}),E===null?null:v]},h.id)})]})]}),o.capabilities.comment&&o.viewerPermissions.comment?a(cd,{environmentId:e,detail:o,onCommented:c},`${e}:${o.projectId}/${o.repository}#${o.number}`):null]})]})}De();ce();Ue();qe();Me();Me();Xt();it();N();N();N();Ut();Mo();Ga();Eo();wr();ut();T();function md({body:e,markdown:t,cwd:o,environmentId:r}){return a("div",{className:"mt-3",children:t?a(Pt,{text:e,cwd:o,environmentId:r}):a("p",{className:"whitespace-pre-wrap text-xs text-muted-foreground",children:e})})}function Fn({actor:e}){let{t}=A();return a("span",{className:"font-semibold text-foreground",children:e?.login??t("actor.unknown")})}function pd({children:e,className:t}){return a("span",{className:M("absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background",t),children:e})}function gd({icon:e,className:t}){return a(pd,{className:t,children:a("span",{className:"flex size-7 items-center justify-center bg-background text-muted-foreground",children:e})})}function On({actors:e,className:t,fallback:o,muted:r=!1}){let n=e[0];return n===void 0?a(gd,{className:t,icon:o}):a(pd,{className:t,children:a(pa,{actor:n,className:M("size-7 bg-muted text-ui-2xs transition-opacity",r&&"opacity-45 grayscale")})})}function Qp(e){return e.toLowerCase().replaceAll("_"," ").replaceAll("-"," ").replace(/^\w/u,o=>o.toUpperCase())}function Jp({state:e}){return a("span",{className:"text-ui-2xs font-medium text-muted-foreground",children:Qp(e)})}function hd({url:e,onOpen:t}){let{t:o}=A();return e===null?null:a(b,{size:"icon-xs",variant:"ghost",className:"-mr-1 -mt-1 shrink-0 text-muted-foreground","aria-label":o("timeline.openActivityAria"),onClick:()=>t(e),children:a(la,{className:"size-3"})})}function Yp({event:e,editable:t,cwd:o,onOpen:r,reactions:n}){let{t:l}=A(),[i,u]=C(!1),[f,c]=C(!1),d=Be(Se.converse,{reportFailure:!1}),p=async g=>{if(t===null||f||t.kind==="review")return;c(!0);let L=await d({environmentId:n.environmentId,input:{op:"updateComment",...n.reference,commentId:t.id,kind:t.kind,body:g}});if(c(!1),L._tag==="Failure"){we.error(l("notify.commentSaveFailed"));return}u(!1),n.onRefresh()};return s("article",{className:"group py-2",children:[a("div",{className:"px-2",children:s("div",{className:"flex min-w-0 items-start gap-2",children:[s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[a(Fn,{actor:e.actor}),a("span",{className:"text-muted-foreground",children:l(e.titleKey,e.titleValues)}),e.reviewState?a(Jp,{state:e.reviewState}):null]}),s(Lt,{className:"mt-1 flex-wrap text-ui-xs text-muted-foreground",children:[a("span",{children:He(e.at)}),e.path?s("span",{className:"inline-flex min-w-0 items-center gap-1",children:[a(At,{"aria-hidden":!0,className:"size-3 shrink-0"}),a("span",{className:"truncate",children:e.path})]}):null]})]}),t!==null&&!i?a(b,{size:"icon-xs",variant:"ghost",className:"-mt-1 shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":l("action.editComment"),onClick:()=>u(!0),children:a(st,{className:"size-3"})}):null,a(hd,{url:e.url,onOpen:r})]})}),i&&t!==null?a("div",{className:"px-2 pb-2 pt-3",children:a(Yt,{value:t.body,cwd:o,environmentId:n.environmentId,label:l("action.editComment"),saving:f,onSave:g=>{p(g)},onCancel:()=>u(!1)})}):e.body?a("div",{className:"px-2 pb-2",children:a(md,{body:e.body,markdown:e.markdown,cwd:o,environmentId:n.environmentId})}):null,n.canReact||e.reactions.length>0?a("div",{className:"px-2 pb-2",children:a(_t,{reactions:e.reactions,canReact:n.canReact,subjectId:e.id,environmentId:n.environmentId,reference:n.reference,onRefresh:n.onRefresh})}):null]})}function Zp(e){let t=new Map;for(let o of e){let r=o.actor;r!==null&&!t.has(r.login)&&t.set(r.login,r)}return[...t.values()]}function eg({events:e,editable:t,cwd:o,onOpen:r,reactions:n}){let{t:l}=A(),[i,u]=C(!1),f=Zp(e),c=e[0];return c===void 0?null:s("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(On,{actors:f,className:"top-6",fallback:a(nt,{className:"size-icon-2"}),muted:!i}),a(ca,{open:i,onOpenChange:u,children:s("div",{children:[s(ma,{className:M("flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100",i?"text-foreground opacity-100":"text-muted-foreground opacity-55"),children:[s("span",{className:"min-w-0 flex-1",children:[a("span",{className:"block text-xs font-semibold",children:l("timeline.commentCount",{count:e.length,total:e.length.toLocaleString()})}),s("span",{className:"block truncate text-ui-2xs text-muted-foreground",children:[l("timeline.authorCount",{count:f.length,total:f.length.toLocaleString()}),", ",He(c.at)]})]}),a(rt,{"aria-hidden":!0,className:M("size-icon-1 shrink-0 text-muted-foreground transition-transform",i&&"rotate-180")})]}),a(fa,{children:i?a("div",{className:"mt-1 space-y-1",children:e.map(d=>a(Yp,{event:d,editable:t.get(d.id)??null,cwd:o,onOpen:r,reactions:n},`${n.reference.projectId}#${n.reference.number}:${d.id}`))}):null})]})})]})}function tg({event:e,onOpen:t}){let{t:o}=A();return s("button",{type:"button",className:"group relative mb-5 block w-full rounded-sm pl-12 text-left [contain-intrinsic-block-size:48px] [content-visibility:auto]","aria-label":o("timeline.viewCommitAria",{id:e.id}),onClick:()=>t(e.id),children:[a(On,{actors:e.commitAuthors,fallback:a(vt,{className:"size-icon-2"})}),s("div",{className:"flex min-w-0 items-center gap-2.5 py-1.5",children:[s("div",{className:"min-w-0 flex-1",children:[a("div",{className:"truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary",children:e.body??o("timeline.untitledCommit")}),s("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-ui-2xs text-muted-foreground",children:[a("code",{className:"font-mono",children:e.id.slice(0,7)}),a("span",{children:He(e.at)})]})]}),e.additions!==null&&e.deletions!==null?a(Ot,{additions:e.additions,deletions:e.deletions,className:"ml-auto shrink-0 font-mono text-ui-2xs"}):null]})]})}function ag({event:e}){let{t}=A(),o=e.kind==="opened"?{icon:a(Je,{className:"size-icon-2"}),label:t("timeline.eventOpened")}:e.kind==="merged"?{icon:a(Ke,{className:"size-icon-2"}),label:t("timeline.merged")}:{icon:a(mt,{className:"size-icon-2"}),label:t("timeline.closed")};return s("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(gd,{icon:o.icon}),s("div",{className:"py-1.5 text-xs",children:[s("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.actor?a(Fn,{actor:e.actor}):null,a("span",{className:"font-semibold text-foreground",children:o.label})]}),a("div",{className:"mt-0.5 text-ui-xs text-muted-foreground",children:He(e.at)})]})]})}function og({event:e,outcome:t,stale:o,cwd:r,onOpen:n,reactions:l}){let{t:i}=A();return s("div",{className:"group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[a(On,{actors:e.actor?[e.actor]:[],className:"top-6",fallback:a(fr,{outcome:t})}),s("div",{className:"flex min-w-0 items-start gap-2 py-1.5",children:[s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[a(Fn,{actor:e.actor}),s(oe,{disabled:!o,children:[s(ne,{render:a("span",{className:M("font-medium lowercase",o?"text-muted-foreground opacity-70":cr(t))}),children:[i(qo(t)),o?a("span",{className:"sr-only",children:i("reviewOutcome.beforeLatestCommits")}):null]}),a(re,{children:i(ko(t))})]})]}),s("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s(Lt,{className:"flex-wrap text-ui-xs text-muted-foreground",children:[a("span",{children:He(e.at)}),e.path?s("span",{className:"inline-flex min-w-0 items-center gap-1",children:[a(At,{"aria-hidden":!0,className:"size-3 shrink-0"}),a("span",{className:"truncate",children:e.path})]}):null]}),l.canReact||e.reactions.length>0?a(_t,{reactions:e.reactions,canReact:l.canReact,subjectId:e.id,environmentId:l.environmentId,reference:l.reference,onRefresh:l.onRefresh}):null]}),e.body?a(md,{body:e.body,markdown:e.markdown,cwd:r,environmentId:l.environmentId}):null]}),a(hd,{url:e.url,onOpen:n})]})]})}function yd({detail:e,environmentId:t,reference:o,order:r,onOpenCommit:n,onRefresh:l}){let{t:i}=A(),u=ju(e),f=qn(e.commits),c={canReact:e.capabilities.reactions===!0,environmentId:t,reference:o,onRefresh:l},d=new Map(e.comments.filter(R=>Ha(e,R)).map(R=>[R.id,R])),p=r==="newest"?u:u.toReversed(),g=Ku(p),L=R=>{pt()?.shell.openExternal(R)};return a("div",{className:"h-full overflow-y-auto px-4 py-5",children:s("div",{className:"mx-auto max-w-3xl",children:[s("div",{className:"relative",children:[a("span",{"aria-hidden":!0,className:"absolute bottom-5 left-[15px] top-1 w-px bg-border/45"}),g.map(R=>{if(R.kind==="comments")return a(eg,{events:R.events,editable:d,cwd:e.workspaceRoot,onOpen:L,reactions:c},`comments:${R.events[0]?.id??"empty"}`);let I=R.event;if(I.kind==="commit")return a(tg,{event:I,onOpen:n},I.id);let P=_a(I.reviewState);return P!==null?a(og,{event:I,outcome:P,stale:Tn(I.at,f),cwd:e.workspaceRoot,onOpen:L,reactions:c},I.id):a(ag,{event:I},I.id)})]}),u.length===0?s("div",{className:"flex flex-col items-center justify-center py-16 text-center text-muted-foreground",children:[a(Je,{className:"mb-2 size-5"}),a("p",{className:"text-xs",children:i("timeline.noActivity")})]}):null]})})}qe();De();ce();Ue();N();N();N();ze();qe();De();function Zt(e){return e==="gitlab"?{label:"GitLab",providerName:"GitLab",Icon:ro}:e==="github"?{label:"GitHub",providerName:"GitHub",Icon:oo}:{label:e,providerName:e,Icon:Mt}}function Rr(){let{t:e}=A();return t=>{let o=Zt(t).providerName;return o===t?e("link.openOnHostGeneric"):e("link.openOnHost",{host:o})}}function Cr(){return me().ui.useLinkContextMenu()}function br(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function xd(e,t,o){let r=new Map(t.map((i,u)=>[i,u])),n=new Map;for(let i of e){let u=br(i);if(!u)continue;let f=r.get(i.environmentId);if(f===void 0)continue;let c=n.get(u);if(c===void 0){n.set(u,i.environmentId);continue}c!==o&&(i.environmentId===o||f<(r.get(c)??Number.MAX_SAFE_INTEGER))&&n.set(u,i.environmentId)}let l=new Map;for(let i of e){if(!r.has(i.environmentId))continue;let u=br(i);if(u&&n.get(u)!==i.environmentId)continue;let f=l.get(i.environmentId);f===void 0?l.set(i.environmentId,[i.id]):f.push(i.id)}return l}function wd(e,t,o){let r=t.find(u=>u.environmentId===e.environmentId&&u.id===e.projectId),n=r===void 0?void 0:br(r),l=o.find(u=>u.environmentId===e.environmentId)?.label;if(r===void 0||!n||l===void 0)return[];let i=o.flatMap(u=>{if(u.environmentId===e.environmentId)return[];let f=t.find(c=>c.environmentId===u.environmentId&&br(c)===n);return f===void 0?[]:[{environmentId:u.environmentId,projectId:f.id,workspaceRoot:f.workspaceRoot,label:u.label}]});return i.length===0?[]:[{environmentId:e.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:l},...i]}T();function Ud({label:e}){let{t}=A();return a("p",{className:"p-4 text-sm text-muted-foreground",children:e??t("detail.loadingLabel")})}var _d={merge:"notify.successMerge",ready:"notify.successReady",draft:"notify.successDraft",close:"notify.successClose",reopen:"notify.successReopen","update-branch":"notify.successUpdateBranch","enable-auto-merge":"notify.successEnableAutoMerge","disable-auto-merge":"notify.successDisableAutoMerge"},ya={merge:"mergeMethod.merge",squash:"mergeMethod.squash",rebase:"mergeMethod.rebase"},Hd={merge:"notify.failureMerge",ready:"notify.failureReady",draft:"notify.failureDraft",close:"notify.failureClose",reopen:"notify.failureReopen","update-branch":"notify.failureUpdateBranch","enable-auto-merge":"notify.failureEnableAutoMerge","disable-auto-merge":"notify.failureDisableAutoMerge"},Gd={merge:"notify.hintMerge",ready:"notify.hintReady",draft:"notify.hintDraft",close:"notify.hintClose",reopen:"notify.hintReopen","update-branch":"notify.hintUpdateBranch","enable-auto-merge":"notify.hintEnableAutoMerge","disable-auto-merge":"notify.hintDisableAutoMerge"},$d="notify.hintUpdateBranchRebase",zd=[{value:"summary",labelKey:"detail.tabSummary"},{value:"timeline",labelKey:"detail.tabTimeline"},{value:"code",labelKey:"detail.tabCode"}],$n=()=>Promise.resolve().then(()=>(Od(),Fd)),Vd=is($n);function zn({environments:e,value:t,onChange:o,disabled:r}){return s(ve,{children:[a(je,{}),a(Ft,{value:t,onValueChange:n=>o(n),children:e.map(n=>a(Ct,{value:n.environmentId,disabled:r,children:a(da,{environmentId:n.environmentId,fallbackName:n.label,className:"gap-2",iconClassName:"size-icon-2"})},n.environmentId))})]})}var Kd=(e,t,o,r)=>{t.preventDefault(),t.stopPropagation(),e({url:o.url,openLabel:r,position:{x:t.clientX,y:t.clientY}})};function jd({baseBranch:e,freshness:t,pending:o,onUpdate:r,iconClassName:n}){let{t:l}=A(),i=t.behindBy===null?l("detail.outOfDate",{branch:e}):l("detail.outOfDateBehind",{branch:e,count:t.behindBy,total:t.behindBy.toLocaleString()});return s(Ea,{children:[a(Na,{openOnHover:!0,delay:0,closeDelay:120,render:a("button",{type:"button","aria-label":i,className:"inline-flex shrink-0 cursor-help items-center rounded-sm text-warning-foreground"}),children:a(tt,{"aria-hidden":!0,className:M("size-icon-2",n)})}),s(Da,{align:"start",side:"bottom",className:"max-w-80",viewportClassName:"py-2.5 [--viewport-inline-padding:--spacing(3)]",children:[a("p",{className:"text-xs text-foreground",children:i}),a("p",{className:"mt-0.5 text-xs text-muted-foreground",children:l("detail.cleanlyMergeable")}),t.methods.length>0?a("span",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:t.methods.map(u=>s(b,{size:"xs",variant:"outline",disabled:o,onClick:()=>r(u),children:[a(Ke,{"aria-hidden":!0,className:"size-3"}),l(u==="rebase"?"detail.updateWithRebase":"detail.updateBranch")]},u))}):null]})]})}De();N();N();N();N();Ut();T();function Wd({state:e,onClose:t}){let{t:o,openOnHostLabel:r,pullRequestKey:n,setMergeMethod:l,setConfirmation:i,handoff:u,detailQuery:f,detail:c,refreshFromHost:d,pendingAction:p,actionPending:g,handoffUnsupportedReason:L,handoffBlocked:R,withBlockedReason:I,pickableEnvironments:P,setActingScope:y,actingEnvironmentId:w,perform:S,attachTarget:ee,handoffLabels:J,askAboutPullRequest:B,explainPullRequest:G,startCheckout:F,startFixFindings:H,startResolveConflicts:K,allowedMergeMethods:V,selectedMergeMethod:O,selectedMergeMethodLabel:U,conflicting:j,autoMergeArmed:Y,can:he,primaryAction:le,showsDraftToggle:xe,showsAutoMerge:pe,showsMergeMethods:ue,context:be}=e;return s("div",{className:"mr-4 flex h-7 min-w-0 flex-nowrap items-center justify-end gap-1",children:[c?s(ve,{children:[be==="page"&&R?I(s(b,{size:"xs",variant:"outline",softDisabled:!0,children:[a(Mt,{"aria-hidden":!0}),o("detail.checkOut")]})):be==="page"?s(gt,{children:[a(yt,{disabled:u!==null,render:s(b,{size:"xs",variant:"outline",children:[a(Mt,{"aria-hidden":!0}),u?.startsWith("checkout")?o("detail.checkingOut"):o("detail.checkOut"),a(rt,{"aria-hidden":!0,className:"text-muted-foreground"})]})}),s(ht,{align:"end",side:"bottom",className:"min-w-72",children:[s(Oe,{onClick:()=>F("worktree"),children:[a(Mt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o("detail.checkoutInWorktreeTitle")}),a("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInWorktreeDetail")})]})]}),s(Oe,{onClick:()=>F("local"),children:[a(ao,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o("detail.checkoutInRepositoryTitle")}),a("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInRepositoryDetail")})]})]}),P.length>0?a(zn,{environments:P,value:w,onChange:ae=>y({pullRequestKey:n,environmentId:ae}),disabled:u!==null}):null]})]}):null,Y?s(oe,{children:[a(ne,{render:s(nr,{variant:"info",className:"h-5 shrink-0 gap-1 rounded px-1.5 text-ui-2xs",children:[a(Ke,{"aria-hidden":!0,className:"size-3"}),o("detail.autoMerge")]})}),a(re,{side:"top",children:o("detail.autoMergeHint")})]}):null,le==="resolve"?I(s(b,{size:"xs",variant:"destructive-outline",disabled:u!==null,softDisabled:R,onClick:K,children:[a(tt,{}),o(u==="conflicts"?"action.preparing":"detail.resolveConflicts")]})):le==="ready"?a(b,{size:"xs",disabled:g,onClick:()=>{S("ready")},children:o("detail.readyForReview")}):le==="merge"?a(b,{size:"xs",disabled:g,onClick:()=>i({open:!0,action:"merge"}),children:p==="merge"?o("detail.merging"):U}):null,s(gt,{children:[a(yt,{render:a(b,{"aria-label":o("detail.moreActionsAria"),className:"size-6",size:"icon-xs",variant:"ghost-muted"}),children:a(zt,{className:"size-4"})}),s(ht,{align:"end",side:"bottom",className:"min-w-72",children:[s(Oe,{disabled:f.isPending,onClick:()=>{d()},children:[a(et,{className:"size-icon-2"}),o("action.refresh")]}),L!==null?a(Oe,{disabled:!0,children:a("span",{className:"text-xs text-muted-foreground",children:o(L)})}):null,s(Oe,{disabled:u!==null||R,onClick:B,children:[a(Vt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),s("span",{className:"flex min-w-0 flex-col",children:[a("span",{children:o(u==="ask"?"detail.opening":"detail.askQuestion")}),a("span",{className:"text-xs text-muted-foreground",children:o(ee!==null?"detail.askQuestionInThread":"detail.askQuestionNewThread")})]})]}),s(Oe,{disabled:u!==null||R,onClick:G,children:[a(Qa,{className:"size-icon-2"}),o(u==="explain"?"detail.opening":"detail.explainPullRequest")]}),s(Oe,{disabled:u!==null||R,onClick:H,children:[a(It,{className:"size-icon-2"}),o(u==="findings"?"action.preparing":J.fixFindings)]}),P.length>0?a(zn,{environments:P,value:w,onChange:ae=>y({pullRequestKey:n,environmentId:ae}),disabled:u!==null}):null,a(je,{}),c.state==="open"?s(ve,{children:[xe?s(Oe,{disabled:g,onClick:()=>{S(c.isDraft?"ready":"draft")},children:[c.isDraft?a(Je,{className:"size-icon-2"}):a(Et,{className:"size-icon-2"}),c.isDraft?o("detail.readyForReview"):o("detail.convertToDraft")]}):null,Y&&he("disable-auto-merge")?s(Oe,{disabled:g,onClick:()=>{S("disable-auto-merge")},children:[a(Ke,{className:"size-icon-2"}),o("detail.disableAutoMerge")]}):!Y&&!c.isDraft&&!j&&he("enable-auto-merge")&&V.length>0?s(Oe,{disabled:g,onClick:()=>i({open:!0,action:"enable-auto-merge"}),children:[a(Ke,{className:"size-icon-2"}),o("detail.enableAutoMerge")]}):null,ue?s(ve,{children:[xe?a(je,{}):null,a(Ft,{value:O,onValueChange:ae=>l(ae),children:V.map(ae=>a(Ct,{value:ae,disabled:g,children:s("span",{className:"flex min-w-0 items-center gap-2",children:[a(Ke,{className:"size-icon-2"}),a("span",{children:o(ya[ae])})]})},ae))})]}):null,$u(xe,pe,ue)?a(je,{}):null]}):null,s(Oe,{onClick:()=>{pt()?.shell.openExternal(c.url)},children:[a(Xa,{className:"size-icon-2"}),r(c.provider)]}),s(Oe,{onClick:()=>{Yl(c.url)},children:[a(no,{className:"size-icon-2"}),o("detail.copyLink")]}),c.state==="open"&&he("close")?s(ve,{children:[a(je,{}),s(Oe,{variant:"destructive",disabled:g,onClick:()=>i({open:!0,action:"close"}),children:[a(mt,{className:"size-icon-2"}),o("detail.closePullRequest")]})]}):c.state==="closed"&&he("reopen")?s(ve,{children:[a(je,{}),s(Oe,{disabled:g,onClick:()=>{S("reopen")},children:[a(Je,{className:"size-icon-2"}),o("detail.reopenPullRequest")]})]}):null]})]})]}):null,t?a(b,{size:"icon-xs",variant:"ghost","aria-label":o("detail.collapsePanelAria"),onClick:t,children:a(ia,{})}):null]})}De();Ue();Xt();ze();N();N();N();N();Mo();qe();Ue();Me();Me();N();N();ut();T();function ig({environmentId:e,reference:t}){let{t:o}=A(),r=xt(Se.detail({environmentId:e,input:t}));if(r.error!==null)return a("p",{className:"select-text text-muted-foreground text-xs",children:r.error});if(r.data===null)return a("p",{className:"text-muted-foreground text-xs",children:r.isPending?o("checks.loading"):o("checks.summaryNoneReported")});let n=r.data?.checks;return n===void 0?a("p",{className:"text-muted-foreground text-xs",children:o("checks.summaryNoneReported")}):a(Xd,{checks:n})}function Xd({checks:e}){let{t}=A();return e.length===0?a("p",{className:"text-muted-foreground text-xs",children:t("checks.summaryNoneReported")}):a("ul",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:e.map((o,r)=>s("li",{className:"flex items-center gap-2 text-xs",children:[a(dr,{status:o.status}),s(oe,{children:[a(ne,{render:a("span",{className:"min-w-0 flex-1 truncate",children:o.name})}),a(re,{side:"top",children:o.description??o.name})]}),a("span",{className:"shrink-0 text-muted-foreground",children:t(ur(o.status))}),o.url===null?null:a("button",{type:"button",className:"shrink-0 text-primary hover:underline",onClick:()=>{pt()?.shell.openExternal(o.url??"")},children:t("action.details")})]},`${r}:${o.name}`))})}function qr({checksState:e,checks:t,environmentId:o,reference:r,className:n}){let{t:l}=A(),i=Pu(e),u=t===void 0?null:mr(t);return s(Ea,{children:[a(Na,{render:a("span",{role:"button",tabIndex:0,"aria-label":l("checks.ariaWithSummary",{summary:l(i.labelKey)}),className:M("inline-flex shrink-0 cursor-[var(--control-cursor)] select-none items-center",n)}),onClick:f=>f.stopPropagation(),children:a(i.Icon,{"aria-hidden":!0,className:M("size-icon-2",i.toneClassName)})}),s(Da,{align:"start",className:"w-80 max-w-full",side:"bottom",children:[a("p",{className:"mb-2 font-medium text-sm",children:l(i.labelKey)}),u===null||u.key==="checks.summaryAllPassed"?null:a("p",{className:"mb-2 text-muted-foreground text-xs",children:l(u.key,u.values)}),t!==void 0?a(Xd,{checks:t}):o!==void 0&&r!==void 0?a(ig,{environmentId:o,reference:r}):null]})]})}ut();T();function Qd({state:e,detail:t,toneClassName:o,tabIndex:r}){let{t:n,openOnHostLabel:l,showPullRequestLinkContextMenu:i}=e;return s(oe,{children:[a(ne,{render:s("button",{type:"button",...r===void 0?{}:{tabIndex:r},onClick:()=>{pt()?.shell.openExternal(t.url)},onContextMenu:u=>Kd(i,u,t,l(t.provider)),className:M("shrink-0 font-medium underline-offset-2 hover:underline",o),"aria-label":n("detail.openOnHostAria",{number:t.number}),children:["#",t.number]})}),a(re,{side:"top",children:l(t.provider)})]})}function Jd({state:e,detail:t,freshnessIconClassName:o,arrowClassName:r}){let{t:n,isStackedPullRequest:l,freshness:i,actionPending:u,perform:f}=e;return s(ve,{children:[s(oe,{children:[a(ne,{render:s("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[l?a(Fe,{"aria-label":n("detail.stackedAria"),className:"size-3 shrink-0"}):null,a("code",{className:"min-w-0 truncate",children:t.baseBranch})]})}),a(re,{side:"top",children:l?n("detail.stackedOn",{branch:t.baseBranch}):t.baseBranch})]}),i?a(jd,{baseBranch:t.baseBranch,freshness:i,pending:u,onUpdate:c=>{f("update-branch",void 0,c)},...o===void 0?{}:{iconClassName:o}}):null,a(Wa,{"aria-label":n("detail.receivesChangesFrom"),className:r})]})}function Yd({state:e}){let{t,condensed:o,detail:r,repositoryUrl:n,statePresentation:l}=e;return s("div",{className:"ml-4 grid h-7 min-w-0 items-center",children:[a("div",{"aria-hidden":o,inert:o,className:M("col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs",o?"pointer-events-none -translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50 duration-150"),children:r&&l?s(ve,{children:[s(oe,{children:[a(ne,{render:n?a("button",{type:"button",onClick:()=>{pt()?.shell.openExternal(n)},className:"min-w-0 cursor-[var(--control-cursor)] truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:r.repository}):a("span",{className:"min-w-0 truncate font-medium text-muted-foreground",children:r.repository})}),a(re,{side:"top",children:n?t("detail.openRepositoryTooltip",{repository:r.repository}):r.repository})]}),a(Qd,{state:e,detail:r,toneClassName:l.toneClassName})]}):null}),a("div",{"aria-hidden":!o,inert:!o,className:M("col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs",o?"translate-y-0 opacity-100 delay-50 duration-150":"pointer-events-none translate-y-1 opacity-0 duration-100"),children:r&&l?s(ve,{children:[a(Qd,{state:e,detail:r,toneClassName:l.toneClassName,tabIndex:o?0:-1}),s(oe,{children:[a(ne,{render:a("span",{className:"min-w-0 truncate font-medium text-foreground",children:r.title})}),a(re,{side:"top",children:r.title})]})]}):null})]})}function Zd({state:e}){let{t,condensed:o,condensedRowRef:r,detail:n}=e;return a("div",{className:M("col-span-2 grid",o?"grid-rows-[1fr]":"grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:a("div",{ref:r,className:M("min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none",o?"translate-y-0 opacity-100 delay-50":"translate-y-1 opacity-0 duration-100"),inert:!o,children:n?a("div",{className:"col-span-2 min-w-0 px-4 pb-2 pt-1",children:s("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[s("span",{className:"flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground",children:[s(oe,{children:[a(ne,{render:a("span",{className:"shrink-0 rounded-full","aria-label":n.author?.login??t("actor.unknown")}),children:a(pa,{actor:n.author})}),a(re,{side:"top",children:n.author?.login??t("actor.unknown")})]}),a("span",{className:"shrink-0",children:He(n.updatedAt)})]}),a("span",{"aria-hidden":!0,className:"h-3 w-px shrink-0 bg-border/70"}),s("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-ui-xs text-muted-foreground/65",children:[a(Jd,{state:e,detail:n,freshnessIconClassName:"size-3",arrowClassName:"size-3 shrink-0 opacity-60"}),s(oe,{children:[a(ne,{render:a("code",{className:"min-w-0 flex-1 truncate",children:n.headBranch})}),a(re,{side:"top",children:n.headBranch})]})]}),s("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-ui-xs",children:[s("span",{className:"inline-flex items-center gap-1 tabular-nums","aria-label":t("detail.changedFilesAria",{count:n.changedFiles,total:n.changedFiles.toLocaleString()}),children:[a(Ca,{"aria-hidden":!0,className:"size-3"}),n.changedFiles.toLocaleString()]}),a(Ot,{additions:n.additions,deletions:n.deletions,className:"shrink-0 font-mono text-ui-xs"})]})]})}):null})})}function ec({state:e}){let{t,pullRequestKey:o,condensed:r,foldRef:n,copyBranchToClipboard:l,isBranchCopied:i,detail:u,setTitleScope:f,titleDraft:c,titleSaving:d,saveTitle:p}=e;return a("div",{className:M("col-span-2 grid",r?"grid-rows-[0fr]":"grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:a("div",{ref:n,className:M("min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none",r?"-translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50"),inert:r,children:u?s("div",{className:"col-span-2 mt-1 min-w-0 px-4 pb-4",children:[c===null?s("div",{className:"group flex min-w-0 items-start gap-1",children:[a("h1",{className:"min-w-0 flex-1 select-text text-base font-semibold leading-snug",children:u.title}),yr(u)?a(b,{size:"icon-xs",variant:"ghost",className:"shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100","aria-label":t("detail.editTitleAria"),onClick:()=>f({pullRequestKey:o,text:u.title}),children:a(st,{className:"size-3"})}):null]}):s("div",{className:"space-y-2",children:[a(or,{autoFocus:!0,size:"sm",disabled:d,value:c,"aria-label":t("detail.titleAria"),onChange:g=>f({pullRequestKey:o,text:g.target.value}),onKeyDown:g=>{g.key==="Enter"?(g.preventDefault(),p(c)):g.key==="Escape"&&(g.preventDefault(),f(null))}}),s("div",{className:"flex justify-end gap-2",children:[a(b,{size:"xs",variant:"ghost",disabled:d,onClick:()=>f(null),children:t("action.cancel")}),a(b,{size:"xs",variant:"outline",disabled:d||c.trim().length===0,onClick:()=>{p(c)},children:t(d?"action.saving":"action.save")})]})]}),s(Lt,{className:"mt-2 text-xs text-muted-foreground",children:[a(bt,{actor:u.author,className:"font-medium"}),a("span",{children:t("detail.updatedAt",{when:He(u.updatedAt)})})]}),s("div",{className:"mt-4 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[s("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70",children:[a(Jd,{state:e,detail:u,arrowClassName:"size-icon-2 shrink-0 opacity-60"}),s(oe,{children:[s(ne,{render:a(b,{size:"compact",variant:"ghost",className:"grid h-auto w-fit min-w-0 max-w-full shrink items-stretch justify-stretch gap-0 rounded px-1 py-0.5 text-left font-normal text-muted-foreground/70 text-xs sm:text-xs hover:bg-accent hover:text-foreground","aria-label":t(i?"detail.branchCopied":"detail.copyBranch"),onClick:()=>l(u.headBranch)}),children:[a("code",{className:M("col-start-1 row-start-1 min-w-0 truncate transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-0":"opacity-100"),children:u.headBranch}),a("span",{"aria-hidden":"true",className:M("col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-100":"opacity-0"),children:t("action.copied")})]}),a(re,{side:"top",children:i?t("detail.branchCopiedTooltip",{branch:u.headBranch}):t("detail.copyBranchTooltip",{branch:u.headBranch})})]})]}),s("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2",children:[s("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[a(Ca,{className:"size-icon-2"}),t("detail.fileCount",{count:u.changedFiles,total:u.changedFiles.toLocaleString()})]}),a(Ot,{additions:u.additions,deletions:u.deletions,className:"shrink-0 font-mono text-xs"})]})]})]}):null})})}function tc({state:e,tabIdPrefix:t}){let{t:o,tab:r,setTab:n,timelineOrder:l,setTimelineOrder:i,detail:u,activityPending:f,activityError:c,visibleTabs:d,checksSummary:p,checksState:g,approvalCount:L}=e,{Tabs:R,TabsList:I,TabsTab:P}=me().ui;return u?s("div",{className:"col-span-2 flex min-w-0 flex-wrap items-center gap-x-1 gap-y-2 border-t border-border/60 px-4 py-2",children:[R&&I&&P?a(R,{variant:"segmented",value:r,onValueChange:y=>{let w=d.find(S=>S.value===y)?.value;w&&n(w)},className:"ycodium-pull-requests-ui shrink-0",children:a(I,{"aria-label":o("detail.tabsAria"),children:d.map(y=>a(P,{value:y.value,id:t?`${t}-tab-${y.value}`:void 0,"aria-controls":t?`${t}-panel-${y.value}`:void 0,children:o(y.labelKey)},y.value))})}):a(rr,{className:"shrink-0",size:"segmented",variant:"segmented","aria-label":o("detail.tabsAria"),value:[r],onValueChange:y=>{let w=d.find(S=>S.value===y[0])?.value;w&&n(w)},children:d.map(y=>a(Bt,{value:y.value,children:o(y.labelKey)},y.value))}),r==="summary"?s("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":p?o("checks.ariaWithSummary",{summary:o(p.key,p.values)}):o("checks.title"),children:[g!==null?a(qr,{checks:u.checks,checksState:g}):a(sa,{"aria-hidden":!0,className:"size-icon-2"}),p?o(p.key,p.values):null]}):r==="timeline"?s("div",{className:"ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[s(Lt,{className:M("whitespace-nowrap text-ui-xs transition-opacity",(f||c)&&"opacity-35"),children:[s("span",{className:"inline-flex items-center gap-1","aria-label":c?o("detail.commentsUnavailable"):o("timeline.commentCount",{count:u.commentCount,total:u.commentCount.toLocaleString()}),children:[a(nt,{"aria-hidden":!0,className:"size-3"}),c?"\u2014":f?"\u2026":u.commentCount.toLocaleString()]}),s("span",{className:"inline-flex items-center gap-1","aria-label":c?o("detail.commitsUnavailable"):o("detail.commitCount",{count:u.commits.length,total:u.commits.length.toLocaleString()}),children:[a(vt,{"aria-hidden":!0,className:"size-3"}),c?"\u2014":f?"\u2026":u.commits.length.toLocaleString()]}),L>0?s("span",{className:M("inline-flex items-center gap-1",cr("approved")),children:[a(fr,{outcome:"approved",className:"size-3"}),L.toLocaleString(),a("span",{className:"sr-only",children:o("detail.approvalNoun",{count:L})})]}):null]}),s(b,{size:"xs",variant:"ghost",className:"h-7 px-2 text-muted-foreground","aria-label":o(l==="newest"?"detail.activityOldestAria":"detail.activityNewestAria"),onClick:()=>i(y=>y==="newest"?"oldest":"newest"),children:[a(ra,{"aria-hidden":!0,className:"size-3"}),o(l==="newest"?"sort.newestFirst":"sort.oldestFirst")]})]}):null]}):null}qe();ce();ja();Yo();ze();ce();ze();var ug=e=>e==="github"||e==="gitlab"?e:"unknown",Vn=e=>{let t=e.repositoryIdentity;return{projectId:e.id,title:e.title,workspaceRoot:e.workspaceRoot,repositoryIdentity:t==null?null:{provider:ug(t.provider),canonicalKey:t.canonicalKey,remoteName:t.locator.remoteName,remoteUrl:t.locator.remoteUrl,...t.displayName===void 0?{}:{displayName:t.displayName},...t.owner===void 0?{}:{owner:t.owner},...t.name===void 0?{}:{name:t.name},...t.rootPath===void 0?{}:{rootPath:t.rootPath}},...e.archivedAt==null?{}:{archivedAt:e.archivedAt}}};Yo();function ac(e){return e===null?[]:e.map(Vn).filter(t=>!La(t))}function Tr(e,t){let o=e?.find(r=>r.id===t);return o===void 0?null:Vn(o)}function dg(e){return e.filter(t=>t.connected&&t.pluginLoaded).map(t=>({environmentId:t.environmentId}))}function cg(e){return e.flatMap(t=>ac(t.data).map(o=>({id:o.projectId,environmentId:t.environmentId,title:o.title,workspaceRoot:o.workspaceRoot,repositoryIdentity:o.repositoryIdentity})))}function Ar(){let e=me(),t=e.useConnectedEnvironments(),o=dg(t),n=e.data.useQueryEach("projects.list",o.map(i=>({environmentId:i.environmentId,input:{}})),{refreshKey:e.useRepositoryIdentityKey()}).rows;return{projects:$(()=>cg(n),[n]),bootstrapped:o.length===0||n.every(i=>!i.isPending),rows:n}}ce();ze();function Mr(){return{environments:me().useConnectedEnvironments().map(t=>({environmentId:t.environmentId,label:t.label,displayUrl:t.label,serverConfig:t.connected?{}:null}))}}function oc(e,t){let o=me().useConnectedEnvironments();return $(()=>{let r=new Map;for(let n of t)r.set(n,o.find(l=>l.environmentId===n)?.pluginLoaded===!0);return r},[t,o])}Me();ce();function Er(e,t=!0){let o=typeof t=="boolean"?t:t.enabled!==!1,r=typeof t=="object"?t.key:void 0;ye(()=>{if(!o||typeof document>"u")return;let n=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[o,r,e])}Me();Me();it();N();Ut();ut();qe();var rc={make:e=>e};function nc(e,t){return{environmentId:e,threadId:t}}function Kn(e,t){return{environmentId:e,projectId:t}}function dt(e){return`${e.environmentId}:${e.threadId}`}it();Ut();Sn();var sc=new Map,lc=e=>typeof e=="string"?e:dt(e);function ic({t:e,detail:t,handoff:o,setHandoff:r,handoffUnsupportedReason:n,acting:l,actingEnvironmentId:i,newThread:u,prepareThread:f,context:c,composerDraftTarget:d}){let p=Gu(c,d),g=Hu(p!==null),L=In({attachAvailable:p!==null,blockedReason:n}),R=(H,K)=>{let V=Rn({supported:n===null,existing:jo.getState().getComposerDraft(H),lastHandoffPrompt:sc.get(lc(H)),task:K});if(!V.ok)return we.error(e(V.reason)),!1;let O=jo.getState();return sc.set(lc(H),K.prompt),O.setPrompt(H,V.next.prompt),O.setReviewComments(H,V.next.reviewComments),!0},I=async(H,K,V)=>{let O=V??await u(H).then(U=>U,()=>null);return O===null?null:K===null||R(O.draftId,K)?O:null},P=async(H,K)=>{if(!t||o!==null)return;if(n!==null){we.error(e(n));return}if(p!==null){if(!R(p,K))return;we.success(e("notify.addedToComposer"),K.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"));return}r(H);let V=Kn(i,l?.projectId??t.projectId),O=await I(V,K);if(r(null),O===null){we.error(e("notify.couldNotOpenThread"),void 0,{description:e("notify.threadHandoffHint")});return}we.success(e("notify.askedInThread"),K.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"))},y=async(H,K,V="worktree")=>{if(!t||o!==null)return;if(n!==null){we.error(e(n));return}if(p!==null&&K!==null){if(!R(p,K))return;we.success(e("notify.addedToComposer"),e("notify.taskInComposer"));return}r(H);let O=we.task({title:e("notify.checkoutPreparing")}),U=Kn(i,l?.projectId??t.projectId),j=await u(U).then(pe=>pe,()=>null);if(j===null){r(null),O.fail({title:e("notify.checkoutThreadFailed"),description:e("notify.threadHandoffHint")});return}let Y=await f.run({reference:t.url,mode:V,threadId:j.threadId});if(Y._tag==="Failure"){r(null);let pe=f.error instanceof Error?f.error.message:null;O.fail({title:e("notify.checkoutFailed"),...pe?{description:pe}:{}});return}if(!await u(U,{branch:Y.value.branch,worktreePath:Y.value.worktreePath}).then(pe=>pe!==null,()=>!1)){r(null),O.fail({title:e("notify.checkoutThreadUnmoved"),description:e("notify.checkoutReadyOnBranch",{branch:Y.value.branch})});return}r(null);let le={title:e("notify.checkoutStale"),description:e("notify.checkoutStaleDetail")},xe=pe=>{Y.value.isOnPullRequestHead?O.succeed(pe):O.fail(le)};if(K===null){xe({title:e(V==="local"?"notify.checkoutHereTitle":"notify.checkoutDoneTitle"),description:e(V==="local"?"notify.checkoutHereDetail":"notify.checkoutWorktreeDetail")});return}await I(U,K,j),xe({title:e("notify.checkoutReady"),description:e("notify.taskInComposer")})};return{attachTarget:p,handoffLabels:g,addToAgentEntry:L,askAboutPullRequest:()=>{t&&P("ask",{...bn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})},explainPullRequest:()=>{t&&P("explain",{...Ln({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})},addSelectionToAgent:H=>{t&&P(`selection:${H.comment.id}`,Pn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,comment:H.comment,request:H.request}))},startCheckout:H=>{t&&y(`checkout:${H}`,null,H)},startFixFinding:H=>{t&&y(Jt(H),xn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,finding:H}))},startFixFindings:()=>{t&&y("findings",yn({number:t.number,title:t.title,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch,reviewThreads:t.reviewThreads,comments:t.comments,checks:t.checks,commentsTruncated:t.commentsTruncated}))},startResolveConflicts:()=>{t&&y("conflicts",{prompt:Bu({number:t.number,url:t.url,headBranch:t.headBranch,baseBranch:t.baseBranch})})}}}T();function uc({environmentId:e,reference:t,refreshToken:o=0,onActed:r,onStateChange:n,context:l="page",composerDraftTarget:i}){let{t:u}=A(),f=Rr(),c=Cr(),d=`${t.projectId}:${t.repository}#${t.number}`,[p,g]=C("summary"),[L,R]=C("newest"),[I,P]=C(()=>({pullRequestKey:d,oid:null})),y=I.pullRequestKey===d?I.oid:null,w=se=>{P({pullRequestKey:d,oid:se})},S=se=>{w(se),g("code")},[ee,J]=C(()=>new Set(["summary"]));ye(()=>{J(se=>se.has(p)?se:new Set(se).add(p))},[p]);let[B,G]=C(!1),F=Ne({});ye(()=>{G(F.current[p]??!1)},[p]);let H=B,K=Ne(null),V=Ne(null),O=Ne(null),U=Ne(null);cs(()=>{if(U.current===null)return;let se=K.current,Gt=U.current;U.current=null,se&&(se.scrollTop=Math.max(0,se.scrollTop+Gt))},[H]);let[j,Y]=C("merge"),[he,le]=C({open:!1,action:"merge"}),xe=he.action,[pe,ue]=C(null),{copyToClipboard:be,isCopied:ae}=Zl({target:u("detail.branchNameTarget"),timeout:1600});ye(()=>{$n()},[]);let h=xt(Se.detail({environmentId:e,input:t})),W=xt(Se.activity({environmentId:e,input:t})),E=xt(Se.diff({environmentId:e,input:{...t}})),X=h.data,k=W.data,v=$(()=>X===null?null:{...X,author:k?.author??X.author,reviewers:k?.reviewers??X.reviewers,comments:k?.comments??[],commentCount:k?.commentCount??0,commentsTruncated:k?.commentsTruncated??!1,reviewThreads:k?.reviewThreads??[],commits:k?.commits??[],reactions:k?.reactions??[]},[k,X]),de=v===null?null:Ql(v.url),Ge=xt(v===null?null:ci.listRefs({environmentId:e,input:{cwd:v.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),$e=v!==null&&zu(v.baseBranch,Ge.data?.refs??[]),ct=W.isPending&&k===null,at=k===null?W.error:null,Le=Xe(()=>{h.refresh(),W.refresh()},[W.refresh,h.refresh]),Ye=Ne(null);ye(()=>{if(!X)return;let se={key:d,updatedAt:X.updatedAt};Ou(Ye.current,se)&&W.refresh(),Ye.current=se},[W.refresh,X,d]),ye(()=>{v&&n?.({projectId:v.projectId,repository:v.repository,number:v.number,state:v.state,isDraft:v.isDraft})},[v,n]),Er(h.refresh,{key:`pull-request:${t.projectId}:${t.repository}#${t.number}`});let Ze=Be(Se.invalidate,{reportFailure:!1}),[wt,qt]=C(0),Q=Xe(async()=>{await Ze({environmentId:e,input:{reference:t}}),Le(),qt(se=>se+1)},[e,Ze,t,Le]),Re=Ne(o);ye(()=>{Re.current!==o&&(Re.current=o,Q())},[o,Q]);let Ce=Be(Se.act,{reportFailure:!1}),[Pe,q]=C(null),fe=Pe!==null,[D,Z]=C(null),ge=D?.pullRequestKey===d?D.text:null,[ke,We]=C(!1),Ht=ui(),No=me(),{projects:Bo,rows:Fr}=Ar(),Fo=Tr(Fr.find(se=>se.environmentId===e)?.data??null,t.projectId),Oo=Fo!==null&&La(Fo),aa=vn({canCreateThread:ft(No,"createThread"),canWriteComposerDraft:ft(No,"composerDraft"),projectArchived:Oo}),Or=aa!==null,_=se=>aa===null?se:s(oe,{children:[a(ne,{render:se}),a(re,{side:"top",children:u(aa)})]}),{environments:Ee}=Mr(),Uo=$(()=>l==="page"?wd({environmentId:e,projectId:t.projectId},Bo,Ee):[],[l,e,Ee,Bo,t.projectId]),[as,Dc]=C(null),Nc=as?.pullRequestKey===d?as.environmentId:e,Ur=Uo.find(se=>se.environmentId===Nc)??null,_r=Ur?.environmentId??e,Bc=di({environmentId:_r,cwd:Ur?.workspaceRoot??v?.workspaceRoot??null}),Fc=async(se,Gt,Ra)=>{if(Pe!==null)return;q(se);let ns=await Ce({environmentId:e,input:{op:"runAction",...t,action:se,...Gt?{mergeMethod:Gt}:{},...Ra?{updateMethod:Ra}:{}}});if(q(null),ns._tag==="Failure"){let rf=vo(ns),nf=u(Ra==="rebase"?$d:Gd[se]);we.error(u(Hd[se]),void 0,{description:Ao(rf,nf)});return}we.success(u(_d[se])),Xu(se)?Q():Le(),r?.()},Oc=async se=>{let Gt=se.trim();if(v===null||ke)return;if(Gt.length===0||Gt===v.title){Z(null);return}We(!0);let Ra=await Ce({environmentId:e,input:{op:"update",...t,title:Gt}});if(We(!1),Ra._tag==="Failure"){we.error(u("notify.titleSaveFailed"),void 0,{description:Ao(vo(Ra),u("notify.titleRefused"))});return}Z(null),Le()},{attachTarget:Uc,handoffLabels:_c,addToAgentEntry:Hc,askAboutPullRequest:Gc,explainPullRequest:$c,addSelectionToAgent:zc,startCheckout:Vc,startFixFinding:Kc,startFixFindings:jc,startResolveConflicts:Wc}=ic({t:u,detail:v,handoff:pe,setHandoff:ue,handoffUnsupportedReason:aa,acting:Ur,actingEnvironmentId:_r,newThread:Ht,prepareThread:Bc,context:l,composerDraftTarget:i}),Ia=v?v.capabilities.mergeMethods.filter(se=>v.mergeCapabilities[se]):[],os=Ia.includes(j)?j:Ia[0]??"merge",Xc=u(ya[os]),_o=v?.state==="open"&&v.mergeability==="conflicting",Hr=v?.state==="open"&&v.autoMergeEnabled===!0,Qc=v===null?null:Wu(v),Gr=zd.filter(se=>se.value!=="code"||v===null||v.capabilities.diff);ye(()=>{Gr.some(se=>se.value===p)||g("summary")},[p,Gr]);let oa=se=>v?.capabilities.actions.includes(se)===!0&&v.viewerPermissions.actions.includes(se),rs=v===null||v.state!=="open"?null:_o?"resolve":v.isDraft&&oa("ready")?"ready":oa("merge")&&Ia.length>0?"merge":null,Jc=v?.state==="open"&&oa(v.isDraft?"ready":"draft")&&!(v.isDraft&&rs==="ready"),Yc=v?.state==="open"&&(Hr&&oa("disable-auto-merge")||!Hr&&!v.isDraft&&!_o&&oa("enable-auto-merge")&&Ia.length>0),Zc=v?.state==="open"&&oa("merge")&&!v.isDraft&&!_o&&Ia.length>1,ef=v?So({state:v.state,isDraft:v.isDraft}):null,tf=v?mr(v.checks):null,af=v?Su(v.checks):null,of=v&&!v.commentsTruncated?hr(v.comments,v.commits).filter(se=>se.outcome==="approved"&&!se.stale).length:0;return{t:u,openOnHostLabel:f,showPullRequestLinkContextMenu:c,pullRequestKey:d,tab:p,setTab:g,timelineOrder:L,setTimelineOrder:R,selectedCodeCommitOid:y,selectCodeCommit:w,openCommit:S,mountedTabs:ee,setChromeCondensed:G,chromeStateByTab:F,condensed:H,scrollerRef:K,foldRef:V,condensedRowRef:O,compensationRef:U,setMergeMethod:Y,confirmation:he,setConfirmation:le,confirmAction:xe,handoff:pe,copyBranchToClipboard:be,isBranchCopied:ae,detailQuery:h,activityQuery:W,detail:v,repositoryUrl:de,isStackedPullRequest:$e,activityPending:ct,activityError:at,refreshDetail:Le,refreshToken:wt,refreshFromHost:Q,pendingAction:Pe,actionPending:fe,setTitleScope:Z,titleDraft:ge,titleSaving:ke,projectArchived:Oo,handoffUnsupportedReason:aa,handoffBlocked:Or,withBlockedReason:_,pickableEnvironments:Uo,setActingScope:Dc,actingEnvironmentId:_r,perform:Fc,saveTitle:Oc,attachTarget:Uc,handoffLabels:_c,addToAgentEntry:Hc,askAboutPullRequest:Gc,explainPullRequest:$c,addSelectionToAgent:zc,startCheckout:Vc,startFixFinding:Kc,startFixFindings:jc,startResolveConflicts:Wc,allowedMergeMethods:Ia,selectedMergeMethod:os,selectedMergeMethodLabel:Xc,conflicting:_o,autoMergeArmed:Hr,freshness:Qc,visibleTabs:Gr,can:oa,primaryAction:rs,showsDraftToggle:Jc,showsAutoMerge:Yc,showsMergeMethods:Zc,statePresentation:ef,checksSummary:tf,checksState:af,approvalCount:of,context:l}}T();function Dr(e){let{environmentId:t,reference:o,onClose:r}=e,n=uc(e),{t:l,tab:i,timelineOrder:u,selectedCodeCommitOid:f,selectCodeCommit:c,openCommit:d,mountedTabs:p,setChromeCondensed:g,chromeStateByTab:L,scrollerRef:R,foldRef:I,condensedRowRef:P,compensationRef:y,confirmation:w,setConfirmation:S,confirmAction:ee,handoff:J,detailQuery:B,activityQuery:G,detail:F,activityPending:H,activityError:K,refreshDetail:V,refreshToken:O,actionPending:U,projectArchived:j,perform:Y,handoffLabels:he,addToAgentEntry:le,addSelectionToAgent:xe,startFixFinding:pe,selectedMergeMethod:ue,selectedMergeMethodLabel:be}=n,ae=ds(),h=me().ui.TabsDetachedPanel,W=h??"div";return B.isPending&&!F?a(xu,{}):s("div",{className:"flex h-full min-h-0 w-full flex-col bg-background",children:[s("div",{className:"grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60",children:[a(Yd,{state:n}),a(Wd,{state:n,onClose:r}),a(Zd,{state:n}),a(ec,{state:n}),a(tc,{state:n,tabIdPrefix:ae})]}),a("div",{className:"relative min-h-0 flex-1 overflow-hidden",onScrollCapture:E=>{let X=E.target;R.current=X;let k=X.scrollTop;g(v=>{let de=v,Ge=I.current?.scrollHeight??0,$e=Ge-(P.current?.scrollHeight??0);return v?k<4&&Ge>0&&(de=!1):Ge>0&&k>Ge+32&&(y.current=-$e,de=!0),L.current[i]=de,de})},children:B.error&&!F?a(Lo,{error:B.error,onRetry:V}):F?s(ve,{children:[p.has("summary")?a(W,{id:`${ae}-panel-summary`,...h?{tabId:i==="summary"?`${ae}-tab-summary`:void 0}:{},className:M("absolute inset-0",i!=="summary"&&"invisible"),children:a(fd,{environmentId:t,reference:o,detail:F,activityPending:H,activityError:K,pendingFinding:J,fixFindingLabel:he.fixFinding,fixCheckLabel:he.fixCheck,...j?{}:{onFixFinding:pe},onRefresh:V})}):null,p.has("timeline")?a(W,{id:`${ae}-panel-timeline`,...h?{tabId:i==="timeline"?`${ae}-tab-timeline`:void 0}:{},className:M("absolute inset-0",i!=="timeline"&&"invisible"),children:H?a(vu,{}):K?a(ir,{error:K,onRetry:G.refresh}):a(yd,{detail:F,environmentId:t,reference:o,order:u,onOpenCommit:d,onRefresh:V})}):null,p.has("code")?a(W,{id:`${ae}-panel-code`,...h?{tabId:i==="code"?`${ae}-tab-code`:void 0}:{},className:M("absolute inset-0",i!=="code"&&"invisible"),children:a(ls,{fallback:a(Ud,{label:l("code.loadingDiff")}),children:a(Vd,{...le.kind==="hidden"?{}:{onAddToAgentSelection:xe},...le.kind==="disabled"?{addToAgentDisabledReason:l(le.reason)}:{},environmentId:t,reference:o,detail:F,selectedCommitOid:f,onSelectedCommitChange:c,pendingFinding:J,fixFindingLabel:he.fixFinding,...j?{}:{onFixFinding:pe},onRefresh:V,refreshToken:O})})}):null]}):null}),a(nu,{open:w.open,onOpenChange:E=>{!E&&U||S(X=>({...X,open:E}))},onOpenChangeComplete:E=>{E||S({open:!1,action:"merge"})},children:s(du,{children:[s(uu,{children:[a(cu,{children:l(ee==="merge"?"detail.confirmMergeTitle":ee==="enable-auto-merge"?"detail.confirmAutoMergeTitle":"detail.confirmCloseTitle")}),a(lu,{children:ee==="merge"?l("detail.confirmMergeBody",{number:o.number,method:l(ya[ue])}):ee==="enable-auto-merge"?l("detail.confirmAutoMergeBody",{number:o.number,method:l(ya[ue])}):l("detail.confirmCloseBody",{number:o.number})})]}),s(iu,{children:[a(su,{render:a(b,{variant:"outline",size:"sm",disabled:U}),children:l("action.cancel")}),a(b,{size:"sm",variant:ee==="close"?"destructive":"default",disabled:U,onClick:()=>{let E=ee;S(X=>({...X,open:!1})),E==="merge"&&Y("merge",ue),E==="enable-auto-merge"&&Y("enable-auto-merge",ue),E==="close"&&Y("close")},children:ee==="merge"?be:l(ee==="enable-auto-merge"?"detail.enableAutoMerge":"detail.close")})]})]})})]})}De();Ue();ze();qe();N();N();N();N();T();function fc(e,t){return e.filter(r=>r.kind===t.kind).length>1?t.host:Zt(t.kind).providerName}function mc({value:e,busy:t,onChange:o}){let{t:r}=A(),n=me().ui.SearchInput;return n!==void 0?a(n,{busy:t,value:e,onValueChange:o,placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria"),className:"ycodium-pull-requests-ui min-w-0 flex-1"}):s(dn,{className:"min-w-0 flex-1 **:[input]:h-9 sm:**:[input]:h-8",children:[a(cn,{children:t?a("span",{className:"inline-flex shrink-0 animate-spin",children:a(Dt,{"aria-hidden":!0})}):a(Nt,{"aria-hidden":!0})}),a(fn,{type:"search",value:e,onChange:l=>o(l.currentTarget.value),placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria")})]})}var jn="all",dc="",cc="",wa="all",St=e=>JSON.stringify([e.environmentId,e.id]),fg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"only",labelKey:"filter.draftsOnly",Icon:Et},{value:"hide",labelKey:"filter.hideDrafts",Icon:eo}],mg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"approved",labelKey:"filter.reviewApproved",Icon:Qe},{value:"changes-requested",labelKey:"filter.reviewChangesRequested",Icon:Ve},{value:"review-required",labelKey:"filter.reviewRequired",Icon:Tt},{value:"none",labelKey:"filter.reviewNone",Icon:Ya}],pg=[{value:wa,labelKey:"filter.all",Icon:Fe},{value:"passing",labelKey:"filter.checksPassing",Icon:Qe},{value:"failing",labelKey:"filter.checksFailing",Icon:Ve}];function xa({label:e,value:t,options:o,onChange:r}){let{t:n}=A();return s(Ft,{value:t,onValueChange:l=>{l!==t&&r(l)},children:[a(mn,{children:e}),o.map(l=>{let i=a(Ct,{value:l.value,className:l.unavailable?"data-disabled:pointer-events-auto":void 0,disabled:l.unavailable!==void 0,children:l.environmentId!==void 0?a(da,{environmentId:l.environmentId,fallbackName:l.label,className:"gap-2",iconClassName:"size-icon-2"}):s("span",{className:"flex min-w-0 items-center gap-2",children:[l.Icon===void 0?null:a(l.Icon,{"aria-hidden":!0,className:"size-icon-2"}),l.labelKey!==void 0?n(l.labelKey):l.label]})},l.value);return l.unavailable?s(oe,{children:[a(ne,{render:i}),a(re,{side:"top",className:"max-w-80",children:l.unavailable})]},l.value):i})]})}function pc({state:e,stateOptions:t,onState:o,involvement:r,involvementOptions:n,onInvolvement:l,filters:i,onFilters:u,host:f,hostOptions:c,onHost:d,server:p,serverOptions:g,onServer:L,projects:R,projectId:I,projectEnvironmentId:P,unavailable:y,onProject:w}){let{t:S}=A(),ee=e!=="open"||r!=="all"||f!==void 0||p!==void 0||I!==void 0||Object.keys(i).length>0,J=(B,G)=>Object.fromEntries(Object.entries({...i,[B]:G===wa?void 0:G}).filter(([,F])=>F!==void 0));return s(gt,{children:[s(yt,{render:a(b,{className:M("relative",ee&&"[--control-icon-color:currentColor]"),size:"icon",variant:"outline","aria-label":S("list.filterAria")}),children:[a(so,{className:"size-4"}),ee?a("span",{"aria-hidden":!0,className:"absolute top-0.5 right-0.5 size-1.5 rounded-full bg-primary"}):null]}),s(ht,{align:"end",side:"bottom",children:[a(xa,{label:S("filter.groupState"),value:e,options:t,onChange:o}),a(je,{}),a(xa,{label:S("filter.groupInvolvement"),value:r,options:n,onChange:l}),a(je,{}),a(xa,{label:S("filter.groupDraft"),value:i.draft??wa,options:fg,onChange:B=>u(J("draft",B))}),a(je,{}),a(xa,{label:S("filter.groupReview"),value:i.review??wa,options:mg,onChange:B=>u(J("review",B))}),a(je,{}),a(xa,{label:S("filter.groupChecks"),value:i.checks??wa,options:pg,onChange:B=>u(J("checks",B))}),c.length>2?s(ve,{children:[a(je,{}),a(xa,{label:S("filter.groupHost"),value:f??dc,options:c,onChange:B=>d(B===dc?void 0:B)})]}):null,g.length>1?s(ve,{children:[a(je,{}),a(xa,{label:S("filter.groupServer"),value:p??cc,options:g,onChange:B=>L(B===cc?void 0:B)})]}):null,a(je,{}),s(Ft,{value:I===void 0||P===void 0?jn:St({id:I,environmentId:P}),onValueChange:B=>{if(B===jn){I!==void 0&&w(void 0,void 0);return}let G=R.find(F=>St(F)===B);G!==void 0&&(G.id!==I||G.environmentId!==P)&&w(G.id,G.environmentId)},children:[a(mn,{children:S("filter.groupProject")}),a(Ct,{value:jn,children:s("span",{className:"flex min-w-0 items-center gap-2",children:[a(Fe,{"aria-hidden":!0,className:"size-icon-2"}),S("filter.allProjects")]})}),R.toSorted((B,G)=>Number(y.has(St(B)))-Number(y.has(St(G)))).map(B=>{let G=y.get(St(B)),F=a(Ct,{value:St(B),className:G!==void 0?"data-disabled:pointer-events-auto":void 0,disabled:G!==void 0,children:s("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a(tu,{projectRef:{environmentId:B.environmentId,projectId:B.id},fallbackName:B.title,className:"min-w-0 flex-1 gap-2",iconClassName:"size-icon-2"}),B.showMachine===!0?a(da,{environmentId:B.environmentId,className:"min-w-0 shrink text-muted-foreground",iconClassName:"size-3"}):null,G===void 0?null:a("span",{className:"shrink-0 rounded-full border border-warning/40 bg-warning-surface px-1.5 py-px text-ui-2xs font-medium text-warning-foreground",children:S("filter.unavailable")})]})},St(B));return G===void 0?F:s(oe,{children:[a(ne,{render:F}),a(re,{side:"top",className:"max-w-80",children:G})]},St(B))})]})]})]})}qe();De();N();N();T();function Wn({joined:e}){return s("svg",{"aria-hidden":!0,viewBox:"0 0 120 72",className:"h-20 w-32 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[a("path",{d:"M10 58h100",className:"text-muted-foreground/30",stroke:"currentColor"}),a("circle",{cx:"10",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),a("circle",{cx:"110",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),e?a("path",{d:"M30 58c0-18 8-26 24-26h12c16 0 24 8 24 26"}):s(ve,{children:[a("path",{d:"M30 58c0-18 8-26 24-26h4"}),a("path",{d:"M90 58c0-18-8-26-24-26h-4",strokeDasharray:"2 7",className:"text-muted-foreground/50"})]}),a("circle",{cx:"60",cy:"32",r:e?5:4,fill:e?"currentColor":"none",fillOpacity:.25,className:e?void 0:"text-muted-foreground/45"})]})}function gc({query:e,filtered:t,searching:o,hasProjects:r,canLoadMore:n,loadingMore:l,refreshing:i,onClearQuery:u,onLoadMore:f,onRefresh:c}){let d=ni(),{t:p}=A();return r?o?a(Fa,{rows:5,caption:p("emptyState.searchingCaption",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}):e.length>0?s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p("emptyState.nothingMatches",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}),a(Ta,{children:p("emptyState.nothingMatchesDetail")})]}),s(qa,{className:"flex-row flex-wrap justify-center gap-2",children:[s(b,{size:"sm",variant:"outline",onClick:u,children:[a(Nt,{}),p("emptyState.clearSearch")]}),s(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[a(et,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p(t?"emptyState.nothingUnderFilters":"emptyState.noPullRequests")}),t?a(Ta,{children:p("emptyState.widenFilters")}):null]}),s(qa,{className:"flex-row flex-wrap justify-center gap-2",children:[n?a(b,{size:"sm",variant:"outline",disabled:l,onClick:f,children:p(l?"action.loading":"emptyState.loadMore")}):null,s(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[a(et,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):s(ka,{className:"py-16",children:[a(Wn,{joined:!1}),s(Aa,{children:[a(Ma,{children:p("emptyState.noProjectsTitle")}),a(Ta,{children:p(d?"emptyState.noProjectsDetail":"empty.addProjectWithoutPalette")})]}),d?a(qa,{children:s(b,{size:"sm",onClick:()=>si({open:"add-project"}),children:[a(mo,{}),p("emptyState.addProject")]})}):null]})}ce();Ue();qe();Xt();N();ut();T();function gg({entry:e,selected:t,showProjectTitle:o,showProvider:r,showEnvironment:n,environmentFallbackName:l,matchedElsewhere:i,onSelect:u}){let{t:f}=A(),c=Rr(),d=Cr(),{Icon:p,providerName:g}=Zt(e.provider);return s("button",{type:"button","aria-current":t?"true":void 0,onClick:()=>u(e),className:M("grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors","[contain-intrinsic-block-size:54px] [content-visibility:auto]",t?"bg-accent":"hover:bg-accent"),children:[a(bu,{state:e.state,isDraft:e.isDraft,mergeability:e.mergeability,baseBranch:e.baseBranch}),s("span",{className:"min-w-0",children:[a("span",{className:"block truncate text-sm font-medium text-foreground",children:e.title}),s(Lt,{className:"mt-0.5 text-xs text-muted-foreground/70",children:[s("span",{className:"flex shrink-0 items-center gap-1",children:[r?s(oe,{children:[a(ne,{render:a("span",{className:"inline-flex shrink-0"}),children:a(p,{"aria-label":g,className:"size-3"})}),a(re,{children:g})]}):null,s("span",{onContextMenu:L=>{L.preventDefault(),L.stopPropagation(),d({url:e.url,openLabel:c(e.provider),position:{x:L.clientX,y:L.clientY}})},children:["#",e.number]})]}),o?a("span",{className:"truncate",children:e.repository}):null,n?a(da,{environmentId:e.environmentId,fallbackName:l,className:"max-w-32 shrink-0",iconClassName:"size-3"}):null,a(bt,{actor:e.author,className:"max-w-40 shrink-0"}),e.reviewDecision==="approved"||e.reviewDecision==="changes-requested"?a("span",{className:M("shrink-0",e.reviewDecision==="approved"?"text-success-foreground":"text-warning-foreground"),children:e.reviewDecision==="approved"?f("reviewOutcome.approved"):f("reviewOutcome.changesRequested")}):null,e.checksState===void 0?null:a(qr,{checksState:e.checksState,environmentId:e.environmentId,reference:{projectId:e.projectId,repository:e.repository,number:e.number}}),i?a("span",{className:"shrink-0 rounded-full border border-border/60 px-1.5 text-ui-2xs",children:f("row.matchedInDescription")}):null]})]}),s("span",{className:"flex shrink-0 flex-col items-end gap-0.5 text-xs text-muted-foreground/70 tabular-nums",children:[a("span",{children:He(e.updatedAt)}),a(Ot,{additions:e.additions,deletions:e.deletions})]})]})}var hc=zr(gg);N();ut();T();function yc({children:e,documents:t,activeDocumentId:o,widthStorageKey:r,defaultWidth:n,pullRequestStatuses:l,onActivate:i,onCloseDocument:u,onCloseOtherDocuments:f,onCloseDocumentsToRight:c,onCloseAllDocuments:d}){let p=(g,L)=>{let R=t.find(I=>I.id===g);R&&L(R)};return a(au,{tabs:t.map(g=>{let L=l[g.id],R=L?So(L):null;return{id:g.id,title:`${g.repository.split("/").at(-1)} #${g.number}`,description:`${g.repository} #${g.number}`,...R?{icon:a(R.Icon,{className:`size-3 ${R.toneClassName}`,"aria-hidden":!0})}:{}}}),activeId:o,widthStorageKey:r,...n===void 0?{}:{defaultWidth:n},onActivate:g=>p(g,i),onClose:g=>p(g,u),onCloseOthers:g=>p(g,f),onCloseToRight:g=>p(g,c),onCloseAll:d,children:e})}De();N();qe();T();function xc({rightPanelAvailable:e,rightPanelOpen:t,rightPanelUnavailableLabel:o,rightPanelMaximized:r,onToggleRightPanelMaximized:n,onToggleRightPanel:l}){let{t:i}=A();return s("div",{className:"flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]","data-panel-layout-controls":!0,children:[r!==void 0&&n!==void 0?s(oe,{children:[a(ne,{render:a(Bt,{className:"shrink-0",pressed:r,onPressedChange:n,"aria-label":i(r?"panel.restore":"panel.maximize"),variant:"ghost",size:"sm"}),children:r?a(uo,{className:"size-4"}):a(lo,{className:"size-4"})}),a(re,{side:"bottom",children:i(r?"panel.restore":"panel.maximize")})]}):null,s(oe,{children:[a(ne,{render:a(Bt,{className:"shrink-0",pressed:t,onPressedChange:l,"aria-label":i("panel.toggleRight"),variant:"ghost",size:"sm",disabled:!e}),children:a(ia,{className:"size-4"})}),a(re,{side:"bottom",children:e?i("panel.toggleRight"):o??i("panel.rightUnavailable")})]})]})}N();N();ce();var Nr={isOpen:!1,activeDocumentId:null,documents:[]},Xn=new Set;function ea(){for(let e of Xn)e()}function hg(e){return Xn.add(e),()=>{Xn.delete(e)}}function yg(e){return`pull-request:${e.environmentId===void 0?"":`${encodeURIComponent(e.environmentId)}:`}${encodeURIComponent(e.projectId)}:${encodeURIComponent(e.repository)}:${e.number}`}function xg(e){return{id:yg(e),kind:"pull-request",...e.environmentId===void 0?{}:{environmentId:e.environmentId},projectId:e.projectId,repository:e.repository,number:e.number}}function ta(e,t,o){let r=o(e[t]??Nr);return{...e,[t]:r}}function wg(e,t){let o=e.documents.find(r=>r.id===t.id);return{...e,isOpen:!0,activeDocumentId:t.id,documents:o?e.documents.map(r=>r.id===t.id?t:r):[...e.documents,t]}}function vg(e,t,o){let r=e.documents.findIndex(u=>u.id===t);if(r<0)return e;let n=e.documents.filter((u,f)=>o(f,r)),l=n.some(u=>u.id===e.activeDocumentId),i=n[Math.min(r,n.length-1)]??null;return{...e,documents:n,activeDocumentId:l?e.activeDocumentId:i?.id??null,isOpen:n.length>0?e.isOpen:!1}}var Ae={byThreadKey:{},openPullRequest:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>wg(o,xg(t)))},ea()},activateDocument:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>o.documents.some(r=>r.id===t)?{...o,isOpen:!0,activeDocumentId:t}:o)},ea()},closeDocument:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>vg(o,t,(r,n)=>r!==n))},ea()},closeOtherDocuments:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>({...o,documents:o.documents.filter(r=>r.id===t),activeDocumentId:t}))},ea()},closeDocumentsToRight:(e,t)=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),o=>{let r=o.documents.findIndex(n=>n.id===t);return r<0?o:{...o,documents:o.documents.slice(0,r+1),activeDocumentId:t}})},ea()},closeAllDocuments:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),()=>Nr)},ea()},show:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),t=>({...t,isOpen:t.documents.length>0}))},ea()},close:e=>{Ae={...Ae,byThreadKey:ta(Ae.byThreadKey,dt(e),t=>({...t,isOpen:!1}))},ea()}};function Qn(){return Ae}var _e=(e=>{let t=Va(hg,Qn,Qn);return e(t)});_e.getState=Qn;function Br(e,t){return t?e[dt(t)]??Nr:Nr}function Jn(e,t){let o=Br(e,t);return o.documents.find(r=>r.id===o.activeDocumentId)??null}function Yn(e,t){return Br(e,t).isOpen?Jn(e,t):null}function wc(e,t,o){return e[t]?.state===o.state&&e[t]?.isDraft===o.isDraft?e:{...e,[t]:o}}qe();De();ce();N();N();N();N();N();N();N();Ue();T();var es=[{value:"all",labelKey:"filter.all",Icon:Fe},{value:"reviewing",labelKey:"filter.reviewing",Icon:to},{value:"authored",labelKey:"filter.authored",Icon:Kt}],ts=[{value:"all",labelKey:"filter.all",Icon:Fe},{value:"open",labelKey:"filter.open",Icon:Je},{value:"closed",labelKey:"filter.closed",Icon:mt},{value:"merged",labelKey:"filter.merged",Icon:Ke}];function Zn({label:e,value:t,options:o,onChange:r}){let{t:n}=A(),l=o.find(i=>i.value===t)??o[0];return l?s(gt,{children:[s(yt,{"aria-label":e,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-control-3 px-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground",children:[l.labelKey!==void 0?n(l.labelKey):l.label,a(rt,{"aria-hidden":!0,className:"size-3 text-muted-foreground/70"})]}),a(ht,{align:"start",side:"bottom",children:a(Ft,{value:t,onValueChange:i=>r(i),children:o.map(i=>{let u=a(Ct,{value:i.value,disabled:i.unavailable!==void 0,className:"data-disabled:pointer-events-auto",children:s("span",{className:"flex min-w-0 items-center gap-2",children:[i.Icon===void 0?null:a(i.Icon,{"aria-hidden":!0,className:"size-icon-2"}),i.labelKey!==void 0?n(i.labelKey):i.label]})},i.value);return i.unavailable===void 0?u:s(oe,{children:[a(ne,{render:u}),a(re,{side:"right",className:"max-w-64 break-words",children:i.unavailable})]},i.value)})})})]}):null}function Ig({searchInput:e,searchValue:t,open:o,onOpenChange:r,focusToken:n,onFocusWithin:l}){let{t:i}=A(),u=Ne(null);ye(()=>{o&&u.current?.querySelector("input")?.focus()},[o]);let f=Ne(n);return ye(()=>{if(f.current===n)return;f.current=n;let c=u.current?.querySelector("input");c?.focus(),c?.select()},[n]),o||t.length>0?a("div",{ref:u,className:"w-56 shrink-0",onFocus:()=>l?.(!0),onBlur:()=>{l?.(!1),t.length===0&&r(!1)},children:e}):a(b,{size:"icon-sm",variant:"ghost","aria-label":i("list.searchAria"),onClick:()=>r(!0),children:a(Nt,{className:"size-4"})})}function Ic({masterVisible:e,onMasterVisibilityChange:t,onBack:o,refreshing:r,onRefresh:n,searchValue:l,involvement:i,state:u,host:f,hostMenuOptions:c,onInvolvement:d,onState:p,onHost:g,searchInput:L,filtersMenu:R,rightPanelControl:I,rightPanel:P,listBody:y}){let{t:w}=A(),S=Ne(null),ee=Ne(null),[J,B]=C(!1);ye(()=>{let U=ee.current;if(!U||!e)return;let j=new IntersectionObserver(([Y])=>B(Y?!Y.isIntersecting:!1),{root:S.current});return j.observe(U),()=>j.disconnect()},[e]);let G=Ne(!1),F=Ne(null),[H,K]=C(!1),[V,O]=C(0);return ye(()=>{if(!e)return;let U=j=>{if(j.defaultPrevented||j.key.toLowerCase()!=="f"||!(j.metaKey||j.ctrlKey)||j.altKey||j.shiftKey)return;if(j.preventDefault(),J){K(!0),O(he=>he+1);return}let Y=F.current?.querySelector("input");Y?.focus(),Y?.select()};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[J,e]),ye(()=>{if(J||!e||(K(!1),!G.current))return;G.current=!1;let U=F.current?.querySelector("input");U&&(U.focus(),U.setSelectionRange(U.value.length,U.value.length))},[J,e]),s("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[s(yu,{className:"bg-background",children:[J&&e?s(pn,{ariaLabel:w("page.scopeAria"),children:[a(sr,{current:!0,children:a("h1",{className:"truncate",children:w("page.title")})}),a(gu,{}),s(sr,{className:"gap-1.5 overflow-hidden",children:[a(Zn,{label:w("list.filterByState"),value:u,options:ts,onChange:p}),a(Zn,{label:w("list.filterByInvolvement"),value:i,options:es,onChange:d}),c.length>2?a(Zn,{label:w("list.filterByHost"),value:f??"",options:c,onChange:U=>g(U===""?void 0:U)}):null]})]}):a(pn,{ariaLabel:w("breadcrumb.ariaLabel"),children:a(sr,{current:!0,children:a("h1",{className:"truncate",children:w("page.title")})})}),a("div",{className:"min-w-0 flex-1"}),J&&e?s("div",{className:"flex shrink-0 items-center gap-1.5",children:[a(Ig,{searchInput:L,searchValue:l,open:H,onOpenChange:K,focusToken:V,onFocusWithin:U=>{G.current=U}}),a(vc,{compact:!0,refreshing:r,onRefresh:n})]}):null,I]}),a(ou,{detail:P,onBack:o,onMasterVisibilityChange:t,children:a("div",{ref:S,className:"topbar-scroll-fade scrollbar-gutter-both min-h-0 min-w-0 flex-1 overflow-y-auto [--topbar-scroll-fade-height:1.5rem] sm:[--topbar-scroll-fade-height:1.5rem]",children:s(hu,{className:"gap-4",children:[s("div",{className:"flex flex-col gap-3",children:[s("div",{ref:F,className:"flex items-center gap-2",children:[L,R,J?null:a(vc,{refreshing:r,onRefresh:n})]}),a("div",{ref:ee,"aria-hidden":!0,className:"-mt-3 h-px w-full"})]}),y]})})})]})}function vc({compact:e=!1,refreshing:t,onRefresh:o}){let{t:r}=A();return a(b,{size:e?"icon-sm":"icon",variant:e?"ghost":"outline","aria-label":r("list.refreshAria"),onClick:o,disabled:t,children:a("span",{className:M("inline-flex shrink-0",t&&"animate-spin"),children:a(et,{className:"size-4"})})})}ce();Pa();ce();function Rc(e,t){let[o,r]=C(e);return ye(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[t,e]),o}Me();Me();var Rg=250,kt=99,va=500,Cc=[];function bc(e){let{search:t,environmentIds:o,environmentKey:r,pullRequestsSupported:n,projectsKnown:l,projects:i,scopedProjectId:u,scopedProject:f}=e,c=(t.q??"").trim(),d=Rc(c,Rg),p=c===d,g=$(()=>Zo(c),[c]),L=$(()=>Zo(d),[d]),R=$(()=>({...t.draft?{draft:t.draft}:{},...t.review?{review:t.review}:{},...t.checks?{checks:t.checks}:{}}),[t.checks,t.draft,t.review]),I=Object.keys(R).length>0,P=$(()=>({...R,...L.filters}),[R,L.filters]),y=Object.keys(P).length>0,w=$(()=>({...R,...g.filters}),[R,g.filters]),S=Object.keys(w).length>0,ee=$(()=>Yi(o,i,f,u,l),[o,i,l,f,u]),J=$(()=>{let D=ee.map(ke=>({environmentId:ke}));if(!l||u!==void 0)return D;let Z=xd(i,ee,ee[0]),ge=new Map;for(let ke of i)ge.set(ke.environmentId,(ge.get(ke.environmentId)??0)+1);return ee.flatMap(ke=>{let We=Z.get(ke);return We===void 0?[]:We.length===(ge.get(ke)??0)?[{environmentId:ke}]:[{environmentId:ke,projectIds:We}]})},[i,l,ee,u]),B=$(()=>J.map(({environmentId:D,projectIds:Z})=>`${D}#${Z?.join("+")??"*"}`).join("|"),[J]),G=`${r}:${B}:${t.state}:${t.involvement}:${u??""}:${t.host??""}:${t.draft??""}:${t.review??""}:${t.checks??""}`,F=`${G}:${d}`,[H,K]=C({key:F,size:kt,cursors:null,regrown:[]}),V=H.key===F?H.size:kt,O=H.key===F?H.cursors:null,U=H.key===F?H.regrown:[];ye(()=>{K({key:F,size:kt,cursors:null,regrown:[]})},[F]);let j=$(()=>J.flatMap(({environmentId:D,projectIds:Z})=>{let ge=O?.[D];return O!==null&&ge===void 0&&!U.includes(D)?[]:[{environmentId:D,input:{state:t.state,involvement:t.involvement,limit:V,...u?{projectId:u}:{},...Z?{projectIds:Z}:{},...t.host?{host:t.host}:{},...y?{filters:P}:{},...L.text?{query:L.text}:{},...ge===void 0?{}:{cursors:ge}}}]}),[P,y,V,J,u,t.host,t.involvement,t.state,O,U,L.text]),Y=Po(j),he=$(()=>J.map(({environmentId:D,projectIds:Z})=>({environmentId:D,input:{state:t.state,involvement:t.involvement,limit:kt,...u?{projectId:u}:{},...Z?{projectIds:Z}:{},...t.host?{host:t.host}:{},...I?{filters:R}:{}}})),[I,R,J,u,t.host,t.involvement,t.state]),le=Po(he),xe=t.involvement==="all"&&c.length===0,pe=$(()=>{if(!xe)return{authored:Cc,reviewing:Cc};let D=Z=>J.map(({environmentId:ge,projectIds:ke})=>({environmentId:ge,input:{state:t.state,involvement:Z,limit:kt,...u?{projectId:u}:{},...ke?{projectIds:ke}:{},...t.host?{host:t.host}:{},...I?{filters:R}:{}}}));return{authored:D("authored"),reviewing:D("reviewing")}},[I,R,xe,J,u,t.host,t.state]),ue=Po(pe.authored),be=Po(pe.reviewing),ae=Be(Se.invalidate,{reportFailure:!1}),[h,W]=C(0),[E,X]=C(!1),k=async D=>{X(!0);try{await Promise.all(ee.map(Z=>ae({environmentId:Z,input:{}})))}finally{X(!1)}fe(),le.refresh(),ue.refresh(),be.refresh(),D(),W(Z=>Z+1)},v=E||Y.isPending,[de,Ge]=C(null),[$e,ct]=C(null);ye(()=>{r.length!==0&&Ge(D=>{if(D!==null&&D.environmentKey===r)return D;let Z=Xi(typeof window>"u"?void 0:window.localStorage,r);return Z===null?null:{environmentKey:r,scope:Z.scope,query:"",data:Z.data,...Z.partitions===void 0?{}:{partitions:Z.partitions}}})},[r]),ye(()=>{if(!Y.data||Y.isPending)return;let D=Y.data;Ge(Z=>{let ge=xe&&ue.data!==null&&be.data!==null?{authored:ue.data.entries,reviewing:be.data.entries}:Z!==null&&Z.environmentKey===r&&Z.scope===G?Z.partitions:void 0;if(r.length>0&&d.length===0){let ke=$e?.key===F?$e.entries:D.entries;Qi(typeof window>"u"?void 0:window.localStorage,r,{scope:G,data:{...D,entries:ke,viewers:le.data?.viewers??D.viewers,providers:le.data?.providers??D.providers},...ge===void 0?{}:{partitions:ge}})}return{environmentKey:r,scope:G,query:d,data:D,...ge===void 0?{}:{partitions:ge}}})},[r,G,d,Y.data,Y.isPending,xe,ue.data,be.data,$e,F,le.data]);let at=$(()=>{if(de===null||de.environmentKey!==r||de.scope===G)return null;let D=Hi(de.data.entries,{state:t.state,projectId:u,host:t.host});return D.length===0?null:{...de.data,entries:D}},[r,de,G,u,t.host,t.state]),Le=(d.length===0&&O===null&&V===kt?le.data:Y.data)??(de?.scope===G&&de.query===d?de.data:null),Ye=(d.length===0?le.data:void 0)??(de?.scope===G?de.data:null)??at,Ze=Le??Ye,wt=Le===null&&Ye!==null,qt=Y.isPending&&Ze!==null,Q=Y.isPending&&Ze===null;ye(()=>{Le&&ct(D=>{if(D===null||D.key!==F)return{key:F,entries:ar(Le.entries,L.text)};if(O!==null){let Z=new Set(D.entries.map(Qt)),ge=Le.entries.filter(We=>!Z.has(Qt(We))),ke=ar(ge.toSorted((We,Ht)=>Ht.updatedAt.localeCompare(We.updatedAt)),L.text);return{key:F,entries:[...D.entries,...ke]}}return{key:F,entries:ar(Le.entries,L.text)}})},[Le,F,O,L.text]);let Re=Le?.nextCursors??{},Ce=(Le?.truncatedEnvironments??[]).filter(D=>Re[D]===void 0),Pe=!wt&&Object.keys(Re).length>0,q=()=>{if(Pe){K({key:F,size:Ce.length===0?V:Math.min(V+kt,va),cursors:Re,regrown:Ce});return}K({key:F,size:Math.min(V+kt,va),cursors:null,regrown:[]})},fe=()=>{if(O===null){Y.refresh();return}let D=$e?.key===F?$e.entries.length:V;K({key:F,regrown:[],size:Math.min(Math.max(V,Math.ceil(D/kt)*kt),va),cursors:null})};return Er(()=>{fe(),ue.refresh(),be.refresh()},{enabled:n}),{typedQuery:c,querySettled:p,typedParsed:g,menuFilters:R,localFilters:w,hasLocalFilters:S,scopeKey:G,filterKey:F,pageSize:V,listQuery:Y,baselineQuery:le,partitionsWanted:xe,authoredQuery:ue,reviewingQuery:be,detailRefreshToken:h,refreshing:v,loaded:de,ordered:$e,answered:Le,listData:Ze,showingCarried:wt,loadingMore:qt,firstLoad:Q,canContinue:Pe,loadMore:q,refreshList:fe,refreshFromHost:k}}bo();ce();ze();function Lc(e){let{search:t}=me().useLocation();return $(()=>{let o=new URLSearchParams(t.startsWith("?")?t.slice(1):t),r={};for(let[n,l]of o.entries())r[n]=l;return r},[t])}function Cg(e){let t=new URLSearchParams;for(let[o,r]of Object.entries(e))r==null||r===""||t.set(o,String(r));return t.toString()}function Pc(){let e=me(),t=e.useLocation();return Xe(o=>{let r=new URLSearchParams(t.search.startsWith("?")?t.search.slice(1):t.search),n={};for(let[c,d]of r.entries())n[c]=d;let l=typeof o.search=="function"?o.search(n):o.search??n,i=Cg(l),u="/x/pull-requests",f=t.pathname===u||t.pathname.startsWith(`${u}/`)?t.pathname:u;e.navigate(i.length>0?`${f}?${i}`:f)},[e,t.pathname,t.search])}qe();ce();Pa();Me();function Sc(e){return{involvement:e.involvement==="reviewing"||e.involvement==="authored"?e.involvement:"all",state:e.state==="closed"||e.state==="merged"||e.state==="all"?e.state:"open",...typeof e.repository=="string"&&e.repository?{repository:e.repository.slice(0,200)}:{},...typeof e.number=="number"&&Number.isInteger(e.number)&&e.number>0?{number:e.number}:{},...typeof e.projectId=="string"&&e.projectId?{projectId:e.projectId}:{},...typeof e.environmentId=="string"&&e.environmentId?{environmentId:e.environmentId}:{},...typeof e.host=="string"&&e.host?{host:e.host.slice(0,200)}:{},...typeof e.selectedProjectId=="string"&&e.selectedProjectId?{selectedProjectId:e.selectedProjectId}:{},...typeof e.selectedEnvironmentId=="string"&&e.selectedEnvironmentId?{selectedEnvironmentId:e.selectedEnvironmentId}:{},...typeof e.q=="string"&&e.q?{q:e.q.slice(0,200)}:{},...e.draft==="only"||e.draft==="hide"?{draft:e.draft}:{},...e.review==="approved"||e.review==="changes-requested"||e.review==="review-required"||e.review==="none"?{review:e.review}:{},...e.checks==="passing"||e.checks==="failing"?{checks:e.checks}:{}}}function kc(e,t){let o={...e,...t};return{involvement:o.involvement??e.involvement,state:o.state??e.state,...o.repository?{repository:o.repository}:{},...o.number?{number:o.number}:{},...o.projectId?{projectId:o.projectId}:{},...o.environmentId?{environmentId:o.environmentId}:{},...o.host?{host:o.host}:{},...o.selectedProjectId?{selectedProjectId:o.selectedProjectId}:{},...o.selectedEnvironmentId?{selectedEnvironmentId:o.selectedEnvironmentId}:{},...o.q?{q:o.q}:{},...o.draft?{draft:o.draft}:{},...o.review?{review:o.review}:{},...o.checks?{checks:o.checks}:{}}}var bg=rc.make("pull-requests-panel"),Lg="pull-requests-panel";function qc(){let[e,t]=C(!0),o=Lc({strict:!1}),r=$(()=>Sc(o),[o]),n=Pc(),{t:l}=A(),{environments:i}=Mr(),u=$(()=>i.filter(k=>k.serverConfig!==null).map(k=>k.environmentId),[i]),f=oc(Ru,u),c=$(()=>i.filter(k=>f.get(k.environmentId)===!0).toSorted((k,v)=>k.environmentId.localeCompare(v.environmentId)),[i,f]),d=c.find(k=>k.environmentId===r.environmentId)?.environmentId??null,p=$(()=>new Set(i.map(k=>k.environmentId)),[i]),g=$(()=>c.filter(k=>d===null||k.environmentId===d).map(k=>k.environmentId),[c,d]),L=$(()=>ji(g),[g]),R=f.size>0,I=g.length>0,{projects:P,bootstrapped:y,rows:w}=Ar(),S=$(()=>P.filter(k=>g.includes(k.environmentId)),[P,g]),ee=$(()=>new Map(i.map(k=>[k.environmentId,k.label])),[i]),J=$(()=>{let k=new Map;for(let v of S)k.set(v.title,(k.get(v.title)??0)+1);return S.map(v=>({id:v.id,environmentId:v.environmentId,title:v.title,workspaceRoot:v.workspaceRoot,showMachine:(k.get(v.title)??0)>1})).toSorted((v,de)=>v.title.localeCompare(de.title))},[S]),B=$(()=>ln(r.projectId,S,y),[S,y,r.projectId]),G=$(()=>un(S,d,B),[S,d,B]),F=$(()=>{let k=r.repository?.toLowerCase();return k===void 0?void 0:S.find(de=>de.repositoryIdentity?.owner&&de.repositoryIdentity.name&&`${de.repositoryIdentity.owner}/${de.repositoryIdentity.name}`.toLowerCase()===k&&(r.host===void 0||Co(de.repositoryIdentity,de.repositoryIdentity.provider)===r.host.toLowerCase()))?.id},[S,r.host,r.repository]),H=$(()=>ln(r.selectedProjectId,S,y),[S,y,r.selectedProjectId]),K=H??F??B,V=Zi(r.selectedEnvironmentId,p,d),O=$(()=>{let k=r.selectedProjectId,v=k===void 0||!y||H!==void 0?[]:w.flatMap(de=>!g.includes(de.environmentId)||V!==null&&de.environmentId!==V?[]:[{environmentId:de.environmentId,project:Tr(de.data,k)}]);return Ji({projectId:k,environmentId:V,rows:v})},[g,H,w,y,r.selectedProjectId,V]),U=$(()=>O??un(S,V,K),[O,S,V,K]),j=$(()=>c.length===0?null:nc(Lg,bg),[c.length]),Y=_e(k=>Br(k.byThreadKey,j)),he=_e(k=>Jn(k.byThreadKey,j)),le=he?.kind==="pull-request"?he:null,xe=Y.isOpen?le:null,pe=xe?.environmentId??U?.environmentId??null,[ue,be]=C({}),ae=xe?.id,h=Xe(k=>{let v=ae;v!==void 0&&be(de=>wc(de,v,k))},[ae]),W=Xe(k=>{n({search:kc(r,k)})},[n,r]),E={repository:void 0,number:void 0,selectedProjectId:void 0,selectedEnvironmentId:void 0};return{masterVisible:e,setMasterVisible:t,search:r,t:l,capableEnvironments:c,scopedEnvironmentId:d,environmentIds:g,environmentKey:L,capabilityKnown:R,pullRequestsSupported:I,projectsKnown:y,projects:S,environmentLabels:ee,scopedProjects:J,scopedProjectId:B,scopedProject:G,selectedProject:U,rightPanelRef:j,rightPanelState:Y,selectedPullRequestDocument:le,activePullRequestDocument:xe,panelEnvironmentId:pe,pullRequestTabStatuses:ue,handlePullRequestTabStatusChange:h,updateSearch:W,clearedSelection:E,updateListScope:k=>{j!==null&&_e.getState().close(j),W({...k,...E})}}}bo();ce();Pa();Me();var Pg={};function Tc(e,t){let{masterVisible:o,search:r,environmentKey:n,pullRequestsSupported:l,projects:i,selectedProject:u,rightPanelRef:f,rightPanelState:c,selectedPullRequestDocument:d,activePullRequestDocument:p,updateSearch:g,clearedSelection:L}=e,{querySettled:R,typedParsed:I,localFilters:P,hasLocalFilters:y,scopeKey:w,filterKey:S,pageSize:ee,listQuery:J,baselineQuery:B,partitionsWanted:G,authoredQuery:F,reviewingQuery:H,loaded:K,ordered:V,answered:O,listData:U,showingCarried:j,canContinue:Y,loadMore:he}=t,le=B.data?.viewers??U?.viewers??Pg,xe=B.data?.errors??U?.errors??[],pe=$(()=>new Set((B.data?.providers??U?.providers??[]).flatMap(Q=>Q.searchesOnHost?[Q.host]:[])),[B.data?.providers,U?.providers]),ue=$(()=>{let Q=V?.key===S?V.entries:U?.entries??[],Re=_i(Q,le,r.involvement),Ce=y?Re.filter(q=>sn(q,P,tr(q,le))):Re;if(I.text.length===0)return Ce.toSorted((q,fe)=>fe.updatedAt.localeCompare(q.updatedAt));let Pe=R&&!j;return Ce.filter(q=>Pe&&pe.has(q.host)||rn(q,I.text))},[S,y,P,U,V,R,r.involvement,pe,j,I.text,le]),be=Ne(null);ye(()=>{let Q=be.current;if(!o||!Q||ue.length===0||U?.truncated!==!0||J.isPending||J.error!==null||j||!Y&&ee>=va)return;let Re=new IntersectionObserver(Ce=>{Ce.some(Pe=>Pe.isIntersecting)&&he()},{rootMargin:"240px"});return Re.observe(Q),()=>Re.disconnect()},[o,ue.length,S,Y,U?.truncated,J.error,J.isPending,ee,j]);let ae=$(()=>{if(r.involvement!=="all")return[{key:"others",entries:ue}];let Q=K!==null&&K.environmentKey===n&&K.scope===w?K.partitions:void 0,Re=q=>q===void 0||!y?q:q.filter(fe=>sn(fe,P,tr(fe,le))),Ce=Re(G?F.data?.entries??Q?.authored:void 0),Pe=Re(G?H.data?.entries??Q?.reviewing:void 0);return Ce===void 0||Pe===void 0?Gi(ue,le):$i(ue,Ce,Pe)},[y,P,F.data?.entries,ue,n,K,G,H.data?.entries,w,r.involvement,le]),h=$(()=>{let Q=new Map;for(let Re of ae)for(let Ce of Re.entries){let Pe=Q.get(Ce.environmentId)??[];Pe.push({projectId:Ce.projectId,repository:Ce.repository,number:Ce.number}),Q.set(Ce.environmentId,Pe)}return[...Q].map(([Re,Ce])=>({environmentId:Re,input:{refs:Ce}}))},[ae]),W=Cu(h),[E,X]=C(()=>new Map);ye(()=>{let Q=W.stats;Q!==null&&X(Re=>zi(Re,Q))},[W.stats]);let k=$(()=>r.repository&&r.number&&u?{environmentId:u.environmentId,repository:r.repository,number:r.number,projectId:u.id}:null,[r.number,r.repository,u]),v=d!==null;ye(()=>{!l||f===null||k===null||_e.getState().openPullRequest(f,k)},[k,l,f]);let de=c.isOpen&&p!==null?{environmentId:p.environmentId,repository:p.repository,number:p.number,projectId:p.projectId}:null,Ge=Q=>g(Q===null?L:{repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,...Q.environmentId===void 0?{}:{selectedEnvironmentId:Q.environmentId}}),$e=()=>{if(f!==null){if(c.isOpen){_e.getState().close(f),g(L);return}d!==null&&(_e.getState().show(f),Ge(d))}},[ct,at]=C([]);ye(()=>{O!==null&&at(Q=>r.host===void 0||Q.length===0?O.providers:Q)},[O,r.host]);let Le=ct.length>1,Ye=$(()=>{let Q=new Map;for(let Re of i){let Ce=Re.repositoryIdentity?.provider;if(Ce===void 0)continue;let Pe=Co(Re.repositoryIdentity,Ce);Q.has(Pe)||Q.set(Pe,{host:Pe,kind:Ce})}return[...Q.values()]},[i]),Ze=$(()=>new Map(xe.map(Q=>[St({id:Q.projectId,environmentId:Q.environmentId}),Q.message])),[xe]),wt=Xe(Q=>{f!==null&&(_e.getState().openPullRequest(f,Q),g({repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,selectedEnvironmentId:Q.environmentId}))},[f,g]);return{entries:ue,sentinelRef:be,groups:ae,statsByRow:E,rightPanelAvailable:v,selected:de,selectSurfaceInUrl:Ge,toggleRightPanel:$e,hosts:ct,showProvider:Le,expectedHosts:Ye,unavailableProjects:Ze,selectEntry:wt,refreshStats:()=>W.refresh()}}T();var Sg=10;function Ac(){let e=qc(),t=bc(e),o=Tc(e,t),{masterVisible:r,setMasterVisible:n,search:l,t:i,capableEnvironments:u,scopedEnvironmentId:f,capabilityKnown:c,pullRequestsSupported:d,projectsKnown:p,projects:g,environmentLabels:L,scopedProjects:R,scopedProjectId:I,scopedProject:P,rightPanelRef:y,rightPanelState:w,activePullRequestDocument:S,panelEnvironmentId:ee,pullRequestTabStatuses:J,handlePullRequestTabStatusChange:B,updateSearch:G,updateListScope:F}=e,{typedQuery:H,querySettled:K,typedParsed:V,menuFilters:O,pageSize:U,listQuery:j,baselineQuery:Y,authoredQuery:he,reviewingQuery:le,detailRefreshToken:xe,refreshing:pe,listData:ue,showingCarried:be,loadingMore:ae,firstLoad:h,canContinue:W,loadMore:E,refreshList:X,refreshFromHost:k}=t,{entries:v,sentinelRef:de,groups:Ge,statsByRow:$e,rightPanelAvailable:ct,selected:at,selectSurfaceInUrl:Le,toggleRightPanel:Ye,hosts:Ze,showProvider:wt,expectedHosts:qt,unavailableProjects:Q,selectEntry:Re,refreshStats:Ce}=o,Pe=()=>k(Ce),q=a(mc,{value:l.q??"",busy:H.length>0&&(!K||be),onChange:_=>G({q:_||void 0})}),fe=a(xc,{showTerminalControl:!1,terminalAvailable:!1,terminalOpen:!1,terminalShortcutLabel:null,rightPanelAvailable:ct,rightPanelOpen:w.isOpen,rightPanelShortcutLabel:null,rightPanelUnavailableLabel:i("list.selectFirst"),onToggleTerminal:()=>{},onToggleRightPanel:Ye}),D=be&&j.isPending&&v.length===0&&H.length===0,Z=s(ve,{children:[c?d?h?a(Fa,{rows:7}):j.error&&ue===null?a(Lo,{error:j.error,onRetry:()=>j.refresh()}):D?a(Fa,{rows:7}):v.length===0?a(gc,{hasProjects:!p||g.length>0,refreshing:pe,onRefresh:()=>{Pe()},query:H,filtered:l.state!=="open"||l.involvement!=="all"||I!==void 0||l.host!==void 0,searching:H.length>0&&(!K||be),canLoadMore:ue?.truncated===!0&&(W||U<va),loadingMore:ae,onClearQuery:()=>G({q:void 0}),onLoadMore:E}):a("div",{className:"space-y-3",children:Ge.map(_=>s("div",{className:"space-y-0.5",children:[_.labelKey?a("h2",{className:"px-3 pb-0.5 text-xs font-medium text-muted-foreground/70",children:i(_.labelKey)}):null,_.entries.map(Ee=>a(hc,{entry:eu(Ee,$e),showProjectTitle:!0,showProvider:wt,showEnvironment:u.length>0,environmentFallbackName:L.get(Ee.environmentId),matchedElsewhere:V.text.length>0&&er(Ee,V.text)<=Sg,selected:at?.environmentId===Ee.environmentId&&at.repository===Ee.repository&&at.number===Ee.number,onSelect:Re},Qt(Ee)))]},_.key))}):a(Lo,{title:i("list.unavailableTitle"),error:i("page.notEnabled")}):a(Fa,{rows:7}),j.error&&ue!==null?s("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-warning/30 bg-warning-surface px-3 py-2 text-xs",children:[a("span",{children:i("list.staleNotice")}),a(b,{size:"xs",variant:"outline",onClick:()=>j.refresh(),children:i("action.retry")})]}):null,ue?.truncated&&v.length>0?a("div",{ref:de,className:"flex justify-center py-2 text-xs text-muted-foreground",children:ae?s("span",{className:"flex items-center gap-2",children:[a("span",{className:"inline-flex size-icon-2 shrink-0 animate-spin",children:a(Dt,{"aria-hidden":!0,className:"size-icon-2"})}),i("list.loadingMore")]}):null}):null]}),ge=Ze.length>0?Ze:qt,ke=[{value:"",labelKey:"list.allHosts",Icon:Fe},...ge.map(_=>{let Ee=Ze.find(Uo=>Uo.host===_.host);return{value:_.host,label:fc(ge,_),Icon:Zt(_.kind).Icon,...Ee===void 0||Ee.configured?{}:{unavailable:Ee.detail??i("list.hostUnreadable")}}})],We=[{value:"",labelKey:"list.allServers",Icon:Fe},...u.map(_=>({value:_.environmentId,environmentId:_.environmentId,label:_.label}))],Ht=a(pc,{state:l.state,stateOptions:ts,onState:_=>F({state:_}),involvement:l.involvement,involvementOptions:es,onInvolvement:_=>F({involvement:_}),filters:O,onFilters:_=>F({draft:_.draft,review:_.review,checks:_.checks}),host:l.host,hostOptions:ke,onHost:_=>F({host:_}),server:f??void 0,serverOptions:We,onServer:_=>F({environmentId:_,projectId:void 0}),projects:R,projectId:I,projectEnvironmentId:P?.environmentId,unavailable:Q,onProject:(_,Ee)=>F(Ee===void 0?{projectId:_}:{projectId:_,environmentId:Ee})}),No={masterVisible:r,onMasterVisibilityChange:n,onBack:Ye,refreshing:pe,onRefresh:()=>{Pe()},searchValue:l.q??"",involvement:l.involvement,state:l.state,host:l.host,hostMenuOptions:ke,onInvolvement:_=>F({involvement:_}),onState:_=>F({state:_}),onHost:_=>F({host:_}),searchInput:q,filtersMenu:Ht,rightPanelControl:d?fe:null,listBody:Z},Bo=_=>{y!==null&&(_e.getState().activateDocument(y,_.id),Le(_))},Fr=_=>{if(y===null)return;_e.getState().closeDocument(y,_.id);let Ee=Yn(_e.getState().byThreadKey,y);Le(Ee?.kind==="pull-request"?Ee:null)},Fo=_=>{y!==null&&(_e.getState().closeOtherDocuments(y,_.id),Le(_))},Oo=_=>{if(y===null)return;_e.getState().closeDocumentsToRight(y,_.id);let Ee=Yn(_e.getState().byThreadKey,y);Le(Ee?.kind==="pull-request"?Ee:null)},aa=()=>{y!==null&&(_e.getState().closeAllDocuments(y),Le(null))},Or=w.isOpen&&S&&ee!==null?a(yc,{widthStorageKey:"ycodium:pull-request-panel-width",defaultWidth:typeof window>"u"?640:Math.floor(window.innerWidth/2),documents:w.documents,activeDocumentId:S.id,onActivate:_=>{_.kind==="pull-request"&&Bo(_)},onCloseDocument:_=>{_.kind==="pull-request"&&Fr(_)},onCloseOtherDocuments:_=>{_.kind==="pull-request"&&Fo(_)},onCloseDocumentsToRight:_=>{_.kind==="pull-request"&&Oo(_)},onCloseAllDocuments:aa,pullRequestStatuses:J,children:a(Dr,{environmentId:ee,reference:{projectId:S.projectId,repository:S.repository,number:S.number},refreshToken:xe,onActed:()=>{X(),Y.refresh(),he.refresh(),le.refresh()},onStateChange:B},S.id)}):null;return a(pu,{className:"h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground",children:a(Ic,{...No,rightPanel:Or})})}Ut();T();function Ec(e){jl(typeof e.notify=="function"?e.notify:()=>{},typeof e.notifyTask=="function"?e.notifyTask:void 0),typeof e.openExternal=="function"&&Xl(e.openExternal),typeof e.writeClipboard=="function"&&Jl(e.writeClipboard),ri(t=>{if(typeof e.openCommandPalette=="function"&&ft(e,"commandPalette")){e.openCommandPalette(t);return}typeof e.notify=="function"&&e.notify(ms,"warning")},ft(e,"commandPalette")),e.composerDraft!==void 0&&ii(e.composerDraft)}function Mc({bridge:e}){let t=e.useFormatTimestamp();return ye(()=>{Ec(e),ti(t)},[e,t]),null}function kg(e){if(["InputGroup","InputGroupAddon","InputGroupInput","DocumentPanel","MasterDetail","useLinkContextMenu"].some(r=>e.ui[r]===void 0)){let r=function(){let n=e.i18n.usePluginTranslation();return a("p",{role:"status",className:"p-6 text-sm text-muted-foreground",children:n("page.hostUpgradeRequired")})};var o=r;return{pages:{"pull-requests":r},panels:{},views:{detail:r}}}return Ec(e),{pages:{"pull-requests":function(){return s(Vr,{value:e,children:[a(Mc,{bridge:e}),a("style",{children:$r}),a("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:a(Ac,{})})]})}},panels:{},views:{detail:function({threadReference:n,...l}){return s(Vr,{value:e,children:[a(Mc,{bridge:e}),a("style",{children:$r}),a("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:a(Dr,{...l,context:n?_u(n,l.reference)?"thread":"page":l.context??"page"})})]})}}}}export{kg as default};
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { definePlugin } from "@ycodium-ai/plugin-api";
3
3
 
4
4
  // ../../packages/plugin-api/src/version.ts
5
- var PLUGIN_API_VERSION = 184;
5
+ var PLUGIN_API_VERSION = 185;
6
6
 
7
7
  // src/hostProject.ts
8
8
  var providerOf = (provider) => provider === "github" || provider === "gitlab" ? provider : "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-pull-requests",
3
- "version": "0.2.5877",
3
+ "version": "0.2.5891",
4
4
  "description": "The pull request page, for GitHub and GitLab.",
5
5
  "keywords": [
6
6
  "pull-requests",
@@ -30,7 +30,7 @@
30
30
  "tailwindcss": "^4.0.0",
31
31
  "typescript": "~6.0.3",
32
32
  "vite-plus": "0.2.2",
33
- "@ycodium-ai/plugin-api": "0.2.5877",
33
+ "@ycodium-ai/plugin-api": "0.2.5891",
34
34
  "ycodium-plugin-testing": "0.0.0"
35
35
  },
36
36
  "ycodium": {