@ycodium-ai/plugin-pull-requests 0.2.3168 → 0.2.3188

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.
Files changed (2) hide show
  1. package/assets/ui.js +4 -1
  2. package/package.json +2 -2
package/assets/ui.js CHANGED
@@ -304,6 +304,9 @@ ${a}`}function Ui(e,a){return[...e.filter(o=>!o.id.startsWith(Tf)),...a]}functio
304
304
  .max-h-72:where(:scope, *) {
305
305
  max-height: calc(var(--spacing, 0.25rem) * 72);
306
306
  }
307
+ .max-h-96:where(:scope, *) {
308
+ max-height: calc(var(--spacing, 0.25rem) * 96);
309
+ }
307
310
  .min-h-0:where(:scope, *) {
308
311
  min-height: calc(var(--spacing, 0.25rem) * 0);
309
312
  }
@@ -1522,4 +1525,4 @@ ${a}`}function Ui(e,a){return[...e.filter(o=>!o.id.startsWith(Tf)),...a]}functio
1522
1525
  }
1523
1526
  }
1524
1527
  }
1525
- `;he();$t();la();sa();var rl=()=>{};function nl(e){rl=e}function ia(){return{shell:{openExternal:async e=>{rl(e)}}}}function ll(e){try{let a=new URL(e),o=/^(.*?)\/-\/merge_requests\/\d+(?:\/|$)/iu.exec(a.pathname)?.[1]??/^(.*?)(?:\/pull\/\d+|\/-\/merge_requests\/\d+)(?:\/|$)/iu.exec(a.pathname)?.[1];return o?(a.pathname=o,a.search="",a.hash="",a.toString()):null}catch{return null}}var Nr=async()=>{};function sl(e){Nr=e}async function il(e){return await Nr(e),!0}function ul(e){return{copyToClipboard:a=>{Nr(a)},isCopied:!1}}_a();var fl=()=>{},pl=!0;function ml(e,a=!0){fl=e,pl=a}function gl(){return pl}function hl(e){fl(e)}he();$t();la();sa();function Xt(e){if(e!==null&&typeof e=="object"&&"cause"in e){let a=e.cause;return a instanceof Error?a:new Error(String(a))}return e instanceof Error?e:new Error(String(e))}function Oo(e){return{getComposerDraft:a=>e.get(a),setPrompt:(a,o)=>e.setPrompt(a,o),setReviewComments:(a,o)=>e.setReviewComments(a,o)}}var xl=Oo({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function yl(e){xl=Oo(e)}var gc=Oo({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function Ho(){let e=Pe();return e.composerDraft===void 0||!fa(e,"composerDraft")?gc:Oo(e.composerDraft)}Ho.getState=()=>xl;function Il(){let e=Pe(),a=typeof e.useCreateThread=="function"?e.useCreateThread():null;return async(o,r)=>a===null||!fa(e,"createThread")?(ye.error(Wt),null):a(o,r)}function vl(e){let a=Pe(),o=typeof a.usePrepareWorkspace=="function"?a.usePrepareWorkspace():async()=>({ok:!1,error:Wt}),[r,l]=C(null);return{error:r,run:async s=>{if(e.cwd===null){let u=new Error("No workspace is available for this checkout.");return l(u),{_tag:"Failure"}}let i=await o({environmentId:e.environmentId,cwd:e.cwd,reference:s.reference,mode:s.mode,...s.threadId===void 0?{}:{threadId:s.threadId}});return i.ok?(l(null),{_tag:"Success",value:i.value}):(l(new Error(i.error)),{_tag:"Failure"})}}}var Ll={listRefs:e=>({command:"listRefs",environmentId:e.environmentId,payload:e.input})};Fe();St();he();ze();A();A();ze();Te();M();function te({className:e}){return t("div",{"aria-hidden":!0,className:S("h-3 rounded bg-muted-foreground/15",e)})}var Qo=["w-3/5","w-2/5","w-1/2","w-2/3","w-2/5","w-3/5","w-1/2"],Et=["w-2/5","w-1/3","w-2/5","w-1/4","w-1/3","w-2/5","w-1/3"];function Ot({rows:e=7,caption:a}){let{t:o}=k();return n("div",{role:"status","aria-label":a??o("ghost.loadingList"),className:"animate-ghost-pulse space-y-0.5",children:[a?t("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground/70",children:a}):null,Array.from({length:e},(r,l)=>n("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2",children:[t(te,{className:"size-4 rounded-full"}),n("div",{className:"min-w-0 space-y-1.5",children:[t(te,{className:S("h-3.5",Qo[l%Qo.length])}),t(te,{className:Et[l%Et.length]})]}),n("div",{className:"flex flex-col items-end gap-1.5",children:[t(te,{className:"w-12"}),t(te,{className:"w-16"})]})]},l))]})}function Pi(){let{t:e}=k();return n("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:[n("div",{className:"shrink-0 border-b border-border/60",children:[n("div",{className:"flex h-7 items-center justify-between gap-3 px-4",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t(te,{className:"w-24"}),t(te,{className:"w-9"})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[t(te,{className:"h-5 w-16 rounded-control-1"}),t(te,{className:"size-5 rounded-control-1"})]})]}),n("div",{className:"px-4 pb-4 pt-1",children:[t(te,{className:"h-5 w-4/5 max-w-md"}),n("div",{className:"mt-2 flex items-center gap-1.5",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:"w-24"})]}),n("div",{className:"mt-4 flex min-w-0 items-center gap-2",children:[t(te,{className:"h-6 w-24 rounded-control-2"}),t(te,{className:"size-3 rounded-full"}),t(te,{className:"h-6 w-32 rounded-control-2"}),n("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[t(te,{className:"w-10"}),t(te,{className:"w-20"})]})]})]}),n("div",{className:"flex min-h-10 items-center justify-between gap-3 border-t border-border/60 px-4 py-2",children:[n("div",{className:"flex items-center gap-1 p-0.5",children:[t(te,{className:"h-6 w-16 rounded-control-2"}),t(te,{className:"h-6 w-16 rounded-control-2"}),t(te,{className:"h-6 w-12 rounded-control-2"})]}),t(te,{className:"w-20"})]})]}),n("div",{className:"min-h-0 flex-1 overflow-hidden",children:[n("section",{className:"px-4 py-3",children:[n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-14"})]}),n("div",{className:"flex items-center gap-1",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:"size-4 rounded-full"}),t(te,{className:"ml-1 size-5 rounded-control-1"})]})]}),n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-10"})]}),n("div",{className:"flex items-center gap-1",children:[t(te,{className:"h-5 w-24 rounded-full"}),t(te,{className:"h-5 w-20 rounded-full"})]})]}),n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-14"})]}),t(te,{className:"w-20"})]})]}),n("section",{className:"border-t border-border/60",children:[n("div",{className:"flex min-h-11 items-center gap-1.5 px-4 py-3",children:[t(te,{className:"h-4 w-24"}),t(te,{className:"size-icon-2 rounded-full"})]}),n("div",{className:"space-y-2 px-4 pb-4",children:[t(te,{className:"w-full"}),t(te,{className:"w-11/12"}),t(te,{className:"w-4/5"}),t(te,{className:"w-2/3"})]})]})]})]})}function Si({rows:e=4}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingPeople"),className:"animate-ghost-pulse space-y-1 p-1",children:Array.from({length:e},(o,r)=>n("div",{className:"flex h-7 items-center gap-2 rounded-control-3 px-2",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:Et[r%Et.length]})]},r))})}function ki({rows:e=6}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingTimeline"),className:"animate-ghost-pulse px-4 py-5",children:t("div",{className:"relative ml-2 border-l border-border/70 pl-5",children:Array.from({length:e},(o,r)=>n("div",{className:"relative pb-5",children:[t(te,{className:"absolute -left-[1.55rem] top-1 size-2 rounded-full"}),t(te,{className:S("h-3.5",Qo[r%Qo.length])}),t(te,{className:"mt-1.5 w-16"})]},r))})})}function qi({rows:e=3}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingConversation"),className:"animate-ghost-pulse space-y-4 py-2",children:Array.from({length:e},(o,r)=>n("div",{className:"flex items-start gap-2",children:[t(te,{className:"size-5 shrink-0 rounded-full"}),n("div",{className:"flex-1 space-y-1.5",children:[t(te,{className:Et[r%Et.length]}),t(te,{className:"w-full"}),t(te,{className:"w-3/4"})]})]},r))})}Fe();ze();A();Te();M();function Zo({error:e,onRetry:a,compact:o=!1}){let{t:r}=k();return n("div",{className:S("flex flex-col items-center justify-center gap-2 text-center",o?"py-3":"min-h-48 px-4 py-10"),children:[t("p",{className:"text-sm font-medium text-foreground",children:r("activity.loadFailed")}),t("p",{className:"max-w-md text-xs text-muted-foreground",children:e}),n(b,{size:"sm",variant:"outline",onClick:a,children:[t(ea,{"aria-hidden":!0}),r("action.retry")]})]})}Fe();Te();A();A();M();function Lo({title:e,error:a,onRetry:o}){let{t:r}=k();return n(qt,{className:"px-4 py-16 md:px-4",children:[t(fi,{variant:"icon",children:t(Xe,{})}),n(Mt,{children:[t(Dt,{children:e??r("list.loadFailedTitle")}),t(At,{children:a})]}),o?t(Tt,{children:n(b,{size:"sm",variant:"outline",onClick:o,children:[t(ea,{}),r("action.retry")]})}):null]})}Fe();he();Ne();Ne();ze();_a();sa();A();A();da();Te();Te();Fe();he();Ne();Ne();Ne();sa();A();A();A();A();da();Ea();M();function Nf(e,a){if(a.length===0)return!0;let o=a.toLowerCase();return e.login.toLowerCase().includes(o)||(e.name??"").toLowerCase().includes(o)}function ou({environmentId:e,reference:a,allowed:o,onRequested:r}){let[l,s]=C(!1),[i,u]=C(""),[f,c]=C(null),{t:d}=k(),p=xa(l?ke.reviewerCandidates({environmentId:e,input:a}):null),m=Oe(ke.act,{reportFailure:!1}),w=V(()=>(p.data?.candidates??[]).filter(x=>Nf(x,i)),[p.data,i]),L=async x=>{if(f!==null)return;c(x.id);let D=await m({environmentId:e,input:{op:"requestReviewers",...a,reviewers:[{id:x.id,kind:x.kind}],requested:!x.isRequested}});if(c(null),D._tag==="Failure"){ye.error(x.isRequested?d("reviewer.withdrawFailedTitle",{login:x.login}):d("reviewer.requestFailedTitle",{login:x.login}),So(Xt(D),d("reviewer.requestFailedHint")));return}ye.success(x.isRequested?d("reviewer.withdrawnTitle",{login:x.login}):d("reviewer.requestedTitle",{login:x.login})),r(),p.refresh()};return o?n(ma,{open:l,onOpenChange:s,children:[t(ha,{render:t(b,{size:"icon-xs",variant:"ghost","aria-label":d("action.requestReviewAria"),children:t(Pt,{})})}),n(ga,{align:"start",side:"bottom",className:"w-72 p-0",children:[t("div",{className:"border-b border-border/60 p-2",children:t(jo,{autoFocus:!0,value:i,onChange:x=>u(x.currentTarget.value),placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact"})}),n("div",{className:"max-h-72 overflow-y-auto p-1",children:[p.isPending?t(Si,{rows:4}):p.error!==null?t("p",{className:"p-2 text-xs text-muted-foreground",children:d("reviewer.peopleUnreadable",{error:p.error})}):w.length===0?t("p",{className:"p-2 text-xs text-muted-foreground",children:i.length>0?d("reviewer.noMatches"):d("reviewer.noAccess")}):w.map(x=>n("button",{type:"button",disabled:f!==null,onClick:()=>{L(x)},className:"relative flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:[t(wa,{actor:x,className:"min-w-0 flex-1 truncate"}),x.kind==="team"?t("span",{className:"shrink-0 text-muted-foreground",children:d("reviewer.team")}):null,x.isRequested?t(lt,{"aria-label":d("action.alreadyAskedAria"),className:"size-icon-2 shrink-0"}):null]},`${x.kind}:${x.id}`)),p.data?.truncated?t("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:d("reviewer.truncatedNotice")}):null]})]})]}):n(re,{children:[t(le,{render:t(b,{size:"icon-xs",variant:"ghost",disabled:!0,"aria-label":d("action.requestReviewAria"),children:t(Pt,{})})}),t(ne,{side:"bottom",children:d("reviewer.writeAccessRequired")})]})}Ea();Ut();ko();Gt();qo();ir();Fe();he();Ne();Ne();ze();_a();sa();A();A();A();A();da();Te();Gt();qo();function xu(e){let a=e.sectionTop<e.viewportTop,o=e.headingTop<=e.viewportTop+1;return!a||!o?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}M();function Kt(e){return e.toLowerCase()}function yu(e){let a=e?.trim().replace(/^#/,"")??"";return/^[0-9a-fA-F]{6}$/.test(a)?`#${a}`:null}function In({actor:e}){let a=e?.login??"ghost";return n(re,{children:[t(le,{render:t("span",{className:"shrink-0 rounded-full","aria-label":a}),children:t(ht,{actor:e})}),t(ne,{side:"bottom",children:e?.name&&e.name!==a?`${e.name} (@${a})`:a})]})}function Iu(e){let a=e.toLowerCase().replace(/_/g," ");return a.charAt(0).toUpperCase()+a.slice(1)}function vn({comment:e,editing:a,className:o}){let{t:r}=k();return a.editingId===e.id?t(Ja,{className:o,value:e.body,cwd:a.cwd,environmentId:a.environmentId,label:r("action.editComment"),saving:a.saving,onSave:l=>a.onSave(e,l),onCancel:()=>a.onEdit(null)}):n("div",{className:S("flex items-start gap-1",o),children:[t(ba,{className:"min-w-0 flex-1",text:e.body,cwd:a.cwd,environmentId:a.environmentId}),a.canEdit(e)?t(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:()=>a.onEdit(e),children:t(ra,{className:"size-3"})}):null]})}function vu({comment:e,editing:a,label:o,body:r,reactionBar:l}){let[s,i]=C(!1);return t(pt,{open:s,onOpenChange:i,children:n("article",{className:"group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]",children:[n(gt,{className:S("flex w-full items-center gap-2 p-3 text-left transition-opacity hover:opacity-100",s?"opacity-100":"opacity-65"),children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[t(In,{actor:e.author}),t("span",{children:Ge(e.createdAt)}),t("span",{children:o})]}),t(Ye,{"aria-hidden":!0,className:S("size-icon-1 shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),t(mt,{children:s?n("div",{className:"px-3 pb-3",children:[e.path?n(re,{children:[t(le,{render:t("p",{className:"truncate text-xs text-muted-foreground",children:e.path})}),t(ne,{side:"top",children:e.path})]}):null,r===null&&!a.canEdit(e)?null:t(vn,{className:"mt-2",comment:e,editing:a}),l]}):null})]})})}function ur({icon:e,label:a,children:o}){return n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 py-1.5 text-xs",children:[n("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[e,a]}),t("span",{className:"min-w-0 text-foreground",children:o})]})}function dr({title:e,count:a,defaultOpen:o=!0,actions:r,children:l}){let[s,i]=C(o),u=Ee(null);return n(pt,{open:s,onOpenChange:c=>{if(!c){let d=u.current,p=d?.closest("[data-pull-request-summary-section]"),m=d?.closest("[data-pull-request-summary-scroll]");if(d&&p&&m){let w=xu({scrollTop:m.scrollTop,viewportTop:m.getBoundingClientRect().top,sectionTop:p.getBoundingClientRect().top,headingTop:d.getBoundingClientRect().top});w!==null&&(m.scrollTop=w)}}i(c)},"data-pull-request-summary-section":!0,children:[n("div",{ref:u,className:"sticky top-0 z-10 flex w-full items-center border-t border-border/60 bg-background pr-4",children:[n(gt,{className:"flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-sm font-medium",children:[t("span",{children:e}),t(Jt,{"aria-hidden":!0,className:S("size-icon-1 text-muted-foreground transition-transform",s&&"rotate-90")}),a===void 0?null:t("span",{className:"text-xs tabular-nums text-muted-foreground",children:a})]}),s?r:null]}),t(mt,{children:t("div",{className:"px-4 pb-4",children:l})})]})}function Lu({environmentId:e,detail:a,onCommented:o}){let{t:r}=k(),[l,s]=C(""),[i,u]=C(!1),f=Oe(ke.converse,{reportFailure:!1}),c=async()=>{let d=l.trim();if(d.length===0||i)return;u(!0);let p=await f({environmentId:e,input:{op:"comment",projectId:a.projectId,repository:a.repository,number:a.number,body:d}});if(u(!1),p._tag==="Failure"){ye.error(r("notify.commentPostFailed"));return}s(""),o()};return n("div",{className:"mt-3 space-y-2",children:[t(Qa,{disabled:i,value:l,rows:3,placeholder:r("summary.commentPlaceholder"),"aria-label":r("summary.commentAria"),onChange:d=>s(d.target.value)}),t("div",{className:"flex justify-end",children:n(b,{size:"xs",variant:"outline",disabled:l.trim().length===0||i,onClick:()=>{c()},children:[t(go,{}),r(i?"action.posting":"action.comment")]})})]})}M();var cr=30;function wu({environmentId:e,reference:a,detail:o,activityPending:r,activityError:l,pendingFinding:s,fixFindingLabel:i,fixCheckLabel:u,onFixFinding:f,onRefresh:c}){let{t:d}=k(),p=d(i??"thread.fixInThread"),m=d(u??"handoff.fix"),[w,L]=C({url:o.url,count:cr}),x=w.url===o.url?w.count:cr,D=o.comments.slice(Math.max(0,o.comments.length-x)),v=o.comments.length-D.length,[y,_]=C("newest"),oe=Ji(D,y),j=nr(o.comments,o.commits),H=new Map(j.flatMap(g=>g.actor?[[Kt(g.actor.login),g]]:[])),G=[...o.reviewers.map(g=>({key:g.login,actor:g,outcome:H.get(Kt(g.login))?.outcome??null,stale:H.get(Kt(g.login))?.stale??!1})),...j.filter(g=>!o.reviewers.some($=>g.actor!==null&&Kt($.login)===Kt(g.actor.login))).map(g=>({key:g.key,actor:g.actor,outcome:g.outcome,stale:g.stale}))],T=new Map(o.reviewThreads.flatMap(g=>g.comments.map($=>[$.id,g]))),K=g=>{ia()?.shell.openExternal(g)},U=Oe(ke.act,{reportFailure:!1}),J=Oe(ke.converse,{reportFailure:!1}),[B,E]=C(null),[Y,W]=C(!1),[ce,se]=C(null),[xe,fe]=C(!1),ie=ce?.pullRequest===o.url?ce.commentId:null,Ce=async g=>{if(Y)return;W(!0);let $=await U({environmentId:e,input:{op:"update",...a,body:g}});if(W(!1),$._tag==="Failure"){ye.error(d("notify.descriptionSaveFailed"));return}E(null),c()},ae={cwd:o.workspaceRoot,environmentId:e,canEdit:g=>_t(o,g),editingId:ie,saving:xe,onEdit:g=>se(g===null?null:{pullRequest:o.url,commentId:g.id}),onSave:async(g,$)=>{if(xe||g.kind==="review")return;fe(!0);let N=await J({environmentId:e,input:{op:"updateComment",...a,commentId:g.id,kind:g.kind,body:$}});if(fe(!1),N._tag==="Failure"){ye.error(d("notify.commentSaveFailed"));return}se(null),c()}};return n("div",{className:"h-full overflow-y-auto","data-pull-request-summary-scroll":!0,children:[t("section",{className:"px-4 py-3",children:n("div",{children:[t(ur,{icon:t(Io,{className:"size-icon-2"}),label:d("summary.reviewers"),children:n("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[G.length===0?t("span",{className:"text-muted-foreground",children:d("summary.none")}):t("span",{className:"flex items-center -space-x-1",children:G.map(g=>{let $=g.actor?.login??"ghost",N=g.actor?.name&&g.actor.name!==$?`${g.actor.name} (@${$})`:$;return n(re,{children:[n(le,{render:t("span",{className:S("relative rounded-full hover:z-10",g.outcome?Ni(g.outcome,g.stale):void 0)}),children:[t(wa,{actor:g.actor,tooltip:!1,className:S("gap-0 [&>span:last-child]:sr-only",g.outcome?void 0:"[&>img]:ring-2 [&>img]:ring-background [&>span:first-child]:ring-2 [&>span:first-child]:ring-background")}),g.outcome?t("span",{className:"sr-only",children:d(g.stale?bo(g.outcome):Ro(g.outcome))}):null]}),t(ne,{side:"bottom",children:g.outcome?`${N} \u2014 ${g.stale?d(bo(g.outcome)):d(Ro(g.outcome))}`:N})]},g.key)})}),o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?t(ou,{environmentId:e,reference:a,allowed:o.viewerPermissions.requestReviewers,onRequested:c}):null]})}),o.labels.length>0?t(ur,{icon:t(xo,{className:"size-icon-2"}),label:d("summary.labels"),children:t("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:o.labels.map(g=>{let $=yu(g.color);return n("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:[t("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full bg-muted-foreground",...$?{style:{backgroundColor:$}}:{}}),t("span",{className:"truncate",children:g.name})]},g.name)})})}):null,t(ur,{icon:t(Qe,{className:"size-icon-2"}),label:d("summary.comments"),children:r?d("summary.loadingConversation"):l?d("summary.conversationUnavailable"):d("comment.count",{count:o.commentCount})})]})}),t(dr,{title:d("summary.description"),children:n("div",{className:"group",children:[B===o.url?t(Ja,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:e,label:d("summary.descriptionAria"),placeholder:d("summary.descriptionPlaceholder"),saving:Y,onSave:g=>{Ce(g)},onCancel:()=>E(null)}):n("div",{className:"flex items-start gap-1",children:[t(ba,{className:"min-w-0 flex-1",text:o.body.trim().length>0?o.body:d("summary.noDescription"),cwd:o.workspaceRoot,environmentId:e}),lr(o)?t(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:()=>E(o.url),children:t(ra,{className:"size-3"})}):null]}),t(Oa,{className:"mt-2",reactions:o.reactions??[],canReact:o.capabilities.reactions===!0,environmentId:e,reference:a,onRefresh:c})]})}),t(dr,{title:d("checks.title"),count:o.checks.length,children:o.checks.length===0?t("p",{className:"text-xs text-muted-foreground",children:d("checks.noneReported")}):t("div",{className:"space-y-0.5",children:o.checks.map((g,$)=>{let N={kind:"check",check:g},X=g.status==="failure"||g.status==="cancelled";return n("div",{className:"group flex items-center gap-1 rounded-md pr-1 hover:bg-accent",children:[n("button",{type:"button",disabled:!g.url,onClick:()=>g.url&&K(g.url),className:S("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",g.url?void 0:"cursor-default"),children:[t(Yo,{status:g.status}),t("span",{className:"min-w-0 flex-1 truncate",children:g.name}),t("span",{className:"shrink-0 text-muted-foreground",children:d(Jo(g.status))})]}),f&&X?n(b,{size:"xs",variant:"ghost",className:"shrink-0",disabled:s!=null,onClick:()=>f(N),children:[t(va,{className:"size-3"}),s===Za(N)?d("action.preparing"):m]}):null]},`${$}:${g.name}:${g.url??""}`)})})}),n(dr,{title:d("summary.comments"),...r||l?{}:{count:o.commentCount},actions:!r&&!l&&o.comments.length>0?n(b,{size:"xs",variant:"ghost",className:"h-7 shrink-0 px-2 text-[10px] text-muted-foreground","aria-label":d(y==="newest"?"summary.commentsOldestAria":"summary.commentsNewestAria"),onClick:()=>_(g=>g==="newest"?"oldest":"newest"),children:[t(nt,{"aria-hidden":!0,className:"size-3"}),d(y==="newest"?"sort.newestFirst":"sort.oldestFirst")]}):null,children:[r?t(qi,{}):l?t(Zo,{compact:!0,error:l,onRetry:c}):n(Se,{children:[o.commentsTruncated?t("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?t("p",{className:"py-2 text-xs text-muted-foreground",children:d("summary.noComments")}):n("div",{className:"space-y-3",children:[v>0?t(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>L({url:o.url,count:x+cr}),children:d("summary.showEarlier",{count:Math.min(v,cr)})}):null,oe.map(g=>{let $=T.get(g.id),N=xt(g.body),X=zt(g.reviewState);if($?.isResolved||X==="dismissed")return t(vu,{comment:g,editing:ae,label:$?.isResolved?d("thread.resolved"):d("summary.approvalDismissed"),body:N,reactionBar:t(Oa,{className:"mt-2",reactions:g.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:g.id,environmentId:e,reference:a,onRefresh:c})},g.id);let pe=g.kind!=="review"&&g.kind!=="review-comment"||X==="approved"?null:$===void 0?N===null?null:{kind:"comment",comment:g}:{kind:"thread",thread:$},R=t(Oa,{reactions:g.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:g.id,environmentId:e,reference:a,onRefresh:c,...N===null?{}:{className:"mt-2"}});return n("article",{className:"group rounded-lg border border-border/60 p-3 [contain-intrinsic-block-size:120px] [content-visibility:auto]",children:[n("div",{className:"flex items-start gap-2",children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[t(In,{actor:g.author}),t("span",{children:Ge(g.createdAt)}),X?t(Fi,{outcome:X}):g.reviewState?t("span",{children:Iu(g.reviewState)}):null,N===null?R:null]}),f&&pe?n(b,{size:"xs",variant:"ghost",className:"-mt-1 shrink-0",disabled:s!=null,onClick:()=>f(pe),children:[t(va,{className:"size-3"}),s===Za(pe)?d("action.preparing"):p]}):null]}),g.path?n(re,{children:[t(le,{render:t("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:g.path})}),t(ne,{side:"top",children:g.path})]}):null,N===null&&!ae.canEdit(g)?null:t(vn,{className:"mt-2",comment:g,editing:ae}),N===null?null:R]},g.id)})]})]}),o.capabilities.comment&&o.viewerPermissions.comment?t(Lu,{environmentId:e,detail:o,onCommented:c},`${e}:${o.projectId}/${o.repository}#${o.number}`):null]})]})}Fe();he();ze();Te();Ne();Ne();_a();sa();A();A();A();Ea();ko();Gt();qo();ir();da();M();function Cu({body:e,markdown:a,cwd:o,environmentId:r}){return t("div",{className:"mt-3",children:a?t(ba,{text:e,cwd:o,environmentId:r}):t("p",{className:"whitespace-pre-wrap text-xs text-muted-foreground",children:e})})}function Ln({actor:e}){return t("span",{className:"font-semibold text-foreground",children:e?.login??"ghost"})}function bu({children:e,className:a}){return t("span",{className:S("absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background",a),children:e})}function Ru({icon:e,className:a}){return t(bu,{className:a,children:t("span",{className:"flex size-7 items-center justify-center bg-background text-muted-foreground",children:e})})}function wn({actors:e,className:a,fallback:o,muted:r=!1}){let l=e[0];return l===void 0?t(Ru,{className:a,icon:o}):t(bu,{className:a,children:t(ht,{actor:l,className:S("size-7 bg-muted text-[9px] transition-opacity",r&&"opacity-45 grayscale")})})}function Jf(e){return e.toLowerCase().replaceAll("_"," ").replaceAll("-"," ").replace(/^\w/u,o=>o.toUpperCase())}function Yf({state:e}){return t("span",{className:"text-[10px] font-medium text-muted-foreground",children:Jf(e)})}function Pu({url:e,onOpen:a}){let{t:o}=k();return e===null?null:t(b,{size:"icon-xs",variant:"ghost",className:"-mr-1 -mt-1 shrink-0 text-muted-foreground","aria-label":o("timeline.openActivityAria"),onClick:()=>a(e),children:t(it,{className:"size-3"})})}function ep({event:e,editable:a,cwd:o,onOpen:r,reactions:l}){let{t:s}=k(),[i,u]=C(!1),[f,c]=C(!1),d=Oe(ke.converse,{reportFailure:!1}),p=async m=>{if(a===null||f||a.kind==="review")return;c(!0);let w=await d({environmentId:l.environmentId,input:{op:"updateComment",...l.reference,commentId:a.id,kind:a.kind,body:m}});if(c(!1),w._tag==="Failure"){ye.error(s("notify.commentSaveFailed"));return}u(!1),l.onRefresh()};return n("article",{className:"group py-2",children:[t("div",{className:"px-2",children:n("div",{className:"flex min-w-0 items-start gap-2",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[t(Ln,{actor:e.actor}),t("span",{className:"text-muted-foreground",children:s(e.titleKey,e.titleValues)}),e.reviewState?t(Yf,{state:e.reviewState}):null]}),n(Ca,{className:"mt-1 flex-wrap text-[11px] text-muted-foreground",children:[t("span",{children:Ge(e.at)}),e.path?n("span",{className:"inline-flex min-w-0 items-center gap-1",children:[t(qa,{"aria-hidden":!0,className:"size-3 shrink-0"}),t("span",{className:"truncate",children:e.path})]}):null]})]}),a!==null&&!i?t(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":s("action.editComment"),onClick:()=>u(!0),children:t(ra,{className:"size-3"})}):null,t(Pu,{url:e.url,onOpen:r})]})}),i&&a!==null?t("div",{className:"px-2 pb-2 pt-3",children:t(Ja,{value:a.body,cwd:o,environmentId:l.environmentId,label:s("action.editComment"),saving:f,onSave:m=>{p(m)},onCancel:()=>u(!1)})}):e.body?t("div",{className:"px-2 pb-2",children:t(Cu,{body:e.body,markdown:e.markdown,cwd:o,environmentId:l.environmentId})}):null,l.canReact||e.reactions.length>0?t("div",{className:"px-2 pb-2",children:t(Oa,{reactions:e.reactions,canReact:l.canReact,subjectId:e.id,environmentId:l.environmentId,reference:l.reference,onRefresh:l.onRefresh})}):null]})}function ap(e){let a=new Map;for(let o of e){let r=o.actor;r!==null&&!a.has(r.login)&&a.set(r.login,r)}return[...a.values()]}function tp({events:e,editable:a,cwd:o,onOpen:r,reactions:l}){let{t:s}=k(),[i,u]=C(!1),f=ap(e),c=e[0];return c===void 0?null:n("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(wn,{actors:f,className:"top-6",fallback:t(Qe,{className:"size-icon-2"}),muted:!i}),t(pt,{open:i,onOpenChange:u,children:n("div",{children:[n(gt,{className:S("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:[n("span",{className:"min-w-0 flex-1",children:[t("span",{className:"block text-xs font-semibold",children:s("timeline.commentCount",{count:e.length,total:e.length.toLocaleString()})}),n("span",{className:"block truncate text-[10px] text-muted-foreground",children:[s("timeline.authorCount",{count:f.length,total:f.length.toLocaleString()})," ","\xB7 ",Ge(c.at)]})]}),t(Ye,{"aria-hidden":!0,className:S("size-icon-1 shrink-0 text-muted-foreground transition-transform",i&&"rotate-180")})]}),t(mt,{children:i?t("div",{className:"mt-1 space-y-1",children:e.map(d=>t(ep,{event:d,editable:a.get(d.id)??null,cwd:o,onOpen:r,reactions:l},`${l.reference.projectId}#${l.reference.number}:${d.id}`))}):null})]})})]})}function op({event:e,onOpen:a}){let{t:o}=k();return n("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:()=>a(e.id),children:[t(wn,{actors:e.commitAuthors,fallback:t(Ia,{className:"size-icon-2"})}),n("div",{className:"flex min-w-0 items-center gap-2.5 py-1.5",children:[n("div",{className:"min-w-0 flex-1",children:[t("div",{className:"truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary",children:e.body??o("timeline.untitledCommit")}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:[t("code",{className:"font-mono",children:e.id.slice(0,7)}),t("span",{children:Ge(e.at)})]})]}),e.additions!==null&&e.deletions!==null?t(Fa,{additions:e.additions,deletions:e.deletions,className:"ml-auto shrink-0 font-mono text-[10px]"}):null]})]})}function rp({event:e}){let{t:a}=k(),o=e.kind==="opened"?{icon:t(Xe,{className:"size-icon-2"}),label:a("timeline.eventOpened")}:e.kind==="merged"?{icon:t(Ve,{className:"size-icon-2"}),label:a("timeline.merged")}:{icon:t(pa,{className:"size-icon-2"}),label:a("timeline.closed")};return n("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(Ru,{icon:o.icon}),n("div",{className:"py-1.5 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.actor?t(Ln,{actor:e.actor}):null,t("span",{className:"font-semibold text-foreground",children:o.label})]}),t("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:Ge(e.at)})]})]})}function np({event:e,outcome:a,stale:o,cwd:r,onOpen:l,reactions:s}){let{t:i}=k();return n("div",{className:"group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(wn,{actors:e.actor?[e.actor]:[],className:"top-6",fallback:t(ar,{outcome:a})}),n("div",{className:"flex min-w-0 items-start gap-2 py-1.5",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[t(Ln,{actor:e.actor}),n(re,{disabled:!o,children:[n(le,{render:t("span",{className:S("font-medium lowercase",o?"text-muted-foreground opacity-70":er(a))}),children:[i(Ro(a)),o?t("span",{className:"sr-only",children:i("reviewOutcome.beforeLatestCommits")}):null]}),t(ne,{children:i(bo(a))})]})]}),n("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[n(Ca,{className:"flex-wrap text-[11px] text-muted-foreground",children:[t("span",{children:Ge(e.at)}),e.path?n("span",{className:"inline-flex min-w-0 items-center gap-1",children:[t(qa,{"aria-hidden":!0,className:"size-3 shrink-0"}),t("span",{className:"truncate",children:e.path})]}):null]}),s.canReact||e.reactions.length>0?t(Oa,{reactions:e.reactions,canReact:s.canReact,subjectId:e.id,environmentId:s.environmentId,reference:s.reference,onRefresh:s.onRefresh}):null]}),e.body?t(Cu,{body:e.body,markdown:e.markdown,cwd:r,environmentId:s.environmentId}):null]}),t(Pu,{url:e.url,onOpen:l})]})]})}function Su({detail:e,environmentId:a,reference:o,order:r,onOpenCommit:l,onRefresh:s}){let{t:i}=k(),u=eu(e),f=mn(e.commits),c={canReact:e.capabilities.reactions===!0,environmentId:a,reference:o,onRefresh:s},d=new Map(e.comments.filter(L=>_t(e,L)).map(L=>[L.id,L])),p=r==="newest"?u:u.toReversed(),m=Yi(p),w=L=>{ia()?.shell.openExternal(L)};return t("div",{className:"h-full overflow-y-auto px-4 py-5",children:n("div",{className:"mx-auto max-w-3xl",children:[n("div",{className:"relative",children:[t("span",{"aria-hidden":!0,className:"absolute bottom-5 left-[15px] top-1 w-px bg-border/45"}),m.map(L=>{if(L.kind==="comments")return t(tp,{events:L.events,editable:d,cwd:e.workspaceRoot,onOpen:w,reactions:c},`comments:${L.events[0]?.id??"empty"}`);let x=L.event;if(x.kind==="commit")return t(op,{event:x,onOpen:l},x.id);let D=zt(x.reviewState);return D!==null?t(np,{event:x,outcome:D,stale:gn(x.at,f),cwd:e.workspaceRoot,onOpen:w,reactions:c},x.id):t(rp,{event:x},x.id)})]}),u.length===0?n("div",{className:"flex flex-col items-center justify-center py-16 text-center text-muted-foreground",children:[t(Xe,{className:"mb-2 size-5"}),t("p",{className:"text-xs",children:i("timeline.noActivity")})]}):null]})})}Te();Fe();he();ze();A();A();A();la();Te();Fe();function Ya(e){return e==="gitlab"?{label:"GitLab",providerName:"GitLab",Icon:ro}:e==="github"?{label:"GitHub",providerName:"GitHub",Icon:oo}:{label:e,providerName:e,Icon:Ta}}function fr(){let{t:e}=k();return a=>{let o=Ya(a).providerName;return o===a?e("link.openOnHostGeneric"):e("link.openOnHost",{host:o})}}function pr(){return Pe().ui.useLinkContextMenu()}function mr(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function ku(e,a,o){let r=new Map(a.map((i,u)=>[i,u])),l=new Map;for(let i of e){let u=mr(i);if(!u)continue;let f=r.get(i.environmentId);if(f===void 0)continue;let c=l.get(u);if(c===void 0){l.set(u,i.environmentId);continue}c!==o&&(i.environmentId===o||f<(r.get(c)??Number.MAX_SAFE_INTEGER))&&l.set(u,i.environmentId)}let s=new Map;for(let i of e){if(!r.has(i.environmentId))continue;let u=mr(i);if(u&&l.get(u)!==i.environmentId)continue;let f=s.get(i.environmentId);f===void 0?s.set(i.environmentId,[i.id]):f.push(i.id)}return s}function qu(e,a,o){let r=a.find(u=>u.environmentId===e.environmentId&&u.id===e.projectId),l=r===void 0?void 0:mr(r),s=o.find(u=>u.environmentId===e.environmentId)?.label;if(r===void 0||!l||s===void 0)return[];let i=o.flatMap(u=>{if(u.environmentId===e.environmentId)return[];let f=a.find(c=>c.environmentId===u.environmentId&&mr(c)===l);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:s},...i]}M();function Xu({label:e}){let{t:a}=k();return t("p",{className:"p-4 text-sm text-muted-foreground",children:e??a("detail.loadingLabel")})}var Qu={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"},Ir={merge:"mergeMethod.merge",squash:"mergeMethod.squash",rebase:"mergeMethod.rebase"},Zu={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"},Ju={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"},Yu="notify.hintUpdateBranchRebase",ed=[{value:"summary",labelKey:"detail.tabSummary"},{value:"timeline",labelKey:"detail.tabTimeline"},{value:"code",labelKey:"detail.tabCode"}],Sn=()=>Promise.resolve().then(()=>($u(),Wu)),ad=$n(Sn);function kn({environments:e,value:a,onChange:o,disabled:r}){return n(Se,{children:[t(je,{}),t(Na,{value:a,onValueChange:l=>o(l),children:e.map(l=>t(La,{value:l.environmentId,disabled:r,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(ct,{className:"size-icon-2 shrink-0"}),t("span",{className:"truncate",children:l.label})]})},l.environmentId))})]})}var qn=(e,a,o,r)=>{a.preventDefault(),a.stopPropagation(),e({url:o.url,openLabel:r,position:{x:a.clientX,y:a.clientY}})};function Tn({baseBranch:e,freshness:a,pending:o,onUpdate:r,iconClassName:l}){let{t:s}=k(),i=a.behindBy===null?s("detail.outOfDate",{branch:e}):s("detail.outOfDateBehind",{branch:e,count:a.behindBy,total:a.behindBy.toLocaleString()});return n(Bt,{children:[t(Ft,{openOnHover:!0,delay:0,closeDelay:120,render:t("button",{type:"button","aria-label":i,className:"inline-flex shrink-0 cursor-help items-center rounded-sm text-warning-foreground"}),children:t(aa,{"aria-hidden":!0,className:S("size-icon-2",l)})}),n(Nt,{align:"start",side:"bottom",className:"max-w-80",viewportClassName:"py-2.5 [--viewport-inline-padding:--spacing(3)]",children:[t("p",{className:"text-xs text-foreground",children:i}),t("p",{className:"mt-0.5 text-xs text-muted-foreground",children:s("detail.cleanlyMergeable")}),a.methods.length>0?t("span",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:a.methods.map(u=>n(b,{size:"xs",variant:"outline",disabled:o,onClick:()=>r(u),children:[t(Ve,{"aria-hidden":!0,className:"size-3"}),s(u==="rebase"?"detail.updateWithRebase":"detail.updateBranch")]},u))}):null]})]})}Fe();A();A();A();A();Ea();M();function td({state:e,onClose:a}){let{t:o,openOnHostLabel:r,pullRequestKey:l,setMergeMethod:s,setConfirmation:i,handoff:u,detailQuery:f,detail:c,refreshFromHost:d,pendingAction:p,actionPending:m,handoffUnsupportedReason:w,handoffBlocked:L,withBlockedReason:x,pickableEnvironments:D,setActingScope:v,actingEnvironmentId:y,perform:_,attachTarget:oe,handoffLabels:j,askAboutPullRequest:H,explainPullRequest:G,startCheckout:T,startFixFindings:K,startResolveConflicts:U,allowedMergeMethods:J,selectedMergeMethod:B,selectedMergeMethodLabel:E,conflicting:Y,autoMergeArmed:W,can:ce,primaryAction:se,showsDraftToggle:xe,showsAutoMerge:fe,showsMergeMethods:ie,context:Ce}=e;return n("div",{className:"mr-4 flex h-7 min-w-0 flex-nowrap items-center justify-end gap-1",children:[c?n(Se,{children:[Ce==="page"&&L?x(n(b,{size:"xs",variant:"outline",softDisabled:!0,children:[t(Ta,{"aria-hidden":!0}),o("detail.checkOut"),t(Ye,{"aria-hidden":!0,className:"text-muted-foreground"})]})):Ce==="page"?n(ma,{children:[t(ha,{disabled:u!==null,render:n(b,{size:"xs",variant:"outline",children:[t(Ta,{"aria-hidden":!0}),u?.startsWith("checkout")?o("detail.checkingOut"):o("detail.checkOut"),t(Ye,{"aria-hidden":!0,className:"text-muted-foreground"})]})}),n(ga,{align:"end",side:"bottom",className:"min-w-72",children:[n(Ue,{onClick:()=>T("worktree"),children:[t(Ta,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o("detail.checkoutInWorktreeTitle")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInWorktreeDetail")})]})]}),n(Ue,{onClick:()=>T("local"),children:[t(ut,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o("detail.checkoutInRepositoryTitle")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInRepositoryDetail")})]})]}),D.length>0?t(kn,{environments:D,value:y,onChange:ae=>v({pullRequestKey:l,environmentId:ae}),disabled:u!==null}):null]})]}):null,W?n(re,{children:[t(le,{render:n($o,{variant:"info",className:"h-5 shrink-0 gap-1 rounded px-1.5 text-[10px]",children:[t(Ve,{"aria-hidden":!0,className:"size-3"}),o("detail.autoMerge")]})}),t(ne,{side:"top",children:o("detail.autoMergeHint")})]}):null,se==="resolve"?x(n(b,{size:"xs",variant:"destructive-outline",disabled:u!==null,softDisabled:L,onClick:U,children:[t(aa,{}),o(u==="conflicts"?"action.preparing":"detail.resolveConflicts")]})):se==="ready"?t(b,{size:"xs",disabled:m,onClick:()=>{_("ready")},children:o("detail.readyForReview")}):se==="merge"?t(b,{size:"xs",disabled:m,onClick:()=>i({open:!0,action:"merge"}),children:p==="merge"?o("detail.merging"):E}):null,n(ma,{children:[t(ha,{render:t(b,{"aria-label":o("detail.moreActionsAria"),className:"size-6",size:"icon-xs",variant:"ghost-muted"}),children:t(Ka,{className:"size-4"})}),n(ga,{align:"end",side:"bottom",className:"min-w-72",children:[n(Ue,{disabled:f.isPending,onClick:()=>{d()},children:[t(ea,{className:"size-icon-2"}),o("action.refresh")]}),w!==null?t(Ue,{disabled:!0,children:t("span",{className:"text-xs text-muted-foreground",children:o(w)})}):null,n(Ue,{disabled:u!==null||L,onClick:H,children:[t(Va,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o(u==="ask"?"detail.opening":"detail.askQuestion")}),t("span",{className:"text-xs text-muted-foreground",children:o(oe!==null?"detail.askQuestionInThread":"detail.askQuestionNewThread")})]})]}),n(Ue,{disabled:u!==null||L,onClick:G,children:[t(Zt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o(u==="explain"?"detail.opening":"detail.explainPullRequest")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.explainPullRequestHint")})]})]}),n(Ue,{disabled:u!==null||L,onClick:K,children:[t(va,{className:"size-icon-2"}),o(u==="findings"?"action.preparing":j.fixFindings)]}),D.length>0?t(kn,{environments:D,value:y,onChange:ae=>v({pullRequestKey:l,environmentId:ae}),disabled:u!==null}):null,t(je,{}),c.state==="open"?n(Se,{children:[xe?n(Ue,{disabled:m,onClick:()=>{_(c.isDraft?"ready":"draft")},children:[c.isDraft?t(Xe,{className:"size-icon-2"}):t(Aa,{className:"size-icon-2"}),c.isDraft?o("detail.readyForReview"):o("detail.convertToDraft")]}):null,W&&ce("disable-auto-merge")?n(Ue,{disabled:m,onClick:()=>{_("disable-auto-merge")},children:[t(Ve,{className:"size-icon-2"}),o("detail.disableAutoMerge")]}):!W&&!c.isDraft&&!Y&&ce("enable-auto-merge")&&J.length>0?n(Ue,{disabled:m,onClick:()=>i({open:!0,action:"enable-auto-merge"}),children:[t(Ve,{className:"size-icon-2"}),o("detail.enableAutoMerge")]}):null,ie?n(Se,{children:[xe?t(je,{}):null,t(Na,{value:B,onValueChange:ae=>s(ae),children:J.map(ae=>t(La,{value:ae,disabled:m,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(Ve,{className:"size-icon-2"}),t("span",{children:o(Ir[ae])})]})},ae))})]}):null,Qi(xe,fe,ie)?t(je,{}):null]}):null,n(Ue,{onClick:()=>{ia()?.shell.openExternal(c.url)},children:[t(Qt,{className:"size-icon-2"}),r(c.provider)]}),n(Ue,{onClick:()=>{il(c.url)},children:[t(no,{className:"size-icon-2"}),o("detail.copyLink")]}),c.state==="open"&&ce("close")?n(Se,{children:[t(je,{}),n(Ue,{variant:"destructive",disabled:m,onClick:()=>i({open:!0,action:"close"}),children:[t(pa,{className:"size-icon-2"}),o("detail.closePullRequest")]})]}):c.state==="closed"&&ce("reopen")?n(Se,{children:[t(je,{}),n(Ue,{disabled:m,onClick:()=>{_("reopen")},children:[t(Xe,{className:"size-icon-2"}),o("detail.reopenPullRequest")]})]}):null]})]})]}):null,a?t(b,{size:"icon-xs",variant:"ghost","aria-label":o("detail.collapsePanelAria"),onClick:a,children:t(dt,{})}):null]})}Fe();ze();_a();A();A();A();A();ko();Te();ze();Ne();Ne();A();A();da();M();function dp({environmentId:e,reference:a}){let{t:o}=k(),r=xa(ke.detail({environmentId:e,input:a}));if(r.error!==null)return t("p",{className:"text-muted-foreground text-xs",children:r.error});if(r.data===null)return t("p",{className:"text-muted-foreground text-xs",children:r.isPending?o("checks.loading"):o("checks.summaryNoneReported")});let l=r.data?.checks;return l===void 0?t("p",{className:"text-muted-foreground text-xs",children:o("checks.summaryNoneReported")}):t(od,{checks:l})}function od({checks:e}){let{t:a}=k();return e.length===0?t("p",{className:"text-muted-foreground text-xs",children:a("checks.summaryNoneReported")}):t("ul",{className:"flex flex-col gap-1",children:e.map((o,r)=>n("li",{className:"flex items-center gap-2 text-xs",children:[t(Yo,{status:o.status}),n(re,{children:[t(le,{render:t("span",{className:"min-w-0 flex-1 truncate",children:o.name})}),t(ne,{side:"top",children:o.description??o.name})]}),t("span",{className:"shrink-0 text-muted-foreground",children:a(Jo(o.status))}),o.url===null?null:t("button",{type:"button",className:"shrink-0 text-primary hover:underline",onClick:()=>{ia()?.shell.openExternal(o.url??"")},children:a("action.details")})]},`${r}:${o.name}`))})}function vr({checksState:e,checks:a,environmentId:o,reference:r,className:l}){let{t:s}=k(),i=Di(e),u=a===void 0?null:tr(a);return n(Bt,{children:[t(Ft,{render:t("span",{role:"button",tabIndex:0,"aria-label":s("checks.ariaWithSummary",{summary:s(i.labelKey)}),className:S("inline-flex shrink-0 cursor-pointer select-none items-center",l)}),onClick:f=>f.stopPropagation(),children:t(i.Icon,{"aria-hidden":!0,className:S("size-icon-2",i.toneClassName)})}),n(Nt,{align:"start",className:"w-80 max-w-full",side:"bottom",children:[t("p",{className:"mb-2 font-medium text-sm",children:s(i.labelKey)}),u===null?null:t("p",{className:"mb-2 text-muted-foreground text-xs",children:s(u.key,u.values)}),a!==void 0?t(od,{checks:a}):o!==void 0&&r!==void 0?t(dp,{environmentId:o,reference:r}):null]})]})}da();M();function rd({state:e}){let{t:a,openOnHostLabel:o,showPullRequestLinkContextMenu:r,condensed:l,detail:s,repositoryUrl:i,statePresentation:u}=e;return n("div",{className:"ml-4 grid h-7 min-w-0 items-center",children:[t("div",{"aria-hidden":l,inert:l,className:S("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",l?"pointer-events-none -translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50 duration-150"),children:s&&u?n(Se,{children:[n(re,{children:[t(le,{render:i?t("button",{type:"button",onClick:()=>{ia()?.shell.openExternal(i)},className:"min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:s.repository}):t("span",{className:"min-w-0 truncate font-medium text-muted-foreground",children:s.repository})}),t(ne,{side:"top",children:i?a("detail.openRepositoryTooltip",{repository:s.repository}):s.repository})]}),n(re,{children:[t(le,{render:n("button",{type:"button",onClick:()=>{ia()?.shell.openExternal(s.url)},onContextMenu:f=>qn(r,f,s,o(s.provider)),className:S("shrink-0 font-medium underline-offset-2 hover:underline",u.toneClassName),"aria-label":a("detail.openOnHostAria",{number:s.number}),children:["#",s.number]})}),t(ne,{side:"top",children:o(s.provider)})]})]}):null}),t("div",{"aria-hidden":!l,inert:!l,className:S("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",l?"translate-y-0 opacity-100 delay-50 duration-150":"pointer-events-none translate-y-1 opacity-0 duration-100"),children:s&&u?n(Se,{children:[n(re,{children:[t(le,{render:n("button",{type:"button",tabIndex:l?0:-1,onClick:()=>{ia()?.shell.openExternal(s.url)},onContextMenu:f=>qn(r,f,s,o(s.provider)),className:S("shrink-0 font-medium underline-offset-2 hover:underline",u.toneClassName),"aria-label":a("detail.openOnHostAria",{number:s.number}),children:["#",s.number]})}),t(ne,{side:"top",children:o(s.provider)})]}),n(re,{children:[t(le,{render:t("span",{className:"min-w-0 truncate font-medium text-foreground",children:s.title})}),t(ne,{side:"top",children:s.title})]})]}):null})]})}function nd({state:e}){let{t:a,condensed:o,condensedRowRef:r,detail:l,isStackedPullRequest:s,actionPending:i,perform:u,freshness:f}=e;return t("div",{className:S("col-span-2 grid",o?"grid-rows-[1fr]":"grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:t("div",{ref:r,className:S("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:l?t("div",{className:"col-span-2 min-w-0 px-4 pb-2 pt-1",children:n("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[n("span",{className:"flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground",children:[n(re,{children:[t(le,{render:t("span",{className:"shrink-0 rounded-full","aria-label":l.author?.login??"ghost"}),children:t(ht,{actor:l.author})}),t(ne,{side:"top",children:l.author?.login??"ghost"})]}),t("span",{className:"shrink-0",children:Ge(l.updatedAt)})]}),t("span",{"aria-hidden":!0,className:"h-3 w-px shrink-0 bg-border/70"}),n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-[11px] text-muted-foreground/65",children:[n(re,{children:[t(le,{render:n("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[s?t(He,{"aria-label":a("detail.stackedAria"),className:"size-3 shrink-0"}):null,t("code",{className:"min-w-0 truncate",children:l.baseBranch})]})}),t(ne,{side:"top",children:s?a("detail.stackedOn",{branch:l.baseBranch}):l.baseBranch})]}),f?t(Tn,{baseBranch:l.baseBranch,freshness:f,pending:i,onUpdate:c=>{u("update-branch",void 0,c)},iconClassName:"size-3"}):null,t(bt,{"aria-label":a("detail.receivesChangesFrom"),className:"size-3 shrink-0 opacity-60"}),n(re,{children:[t(le,{render:t("code",{className:"min-w-0 flex-1 truncate",children:l.headBranch})}),t(ne,{side:"top",children:l.headBranch})]})]}),n("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-[11px]",children:[n("span",{className:"inline-flex items-center gap-1 tabular-nums","aria-label":a("detail.changedFilesAria",{count:l.changedFiles,total:l.changedFiles.toLocaleString()}),children:[t(Rt,{"aria-hidden":!0,className:"size-3"}),l.changedFiles.toLocaleString()]}),t(Fa,{additions:l.additions,deletions:l.deletions,className:"shrink-0 font-mono text-[11px]"})]})]})}):null})})}function ld({state:e}){let{t:a,pullRequestKey:o,condensed:r,foldRef:l,copyBranchToClipboard:s,isBranchCopied:i,detail:u,isStackedPullRequest:f,actionPending:c,setTitleScope:d,titleDraft:p,titleSaving:m,perform:w,saveTitle:L,freshness:x}=e;return t("div",{className:S("col-span-2 grid",r?"grid-rows-[0fr]":"grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:t("div",{ref:l,className:S("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?n("div",{className:"col-span-2 mt-1 min-w-0 px-4 pb-4",children:[p===null?n("div",{className:"group flex min-w-0 items-start gap-1",children:[t("h1",{className:"min-w-0 flex-1 text-base font-semibold leading-snug",children:u.title}),lr(u)?t(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":a("detail.editTitleAria"),onClick:()=>d({pullRequestKey:o,text:u.title}),children:t(ra,{className:"size-3"})}):null]}):n("div",{className:"space-y-2",children:[t(jo,{autoFocus:!0,size:"sm",disabled:m,value:p,"aria-label":a("detail.titleAria"),onChange:D=>d({pullRequestKey:o,text:D.target.value}),onKeyDown:D=>{D.key==="Enter"?(D.preventDefault(),L(p)):D.key==="Escape"&&(D.preventDefault(),d(null))}}),n("div",{className:"flex justify-end gap-2",children:[t(b,{size:"xs",variant:"ghost",disabled:m,onClick:()=>d(null),children:a("action.cancel")}),t(b,{size:"xs",variant:"outline",disabled:m||p.trim().length===0,onClick:()=>{L(p)},children:a(m?"action.saving":"action.save")})]})]}),n(Ca,{className:"mt-2 text-xs text-muted-foreground",children:[t(wa,{actor:u.author,className:"font-medium"}),t("span",{children:a("detail.updatedAt",{when:Ge(u.updatedAt)})})]}),n("div",{className:"mt-4 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70",children:[n(re,{children:[t(le,{render:n("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[f?t(He,{"aria-label":a("detail.stackedAria"),className:"size-3 shrink-0"}):null,t("code",{className:"min-w-0 truncate",children:u.baseBranch})]})}),t(ne,{side:"top",children:f?a("detail.stackedOn",{branch:u.baseBranch}):u.baseBranch})]}),x?t(Tn,{baseBranch:u.baseBranch,freshness:x,pending:c,onUpdate:D=>{w("update-branch",void 0,D)}}):null,t(bt,{"aria-label":a("detail.receivesChangesFrom"),className:"size-icon-2 shrink-0 opacity-60"}),n(re,{children:[n(le,{render:t(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":a(i?"detail.branchCopied":"detail.copyBranch"),onClick:()=>s(u.headBranch)}),children:[t("code",{className:S("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}),t("span",{"aria-hidden":"true",className:S("col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-100":"opacity-0"),children:a("action.copied")})]}),t(ne,{side:"top",children:i?a("detail.branchCopiedTooltip",{branch:u.headBranch}):a("detail.copyBranchTooltip",{branch:u.headBranch})})]})]}),n("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2",children:[n("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[t(Rt,{className:"size-icon-2"}),a("detail.fileCount",{count:u.changedFiles,total:u.changedFiles.toLocaleString()})]}),t(Fa,{additions:u.additions,deletions:u.deletions,className:"shrink-0 font-mono text-xs"})]})]})]}):null})})}function sd({state:e}){let{t:a,tab:o,setTab:r,timelineOrder:l,setTimelineOrder:s,detail:i,activityPending:u,activityError:f,visibleTabs:c,checksSummary:d,checksState:p,approvalCount:m}=e;return i?n("nav",{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","aria-label":a("detail.tabsAria"),children:[t(Wo,{className:"shrink-0",size:"segmented",variant:"segmented",value:[o],onValueChange:w=>{let L=c.find(x=>x.value===w[0])?.value;L&&r(L)},children:c.map(w=>t(Ba,{value:w.value,children:a(w.labelKey)},w.value))}),o==="summary"?n("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":d?a("checks.ariaWithSummary",{summary:a(d.key,d.values)}):a("checks.title"),children:[p!==null?t(vr,{checks:i.checks,checksState:p}):t(st,{"aria-hidden":!0,className:"size-icon-2"}),d?a(d.key,d.values):null]}):o==="timeline"?n("div",{className:"ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[n(Ca,{className:S("whitespace-nowrap text-[11px] transition-opacity",(u||f)&&"opacity-35"),children:[n("span",{className:"inline-flex items-center gap-1","aria-label":f?a("detail.commentsUnavailable"):a("timeline.commentCount",{count:i.commentCount,total:i.commentCount.toLocaleString()}),children:[t(Qe,{"aria-hidden":!0,className:"size-3"}),f?"\u2014":u?"\u2026":i.commentCount.toLocaleString()]}),n("span",{className:"inline-flex items-center gap-1","aria-label":f?a("detail.commitsUnavailable"):a("detail.commitCount",{count:i.commits.length,total:i.commits.length.toLocaleString()}),children:[t(Ia,{"aria-hidden":!0,className:"size-3"}),f?"\u2014":u?"\u2026":i.commits.length.toLocaleString()]}),m>0?n("span",{className:S("inline-flex items-center gap-1",er("approved")),children:[t(ar,{outcome:"approved",className:"size-3"}),m.toLocaleString(),t("span",{className:"sr-only",children:a("detail.approvalNoun",{count:m})})]}):null]}),n(b,{size:"xs",variant:"ghost",className:"h-7 px-2 text-[10px] text-muted-foreground","aria-label":a(l==="newest"?"detail.activityOldestAria":"detail.activityNewestAria"),onClick:()=>s(w=>w==="newest"?"oldest":"newest"),children:[t(nt,{"aria-hidden":!0,className:"size-3"}),a(l==="newest"?"sort.newestFirst":"sort.oldestFirst")]})]}):null]}):null}Te();he();$t();la();he();la();function cp(e){return e.filter(a=>a.connected&&a.pluginLoaded).map(a=>({environmentId:a.environmentId,payload:{}}))}function fp(e){return e.flatMap(a=>(a.data?.projects??[]).map(r=>({id:String(r.projectId??""),environmentId:a.environmentId,title:String(r.title??""),workspaceRoot:String(r.workspaceRoot??""),repositoryIdentity:r.repositoryIdentity??null})))}function An(){let e=Pe(),a=e.useConnectedEnvironments(),o=cp(a),r=e.commands.useQueryEach("workspaceProjects",o,{refreshKey:e.useRepositoryIdentityKey()});return{projects:V(()=>fp(r.rows),[r.rows]),bootstrapped:o.length===0||r.rows.every(s=>!s.isPending)}}function id(){return An().projects}he();la();function Lr(){return{environments:Pe().useConnectedEnvironments().map(a=>({environmentId:a.environmentId,label:a.label,displayUrl:a.label,serverConfig:a.connected?{}:null}))}}function ud(e,a){let o=Pe().useConnectedEnvironments();return V(()=>{let r=new Map;for(let l of a)r.set(l,o.find(s=>s.environmentId===l)?.pluginLoaded===!0);return r},[a,o])}Ne();he();function wr(e,a=!0){let o=typeof a=="boolean"?a:a.enabled!==!1,r=typeof a=="object"?a.key:void 0;ge(()=>{if(!o||typeof document>"u")return;let l=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",l),()=>document.removeEventListener("visibilitychange",l)},[o,r,e])}Ne();Ne();sa();A();Ea();da();Te();ft();sa();Ea();fn();var dd=new Map,cd=e=>typeof e=="string"?e:ua(e);function fd({t:e,detail:a,handoff:o,setHandoff:r,handoffUnsupportedReason:l,acting:s,actingEnvironmentId:i,newThread:u,prepareThread:f,context:c,composerDraftTarget:d}){let p=Xi(c,d),m=$i(p!==null),w=rn({attachAvailable:p!==null,blockedReason:l}),L=(K,U)=>{let J=ln({supported:l===null,existing:Ho.getState().getComposerDraft(K),lastHandoffPrompt:dd.get(cd(K)),task:U});if(!J.ok)return ye.error(e(J.reason)),!1;let B=Ho.getState();return dd.set(cd(K),U.prompt),B.setPrompt(K,J.next.prompt),B.setReviewComments(K,J.next.reviewComments),!0},x=async(K,U,J)=>{let B=J??await u(K).then(E=>E,()=>null);return B===null?null:U===null||L(B.draftId,U)?B:null},D=async(K,U)=>{if(!a||o!==null)return;if(l!==null){ye.error(e(l));return}if(p!==null){if(!L(p,U))return;ye.success(e("notify.addedToComposer"),U.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"));return}r(K);let J=Or(i,s?.projectId??a.projectId),B=await x(J,U);if(r(null),B===null){ye.error(e("notify.couldNotOpenThread"),void 0,{description:e("notify.threadHandoffHint")});return}ye.success(e("notify.askedInThread"),U.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"))},v=async(K,U,J="worktree")=>{if(!a||o!==null)return;if(l!==null){ye.error(e(l));return}if(p!==null&&U!==null){if(!L(p,U))return;ye.success(e("notify.addedToComposer"),e("notify.taskInComposer"));return}r(K);let B=ye.task({title:e("notify.checkoutPreparing")}),E=Or(i,s?.projectId??a.projectId),Y=await u(E).then(fe=>fe,()=>null);if(Y===null){r(null),B.fail({title:e("notify.checkoutThreadFailed"),description:e("notify.threadHandoffHint")});return}let W=await f.run({reference:a.url,mode:J,threadId:Y.threadId});if(W._tag==="Failure"){r(null);let fe=f.error instanceof Error?f.error.message:null;B.fail({title:e("notify.checkoutFailed"),...fe?{description:fe}:{}});return}if(!await u(E,{branch:W.value.branch,worktreePath:W.value.worktreePath,envMode:W.value.worktreePath===null?"local":"worktree"}).then(fe=>fe!==null,()=>!1)){r(null),B.fail({title:e("notify.checkoutThreadUnmoved"),description:e("notify.checkoutReadyOnBranch",{branch:W.value.branch})});return}r(null);let se={title:e("notify.checkoutStale"),description:e("notify.checkoutStaleDetail")},xe=fe=>{W.value.isOnPullRequestHead?B.succeed(fe):B.fail(se)};if(U===null){xe({title:e(J==="local"?"notify.checkoutHereTitle":"notify.checkoutDoneTitle"),description:e(J==="local"?"notify.checkoutHereDetail":"notify.checkoutWorktreeDetail")});return}await x(E,U,Y),xe({title:e("notify.checkoutReady"),description:e("notify.taskInComposer")})};return{attachTarget:p,handoffLabels:m,addToAgentEntry:w,askAboutPullRequest:()=>{a&&D("ask",{...un({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})},explainPullRequest:()=>{a&&D("explain",{...dn({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})},addSelectionToAgent:K=>{a&&D(`selection:${K.comment.id}`,cn({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,comment:K.comment,request:K.request}))},startCheckout:K=>{a&&v(`checkout:${K}`,null,K)},startFixFinding:K=>{a&&v(Za(K),an({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,finding:K}))},startFixFindings:()=>{a&&v("findings",en({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,reviewThreads:a.reviewThreads,comments:a.comments,checks:a.checks,commentsTruncated:a.commentsTruncated}))},startResolveConflicts:()=>{a&&v("conflicts",{prompt:Gi({number:a.number,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})}}}M();function pd({environmentId:e,reference:a,refreshToken:o=0,onActed:r,onStateChange:l,context:s="page",composerDraftTarget:i}){let{t:u}=k(),f=fr(),c=pr(),d=`${a.projectId}:${a.repository}#${a.number}`,[p,m]=C("summary"),[w,L]=C("newest"),[x,D]=C(()=>({pullRequestKey:d,oid:null})),v=x.pullRequestKey===d?x.oid:null,y=ue=>{D({pullRequestKey:d,oid:ue})},_=ue=>{y(ue),m("code")},[oe,j]=C(()=>new Set(["summary"]));ge(()=>{j(ue=>ue.has(p)?ue:new Set(ue).add(p))},[p]);let[H,G]=C(!1),T=Ee({});ge(()=>{G(T.current[p]??!1)},[p]);let K=H,U=Ee(null),J=Ee(null),B=Ee(null),E=Ee(null);Zn(()=>{if(E.current===null)return;let ue=U.current,Ua=E.current;E.current=null,ue&&(ue.scrollTop=Math.max(0,ue.scrollTop+Ua))},[K]);let[Y,W]=C("merge"),[ce,se]=C({open:!1,action:"merge"}),xe=ce.action,[fe,ie]=C(null),{copyToClipboard:Ce,isCopied:ae}=ul({target:u("detail.branchNameTarget"),timeout:1600});ge(()=>{Sn()},[]);let g=xa(ke.detail({environmentId:e,input:a})),$=xa(ke.activity({environmentId:e,input:a})),N=xa(ke.diff({environmentId:e,input:{...a}})),X=g.data,pe=$.data,R=V(()=>X===null?null:{...X,author:pe?.author??X.author,reviewers:pe?.reviewers??X.reviewers,comments:pe?.comments??[],commentCount:pe?.commentCount??0,commentsTruncated:pe?.commentsTruncated??!1,reviewThreads:pe?.reviewThreads??[],commits:pe?.commits??[],reactions:pe?.reactions??[]},[pe,X]),F=R===null?null:ll(R.url),Ie=xa(R===null?null:Ll.listRefs({environmentId:e,input:{cwd:R.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Ae=R!==null&&Zi(R.baseBranch,Ie.data?.refs??[]),ca=$.isPending&&pe===null,ta=pe===null?$.error:null,be=oa(()=>{g.refresh(),$.refresh()},[$.refresh,g.refresh]),Ze=Ee(null);ge(()=>{if(!X)return;let ue={key:d,updatedAt:X.updatedAt};Vi(Ze.current,ue)&&$.refresh(),Ze.current=ue},[$.refresh,X,d]),ge(()=>{R&&l?.({projectId:R.projectId,repository:R.repository,number:R.number,state:R.state,isDraft:R.isDraft})},[R,l]),wr(g.refresh,{key:`pull-request:${a.projectId}:${a.repository}#${a.number}`});let Je=Oe(ke.invalidate,{reportFailure:!1}),[ya,Sa]=C(0),Q=oa(async()=>{await Je({environmentId:e,input:{reference:a}}),be(),Sa(ue=>ue+1)},[e,Je,a,be]),Le=Ee(o);ge(()=>{Le.current!==o&&(Le.current=o,Q())},[o,Q]);let we=Oe(ke.act,{reportFailure:!1}),[Re,P]=C(null),de=Re!==null,[q,ee]=C(null),me=q?.pullRequestKey===d?q.text:null,[qe,We]=C(!1),Ha=Il(),jt=Pe(),Pr=jt.commands.useQuery("workspaceProject",{projectId:a.projectId},{environmentId:e}),Ao=nn(Pr.data),tt=on({canCreateThread:fa(jt,"createThread"),canWriteComposerDraft:fa(jt,"composerDraft"),projectArchived:Ao}),Sr=tt!==null,kr=ue=>tt===null?ue:n(re,{children:[t(le,{render:ue}),t(ne,{side:"top",children:u(tt)})]}),{environments:Mo}=Lr(),O=id(),Be=V(()=>s==="page"?qu({environmentId:e,projectId:a.projectId},O,Mo):[],[s,e,Mo,O,a.projectId]),[Do,Hd]=C(null),Ud=Do?.pullRequestKey===d?Do.environmentId:e,qr=Be.find(ue=>ue.environmentId===Ud)??null,Tr=qr?.environmentId??e,zd=vl({environmentId:Tr,cwd:qr?.workspaceRoot??R?.workspaceRoot??null}),_d=async(ue,Ua,Ct)=>{if(Re!==null)return;P(ue);let Gn=await we({environmentId:e,input:{op:"runAction",...a,action:ue,...Ua?{mergeMethod:Ua}:{},...Ct?{updateMethod:Ct}:{}}});if(P(null),Gn._tag==="Failure"){let uc=Xt(Gn),dc=u(Ct==="rebase"?Yu:Ju[ue]);ye.error(u(Zu[ue]),void 0,{description:So(uc,dc)});return}ye.success(u(Qu[ue])),tu(ue)?Q():be(),r?.()},Gd=async ue=>{let Ua=ue.trim();if(R===null||qe)return;if(Ua.length===0||Ua===R.title){ee(null);return}We(!0);let Ct=await we({environmentId:e,input:{op:"update",...a,title:Ua}});if(We(!1),Ct._tag==="Failure"){ye.error(u("notify.titleSaveFailed"),void 0,{description:So(Xt(Ct),u("notify.titleRefused"))});return}ee(null),be()},{attachTarget:Kd,handoffLabels:Vd,addToAgentEntry:jd,askAboutPullRequest:Wd,explainPullRequest:$d,addSelectionToAgent:Xd,startCheckout:Qd,startFixFinding:Zd,startFixFindings:Jd,startResolveConflicts:Yd}=fd({t:u,detail:R,handoff:fe,setHandoff:ie,handoffUnsupportedReason:tt,acting:qr,actingEnvironmentId:Tr,newThread:Ha,prepareThread:zd,context:s,composerDraftTarget:i}),wt=R?R.capabilities.mergeMethods.filter(ue=>R.mergeCapabilities[ue]):[],zn=wt.includes(Y)?Y:wt[0]??"merge",ec=u(Ir[zn]),Bo=R?.state==="open"&&R.mergeability==="conflicting",Ar=R?.state==="open"&&R.autoMergeEnabled===!0,ac=R===null?null:au(R),Mr=ed.filter(ue=>ue.value!=="code"||R===null||R.capabilities.diff);ge(()=>{Mr.some(ue=>ue.value===p)||m("summary")},[p,Mr]);let ot=ue=>R?.capabilities.actions.includes(ue)===!0&&R.viewerPermissions.actions.includes(ue),_n=R===null||R.state!=="open"?null:Bo?"resolve":R.isDraft&&ot("ready")?"ready":ot("merge")&&wt.length>0?"merge":null,tc=R?.state==="open"&&ot(R.isDraft?"ready":"draft")&&!(R.isDraft&&_n==="ready"),oc=R?.state==="open"&&(Ar&&ot("disable-auto-merge")||!Ar&&!R.isDraft&&!Bo&&ot("enable-auto-merge")&&wt.length>0),rc=R?.state==="open"&&ot("merge")&&!R.isDraft&&!Bo&&wt.length>1,nc=R?Co({state:R.state,isDraft:R.isDraft}):null,lc=R?tr(R.checks):null,sc=R?Bi(R.checks):null,ic=R&&!R.commentsTruncated?nr(R.comments,R.commits).filter(ue=>ue.outcome==="approved"&&!ue.stale).length:0;return{t:u,openOnHostLabel:f,showPullRequestLinkContextMenu:c,pullRequestKey:d,tab:p,setTab:m,timelineOrder:w,setTimelineOrder:L,selectedCodeCommitOid:v,selectCodeCommit:y,openCommit:_,mountedTabs:oe,setChromeCondensed:G,chromeStateByTab:T,condensed:K,scrollerRef:U,foldRef:J,condensedRowRef:B,compensationRef:E,setMergeMethod:W,confirmation:ce,setConfirmation:se,confirmAction:xe,handoff:fe,copyBranchToClipboard:Ce,isBranchCopied:ae,detailQuery:g,activityQuery:$,detail:R,repositoryUrl:F,isStackedPullRequest:Ae,activityPending:ca,activityError:ta,refreshDetail:be,refreshToken:ya,refreshFromHost:Q,pendingAction:Re,actionPending:de,setTitleScope:ee,titleDraft:me,titleSaving:qe,projectArchived:Ao,handoffUnsupportedReason:tt,handoffBlocked:Sr,withBlockedReason:kr,pickableEnvironments:Be,setActingScope:Hd,actingEnvironmentId:Tr,perform:_d,saveTitle:Gd,attachTarget:Kd,handoffLabels:Vd,addToAgentEntry:jd,askAboutPullRequest:Wd,explainPullRequest:$d,addSelectionToAgent:Xd,startCheckout:Qd,startFixFinding:Zd,startFixFindings:Jd,startResolveConflicts:Yd,allowedMergeMethods:wt,selectedMergeMethod:zn,selectedMergeMethodLabel:ec,conflicting:Bo,autoMergeArmed:Ar,freshness:ac,visibleTabs:Mr,can:ot,primaryAction:_n,showsDraftToggle:tc,showsAutoMerge:oc,showsMergeMethods:rc,statePresentation:nc,checksSummary:lc,checksState:sc,approvalCount:ic,context:s}}M();function Cr(e){let{environmentId:a,reference:o,onClose:r}=e,l=pd(e),{t:s,tab:i,timelineOrder:u,selectedCodeCommitOid:f,selectCodeCommit:c,openCommit:d,mountedTabs:p,setChromeCondensed:m,chromeStateByTab:w,scrollerRef:L,foldRef:x,condensedRowRef:D,compensationRef:v,confirmation:y,setConfirmation:_,confirmAction:oe,handoff:j,detailQuery:H,activityQuery:G,detail:T,activityPending:K,activityError:U,refreshDetail:J,refreshToken:B,actionPending:E,projectArchived:Y,perform:W,handoffLabels:ce,addToAgentEntry:se,addSelectionToAgent:xe,startFixFinding:fe,selectedMergeMethod:ie,selectedMergeMethodLabel:Ce}=l;return H.isPending&&!T?t(Pi,{}):n("div",{className:"flex h-full min-h-0 w-full flex-col bg-background",children:[n("div",{className:"grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60",children:[t(rd,{state:l}),t(td,{state:l,onClose:r}),t(nd,{state:l}),t(ld,{state:l}),t(sd,{state:l})]}),t("div",{className:"relative min-h-0 flex-1 overflow-hidden",onScrollCapture:ae=>{let g=ae.target;L.current=g;let $=g.scrollTop;m(N=>{let X=N,pe=x.current?.scrollHeight??0,R=pe-(D.current?.scrollHeight??0);return N?$<4&&pe>0&&(X=!1):pe>0&&$>pe+32&&(v.current=-R,X=!0),w.current[i]=X,X})},children:H.error&&!T?t(Lo,{error:H.error,onRetry:J}):T?n(Se,{children:[p.has("summary")?t("div",{className:S("absolute inset-0",i!=="summary"&&"invisible"),children:t(wu,{environmentId:a,reference:o,detail:T,activityPending:K,activityError:U,pendingFinding:j,fixFindingLabel:ce.fixFinding,fixCheckLabel:ce.fixCheck,...Y?{}:{onFixFinding:fe},onRefresh:J})}):null,p.has("timeline")?t("div",{className:S("absolute inset-0",i!=="timeline"&&"invisible"),children:K?t(ki,{}):U?t(Zo,{error:U,onRetry:G.refresh}):t(Su,{detail:T,environmentId:a,reference:o,order:u,onOpenCommit:d,onRefresh:J})}):null,p.has("code")?t("div",{className:S("absolute inset-0",i!=="code"&&"invisible"),children:t(Vn,{fallback:t(Xu,{label:s("code.loadingDiff")}),children:t(ad,{...se.kind==="hidden"?{}:{onAddToAgentSelection:xe},...se.kind==="disabled"?{addToAgentDisabledReason:s(se.reason)}:{},environmentId:a,reference:o,detail:T,selectedCommitOid:f,onSelectedCommitChange:c,pendingFinding:j,fixFindingLabel:ce.fixFinding,...Y?{}:{onFixFinding:fe},onRefresh:J,refreshToken:B})})}):null]}):null}),t(pi,{open:y.open,onOpenChange:ae=>_(g=>({...g,open:ae})),onOpenChangeComplete:ae=>{ae||_({open:!1,action:"merge"})},children:n(yi,{children:[n(xi,{children:[t(Ii,{children:s(oe==="merge"?"detail.confirmMergeTitle":oe==="enable-auto-merge"?"detail.confirmAutoMergeTitle":"detail.confirmCloseTitle")}),t(gi,{children:oe==="merge"?s("detail.confirmMergeBody",{number:o.number,method:ie}):oe==="enable-auto-merge"?s("detail.confirmAutoMergeBody",{number:o.number,method:ie}):s("detail.confirmCloseBody",{number:o.number})})]}),n(hi,{children:[t(mi,{render:t(b,{variant:"outline",size:"sm"}),children:s("action.cancel")}),t(b,{size:"sm",variant:oe==="close"?"destructive":"default",disabled:E,onClick:()=>{let ae=oe;_(g=>({...g,open:!1})),ae==="merge"&&W("merge",ie),ae==="enable-auto-merge"&&W("enable-auto-merge",ie),ae==="close"&&W("close")},children:oe==="merge"?Ce:s(oe==="enable-auto-merge"?"detail.enableAutoMerge":"detail.close")})]})]})})]})}Fe();ze();Te();M();function md(e){return t("span",{"aria-hidden":!0,className:"size-4 shrink-0 rounded-sm bg-muted"})}A();A();A();A();M();function xd(e,a){return e.filter(r=>r.kind===a.kind).length>1?a.host:Ya(a.kind).providerName}function yd({value:e,busy:a,onChange:o}){let{t:r}=k();return n(jr,{className:"min-w-0 flex-1 **:[input]:h-9 sm:**:[input]:h-8",children:[t(Wr,{children:a?t("span",{className:"inline-flex shrink-0 animate-spin",children:t(Ma,{"aria-hidden":!0})}):t(Da,{"aria-hidden":!0})}),t($r,{type:"search",value:e,onChange:l=>o(l.currentTarget.value),placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria")})]})}var Mn="all",gd="",hd="",vt="all",Ra=e=>JSON.stringify([e.environmentId,e.id]),pp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"only",labelKey:"filter.draftsOnly",Icon:Aa},{value:"hide",labelKey:"filter.hideDrafts",Icon:ao}],mp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"approved",labelKey:"filter.reviewApproved",Icon:$e},{value:"changes-requested",labelKey:"filter.reviewChangesRequested",Icon:Ke},{value:"review-required",labelKey:"filter.reviewRequired",Icon:ka},{value:"none",labelKey:"filter.reviewNone",Icon:Yt}],gp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"passing",labelKey:"filter.checksPassing",Icon:$e},{value:"failing",labelKey:"filter.checksFailing",Icon:Ke}];function It({label:e,value:a,options:o,onChange:r}){let{t:l}=k();return n(Na,{value:a,onValueChange:s=>{s!==a&&r(s)},children:[t(Xr,{children:e}),o.map(s=>{let i=t(La,{value:s.value,className:s.unavailable?"data-disabled:pointer-events-auto":void 0,disabled:s.unavailable!==void 0,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(s.Icon,{"aria-hidden":!0,className:"size-icon-2"}),s.labelKey!==void 0?l(s.labelKey):s.label]})},s.value);return s.unavailable?n(re,{children:[t(le,{render:i}),t(ne,{side:"top",className:"max-w-80",children:s.unavailable})]},s.value):i})]})}function Id({state:e,stateOptions:a,onState:o,involvement:r,involvementOptions:l,onInvolvement:s,filters:i,onFilters:u,host:f,hostOptions:c,onHost:d,server:p,serverOptions:m,onServer:w,projects:L,projectId:x,projectEnvironmentId:D,unavailable:v,onProject:y}){let{t:_}=k(),oe=e!=="open"||r!=="all"||f!==void 0||p!==void 0||x!==void 0||Object.keys(i).length>0,j=(H,G)=>Object.fromEntries(Object.entries({...i,[H]:G===vt?void 0:G}).filter(([,T])=>T!==void 0));return n(ma,{children:[n(ha,{render:t(b,{className:S("relative",oe&&"[--control-icon-color:currentColor]"),size:"icon",variant:"outline","aria-label":_("list.filterAria")}),children:[t(lo,{className:"size-4"}),oe?t("span",{"aria-hidden":!0,className:"absolute top-0.5 right-0.5 size-1.5 rounded-full bg-primary"}):null]}),n(ga,{align:"end",side:"bottom",className:"min-w-56",children:[t(It,{label:_("filter.groupState"),value:e,options:a,onChange:o}),t(je,{}),t(It,{label:_("filter.groupInvolvement"),value:r,options:l,onChange:s}),t(je,{}),t(It,{label:_("filter.groupDraft"),value:i.draft??vt,options:pp,onChange:H=>u(j("draft",H))}),t(je,{}),t(It,{label:_("filter.groupReview"),value:i.review??vt,options:mp,onChange:H=>u(j("review",H))}),t(je,{}),t(It,{label:_("filter.groupChecks"),value:i.checks??vt,options:gp,onChange:H=>u(j("checks",H))}),c.length>2?n(Se,{children:[t(je,{}),t(It,{label:_("filter.groupHost"),value:f??gd,options:c,onChange:H=>d(H===gd?void 0:H)})]}):null,m.length>2?n(Se,{children:[t(je,{}),t(It,{label:_("filter.groupServer"),value:p??hd,options:m,onChange:H=>w(H===hd?void 0:H)})]}):null,t(je,{}),n(Na,{value:x===void 0||D===void 0?Mn:Ra({id:x,environmentId:D}),onValueChange:H=>{if(H===Mn){x!==void 0&&y(void 0,void 0);return}let G=L.find(T=>Ra(T)===H);G!==void 0&&(G.id!==x||G.environmentId!==D)&&y(G.id,G.environmentId)},children:[t(Xr,{children:_("filter.groupProject")}),t(La,{value:Mn,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(He,{"aria-hidden":!0,className:"size-icon-2"}),_("filter.allProjects")]})}),L.toSorted((H,G)=>Number(v.has(Ra(H)))-Number(v.has(Ra(G)))).map(H=>{let G=v.get(Ra(H)),T=t(La,{value:Ra(H),className:G!==void 0?"data-disabled:pointer-events-auto":void 0,disabled:G!==void 0,children:n("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t(md,{environmentId:H.environmentId,cwd:H.workspaceRoot,fallbackIcon:ut,className:"size-icon-2 shrink-0"}),t("span",{className:"min-w-0 flex-1 truncate",children:H.title}),G===void 0?null:t("span",{className:"shrink-0 rounded-full border border-warning/40 bg-warning-surface px-1.5 py-px text-[10px] font-medium text-warning-foreground",children:_("filter.unavailable")})]})},Ra(H));return G===void 0?T:n(re,{children:[t(le,{render:T}),t(ne,{side:"top",className:"max-w-80",children:G})]},Ra(H))})]})]})]})}Te();Fe();A();A();M();function Dn({joined:e}){return n("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:[t("path",{d:"M10 58h100",className:"text-muted-foreground/30",stroke:"currentColor"}),t("circle",{cx:"10",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),t("circle",{cx:"110",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),e?t("path",{d:"M30 58c0-18 8-26 24-26h12c16 0 24 8 24 26"}):n(Se,{children:[t("path",{d:"M30 58c0-18 8-26 24-26h4"}),t("path",{d:"M90 58c0-18-8-26-24-26h-4",strokeDasharray:"2 7",className:"text-muted-foreground/50"})]}),t("circle",{cx:"60",cy:"32",r:e?5:4,fill:e?"currentColor":"none",fillOpacity:.25,className:e?void 0:"text-muted-foreground/45"})]})}function vd({query:e,filtered:a,searching:o,hasProjects:r,canLoadMore:l,loadingMore:s,refreshing:i,onClearQuery:u,onLoadMore:f,onRefresh:c}){let d=gl(),{t:p}=k();return r?o?t(Ot,{rows:5,caption:p("emptyState.searchingCaption",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}):e.length>0?n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p("emptyState.nothingMatches",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}),t(At,{children:p("emptyState.nothingMatchesDetail")})]}),n(Tt,{className:"flex-row flex-wrap justify-center gap-2",children:[n(b,{size:"sm",variant:"outline",onClick:u,children:[t(Da,{}),p("emptyState.clearSearch")]}),n(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[t(ea,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p(a?"emptyState.nothingUnderFilters":"emptyState.noPullRequests")}),t(At,{children:p(a?"emptyState.widenFilters":"emptyState.workspaceHint")})]}),n(Tt,{className:"flex-row flex-wrap justify-center gap-2",children:[l?t(b,{size:"sm",variant:"outline",disabled:s,onClick:f,children:p(s?"action.loading":"emptyState.loadMore")}):null,n(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[t(ea,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p("emptyState.noProjectsTitle")}),t(At,{children:p(d?"emptyState.noProjectsDetail":"empty.addProjectWithoutPalette")})]}),d?t(Tt,{children:n(b,{size:"sm",onClick:()=>hl({open:"add-project"}),children:[t(mo,{}),p("emptyState.addProject")]})}):null]})}he();ze();Te();_a();A();da();M();function hp({entry:e,selected:a,showProjectTitle:o,showProvider:r,environmentLabel:l,matchedElsewhere:s,onSelect:i}){let{t:u}=k(),f=fr(),c=pr(),{Icon:d,providerName:p}=Ya(e.provider);return n("button",{type:"button","aria-current":a?"true":void 0,onClick:()=>i(e),className:S("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]",a?"bg-accent":"hover:bg-accent"),children:[t(Ai,{state:e.state,isDraft:e.isDraft,mergeability:e.mergeability,baseBranch:e.baseBranch}),n("span",{className:"min-w-0",children:[t("span",{className:"block truncate text-sm font-medium text-foreground",children:e.title}),n(Ca,{className:"mt-0.5 text-xs text-muted-foreground/70",children:[n("span",{className:"flex shrink-0 items-center gap-1",children:[r?n(re,{children:[t(le,{render:t("span",{className:"inline-flex shrink-0"}),children:t(d,{"aria-label":p,className:"size-3"})}),t(ne,{children:p})]}):null,n("span",{onContextMenu:m=>{m.preventDefault(),m.stopPropagation(),c({url:e.url,openLabel:f(e.provider),position:{x:m.clientX,y:m.clientY}})},children:["#",e.number]})]}),o?t("span",{className:"truncate",children:e.repository}):null,l?t("span",{className:"max-w-32 shrink-0 truncate",children:l}):null,t(wa,{actor:e.author,className:"max-w-40 shrink-0"}),e.reviewDecision==="approved"||e.reviewDecision==="changes-requested"?t("span",{className:S("shrink-0",e.reviewDecision==="approved"?"text-success-foreground":"text-warning-foreground"),children:e.reviewDecision==="approved"?u("reviewOutcome.approved"):u("reviewOutcome.changesRequested")}):null,e.checksState===void 0?null:t(vr,{checksState:e.checksState,environmentId:e.environmentId,reference:{projectId:e.projectId,repository:e.repository,number:e.number}}),s?t("span",{className:"shrink-0 rounded-full border border-border/60 px-1.5 text-[10px]",children:u("row.matchedInDescription")}):null]})]}),n("span",{className:"flex shrink-0 flex-col items-end gap-0.5 text-xs text-muted-foreground/70 tabular-nums",children:[t("span",{children:Ge(e.updatedAt)}),t(Fa,{additions:e.additions,deletions:e.deletions})]})]})}var Ld=Xn(hp);A();da();M();function wd({children:e,documents:a,activeDocumentId:o,widthStorageKey:r,defaultWidth:l,pullRequestStatuses:s,onActivate:i,onCloseDocument:u,onCloseOtherDocuments:f,onCloseDocumentsToRight:c,onCloseAllDocuments:d}){let p=(m,w)=>{let L=a.find(x=>x.id===m);L&&w(L)};return t(di,{tabs:a.map(m=>{let w=s[m.id],L=w?Co(w):null;return{id:m.id,title:`${m.repository.split("/").at(-1)} #${m.number}`,description:`${m.repository} #${m.number}`,...L?{icon:t(L.Icon,{className:`size-3 ${L.toneClassName}`,"aria-hidden":!0})}:{}}}),activeId:o,widthStorageKey:r,...l===void 0?{}:{defaultWidth:l},onActivate:m=>p(m,i),onClose:m=>p(m,u),onCloseOthers:m=>p(m,f),onCloseToRight:m=>p(m,c),onCloseAll:d,children:e})}Fe();A();Te();M();function Cd({rightPanelAvailable:e,rightPanelOpen:a,rightPanelUnavailableLabel:o,rightPanelMaximized:r,onToggleRightPanelMaximized:l,onToggleRightPanel:s}){let{t:i}=k();return n("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&&l!==void 0?n(re,{children:[t(le,{render:t(Ba,{className:"shrink-0",pressed:r,onPressedChange:l,"aria-label":i(r?"panel.restore":"panel.maximize"),variant:"ghost",size:"sm"}),children:r?t(uo,{className:"size-4"}):t(so,{className:"size-4"})}),t(ne,{side:"bottom",children:i(r?"panel.restore":"panel.maximize")})]}):null,n(re,{children:[t(le,{render:t(Ba,{className:"shrink-0",pressed:a,onPressedChange:s,"aria-label":i("panel.toggleRight"),variant:"ghost",size:"sm",disabled:!e}),children:t(dt,{className:"size-4"})}),t(ne,{side:"bottom",children:e?i("panel.toggleRight"):o??i("panel.rightUnavailable")})]})]})}A();A();he();ft();var br={isOpen:!1,activeDocumentId:null,documents:[]},Bn=new Set;function et(){for(let e of Bn)e()}function xp(e){return Bn.add(e),()=>{Bn.delete(e)}}function yp(e){return`pull-request:${e.environmentId===void 0?"":`${encodeURIComponent(e.environmentId)}:`}${encodeURIComponent(e.projectId)}:${encodeURIComponent(e.repository)}:${e.number}`}function Ip(e){return{id:yp(e),kind:"pull-request",...e.environmentId===void 0?{}:{environmentId:e.environmentId},projectId:e.projectId,repository:e.repository,number:e.number}}function at(e,a,o){let r=o(e[a]??br);return{...e,[a]:r}}function vp(e,a){let o=e.documents.find(r=>r.id===a.id);return{...e,isOpen:!0,activeDocumentId:a.id,documents:o?e.documents.map(r=>r.id===a.id?a:r):[...e.documents,a]}}function Lp(e,a,o){let r=e.documents.findIndex(u=>u.id===a);if(r<0)return e;let l=e.documents.filter((u,f)=>o(f,r)),s=l.some(u=>u.id===e.activeDocumentId),i=l[Math.min(r,l.length-1)]??null;return{...e,documents:l,activeDocumentId:s?e.activeDocumentId:i?.id??null,isOpen:l.length>0?e.isOpen:!1}}var De={byThreadKey:{},openPullRequest:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>vp(o,Ip(a)))},et()},activateDocument:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>o.documents.some(r=>r.id===a)?{...o,isOpen:!0,activeDocumentId:a}:o)},et()},closeDocument:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>Lp(o,a,(r,l)=>r!==l))},et()},closeOtherDocuments:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>({...o,documents:o.documents.filter(r=>r.id===a),activeDocumentId:a}))},et()},closeDocumentsToRight:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>{let r=o.documents.findIndex(l=>l.id===a);return r<0?o:{...o,documents:o.documents.slice(0,r+1),activeDocumentId:a}})},et()},closeAllDocuments:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),()=>br)},et()},show:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),a=>({...a,isOpen:a.documents.length>0}))},et()},close:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),a=>({...a,isOpen:!1}))},et()}};function Nn(){return De}var _e=(e=>{let a=Fo(xp,Nn,Nn);return e(a)});_e.getState=Nn;function Rr(e,a){return a?e[ua(a)]??br:br}function Fn(e,a){let o=Rr(e,a);return o.documents.find(r=>r.id===o.activeDocumentId)??null}function En(e,a){return Rr(e,a).isOpen?Fn(e,a):null}function bd(e,a,o){return e[a]?.state===o.state&&e[a]?.isDraft===o.isDraft?e:{...e,[a]:o}}Te();Fe();he();A();A();A();A();A();A();A();ze();M();var Hn=[{value:"all",labelKey:"filter.all",Icon:He},{value:"reviewing",labelKey:"filter.reviewing",Icon:to},{value:"authored",labelKey:"filter.authored",Icon:ja}],Un=[{value:"all",labelKey:"filter.all",Icon:He},{value:"open",labelKey:"filter.open",Icon:Xe},{value:"closed",labelKey:"filter.closed",Icon:pa},{value:"merged",labelKey:"filter.merged",Icon:Ve}];function On({label:e,value:a,options:o,onChange:r}){let{t:l}=k(),s=o.find(i=>i.value===a)??o[0];return s?n(ma,{children:[n(ha,{"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:[s.labelKey!==void 0?l(s.labelKey):s.label,t(Ye,{"aria-hidden":!0,className:"size-3 text-muted-foreground/70"})]}),t(ga,{align:"start",side:"bottom",className:"min-w-40",children:t(Na,{value:a,onValueChange:i=>r(i),children:o.map(i=>{let u=t(La,{value:i.value,disabled:i.unavailable!==void 0,className:"data-disabled:pointer-events-auto",children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(i.Icon,{"aria-hidden":!0,className:"size-icon-2"}),i.labelKey!==void 0?l(i.labelKey):i.label]})},i.value);return i.unavailable===void 0?u:n(re,{children:[t(le,{render:u}),t(ne,{side:"right",className:"max-w-64 break-words",children:i.unavailable})]},i.value)})})})]}):null}function wp({searchInput:e,searchValue:a,open:o,onOpenChange:r,focusToken:l,onFocusWithin:s}){let{t:i}=k(),u=Ee(null);ge(()=>{o&&u.current?.querySelector("input")?.focus()},[o]);let f=Ee(l);return ge(()=>{if(f.current===l)return;f.current=l;let c=u.current?.querySelector("input");c?.focus(),c?.select()},[l]),o||a.length>0?t("div",{ref:u,className:"w-56 shrink-0",onFocus:()=>s?.(!0),onBlur:()=>{s?.(!1),a.length===0&&r(!1)},children:e}):t(b,{size:"icon-sm",variant:"ghost","aria-label":i("list.searchAria"),onClick:()=>r(!0),children:t(Da,{className:"size-4"})})}function Pd({masterVisible:e,onMasterVisibilityChange:a,onBack:o,refreshing:r,onRefresh:l,searchValue:s,involvement:i,state:u,host:f,hostMenuOptions:c,onInvolvement:d,onState:p,onHost:m,searchInput:w,filtersMenu:L,rightPanelControl:x,rightPanel:D,listBody:v}){let{t:y}=k(),_=Ee(null),oe=Ee(null),[j,H]=C(!1);ge(()=>{let E=oe.current;if(!E||!e)return;let Y=new IntersectionObserver(([W])=>H(W?!W.isIntersecting:!1),{root:_.current});return Y.observe(E),()=>Y.disconnect()},[e]);let G=Ee(!1),T=Ee(null),[K,U]=C(!1),[J,B]=C(0);return ge(()=>{if(!e)return;let E=Y=>{if(Y.defaultPrevented||Y.key.toLowerCase()!=="f"||!(Y.metaKey||Y.ctrlKey)||Y.altKey||Y.shiftKey)return;if(Y.preventDefault(),j){U(!0),B(ce=>ce+1);return}let W=T.current?.querySelector("input");W?.focus(),W?.select()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[j,e]),ge(()=>{if(j||!e||(U(!1),!G.current))return;G.current=!1;let E=T.current?.querySelector("input");E&&(E.focus(),E.setSelectionRange(E.value.length,E.value.length))},[j,e]),n("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[n(Ri,{className:"bg-background",children:[j&&e?n(Qr,{ariaLabel:y("page.scopeAria"),children:[t(Xo,{current:!0,children:t("h1",{className:"truncate",children:y("page.title")})}),t(Ci,{}),n(Xo,{className:"gap-1.5 overflow-hidden",children:[t(On,{label:y("list.filterByState"),value:u,options:Un,onChange:p}),t(On,{label:y("list.filterByInvolvement"),value:i,options:Hn,onChange:d}),c.length>2?t(On,{label:y("list.filterByHost"),value:f??"",options:c,onChange:E=>m(E===""?void 0:E)}):null]})]}):t(Qr,{ariaLabel:y("breadcrumb.ariaLabel"),children:t(Xo,{current:!0,children:t("h1",{className:"truncate",children:y("page.title")})})}),t("div",{className:"min-w-0 flex-1"}),j&&e?n("div",{className:"flex shrink-0 items-center gap-1.5",children:[t(wp,{searchInput:w,searchValue:s,open:K,onOpenChange:U,focusToken:J,onFocusWithin:E=>{G.current=E}}),t(Rd,{compact:!0,refreshing:r,onRefresh:l})]}):null,x]}),t(ci,{detail:D,onBack:o,onMasterVisibilityChange:a,children:t("div",{ref:_,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:n(bi,{className:"gap-4",children:[n("div",{className:"flex flex-col gap-3",children:[n("div",{ref:T,className:"flex items-center gap-2",children:[w,L,j?null:t(Rd,{refreshing:r,onRefresh:l})]}),t("div",{ref:oe,"aria-hidden":!0,className:"-mt-3 h-px w-full"})]}),v]})})})]})}function Rd({compact:e=!1,refreshing:a,onRefresh:o}){let{t:r}=k();return t(b,{size:e?"icon-sm":"icon",variant:e?"ghost":"outline","aria-label":r("list.refreshAria"),onClick:o,disabled:a,children:t("span",{className:S("inline-flex shrink-0",a&&"animate-spin"),children:t(ea,{className:"size-4"})})})}he();St();he();function Sd(e,a){let[o,r]=C(e);return ge(()=>{let l=setTimeout(()=>r(e),a);return()=>clearTimeout(l)},[a,e]),o}Ne();Ne();var Cp=250,Pa=99,Lt=500,kd=[];function qd(e){let{search:a,environmentIds:o,environmentKey:r,pullRequestsSupported:l,projectsKnown:s,projects:i,scopedProjectId:u,scopedProject:f}=e,c=(a.q??"").trim(),d=Sd(c,Cp),p=c===d,m=V(()=>_o(c),[c]),w=V(()=>_o(d),[d]),L=V(()=>({...a.draft?{draft:a.draft}:{},...a.review?{review:a.review}:{},...a.checks?{checks:a.checks}:{}}),[a.checks,a.draft,a.review]),x=Object.keys(L).length>0,D=V(()=>({...L,...w.filters}),[L,w.filters]),v=Object.keys(D).length>0,y=V(()=>({...L,...m.filters}),[L,m.filters]),_=Object.keys(y).length>0,oe=V(()=>si(o,i,f,u,s),[o,i,s,f,u]),j=V(()=>{let q=oe.map(qe=>({environmentId:qe}));if(!s||u!==void 0)return q;let ee=ku(i,oe,oe[0]),me=new Map;for(let qe of i)me.set(qe.environmentId,(me.get(qe.environmentId)??0)+1);return oe.flatMap(qe=>{let We=ee.get(qe);return We===void 0?[]:We.length===(me.get(qe)??0)?[{environmentId:qe}]:[{environmentId:qe,projectIds:We}]})},[i,s,oe,u]),H=V(()=>j.map(({environmentId:q,projectIds:ee})=>`${q}#${ee?.join("+")??"*"}`).join("|"),[j]),G=`${r}:${H}:${a.state}:${a.involvement}:${u??""}:${a.host??""}:${a.draft??""}:${a.review??""}:${a.checks??""}`,T=`${G}:${d}`,[K,U]=C({key:T,size:Pa,cursors:null,regrown:[]}),J=K.key===T?K.size:Pa,B=K.key===T?K.cursors:null,E=K.key===T?K.regrown:[];ge(()=>{U({key:T,size:Pa,cursors:null,regrown:[]})},[T]);let Y=V(()=>j.flatMap(({environmentId:q,projectIds:ee})=>{let me=B?.[q];return B!==null&&me===void 0&&!E.includes(q)?[]:[{environmentId:q,input:{state:a.state,involvement:a.involvement,limit:J,...u?{projectId:u}:{},...ee?{projectIds:ee}:{},...a.host?{host:a.host}:{},...v?{filters:D}:{},...w.text?{query:w.text}:{},...me===void 0?{}:{cursors:me}}}]}),[D,v,J,j,u,a.host,a.involvement,a.state,B,E,w.text]),W=wo(Y),ce=V(()=>j.map(({environmentId:q,projectIds:ee})=>({environmentId:q,input:{state:a.state,involvement:a.involvement,limit:Pa,...u?{projectId:u}:{},...ee?{projectIds:ee}:{},...a.host?{host:a.host}:{},...x?{filters:L}:{}}})),[x,L,j,u,a.host,a.involvement,a.state]),se=wo(ce),xe=a.involvement==="all"&&c.length===0,fe=V(()=>{if(!xe)return{authored:kd,reviewing:kd};let q=ee=>j.map(({environmentId:me,projectIds:qe})=>({environmentId:me,input:{state:a.state,involvement:ee,limit:Pa,...u?{projectId:u}:{},...qe?{projectIds:qe}:{},...a.host?{host:a.host}:{},...x?{filters:L}:{}}}));return{authored:q("authored"),reviewing:q("reviewing")}},[x,L,xe,j,u,a.host,a.state]),ie=wo(fe.authored),Ce=wo(fe.reviewing),ae=Oe(ke.invalidate,{reportFailure:!1}),[g,$]=C(0),[N,X]=C(!1),pe=async q=>{X(!0);try{await Promise.all(oe.map(ee=>ae({environmentId:ee,input:{}})))}finally{X(!1)}de(),se.refresh(),ie.refresh(),Ce.refresh(),q(),$(ee=>ee+1)},R=N||W.isPending,[F,Ie]=C(null),[Ae,ca]=C(null);ge(()=>{r.length!==0&&Ie(q=>{if(q!==null&&q.environmentKey===r)return q;let ee=ri(typeof window>"u"?void 0:window.localStorage,r);return ee===null?null:{environmentKey:r,scope:ee.scope,query:"",data:ee.data,...ee.partitions===void 0?{}:{partitions:ee.partitions}}})},[r]),ge(()=>{if(!W.data||W.isPending)return;let q=W.data;Ie(ee=>{let me=xe&&ie.data!==null&&Ce.data!==null?{authored:ie.data.entries,reviewing:Ce.data.entries}:ee!==null&&ee.environmentKey===r&&ee.scope===G?ee.partitions:void 0;if(r.length>0&&d.length===0){let qe=Ae?.key===T?Ae.entries:q.entries;ni(typeof window>"u"?void 0:window.localStorage,r,{scope:G,data:{...q,entries:qe,viewers:se.data?.viewers??q.viewers,providers:se.data?.providers??q.providers},...me===void 0?{}:{partitions:me}})}return{environmentKey:r,scope:G,query:d,data:q,...me===void 0?{}:{partitions:me}}})},[r,G,d,W.data,W.isPending,xe,ie.data,Ce.data,Ae,T,se.data]);let ta=V(()=>{if(F===null||F.environmentKey!==r||F.scope===G)return null;let q=Qs(F.data.entries,{state:a.state,projectId:u,host:a.host});return q.length===0?null:{...F.data,entries:q}},[r,F,G,u,a.host,a.state]),be=(d.length===0&&B===null&&J===Pa?se.data:W.data)??(F?.scope===G&&F.query===d?F.data:null),Ze=(d.length===0?se.data:void 0)??(F?.scope===G?F.data:null)??ta,Je=be??Ze,ya=be===null&&Ze!==null,Sa=W.isPending&&Je!==null,Q=W.isPending&&Je===null;ge(()=>{be&&ca(q=>{if(q===null||q.key!==T)return{key:T,entries:Vo(be.entries,w.text)};if(B!==null){let ee=new Set(q.entries.map(Xa)),me=be.entries.filter(We=>!ee.has(Xa(We))),qe=Vo(me.toSorted((We,Ha)=>Ha.updatedAt.localeCompare(We.updatedAt)),w.text);return{key:T,entries:[...q.entries,...qe]}}return{key:T,entries:Vo(be.entries,w.text)}})},[be,T,B,w.text]);let Le=be?.nextCursors??{},we=(be?.truncatedEnvironments??[]).filter(q=>Le[q]===void 0),Re=!ya&&Object.keys(Le).length>0,P=()=>{if(Re){U({key:T,size:we.length===0?J:Math.min(J+Pa,Lt),cursors:Le,regrown:we});return}U({key:T,size:Math.min(J+Pa,Lt),cursors:null,regrown:[]})},de=()=>{if(B===null){W.refresh();return}let q=Ae?.key===T?Ae.entries.length:J;U({key:T,regrown:[],size:Math.min(Math.max(J,Math.ceil(q/Pa)*Pa),Lt),cursors:null})};return wr(()=>{de(),ie.refresh(),Ce.refresh()},{enabled:l}),{typedQuery:c,querySettled:p,typedParsed:m,menuFilters:L,localFilters:y,hasLocalFilters:_,scopeKey:G,filterKey:T,pageSize:J,listQuery:W,baselineQuery:se,partitionsWanted:xe,authoredQuery:ie,reviewingQuery:Ce,detailRefreshToken:g,refreshing:R,loaded:F,ordered:Ae,answered:be,listData:Je,showingCarried:ya,loadingMore:Sa,firstLoad:Q,canContinue:Re,loadMore:P,refreshList:de,refreshFromHost:pe}}ft();ft();he();la();function Td(e){let{search:a}=Pe().useLocation();return V(()=>{let o=new URLSearchParams(a.startsWith("?")?a.slice(1):a),r={};for(let[l,s]of o.entries())r[l]=s;return r},[a])}function bp(e){let a=new URLSearchParams;for(let[o,r]of Object.entries(e))r==null||r===""||a.set(o,String(r));return a.toString()}function Ad(){let e=Pe(),a=e.useLocation();return oa(o=>{let r=new URLSearchParams(a.search.startsWith("?")?a.search.slice(1):a.search),l={};for(let[u,f]of r.entries())l[u]=f;let s=typeof o.search=="function"?o.search(l):o.search??l,i=bp(s);e.navigate(i.length>0?`/x/pull-requests?${i}`:"/x/pull-requests")},[e,a.search])}Te();he();St();la();Ne();function Md(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 Dd(e,a){let o={...e,...a};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 Rp=Os.make("pull-requests-panel"),Pp="pull-requests-panel";function Bd(){let[e,a]=C(!0),o=Td({strict:!1}),r=V(()=>Md(o),[o]),l=Ad(),{t:s}=k(),{environments:i}=Lr(),u=V(()=>i.filter(F=>F.serverConfig!==null).map(F=>F.environmentId),[i]),f=ud(Zr,u),c=V(()=>i.filter(F=>f.get(F.environmentId)===!0).toSorted((F,Ie)=>F.environmentId.localeCompare(Ie.environmentId)),[i,f]),d=c.find(F=>F.environmentId===r.environmentId)?.environmentId??null,p=V(()=>new Set(i.map(F=>F.environmentId)),[i]),m=V(()=>c.filter(F=>d===null||F.environmentId===d).map(F=>F.environmentId),[c,d]),w=V(()=>ti(m),[m]),L=f.size>0,x=m.length>0,{projects:D,bootstrapped:v}=An(),y=V(()=>D.filter(F=>m.includes(F.environmentId)),[D,m]),_=V(()=>new Map(i.map(F=>[F.environmentId,F.label])),[i]),oe=V(()=>{let F=new Map;for(let Ie of y)F.set(Ie.title,(F.get(Ie.title)??0)+1);return y.map(Ie=>({id:Ie.id,environmentId:Ie.environmentId,title:(F.get(Ie.title)??0)>1?`${Ie.title} \xB7 ${_.get(Ie.environmentId)??Ie.environmentId}`:Ie.title,workspaceRoot:Ie.workspaceRoot})).toSorted((Ie,Ae)=>Ie.title.localeCompare(Ae.title))},[_,y]),j=V(()=>Kr(r.projectId,y,v),[y,v,r.projectId]),H=V(()=>Vr(y,d,j),[y,d,j]),G=V(()=>{let F=r.repository?.toLowerCase();return F===void 0?void 0:y.find(Ae=>Ae.repositoryIdentity?.owner&&Ae.repositoryIdentity.name&&`${Ae.repositoryIdentity.owner}/${Ae.repositoryIdentity.name}`.toLowerCase()===F&&(r.host===void 0||zo(Ae.repositoryIdentity,Ae.repositoryIdentity.provider)===r.host.toLowerCase()))?.id},[y,r.host,r.repository]),T=V(()=>Kr(r.selectedProjectId,y,v),[y,v,r.selectedProjectId]),K=T??G??j,U=ii(r.selectedEnvironmentId,p,d),J=Pe(),B=V(()=>r.selectedProjectId===void 0||!v||T!==void 0?[]:m.filter(F=>U===null||F===U).map(F=>({environmentId:F,payload:{projectId:r.selectedProjectId}})),[m,T,v,r.selectedProjectId,U]),E=J.commands.useQueryEach("workspaceProject",B,{refreshKey:J.useRepositoryIdentityKey()}),Y=V(()=>li({projectId:r.selectedProjectId,environmentId:U,rows:B.length===0?[]:E.rows}),[E.rows,B.length,r.selectedProjectId,U]),W=V(()=>Y??Vr(y,U,K),[Y,y,U,K]),ce=V(()=>c.length===0?null:Us(Pp,Rp),[c.length]),se=_e(F=>Rr(F.byThreadKey,ce)),xe=_e(F=>Fn(F.byThreadKey,ce)),fe=xe?.kind==="pull-request"?xe:null,ie=se.isOpen?fe:null,Ce=ie?.environmentId??W?.environmentId??null,[ae,g]=C({}),$=ie?.id,N=oa(F=>{let Ie=$;Ie!==void 0&&g(Ae=>bd(Ae,Ie,F))},[$]),X=oa(F=>{l({to:"/x/$pluginId",params:{pluginId:Zr},search:Dd(r,F),replace:!0})},[l,r]),pe={repository:void 0,number:void 0,selectedProjectId:void 0,selectedEnvironmentId:void 0};return{masterVisible:e,setMasterVisible:a,search:r,t:s,capableEnvironments:c,scopedEnvironmentId:d,environmentIds:m,environmentKey:w,capabilityKnown:L,pullRequestsSupported:x,projectsKnown:v,projects:y,environmentLabels:_,scopedProjects:oe,scopedProjectId:j,scopedProject:H,selectedProject:W,rightPanelRef:ce,rightPanelState:se,selectedPullRequestDocument:fe,activePullRequestDocument:ie,panelEnvironmentId:Ce,pullRequestTabStatuses:ae,handlePullRequestTabStatusChange:N,updateSearch:X,clearedSelection:pe,updateListScope:F=>{ce!==null&&_e.getState().close(ce),X({...F,...pe})}}}ft();he();St();Ne();var Sp={};function Nd(e,a){let{masterVisible:o,search:r,environmentKey:l,pullRequestsSupported:s,projects:i,selectedProject:u,rightPanelRef:f,rightPanelState:c,selectedPullRequestDocument:d,activePullRequestDocument:p,updateSearch:m,clearedSelection:w}=e,{querySettled:L,typedParsed:x,localFilters:D,hasLocalFilters:v,scopeKey:y,filterKey:_,pageSize:oe,listQuery:j,baselineQuery:H,partitionsWanted:G,authoredQuery:T,reviewingQuery:K,loaded:U,ordered:J,answered:B,listData:E,showingCarried:Y,canContinue:W,loadMore:ce}=a,se=H.data?.viewers??E?.viewers??Sp,xe=H.data?.errors??E?.errors??[],fe=V(()=>new Set((H.data?.providers??E?.providers??[]).flatMap(Q=>Q.searchesOnHost?[Q.host]:[])),[H.data?.providers,E?.providers]),ie=V(()=>{let Q=J?.key===_?J.entries:E?.entries??[],Le=Xs(Q,se,r.involvement),we=v?Le.filter(P=>Gr(P,D,Ko(P,se))):Le;if(x.text.length===0)return we.toSorted((P,de)=>de.updatedAt.localeCompare(P.updatedAt));let Re=L&&!Y;return we.filter(P=>Re&&fe.has(P.host)||zr(P,x.text))},[_,v,D,E,J,L,r.involvement,fe,Y,x.text,se]),Ce=Ee(null);ge(()=>{let Q=Ce.current;if(!o||!Q||ie.length===0||E?.truncated!==!0||j.isPending||j.error!==null||Y||!W&&oe>=Lt)return;let Le=new IntersectionObserver(we=>{we.some(Re=>Re.isIntersecting)&&ce()},{rootMargin:"240px"});return Le.observe(Q),()=>Le.disconnect()},[o,ie.length,_,W,E?.truncated,j.error,j.isPending,oe,Y]);let ae=V(()=>{if(r.involvement!=="all")return[{key:"others",entries:ie}];let Q=U!==null&&U.environmentKey===l&&U.scope===y?U.partitions:void 0,Le=P=>P===void 0||!v?P:P.filter(de=>Gr(de,D,Ko(de,se))),we=Le(G?T.data?.entries??Q?.authored:void 0),Re=Le(G?K.data?.entries??Q?.reviewing:void 0);return we===void 0||Re===void 0?Zs(ie,se):Js(ie,we,Re)},[v,D,T.data?.entries,ie,l,U,G,K.data?.entries,y,r.involvement,se]),g=V(()=>{let Q=new Map;for(let Le of ae)for(let we of Le.entries){let Re=Q.get(we.environmentId)??[];Re.push({projectId:we.projectId,repository:we.repository,number:we.number}),Q.set(we.environmentId,Re)}return[...Q].map(([Le,we])=>({environmentId:Le,input:{refs:we}}))},[ae]),$=Ti(g),[N,X]=C(()=>new Map);ge(()=>{let Q=$.stats;Q!==null&&X(Le=>Ys(Le,Q))},[$.stats]);let pe=V(()=>r.repository&&r.number&&u?{environmentId:u.environmentId,repository:r.repository,number:r.number,projectId:u.id}:null,[r.number,r.repository,u]),R=d!==null;ge(()=>{!s||f===null||pe===null||_e.getState().openPullRequest(f,pe)},[pe,s,f]);let F=c.isOpen&&p!==null?{environmentId:p.environmentId,repository:p.repository,number:p.number,projectId:p.projectId}:null,Ie=Q=>m(Q===null?w:{repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,...Q.environmentId===void 0?{}:{selectedEnvironmentId:Q.environmentId}}),Ae=()=>{if(f!==null){if(c.isOpen){_e.getState().close(f),m(w);return}d!==null&&(_e.getState().show(f),Ie(d))}},[ca,ta]=C([]);ge(()=>{B!==null&&ta(Q=>r.host===void 0||Q.length===0?B.providers:Q)},[B,r.host]);let be=ca.length>1,Ze=V(()=>{let Q=new Map;for(let Le of i){let we=Le.repositoryIdentity?.provider;if(we===void 0)continue;let Re=zo(Le.repositoryIdentity,we);Q.has(Re)||Q.set(Re,{host:Re,kind:we})}return[...Q.values()]},[i]),Je=V(()=>new Map(xe.map(Q=>[Ra({id:Q.projectId,environmentId:Q.environmentId}),Q.message])),[xe]),ya=oa(Q=>{f!==null&&(_e.getState().openPullRequest(f,Q),m({repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,selectedEnvironmentId:Q.environmentId}))},[f,m]);return{entries:ie,sentinelRef:Ce,groups:ae,statsByRow:N,rightPanelAvailable:R,selected:F,selectSurfaceInUrl:Ie,toggleRightPanel:Ae,hosts:ca,showProvider:be,expectedHosts:Ze,unavailableProjects:Je,selectEntry:ya,refreshStats:()=>$.refresh()}}M();var kp=10;function Fd(){let e=Bd(),a=qd(e),o=Nd(e,a),{masterVisible:r,setMasterVisible:l,search:s,t:i,capableEnvironments:u,scopedEnvironmentId:f,capabilityKnown:c,pullRequestsSupported:d,projectsKnown:p,projects:m,environmentLabels:w,scopedProjects:L,scopedProjectId:x,scopedProject:D,rightPanelRef:v,rightPanelState:y,activePullRequestDocument:_,panelEnvironmentId:oe,pullRequestTabStatuses:j,handlePullRequestTabStatusChange:H,updateSearch:G,updateListScope:T}=e,{typedQuery:K,querySettled:U,typedParsed:J,menuFilters:B,pageSize:E,listQuery:Y,baselineQuery:W,authoredQuery:ce,reviewingQuery:se,detailRefreshToken:xe,refreshing:fe,listData:ie,showingCarried:Ce,loadingMore:ae,firstLoad:g,canContinue:$,loadMore:N,refreshList:X,refreshFromHost:pe}=a,{entries:R,sentinelRef:F,groups:Ie,statsByRow:Ae,rightPanelAvailable:ca,selected:ta,selectSurfaceInUrl:be,toggleRightPanel:Ze,hosts:Je,showProvider:ya,expectedHosts:Sa,unavailableProjects:Q,selectEntry:Le,refreshStats:we}=o,Re=()=>pe(we),P=t(yd,{value:s.q??"",busy:K.length>0&&(!U||Ce),onChange:O=>G({q:O||void 0})}),de=t(Cd,{showTerminalControl:!1,terminalAvailable:!1,terminalOpen:!1,terminalShortcutLabel:null,rightPanelAvailable:ca,rightPanelOpen:y.isOpen,rightPanelShortcutLabel:null,rightPanelUnavailableLabel:i("list.selectFirst"),onToggleTerminal:()=>{},onToggleRightPanel:Ze}),q=Ce&&Y.isPending&&R.length===0&&K.length===0,ee=n(Se,{children:[c?d?g?t(Ot,{rows:7}):Y.error&&ie===null?t(Lo,{error:Y.error,onRetry:()=>Y.refresh()}):q?t(Ot,{rows:7}):R.length===0?t(vd,{hasProjects:!p||m.length>0,refreshing:fe,onRefresh:()=>{Re()},query:K,filtered:s.state!=="open"||s.involvement!=="all"||x!==void 0||s.host!==void 0,searching:K.length>0&&(!U||Ce),canLoadMore:ie?.truncated===!0&&($||E<Lt),loadingMore:ae,onClearQuery:()=>G({q:void 0}),onLoadMore:N}):t("div",{className:"space-y-3",children:Ie.map(O=>n("div",{className:"space-y-0.5",children:[O.labelKey?t("h2",{className:"px-3 pb-0.5 text-xs font-medium text-muted-foreground/70",children:i(O.labelKey)}):null,O.entries.map(Be=>t(Ld,{entry:ui(Be,Ae),showProjectTitle:!0,showProvider:ya,...u.length>1&&w.get(Be.environmentId)!==void 0?{environmentLabel:w.get(Be.environmentId)}:{},matchedElsewhere:J.text.length>0&&Go(Be,J.text)<=kp,selected:ta?.environmentId===Be.environmentId&&ta.repository===Be.repository&&ta.number===Be.number,onSelect:Le},Xa(Be)))]},O.key))}):t(Lo,{title:i("list.unavailableTitle"),error:i("page.notEnabled")}):t(Ot,{rows:7}),Y.error&&ie!==null?n("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:[t("span",{children:i("list.staleNotice")}),t(b,{size:"xs",variant:"outline",onClick:()=>Y.refresh(),children:i("action.retry")})]}):null,ie?.truncated&&R.length>0?t("div",{ref:F,className:"flex justify-center py-2 text-xs text-muted-foreground",children:ae?n("span",{className:"flex items-center gap-2",children:[t("span",{className:"inline-flex size-icon-2 shrink-0 animate-spin",children:t(Ma,{"aria-hidden":!0,className:"size-icon-2"})}),i("list.loadingMore")]}):null}):null]}),me=Je.length>0?Je:Sa,qe=[{value:"",labelKey:"list.allHosts",Icon:He},...me.map(O=>{let Be=Je.find(Do=>Do.host===O.host);return{value:O.host,label:xd(me,O),Icon:Ya(O.kind).Icon,...Be===void 0||Be.configured?{}:{unavailable:Be.detail??i("list.hostUnreadable")}}})],We=[{value:"",labelKey:"list.allServers",Icon:He},...u.map(O=>({value:O.environmentId,label:O.label,Icon:O.displayUrl===null?co:ct}))],Ha=t(Id,{state:s.state,stateOptions:Un,onState:O=>T({state:O}),involvement:s.involvement,involvementOptions:Hn,onInvolvement:O=>T({involvement:O}),filters:B,onFilters:O=>T({draft:O.draft,review:O.review,checks:O.checks}),host:s.host,hostOptions:qe,onHost:O=>T({host:O}),server:f??void 0,serverOptions:We,onServer:O=>T({environmentId:O,projectId:void 0}),projects:L,projectId:x,projectEnvironmentId:D?.environmentId,unavailable:Q,onProject:(O,Be)=>T(Be===void 0?{projectId:O}:{projectId:O,environmentId:Be})}),jt={masterVisible:r,onMasterVisibilityChange:l,onBack:Ze,refreshing:fe,onRefresh:()=>{Re()},searchValue:s.q??"",involvement:s.involvement,state:s.state,host:s.host,hostMenuOptions:qe,onInvolvement:O=>T({involvement:O}),onState:O=>T({state:O}),onHost:O=>T({host:O}),searchInput:P,filtersMenu:Ha,rightPanelControl:d?de:null,listBody:ee},Pr=O=>{v!==null&&(_e.getState().activateDocument(v,O.id),be(O))},Ao=O=>{if(v===null)return;_e.getState().closeDocument(v,O.id);let Be=En(_e.getState().byThreadKey,v);be(Be?.kind==="pull-request"?Be:null)},tt=O=>{v!==null&&(_e.getState().closeOtherDocuments(v,O.id),be(O))},Sr=O=>{if(v===null)return;_e.getState().closeDocumentsToRight(v,O.id);let Be=En(_e.getState().byThreadKey,v);be(Be?.kind==="pull-request"?Be:null)},kr=()=>{v!==null&&(_e.getState().closeAllDocuments(v),be(null))},Mo=y.isOpen&&_&&oe!==null?t(wd,{widthStorageKey:"ycodium:pull-request-panel-width",defaultWidth:typeof window>"u"?640:Math.floor(window.innerWidth/2),documents:y.documents,activeDocumentId:_.id,onActivate:O=>{O.kind==="pull-request"&&Pr(O)},onCloseDocument:O=>{O.kind==="pull-request"&&Ao(O)},onCloseOtherDocuments:O=>{O.kind==="pull-request"&&tt(O)},onCloseDocumentsToRight:O=>{O.kind==="pull-request"&&Sr(O)},onCloseAllDocuments:kr,pullRequestStatuses:j,children:t(Cr,{environmentId:oe,reference:{projectId:_.projectId,repository:_.repository,number:_.number},refreshToken:xe,onActed:()=>{X(),W.refresh(),ce.refresh(),se.refresh()},onStateChange:H},_.id)}):null;return t(wi,{className:"h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground",children:t(Pd,{...jt,rightPanel:Mo})})}Ea();M();function Od(e){ol(typeof e.notify=="function"?e.notify:()=>{},typeof e.notifyTask=="function"?e.notifyTask:void 0),typeof e.openExternal=="function"&&nl(e.openExternal),typeof e.writeClipboard=="function"&&sl(e.writeClipboard),ml(a=>{if(typeof e.openCommandPalette=="function"&&fa(e,"commandPalette")){e.openCommandPalette(a);return}typeof e.notify=="function"&&e.notify(Yn,"warning")},fa(e,"commandPalette")),e.composerDraft!==void 0&&yl(e.composerDraft)}function Ed({bridge:e}){let a=e.useFormatTimestamp();return ge(()=>{Od(e),cl(a)},[e,a]),null}function qp(e){if(["InputGroup","InputGroupAddon","InputGroupInput","DocumentPanel","MasterDetail","useLinkContextMenu"].some(r=>e.ui[r]===void 0)){let r=function(){let l=e.i18n.usePluginTranslation();return t("p",{role:"status",className:"p-6 text-sm text-muted-foreground",children:l("page.hostUpgradeRequired")})};var o=r;return{pages:{"pull-requests":r},panels:{},views:{detail:r}}}return Od(e),{pages:{"pull-requests":function(){return n(Br,{value:e,children:[t(Ed,{bridge:e}),t("style",{children:Dr}),t(Fd,{})]})}},panels:{},views:{detail:function({threadReference:l,...s}){return n(Br,{value:e,children:[t(Ed,{bridge:e}),t("style",{children:Dr}),t("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:t(Cr,{...s,context:l?Wi(l,s.reference)?"thread":"page":s.context??"page"})})]})}}}}export{qp as default};
1528
+ `;he();$t();la();sa();var rl=()=>{};function nl(e){rl=e}function ia(){return{shell:{openExternal:async e=>{rl(e)}}}}function ll(e){try{let a=new URL(e),o=/^(.*?)\/-\/merge_requests\/\d+(?:\/|$)/iu.exec(a.pathname)?.[1]??/^(.*?)(?:\/pull\/\d+|\/-\/merge_requests\/\d+)(?:\/|$)/iu.exec(a.pathname)?.[1];return o?(a.pathname=o,a.search="",a.hash="",a.toString()):null}catch{return null}}var Nr=async()=>{};function sl(e){Nr=e}async function il(e){return await Nr(e),!0}function ul(e){return{copyToClipboard:a=>{Nr(a)},isCopied:!1}}_a();var fl=()=>{},pl=!0;function ml(e,a=!0){fl=e,pl=a}function gl(){return pl}function hl(e){fl(e)}he();$t();la();sa();function Xt(e){if(e!==null&&typeof e=="object"&&"cause"in e){let a=e.cause;return a instanceof Error?a:new Error(String(a))}return e instanceof Error?e:new Error(String(e))}function Oo(e){return{getComposerDraft:a=>e.get(a),setPrompt:(a,o)=>e.setPrompt(a,o),setReviewComments:(a,o)=>e.setReviewComments(a,o)}}var xl=Oo({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function yl(e){xl=Oo(e)}var gc=Oo({get:()=>null,setPrompt:()=>{},setReviewComments:()=>{}});function Ho(){let e=Pe();return e.composerDraft===void 0||!fa(e,"composerDraft")?gc:Oo(e.composerDraft)}Ho.getState=()=>xl;function Il(){let e=Pe(),a=typeof e.useCreateThread=="function"?e.useCreateThread():null;return async(o,r)=>a===null||!fa(e,"createThread")?(ye.error(Wt),null):a(o,r)}function vl(e){let a=Pe(),o=typeof a.usePrepareWorkspace=="function"?a.usePrepareWorkspace():async()=>({ok:!1,error:Wt}),[r,l]=C(null);return{error:r,run:async s=>{if(e.cwd===null){let u=new Error("No workspace is available for this checkout.");return l(u),{_tag:"Failure"}}let i=await o({environmentId:e.environmentId,cwd:e.cwd,reference:s.reference,mode:s.mode,...s.threadId===void 0?{}:{threadId:s.threadId}});return i.ok?(l(null),{_tag:"Success",value:i.value}):(l(new Error(i.error)),{_tag:"Failure"})}}}var Ll={listRefs:e=>({command:"listRefs",environmentId:e.environmentId,payload:e.input})};Fe();St();he();ze();A();A();ze();Te();M();function te({className:e}){return t("div",{"aria-hidden":!0,className:S("h-3 rounded bg-muted-foreground/15",e)})}var Qo=["w-3/5","w-2/5","w-1/2","w-2/3","w-2/5","w-3/5","w-1/2"],Et=["w-2/5","w-1/3","w-2/5","w-1/4","w-1/3","w-2/5","w-1/3"];function Ot({rows:e=7,caption:a}){let{t:o}=k();return n("div",{role:"status","aria-label":a??o("ghost.loadingList"),className:"animate-ghost-pulse space-y-0.5",children:[a?t("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground/70",children:a}):null,Array.from({length:e},(r,l)=>n("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-lg px-3 py-2",children:[t(te,{className:"size-4 rounded-full"}),n("div",{className:"min-w-0 space-y-1.5",children:[t(te,{className:S("h-3.5",Qo[l%Qo.length])}),t(te,{className:Et[l%Et.length]})]}),n("div",{className:"flex flex-col items-end gap-1.5",children:[t(te,{className:"w-12"}),t(te,{className:"w-16"})]})]},l))]})}function Pi(){let{t:e}=k();return n("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:[n("div",{className:"shrink-0 border-b border-border/60",children:[n("div",{className:"flex h-7 items-center justify-between gap-3 px-4",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t(te,{className:"w-24"}),t(te,{className:"w-9"})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[t(te,{className:"h-5 w-16 rounded-control-1"}),t(te,{className:"size-5 rounded-control-1"})]})]}),n("div",{className:"px-4 pb-4 pt-1",children:[t(te,{className:"h-5 w-4/5 max-w-md"}),n("div",{className:"mt-2 flex items-center gap-1.5",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:"w-24"})]}),n("div",{className:"mt-4 flex min-w-0 items-center gap-2",children:[t(te,{className:"h-6 w-24 rounded-control-2"}),t(te,{className:"size-3 rounded-full"}),t(te,{className:"h-6 w-32 rounded-control-2"}),n("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[t(te,{className:"w-10"}),t(te,{className:"w-20"})]})]})]}),n("div",{className:"flex min-h-10 items-center justify-between gap-3 border-t border-border/60 px-4 py-2",children:[n("div",{className:"flex items-center gap-1 p-0.5",children:[t(te,{className:"h-6 w-16 rounded-control-2"}),t(te,{className:"h-6 w-16 rounded-control-2"}),t(te,{className:"h-6 w-12 rounded-control-2"})]}),t(te,{className:"w-20"})]})]}),n("div",{className:"min-h-0 flex-1 overflow-hidden",children:[n("section",{className:"px-4 py-3",children:[n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-14"})]}),n("div",{className:"flex items-center gap-1",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:"size-4 rounded-full"}),t(te,{className:"ml-1 size-5 rounded-control-1"})]})]}),n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-10"})]}),n("div",{className:"flex items-center gap-1",children:[t(te,{className:"h-5 w-24 rounded-full"}),t(te,{className:"h-5 w-20 rounded-full"})]})]}),n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2",children:[n("div",{className:"flex items-center gap-1.5",children:[t(te,{className:"size-icon-2 rounded-full"}),t(te,{className:"w-14"})]}),t(te,{className:"w-20"})]})]}),n("section",{className:"border-t border-border/60",children:[n("div",{className:"flex min-h-11 items-center gap-1.5 px-4 py-3",children:[t(te,{className:"h-4 w-24"}),t(te,{className:"size-icon-2 rounded-full"})]}),n("div",{className:"space-y-2 px-4 pb-4",children:[t(te,{className:"w-full"}),t(te,{className:"w-11/12"}),t(te,{className:"w-4/5"}),t(te,{className:"w-2/3"})]})]})]})]})}function Si({rows:e=4}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingPeople"),className:"animate-ghost-pulse space-y-1 p-1",children:Array.from({length:e},(o,r)=>n("div",{className:"flex h-7 items-center gap-2 rounded-control-3 px-2",children:[t(te,{className:"size-4 rounded-full"}),t(te,{className:Et[r%Et.length]})]},r))})}function ki({rows:e=6}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingTimeline"),className:"animate-ghost-pulse px-4 py-5",children:t("div",{className:"relative ml-2 border-l border-border/70 pl-5",children:Array.from({length:e},(o,r)=>n("div",{className:"relative pb-5",children:[t(te,{className:"absolute -left-[1.55rem] top-1 size-2 rounded-full"}),t(te,{className:S("h-3.5",Qo[r%Qo.length])}),t(te,{className:"mt-1.5 w-16"})]},r))})})}function qi({rows:e=3}){let{t:a}=k();return t("div",{role:"status","aria-label":a("ghost.loadingConversation"),className:"animate-ghost-pulse space-y-4 py-2",children:Array.from({length:e},(o,r)=>n("div",{className:"flex items-start gap-2",children:[t(te,{className:"size-5 shrink-0 rounded-full"}),n("div",{className:"flex-1 space-y-1.5",children:[t(te,{className:Et[r%Et.length]}),t(te,{className:"w-full"}),t(te,{className:"w-3/4"})]})]},r))})}Fe();ze();A();Te();M();function Zo({error:e,onRetry:a,compact:o=!1}){let{t:r}=k();return n("div",{className:S("flex flex-col items-center justify-center gap-2 text-center",o?"py-3":"min-h-48 px-4 py-10"),children:[t("p",{className:"text-sm font-medium text-foreground",children:r("activity.loadFailed")}),t("p",{className:"max-w-md text-xs text-muted-foreground",children:e}),n(b,{size:"sm",variant:"outline",onClick:a,children:[t(ea,{"aria-hidden":!0}),r("action.retry")]})]})}Fe();Te();A();A();M();function Lo({title:e,error:a,onRetry:o}){let{t:r}=k();return n(qt,{className:"px-4 py-16 md:px-4",children:[t(fi,{variant:"icon",children:t(Xe,{})}),n(Mt,{children:[t(Dt,{children:e??r("list.loadFailedTitle")}),t(At,{children:a})]}),o?t(Tt,{children:n(b,{size:"sm",variant:"outline",onClick:o,children:[t(ea,{}),r("action.retry")]})}):null]})}Fe();he();Ne();Ne();ze();_a();sa();A();A();da();Te();Te();Fe();he();Ne();Ne();Ne();sa();A();A();A();A();da();Ea();M();function Nf(e,a){if(a.length===0)return!0;let o=a.toLowerCase();return e.login.toLowerCase().includes(o)||(e.name??"").toLowerCase().includes(o)}function ou({environmentId:e,reference:a,allowed:o,onRequested:r}){let[l,s]=C(!1),[i,u]=C(""),[f,c]=C(null),{t:d}=k(),p=xa(l?ke.reviewerCandidates({environmentId:e,input:a}):null),m=Oe(ke.act,{reportFailure:!1}),w=V(()=>(p.data?.candidates??[]).filter(x=>Nf(x,i)),[p.data,i]),L=async x=>{if(f!==null)return;c(x.id);let D=await m({environmentId:e,input:{op:"requestReviewers",...a,reviewers:[{id:x.id,kind:x.kind}],requested:!x.isRequested}});if(c(null),D._tag==="Failure"){ye.error(x.isRequested?d("reviewer.withdrawFailedTitle",{login:x.login}):d("reviewer.requestFailedTitle",{login:x.login}),So(Xt(D),d("reviewer.requestFailedHint")));return}ye.success(x.isRequested?d("reviewer.withdrawnTitle",{login:x.login}):d("reviewer.requestedTitle",{login:x.login})),r(),p.refresh()};return o?n(ma,{open:l,onOpenChange:s,children:[t(ha,{render:t(b,{size:"icon-xs",variant:"ghost","aria-label":d("action.requestReviewAria"),children:t(Pt,{})})}),n(ga,{align:"start",side:"bottom",className:"w-72 p-0",children:[t("div",{className:"border-b border-border/60 p-2",children:t(jo,{autoFocus:!0,value:i,onChange:x=>u(x.currentTarget.value),placeholder:d("reviewer.searchPlaceholder"),"aria-label":d("reviewer.searchPlaceholder"),size:"compact"})}),n("div",{className:"max-h-72 overflow-y-auto p-1",children:[p.isPending?t(Si,{rows:4}):p.error!==null?t("p",{className:"p-2 text-xs text-muted-foreground",children:d("reviewer.peopleUnreadable",{error:p.error})}):w.length===0?t("p",{className:"p-2 text-xs text-muted-foreground",children:i.length>0?d("reviewer.noMatches"):d("reviewer.noAccess")}):w.map(x=>n("button",{type:"button",disabled:f!==null,onClick:()=>{L(x)},className:"relative flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:[t(wa,{actor:x,className:"min-w-0 flex-1 truncate"}),x.kind==="team"?t("span",{className:"shrink-0 text-muted-foreground",children:d("reviewer.team")}):null,x.isRequested?t(lt,{"aria-label":d("action.alreadyAskedAria"),className:"size-icon-2 shrink-0"}):null]},`${x.kind}:${x.id}`)),p.data?.truncated?t("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:d("reviewer.truncatedNotice")}):null]})]})]}):n(re,{children:[t(le,{render:t(b,{size:"icon-xs",variant:"ghost",disabled:!0,"aria-label":d("action.requestReviewAria"),children:t(Pt,{})})}),t(ne,{side:"bottom",children:d("reviewer.writeAccessRequired")})]})}Ea();Ut();ko();Gt();qo();ir();Fe();he();Ne();Ne();ze();_a();sa();A();A();A();A();da();Te();Gt();qo();function xu(e){let a=e.sectionTop<e.viewportTop,o=e.headingTop<=e.viewportTop+1;return!a||!o?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}M();function Kt(e){return e.toLowerCase()}function yu(e){let a=e?.trim().replace(/^#/,"")??"";return/^[0-9a-fA-F]{6}$/.test(a)?`#${a}`:null}function In({actor:e}){let a=e?.login??"ghost";return n(re,{children:[t(le,{render:t("span",{className:"shrink-0 rounded-full","aria-label":a}),children:t(ht,{actor:e})}),t(ne,{side:"bottom",children:e?.name&&e.name!==a?`${e.name} (@${a})`:a})]})}function Iu(e){let a=e.toLowerCase().replace(/_/g," ");return a.charAt(0).toUpperCase()+a.slice(1)}function vn({comment:e,editing:a,className:o}){let{t:r}=k();return a.editingId===e.id?t(Ja,{className:o,value:e.body,cwd:a.cwd,environmentId:a.environmentId,label:r("action.editComment"),saving:a.saving,onSave:l=>a.onSave(e,l),onCancel:()=>a.onEdit(null)}):n("div",{className:S("flex items-start gap-1",o),children:[t(ba,{className:"min-w-0 flex-1",text:e.body,cwd:a.cwd,environmentId:a.environmentId}),a.canEdit(e)?t(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:()=>a.onEdit(e),children:t(ra,{className:"size-3"})}):null]})}function vu({comment:e,editing:a,label:o,body:r,reactionBar:l}){let[s,i]=C(!1);return t(pt,{open:s,onOpenChange:i,children:n("article",{className:"group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]",children:[n(gt,{className:S("flex w-full items-center gap-2 p-3 text-left transition-opacity hover:opacity-100",s?"opacity-100":"opacity-65"),children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[t(In,{actor:e.author}),t("span",{children:Ge(e.createdAt)}),t("span",{children:o})]}),t(Ye,{"aria-hidden":!0,className:S("size-icon-1 shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),t(mt,{children:s?n("div",{className:"px-3 pb-3",children:[e.path?n(re,{children:[t(le,{render:t("p",{className:"truncate text-xs text-muted-foreground",children:e.path})}),t(ne,{side:"top",children:e.path})]}):null,r===null&&!a.canEdit(e)?null:t(vn,{className:"mt-2",comment:e,editing:a}),l]}):null})]})})}function ur({icon:e,label:a,children:o}){return n("div",{className:"grid min-h-8 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 py-1.5 text-xs",children:[n("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[e,a]}),t("span",{className:"min-w-0 text-foreground",children:o})]})}function dr({title:e,count:a,defaultOpen:o=!0,actions:r,children:l}){let[s,i]=C(o),u=Ee(null);return n(pt,{open:s,onOpenChange:c=>{if(!c){let d=u.current,p=d?.closest("[data-pull-request-summary-section]"),m=d?.closest("[data-pull-request-summary-scroll]");if(d&&p&&m){let w=xu({scrollTop:m.scrollTop,viewportTop:m.getBoundingClientRect().top,sectionTop:p.getBoundingClientRect().top,headingTop:d.getBoundingClientRect().top});w!==null&&(m.scrollTop=w)}}i(c)},"data-pull-request-summary-section":!0,children:[n("div",{ref:u,className:"sticky top-0 z-10 flex w-full items-center border-t border-border/60 bg-background pr-4",children:[n(gt,{className:"flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-sm font-medium",children:[t("span",{children:e}),t(Jt,{"aria-hidden":!0,className:S("size-icon-1 text-muted-foreground transition-transform",s&&"rotate-90")}),a===void 0?null:t("span",{className:"text-xs tabular-nums text-muted-foreground",children:a})]}),s?r:null]}),t(mt,{children:t("div",{className:"px-4 pb-4",children:l})})]})}function Lu({environmentId:e,detail:a,onCommented:o}){let{t:r}=k(),[l,s]=C(""),[i,u]=C(!1),f=Oe(ke.converse,{reportFailure:!1}),c=async()=>{let d=l.trim();if(d.length===0||i)return;u(!0);let p=await f({environmentId:e,input:{op:"comment",projectId:a.projectId,repository:a.repository,number:a.number,body:d}});if(u(!1),p._tag==="Failure"){ye.error(r("notify.commentPostFailed"));return}s(""),o()};return n("div",{className:"mt-3 space-y-2",children:[t(Qa,{disabled:i,value:l,rows:3,placeholder:r("summary.commentPlaceholder"),"aria-label":r("summary.commentAria"),onChange:d=>s(d.target.value)}),t("div",{className:"flex justify-end",children:n(b,{size:"xs",variant:"outline",disabled:l.trim().length===0||i,onClick:()=>{c()},children:[t(go,{}),r(i?"action.posting":"action.comment")]})})]})}M();var cr=30;function wu({environmentId:e,reference:a,detail:o,activityPending:r,activityError:l,pendingFinding:s,fixFindingLabel:i,fixCheckLabel:u,onFixFinding:f,onRefresh:c}){let{t:d}=k(),p=d(i??"thread.fixInThread"),m=d(u??"handoff.fix"),[w,L]=C({url:o.url,count:cr}),x=w.url===o.url?w.count:cr,D=o.comments.slice(Math.max(0,o.comments.length-x)),v=o.comments.length-D.length,[y,_]=C("newest"),oe=Ji(D,y),j=nr(o.comments,o.commits),H=new Map(j.flatMap(g=>g.actor?[[Kt(g.actor.login),g]]:[])),G=[...o.reviewers.map(g=>({key:g.login,actor:g,outcome:H.get(Kt(g.login))?.outcome??null,stale:H.get(Kt(g.login))?.stale??!1})),...j.filter(g=>!o.reviewers.some($=>g.actor!==null&&Kt($.login)===Kt(g.actor.login))).map(g=>({key:g.key,actor:g.actor,outcome:g.outcome,stale:g.stale}))],T=new Map(o.reviewThreads.flatMap(g=>g.comments.map($=>[$.id,g]))),K=g=>{ia()?.shell.openExternal(g)},U=Oe(ke.act,{reportFailure:!1}),J=Oe(ke.converse,{reportFailure:!1}),[B,E]=C(null),[Y,W]=C(!1),[ce,se]=C(null),[xe,fe]=C(!1),ie=ce?.pullRequest===o.url?ce.commentId:null,Ce=async g=>{if(Y)return;W(!0);let $=await U({environmentId:e,input:{op:"update",...a,body:g}});if(W(!1),$._tag==="Failure"){ye.error(d("notify.descriptionSaveFailed"));return}E(null),c()},ae={cwd:o.workspaceRoot,environmentId:e,canEdit:g=>_t(o,g),editingId:ie,saving:xe,onEdit:g=>se(g===null?null:{pullRequest:o.url,commentId:g.id}),onSave:async(g,$)=>{if(xe||g.kind==="review")return;fe(!0);let N=await J({environmentId:e,input:{op:"updateComment",...a,commentId:g.id,kind:g.kind,body:$}});if(fe(!1),N._tag==="Failure"){ye.error(d("notify.commentSaveFailed"));return}se(null),c()}};return n("div",{className:"h-full overflow-y-auto","data-pull-request-summary-scroll":!0,children:[t("section",{className:"px-4 py-3",children:n("div",{children:[t(ur,{icon:t(Io,{className:"size-icon-2"}),label:d("summary.reviewers"),children:n("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[G.length===0?t("span",{className:"text-muted-foreground",children:d("summary.none")}):t("span",{className:"flex items-center -space-x-1",children:G.map(g=>{let $=g.actor?.login??"ghost",N=g.actor?.name&&g.actor.name!==$?`${g.actor.name} (@${$})`:$;return n(re,{children:[n(le,{render:t("span",{className:S("relative rounded-full hover:z-10",g.outcome?Ni(g.outcome,g.stale):void 0)}),children:[t(wa,{actor:g.actor,tooltip:!1,className:S("gap-0 [&>span:last-child]:sr-only",g.outcome?void 0:"[&>img]:ring-2 [&>img]:ring-background [&>span:first-child]:ring-2 [&>span:first-child]:ring-background")}),g.outcome?t("span",{className:"sr-only",children:d(g.stale?bo(g.outcome):Ro(g.outcome))}):null]}),t(ne,{side:"bottom",children:g.outcome?`${N} \u2014 ${g.stale?d(bo(g.outcome)):d(Ro(g.outcome))}`:N})]},g.key)})}),o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?t(ou,{environmentId:e,reference:a,allowed:o.viewerPermissions.requestReviewers,onRequested:c}):null]})}),o.labels.length>0?t(ur,{icon:t(xo,{className:"size-icon-2"}),label:d("summary.labels"),children:t("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:o.labels.map(g=>{let $=yu(g.color);return n("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:[t("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full bg-muted-foreground",...$?{style:{backgroundColor:$}}:{}}),t("span",{className:"truncate",children:g.name})]},g.name)})})}):null,t(ur,{icon:t(Qe,{className:"size-icon-2"}),label:d("summary.comments"),children:r?d("summary.loadingConversation"):l?d("summary.conversationUnavailable"):d("comment.count",{count:o.commentCount})})]})}),t(dr,{title:d("summary.description"),children:n("div",{className:"group",children:[B===o.url?t(Ja,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:e,label:d("summary.descriptionAria"),placeholder:d("summary.descriptionPlaceholder"),saving:Y,onSave:g=>{Ce(g)},onCancel:()=>E(null)}):n("div",{className:"flex items-start gap-1",children:[t(ba,{className:"min-w-0 flex-1",text:o.body.trim().length>0?o.body:d("summary.noDescription"),cwd:o.workspaceRoot,environmentId:e}),lr(o)?t(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:()=>E(o.url),children:t(ra,{className:"size-3"})}):null]}),t(Oa,{className:"mt-2",reactions:o.reactions??[],canReact:o.capabilities.reactions===!0,environmentId:e,reference:a,onRefresh:c})]})}),t(dr,{title:d("checks.title"),count:o.checks.length,children:o.checks.length===0?t("p",{className:"text-xs text-muted-foreground",children:d("checks.noneReported")}):t("div",{className:"space-y-0.5",children:o.checks.map((g,$)=>{let N={kind:"check",check:g},X=g.status==="failure"||g.status==="cancelled";return n("div",{className:"group flex items-center gap-1 rounded-md pr-1 hover:bg-accent",children:[n("button",{type:"button",disabled:!g.url,onClick:()=>g.url&&K(g.url),className:S("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",g.url?void 0:"cursor-default"),children:[t(Yo,{status:g.status}),t("span",{className:"min-w-0 flex-1 truncate",children:g.name}),t("span",{className:"shrink-0 text-muted-foreground",children:d(Jo(g.status))})]}),f&&X?n(b,{size:"xs",variant:"ghost",className:"shrink-0",disabled:s!=null,onClick:()=>f(N),children:[t(va,{className:"size-3"}),s===Za(N)?d("action.preparing"):m]}):null]},`${$}:${g.name}:${g.url??""}`)})})}),n(dr,{title:d("summary.comments"),...r||l?{}:{count:o.commentCount},actions:!r&&!l&&o.comments.length>0?n(b,{size:"xs",variant:"ghost",className:"h-7 shrink-0 px-2 text-[10px] text-muted-foreground","aria-label":d(y==="newest"?"summary.commentsOldestAria":"summary.commentsNewestAria"),onClick:()=>_(g=>g==="newest"?"oldest":"newest"),children:[t(nt,{"aria-hidden":!0,className:"size-3"}),d(y==="newest"?"sort.newestFirst":"sort.oldestFirst")]}):null,children:[r?t(qi,{}):l?t(Zo,{compact:!0,error:l,onRetry:c}):n(Se,{children:[o.commentsTruncated?t("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?t("p",{className:"py-2 text-xs text-muted-foreground",children:d("summary.noComments")}):n("div",{className:"space-y-3",children:[v>0?t(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>L({url:o.url,count:x+cr}),children:d("summary.showEarlier",{count:Math.min(v,cr)})}):null,oe.map(g=>{let $=T.get(g.id),N=xt(g.body),X=zt(g.reviewState);if($?.isResolved||X==="dismissed")return t(vu,{comment:g,editing:ae,label:$?.isResolved?d("thread.resolved"):d("summary.approvalDismissed"),body:N,reactionBar:t(Oa,{className:"mt-2",reactions:g.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:g.id,environmentId:e,reference:a,onRefresh:c})},g.id);let pe=g.kind!=="review"&&g.kind!=="review-comment"||X==="approved"?null:$===void 0?N===null?null:{kind:"comment",comment:g}:{kind:"thread",thread:$},R=t(Oa,{reactions:g.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:g.id,environmentId:e,reference:a,onRefresh:c,...N===null?{}:{className:"mt-2"}});return n("article",{className:"group rounded-lg border border-border/60 p-3 [contain-intrinsic-block-size:120px] [content-visibility:auto]",children:[n("div",{className:"flex items-start gap-2",children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",children:[t(In,{actor:g.author}),t("span",{children:Ge(g.createdAt)}),X?t(Fi,{outcome:X}):g.reviewState?t("span",{children:Iu(g.reviewState)}):null,N===null?R:null]}),f&&pe?n(b,{size:"xs",variant:"ghost",className:"-mt-1 shrink-0",disabled:s!=null,onClick:()=>f(pe),children:[t(va,{className:"size-3"}),s===Za(pe)?d("action.preparing"):p]}):null]}),g.path?n(re,{children:[t(le,{render:t("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:g.path})}),t(ne,{side:"top",children:g.path})]}):null,N===null&&!ae.canEdit(g)?null:t(vn,{className:"mt-2",comment:g,editing:ae}),N===null?null:R]},g.id)})]})]}),o.capabilities.comment&&o.viewerPermissions.comment?t(Lu,{environmentId:e,detail:o,onCommented:c},`${e}:${o.projectId}/${o.repository}#${o.number}`):null]})]})}Fe();he();ze();Te();Ne();Ne();_a();sa();A();A();A();Ea();ko();Gt();qo();ir();da();M();function Cu({body:e,markdown:a,cwd:o,environmentId:r}){return t("div",{className:"mt-3",children:a?t(ba,{text:e,cwd:o,environmentId:r}):t("p",{className:"whitespace-pre-wrap text-xs text-muted-foreground",children:e})})}function Ln({actor:e}){return t("span",{className:"font-semibold text-foreground",children:e?.login??"ghost"})}function bu({children:e,className:a}){return t("span",{className:S("absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background",a),children:e})}function Ru({icon:e,className:a}){return t(bu,{className:a,children:t("span",{className:"flex size-7 items-center justify-center bg-background text-muted-foreground",children:e})})}function wn({actors:e,className:a,fallback:o,muted:r=!1}){let l=e[0];return l===void 0?t(Ru,{className:a,icon:o}):t(bu,{className:a,children:t(ht,{actor:l,className:S("size-7 bg-muted text-[9px] transition-opacity",r&&"opacity-45 grayscale")})})}function Jf(e){return e.toLowerCase().replaceAll("_"," ").replaceAll("-"," ").replace(/^\w/u,o=>o.toUpperCase())}function Yf({state:e}){return t("span",{className:"text-[10px] font-medium text-muted-foreground",children:Jf(e)})}function Pu({url:e,onOpen:a}){let{t:o}=k();return e===null?null:t(b,{size:"icon-xs",variant:"ghost",className:"-mr-1 -mt-1 shrink-0 text-muted-foreground","aria-label":o("timeline.openActivityAria"),onClick:()=>a(e),children:t(it,{className:"size-3"})})}function ep({event:e,editable:a,cwd:o,onOpen:r,reactions:l}){let{t:s}=k(),[i,u]=C(!1),[f,c]=C(!1),d=Oe(ke.converse,{reportFailure:!1}),p=async m=>{if(a===null||f||a.kind==="review")return;c(!0);let w=await d({environmentId:l.environmentId,input:{op:"updateComment",...l.reference,commentId:a.id,kind:a.kind,body:m}});if(c(!1),w._tag==="Failure"){ye.error(s("notify.commentSaveFailed"));return}u(!1),l.onRefresh()};return n("article",{className:"group py-2",children:[t("div",{className:"px-2",children:n("div",{className:"flex min-w-0 items-start gap-2",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[t(Ln,{actor:e.actor}),t("span",{className:"text-muted-foreground",children:s(e.titleKey,e.titleValues)}),e.reviewState?t(Yf,{state:e.reviewState}):null]}),n(Ca,{className:"mt-1 flex-wrap text-[11px] text-muted-foreground",children:[t("span",{children:Ge(e.at)}),e.path?n("span",{className:"inline-flex min-w-0 items-center gap-1",children:[t(qa,{"aria-hidden":!0,className:"size-3 shrink-0"}),t("span",{className:"truncate",children:e.path})]}):null]})]}),a!==null&&!i?t(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":s("action.editComment"),onClick:()=>u(!0),children:t(ra,{className:"size-3"})}):null,t(Pu,{url:e.url,onOpen:r})]})}),i&&a!==null?t("div",{className:"px-2 pb-2 pt-3",children:t(Ja,{value:a.body,cwd:o,environmentId:l.environmentId,label:s("action.editComment"),saving:f,onSave:m=>{p(m)},onCancel:()=>u(!1)})}):e.body?t("div",{className:"px-2 pb-2",children:t(Cu,{body:e.body,markdown:e.markdown,cwd:o,environmentId:l.environmentId})}):null,l.canReact||e.reactions.length>0?t("div",{className:"px-2 pb-2",children:t(Oa,{reactions:e.reactions,canReact:l.canReact,subjectId:e.id,environmentId:l.environmentId,reference:l.reference,onRefresh:l.onRefresh})}):null]})}function ap(e){let a=new Map;for(let o of e){let r=o.actor;r!==null&&!a.has(r.login)&&a.set(r.login,r)}return[...a.values()]}function tp({events:e,editable:a,cwd:o,onOpen:r,reactions:l}){let{t:s}=k(),[i,u]=C(!1),f=ap(e),c=e[0];return c===void 0?null:n("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(wn,{actors:f,className:"top-6",fallback:t(Qe,{className:"size-icon-2"}),muted:!i}),t(pt,{open:i,onOpenChange:u,children:n("div",{children:[n(gt,{className:S("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:[n("span",{className:"min-w-0 flex-1",children:[t("span",{className:"block text-xs font-semibold",children:s("timeline.commentCount",{count:e.length,total:e.length.toLocaleString()})}),n("span",{className:"block truncate text-[10px] text-muted-foreground",children:[s("timeline.authorCount",{count:f.length,total:f.length.toLocaleString()})," ","\xB7 ",Ge(c.at)]})]}),t(Ye,{"aria-hidden":!0,className:S("size-icon-1 shrink-0 text-muted-foreground transition-transform",i&&"rotate-180")})]}),t(mt,{children:i?t("div",{className:"mt-1 space-y-1",children:e.map(d=>t(ep,{event:d,editable:a.get(d.id)??null,cwd:o,onOpen:r,reactions:l},`${l.reference.projectId}#${l.reference.number}:${d.id}`))}):null})]})})]})}function op({event:e,onOpen:a}){let{t:o}=k();return n("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:()=>a(e.id),children:[t(wn,{actors:e.commitAuthors,fallback:t(Ia,{className:"size-icon-2"})}),n("div",{className:"flex min-w-0 items-center gap-2.5 py-1.5",children:[n("div",{className:"min-w-0 flex-1",children:[t("div",{className:"truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary",children:e.body??o("timeline.untitledCommit")}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:[t("code",{className:"font-mono",children:e.id.slice(0,7)}),t("span",{children:Ge(e.at)})]})]}),e.additions!==null&&e.deletions!==null?t(Fa,{additions:e.additions,deletions:e.deletions,className:"ml-auto shrink-0 font-mono text-[10px]"}):null]})]})}function rp({event:e}){let{t:a}=k(),o=e.kind==="opened"?{icon:t(Xe,{className:"size-icon-2"}),label:a("timeline.eventOpened")}:e.kind==="merged"?{icon:t(Ve,{className:"size-icon-2"}),label:a("timeline.merged")}:{icon:t(pa,{className:"size-icon-2"}),label:a("timeline.closed")};return n("div",{className:"relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(Ru,{icon:o.icon}),n("div",{className:"py-1.5 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.actor?t(Ln,{actor:e.actor}):null,t("span",{className:"font-semibold text-foreground",children:o.label})]}),t("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:Ge(e.at)})]})]})}function np({event:e,outcome:a,stale:o,cwd:r,onOpen:l,reactions:s}){let{t:i}=k();return n("div",{className:"group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]",children:[t(wn,{actors:e.actor?[e.actor]:[],className:"top-6",fallback:t(ar,{outcome:a})}),n("div",{className:"flex min-w-0 items-start gap-2 py-1.5",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",children:[t(Ln,{actor:e.actor}),n(re,{disabled:!o,children:[n(le,{render:t("span",{className:S("font-medium lowercase",o?"text-muted-foreground opacity-70":er(a))}),children:[i(Ro(a)),o?t("span",{className:"sr-only",children:i("reviewOutcome.beforeLatestCommits")}):null]}),t(ne,{children:i(bo(a))})]})]}),n("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[n(Ca,{className:"flex-wrap text-[11px] text-muted-foreground",children:[t("span",{children:Ge(e.at)}),e.path?n("span",{className:"inline-flex min-w-0 items-center gap-1",children:[t(qa,{"aria-hidden":!0,className:"size-3 shrink-0"}),t("span",{className:"truncate",children:e.path})]}):null]}),s.canReact||e.reactions.length>0?t(Oa,{reactions:e.reactions,canReact:s.canReact,subjectId:e.id,environmentId:s.environmentId,reference:s.reference,onRefresh:s.onRefresh}):null]}),e.body?t(Cu,{body:e.body,markdown:e.markdown,cwd:r,environmentId:s.environmentId}):null]}),t(Pu,{url:e.url,onOpen:l})]})]})}function Su({detail:e,environmentId:a,reference:o,order:r,onOpenCommit:l,onRefresh:s}){let{t:i}=k(),u=eu(e),f=mn(e.commits),c={canReact:e.capabilities.reactions===!0,environmentId:a,reference:o,onRefresh:s},d=new Map(e.comments.filter(L=>_t(e,L)).map(L=>[L.id,L])),p=r==="newest"?u:u.toReversed(),m=Yi(p),w=L=>{ia()?.shell.openExternal(L)};return t("div",{className:"h-full overflow-y-auto px-4 py-5",children:n("div",{className:"mx-auto max-w-3xl",children:[n("div",{className:"relative",children:[t("span",{"aria-hidden":!0,className:"absolute bottom-5 left-[15px] top-1 w-px bg-border/45"}),m.map(L=>{if(L.kind==="comments")return t(tp,{events:L.events,editable:d,cwd:e.workspaceRoot,onOpen:w,reactions:c},`comments:${L.events[0]?.id??"empty"}`);let x=L.event;if(x.kind==="commit")return t(op,{event:x,onOpen:l},x.id);let D=zt(x.reviewState);return D!==null?t(np,{event:x,outcome:D,stale:gn(x.at,f),cwd:e.workspaceRoot,onOpen:w,reactions:c},x.id):t(rp,{event:x},x.id)})]}),u.length===0?n("div",{className:"flex flex-col items-center justify-center py-16 text-center text-muted-foreground",children:[t(Xe,{className:"mb-2 size-5"}),t("p",{className:"text-xs",children:i("timeline.noActivity")})]}):null]})})}Te();Fe();he();ze();A();A();A();la();Te();Fe();function Ya(e){return e==="gitlab"?{label:"GitLab",providerName:"GitLab",Icon:ro}:e==="github"?{label:"GitHub",providerName:"GitHub",Icon:oo}:{label:e,providerName:e,Icon:Ta}}function fr(){let{t:e}=k();return a=>{let o=Ya(a).providerName;return o===a?e("link.openOnHostGeneric"):e("link.openOnHost",{host:o})}}function pr(){return Pe().ui.useLinkContextMenu()}function mr(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function ku(e,a,o){let r=new Map(a.map((i,u)=>[i,u])),l=new Map;for(let i of e){let u=mr(i);if(!u)continue;let f=r.get(i.environmentId);if(f===void 0)continue;let c=l.get(u);if(c===void 0){l.set(u,i.environmentId);continue}c!==o&&(i.environmentId===o||f<(r.get(c)??Number.MAX_SAFE_INTEGER))&&l.set(u,i.environmentId)}let s=new Map;for(let i of e){if(!r.has(i.environmentId))continue;let u=mr(i);if(u&&l.get(u)!==i.environmentId)continue;let f=s.get(i.environmentId);f===void 0?s.set(i.environmentId,[i.id]):f.push(i.id)}return s}function qu(e,a,o){let r=a.find(u=>u.environmentId===e.environmentId&&u.id===e.projectId),l=r===void 0?void 0:mr(r),s=o.find(u=>u.environmentId===e.environmentId)?.label;if(r===void 0||!l||s===void 0)return[];let i=o.flatMap(u=>{if(u.environmentId===e.environmentId)return[];let f=a.find(c=>c.environmentId===u.environmentId&&mr(c)===l);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:s},...i]}M();function Xu({label:e}){let{t:a}=k();return t("p",{className:"p-4 text-sm text-muted-foreground",children:e??a("detail.loadingLabel")})}var Qu={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"},Ir={merge:"mergeMethod.merge",squash:"mergeMethod.squash",rebase:"mergeMethod.rebase"},Zu={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"},Ju={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"},Yu="notify.hintUpdateBranchRebase",ed=[{value:"summary",labelKey:"detail.tabSummary"},{value:"timeline",labelKey:"detail.tabTimeline"},{value:"code",labelKey:"detail.tabCode"}],Sn=()=>Promise.resolve().then(()=>($u(),Wu)),ad=$n(Sn);function kn({environments:e,value:a,onChange:o,disabled:r}){return n(Se,{children:[t(je,{}),t(Na,{value:a,onValueChange:l=>o(l),children:e.map(l=>t(La,{value:l.environmentId,disabled:r,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(ct,{className:"size-icon-2 shrink-0"}),t("span",{className:"truncate",children:l.label})]})},l.environmentId))})]})}var qn=(e,a,o,r)=>{a.preventDefault(),a.stopPropagation(),e({url:o.url,openLabel:r,position:{x:a.clientX,y:a.clientY}})};function Tn({baseBranch:e,freshness:a,pending:o,onUpdate:r,iconClassName:l}){let{t:s}=k(),i=a.behindBy===null?s("detail.outOfDate",{branch:e}):s("detail.outOfDateBehind",{branch:e,count:a.behindBy,total:a.behindBy.toLocaleString()});return n(Bt,{children:[t(Ft,{openOnHover:!0,delay:0,closeDelay:120,render:t("button",{type:"button","aria-label":i,className:"inline-flex shrink-0 cursor-help items-center rounded-sm text-warning-foreground"}),children:t(aa,{"aria-hidden":!0,className:S("size-icon-2",l)})}),n(Nt,{align:"start",side:"bottom",className:"max-w-80",viewportClassName:"py-2.5 [--viewport-inline-padding:--spacing(3)]",children:[t("p",{className:"text-xs text-foreground",children:i}),t("p",{className:"mt-0.5 text-xs text-muted-foreground",children:s("detail.cleanlyMergeable")}),a.methods.length>0?t("span",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:a.methods.map(u=>n(b,{size:"xs",variant:"outline",disabled:o,onClick:()=>r(u),children:[t(Ve,{"aria-hidden":!0,className:"size-3"}),s(u==="rebase"?"detail.updateWithRebase":"detail.updateBranch")]},u))}):null]})]})}Fe();A();A();A();A();Ea();M();function td({state:e,onClose:a}){let{t:o,openOnHostLabel:r,pullRequestKey:l,setMergeMethod:s,setConfirmation:i,handoff:u,detailQuery:f,detail:c,refreshFromHost:d,pendingAction:p,actionPending:m,handoffUnsupportedReason:w,handoffBlocked:L,withBlockedReason:x,pickableEnvironments:D,setActingScope:v,actingEnvironmentId:y,perform:_,attachTarget:oe,handoffLabels:j,askAboutPullRequest:H,explainPullRequest:G,startCheckout:T,startFixFindings:K,startResolveConflicts:U,allowedMergeMethods:J,selectedMergeMethod:B,selectedMergeMethodLabel:E,conflicting:Y,autoMergeArmed:W,can:ce,primaryAction:se,showsDraftToggle:xe,showsAutoMerge:fe,showsMergeMethods:ie,context:Ce}=e;return n("div",{className:"mr-4 flex h-7 min-w-0 flex-nowrap items-center justify-end gap-1",children:[c?n(Se,{children:[Ce==="page"&&L?x(n(b,{size:"xs",variant:"outline",softDisabled:!0,children:[t(Ta,{"aria-hidden":!0}),o("detail.checkOut"),t(Ye,{"aria-hidden":!0,className:"text-muted-foreground"})]})):Ce==="page"?n(ma,{children:[t(ha,{disabled:u!==null,render:n(b,{size:"xs",variant:"outline",children:[t(Ta,{"aria-hidden":!0}),u?.startsWith("checkout")?o("detail.checkingOut"):o("detail.checkOut"),t(Ye,{"aria-hidden":!0,className:"text-muted-foreground"})]})}),n(ga,{align:"end",side:"bottom",className:"min-w-72",children:[n(Ue,{onClick:()=>T("worktree"),children:[t(Ta,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o("detail.checkoutInWorktreeTitle")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInWorktreeDetail")})]})]}),n(Ue,{onClick:()=>T("local"),children:[t(ut,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o("detail.checkoutInRepositoryTitle")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.checkoutInRepositoryDetail")})]})]}),D.length>0?t(kn,{environments:D,value:y,onChange:ae=>v({pullRequestKey:l,environmentId:ae}),disabled:u!==null}):null]})]}):null,W?n(re,{children:[t(le,{render:n($o,{variant:"info",className:"h-5 shrink-0 gap-1 rounded px-1.5 text-[10px]",children:[t(Ve,{"aria-hidden":!0,className:"size-3"}),o("detail.autoMerge")]})}),t(ne,{side:"top",children:o("detail.autoMergeHint")})]}):null,se==="resolve"?x(n(b,{size:"xs",variant:"destructive-outline",disabled:u!==null,softDisabled:L,onClick:U,children:[t(aa,{}),o(u==="conflicts"?"action.preparing":"detail.resolveConflicts")]})):se==="ready"?t(b,{size:"xs",disabled:m,onClick:()=>{_("ready")},children:o("detail.readyForReview")}):se==="merge"?t(b,{size:"xs",disabled:m,onClick:()=>i({open:!0,action:"merge"}),children:p==="merge"?o("detail.merging"):E}):null,n(ma,{children:[t(ha,{render:t(b,{"aria-label":o("detail.moreActionsAria"),className:"size-6",size:"icon-xs",variant:"ghost-muted"}),children:t(Ka,{className:"size-4"})}),n(ga,{align:"end",side:"bottom",className:"min-w-72",children:[n(Ue,{disabled:f.isPending,onClick:()=>{d()},children:[t(ea,{className:"size-icon-2"}),o("action.refresh")]}),w!==null?t(Ue,{disabled:!0,children:t("span",{className:"text-xs text-muted-foreground",children:o(w)})}):null,n(Ue,{disabled:u!==null||L,onClick:H,children:[t(Va,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o(u==="ask"?"detail.opening":"detail.askQuestion")}),t("span",{className:"text-xs text-muted-foreground",children:o(oe!==null?"detail.askQuestionInThread":"detail.askQuestionNewThread")})]})]}),n(Ue,{disabled:u!==null||L,onClick:G,children:[t(Zt,{className:"mt-0.5 size-icon-2 shrink-0 self-start"}),n("span",{className:"flex min-w-0 flex-col",children:[t("span",{children:o(u==="explain"?"detail.opening":"detail.explainPullRequest")}),t("span",{className:"text-xs text-muted-foreground",children:o("detail.explainPullRequestHint")})]})]}),n(Ue,{disabled:u!==null||L,onClick:K,children:[t(va,{className:"size-icon-2"}),o(u==="findings"?"action.preparing":j.fixFindings)]}),D.length>0?t(kn,{environments:D,value:y,onChange:ae=>v({pullRequestKey:l,environmentId:ae}),disabled:u!==null}):null,t(je,{}),c.state==="open"?n(Se,{children:[xe?n(Ue,{disabled:m,onClick:()=>{_(c.isDraft?"ready":"draft")},children:[c.isDraft?t(Xe,{className:"size-icon-2"}):t(Aa,{className:"size-icon-2"}),c.isDraft?o("detail.readyForReview"):o("detail.convertToDraft")]}):null,W&&ce("disable-auto-merge")?n(Ue,{disabled:m,onClick:()=>{_("disable-auto-merge")},children:[t(Ve,{className:"size-icon-2"}),o("detail.disableAutoMerge")]}):!W&&!c.isDraft&&!Y&&ce("enable-auto-merge")&&J.length>0?n(Ue,{disabled:m,onClick:()=>i({open:!0,action:"enable-auto-merge"}),children:[t(Ve,{className:"size-icon-2"}),o("detail.enableAutoMerge")]}):null,ie?n(Se,{children:[xe?t(je,{}):null,t(Na,{value:B,onValueChange:ae=>s(ae),children:J.map(ae=>t(La,{value:ae,disabled:m,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(Ve,{className:"size-icon-2"}),t("span",{children:o(Ir[ae])})]})},ae))})]}):null,Qi(xe,fe,ie)?t(je,{}):null]}):null,n(Ue,{onClick:()=>{ia()?.shell.openExternal(c.url)},children:[t(Qt,{className:"size-icon-2"}),r(c.provider)]}),n(Ue,{onClick:()=>{il(c.url)},children:[t(no,{className:"size-icon-2"}),o("detail.copyLink")]}),c.state==="open"&&ce("close")?n(Se,{children:[t(je,{}),n(Ue,{variant:"destructive",disabled:m,onClick:()=>i({open:!0,action:"close"}),children:[t(pa,{className:"size-icon-2"}),o("detail.closePullRequest")]})]}):c.state==="closed"&&ce("reopen")?n(Se,{children:[t(je,{}),n(Ue,{disabled:m,onClick:()=>{_("reopen")},children:[t(Xe,{className:"size-icon-2"}),o("detail.reopenPullRequest")]})]}):null]})]})]}):null,a?t(b,{size:"icon-xs",variant:"ghost","aria-label":o("detail.collapsePanelAria"),onClick:a,children:t(dt,{})}):null]})}Fe();ze();_a();A();A();A();A();ko();Te();ze();Ne();Ne();A();A();da();M();function dp({environmentId:e,reference:a}){let{t:o}=k(),r=xa(ke.detail({environmentId:e,input:a}));if(r.error!==null)return t("p",{className:"text-muted-foreground text-xs",children:r.error});if(r.data===null)return t("p",{className:"text-muted-foreground text-xs",children:r.isPending?o("checks.loading"):o("checks.summaryNoneReported")});let l=r.data?.checks;return l===void 0?t("p",{className:"text-muted-foreground text-xs",children:o("checks.summaryNoneReported")}):t(od,{checks:l})}function od({checks:e}){let{t:a}=k();return e.length===0?t("p",{className:"text-muted-foreground text-xs",children:a("checks.summaryNoneReported")}):t("ul",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:e.map((o,r)=>n("li",{className:"flex items-center gap-2 text-xs",children:[t(Yo,{status:o.status}),n(re,{children:[t(le,{render:t("span",{className:"min-w-0 flex-1 truncate",children:o.name})}),t(ne,{side:"top",children:o.description??o.name})]}),t("span",{className:"shrink-0 text-muted-foreground",children:a(Jo(o.status))}),o.url===null?null:t("button",{type:"button",className:"shrink-0 text-primary hover:underline",onClick:()=>{ia()?.shell.openExternal(o.url??"")},children:a("action.details")})]},`${r}:${o.name}`))})}function vr({checksState:e,checks:a,environmentId:o,reference:r,className:l}){let{t:s}=k(),i=Di(e),u=a===void 0?null:tr(a);return n(Bt,{children:[t(Ft,{render:t("span",{role:"button",tabIndex:0,"aria-label":s("checks.ariaWithSummary",{summary:s(i.labelKey)}),className:S("inline-flex shrink-0 cursor-pointer select-none items-center",l)}),onClick:f=>f.stopPropagation(),children:t(i.Icon,{"aria-hidden":!0,className:S("size-icon-2",i.toneClassName)})}),n(Nt,{align:"start",className:"w-80 max-w-full",side:"bottom",children:[t("p",{className:"mb-2 font-medium text-sm",children:s(i.labelKey)}),u===null?null:t("p",{className:"mb-2 text-muted-foreground text-xs",children:s(u.key,u.values)}),a!==void 0?t(od,{checks:a}):o!==void 0&&r!==void 0?t(dp,{environmentId:o,reference:r}):null]})]})}da();M();function rd({state:e}){let{t:a,openOnHostLabel:o,showPullRequestLinkContextMenu:r,condensed:l,detail:s,repositoryUrl:i,statePresentation:u}=e;return n("div",{className:"ml-4 grid h-7 min-w-0 items-center",children:[t("div",{"aria-hidden":l,inert:l,className:S("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",l?"pointer-events-none -translate-y-1 opacity-0 duration-100":"translate-y-0 opacity-100 delay-50 duration-150"),children:s&&u?n(Se,{children:[n(re,{children:[t(le,{render:i?t("button",{type:"button",onClick:()=>{ia()?.shell.openExternal(i)},className:"min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:s.repository}):t("span",{className:"min-w-0 truncate font-medium text-muted-foreground",children:s.repository})}),t(ne,{side:"top",children:i?a("detail.openRepositoryTooltip",{repository:s.repository}):s.repository})]}),n(re,{children:[t(le,{render:n("button",{type:"button",onClick:()=>{ia()?.shell.openExternal(s.url)},onContextMenu:f=>qn(r,f,s,o(s.provider)),className:S("shrink-0 font-medium underline-offset-2 hover:underline",u.toneClassName),"aria-label":a("detail.openOnHostAria",{number:s.number}),children:["#",s.number]})}),t(ne,{side:"top",children:o(s.provider)})]})]}):null}),t("div",{"aria-hidden":!l,inert:!l,className:S("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",l?"translate-y-0 opacity-100 delay-50 duration-150":"pointer-events-none translate-y-1 opacity-0 duration-100"),children:s&&u?n(Se,{children:[n(re,{children:[t(le,{render:n("button",{type:"button",tabIndex:l?0:-1,onClick:()=>{ia()?.shell.openExternal(s.url)},onContextMenu:f=>qn(r,f,s,o(s.provider)),className:S("shrink-0 font-medium underline-offset-2 hover:underline",u.toneClassName),"aria-label":a("detail.openOnHostAria",{number:s.number}),children:["#",s.number]})}),t(ne,{side:"top",children:o(s.provider)})]}),n(re,{children:[t(le,{render:t("span",{className:"min-w-0 truncate font-medium text-foreground",children:s.title})}),t(ne,{side:"top",children:s.title})]})]}):null})]})}function nd({state:e}){let{t:a,condensed:o,condensedRowRef:r,detail:l,isStackedPullRequest:s,actionPending:i,perform:u,freshness:f}=e;return t("div",{className:S("col-span-2 grid",o?"grid-rows-[1fr]":"grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:t("div",{ref:r,className:S("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:l?t("div",{className:"col-span-2 min-w-0 px-4 pb-2 pt-1",children:n("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[n("span",{className:"flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground",children:[n(re,{children:[t(le,{render:t("span",{className:"shrink-0 rounded-full","aria-label":l.author?.login??"ghost"}),children:t(ht,{actor:l.author})}),t(ne,{side:"top",children:l.author?.login??"ghost"})]}),t("span",{className:"shrink-0",children:Ge(l.updatedAt)})]}),t("span",{"aria-hidden":!0,className:"h-3 w-px shrink-0 bg-border/70"}),n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-[11px] text-muted-foreground/65",children:[n(re,{children:[t(le,{render:n("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[s?t(He,{"aria-label":a("detail.stackedAria"),className:"size-3 shrink-0"}):null,t("code",{className:"min-w-0 truncate",children:l.baseBranch})]})}),t(ne,{side:"top",children:s?a("detail.stackedOn",{branch:l.baseBranch}):l.baseBranch})]}),f?t(Tn,{baseBranch:l.baseBranch,freshness:f,pending:i,onUpdate:c=>{u("update-branch",void 0,c)},iconClassName:"size-3"}):null,t(bt,{"aria-label":a("detail.receivesChangesFrom"),className:"size-3 shrink-0 opacity-60"}),n(re,{children:[t(le,{render:t("code",{className:"min-w-0 flex-1 truncate",children:l.headBranch})}),t(ne,{side:"top",children:l.headBranch})]})]}),n("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-[11px]",children:[n("span",{className:"inline-flex items-center gap-1 tabular-nums","aria-label":a("detail.changedFilesAria",{count:l.changedFiles,total:l.changedFiles.toLocaleString()}),children:[t(Rt,{"aria-hidden":!0,className:"size-3"}),l.changedFiles.toLocaleString()]}),t(Fa,{additions:l.additions,deletions:l.deletions,className:"shrink-0 font-mono text-[11px]"})]})]})}):null})})}function ld({state:e}){let{t:a,pullRequestKey:o,condensed:r,foldRef:l,copyBranchToClipboard:s,isBranchCopied:i,detail:u,isStackedPullRequest:f,actionPending:c,setTitleScope:d,titleDraft:p,titleSaving:m,perform:w,saveTitle:L,freshness:x}=e;return t("div",{className:S("col-span-2 grid",r?"grid-rows-[0fr]":"grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),children:t("div",{ref:l,className:S("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?n("div",{className:"col-span-2 mt-1 min-w-0 px-4 pb-4",children:[p===null?n("div",{className:"group flex min-w-0 items-start gap-1",children:[t("h1",{className:"min-w-0 flex-1 text-base font-semibold leading-snug",children:u.title}),lr(u)?t(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":a("detail.editTitleAria"),onClick:()=>d({pullRequestKey:o,text:u.title}),children:t(ra,{className:"size-3"})}):null]}):n("div",{className:"space-y-2",children:[t(jo,{autoFocus:!0,size:"sm",disabled:m,value:p,"aria-label":a("detail.titleAria"),onChange:D=>d({pullRequestKey:o,text:D.target.value}),onKeyDown:D=>{D.key==="Enter"?(D.preventDefault(),L(p)):D.key==="Escape"&&(D.preventDefault(),d(null))}}),n("div",{className:"flex justify-end gap-2",children:[t(b,{size:"xs",variant:"ghost",disabled:m,onClick:()=>d(null),children:a("action.cancel")}),t(b,{size:"xs",variant:"outline",disabled:m||p.trim().length===0,onClick:()=>{L(p)},children:a(m?"action.saving":"action.save")})]})]}),n(Ca,{className:"mt-2 text-xs text-muted-foreground",children:[t(wa,{actor:u.author,className:"font-medium"}),t("span",{children:a("detail.updatedAt",{when:Ge(u.updatedAt)})})]}),n("div",{className:"mt-4 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70",children:[n(re,{children:[t(le,{render:n("span",{className:"inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1",children:[f?t(He,{"aria-label":a("detail.stackedAria"),className:"size-3 shrink-0"}):null,t("code",{className:"min-w-0 truncate",children:u.baseBranch})]})}),t(ne,{side:"top",children:f?a("detail.stackedOn",{branch:u.baseBranch}):u.baseBranch})]}),x?t(Tn,{baseBranch:u.baseBranch,freshness:x,pending:c,onUpdate:D=>{w("update-branch",void 0,D)}}):null,t(bt,{"aria-label":a("detail.receivesChangesFrom"),className:"size-icon-2 shrink-0 opacity-60"}),n(re,{children:[n(le,{render:t(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":a(i?"detail.branchCopied":"detail.copyBranch"),onClick:()=>s(u.headBranch)}),children:[t("code",{className:S("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}),t("span",{"aria-hidden":"true",className:S("col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none",i?"opacity-100":"opacity-0"),children:a("action.copied")})]}),t(ne,{side:"top",children:i?a("detail.branchCopiedTooltip",{branch:u.headBranch}):a("detail.copyBranchTooltip",{branch:u.headBranch})})]})]}),n("span",{className:"ml-auto inline-flex shrink-0 items-center justify-end gap-2",children:[n("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[t(Rt,{className:"size-icon-2"}),a("detail.fileCount",{count:u.changedFiles,total:u.changedFiles.toLocaleString()})]}),t(Fa,{additions:u.additions,deletions:u.deletions,className:"shrink-0 font-mono text-xs"})]})]})]}):null})})}function sd({state:e}){let{t:a,tab:o,setTab:r,timelineOrder:l,setTimelineOrder:s,detail:i,activityPending:u,activityError:f,visibleTabs:c,checksSummary:d,checksState:p,approvalCount:m}=e;return i?n("nav",{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","aria-label":a("detail.tabsAria"),children:[t(Wo,{className:"shrink-0",size:"segmented",variant:"segmented",value:[o],onValueChange:w=>{let L=c.find(x=>x.value===w[0])?.value;L&&r(L)},children:c.map(w=>t(Ba,{value:w.value,children:a(w.labelKey)},w.value))}),o==="summary"?n("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":d?a("checks.ariaWithSummary",{summary:a(d.key,d.values)}):a("checks.title"),children:[p!==null?t(vr,{checks:i.checks,checksState:p}):t(st,{"aria-hidden":!0,className:"size-icon-2"}),d?a(d.key,d.values):null]}):o==="timeline"?n("div",{className:"ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[n(Ca,{className:S("whitespace-nowrap text-[11px] transition-opacity",(u||f)&&"opacity-35"),children:[n("span",{className:"inline-flex items-center gap-1","aria-label":f?a("detail.commentsUnavailable"):a("timeline.commentCount",{count:i.commentCount,total:i.commentCount.toLocaleString()}),children:[t(Qe,{"aria-hidden":!0,className:"size-3"}),f?"\u2014":u?"\u2026":i.commentCount.toLocaleString()]}),n("span",{className:"inline-flex items-center gap-1","aria-label":f?a("detail.commitsUnavailable"):a("detail.commitCount",{count:i.commits.length,total:i.commits.length.toLocaleString()}),children:[t(Ia,{"aria-hidden":!0,className:"size-3"}),f?"\u2014":u?"\u2026":i.commits.length.toLocaleString()]}),m>0?n("span",{className:S("inline-flex items-center gap-1",er("approved")),children:[t(ar,{outcome:"approved",className:"size-3"}),m.toLocaleString(),t("span",{className:"sr-only",children:a("detail.approvalNoun",{count:m})})]}):null]}),n(b,{size:"xs",variant:"ghost",className:"h-7 px-2 text-[10px] text-muted-foreground","aria-label":a(l==="newest"?"detail.activityOldestAria":"detail.activityNewestAria"),onClick:()=>s(w=>w==="newest"?"oldest":"newest"),children:[t(nt,{"aria-hidden":!0,className:"size-3"}),a(l==="newest"?"sort.newestFirst":"sort.oldestFirst")]})]}):null]}):null}Te();he();$t();la();he();la();function cp(e){return e.filter(a=>a.connected&&a.pluginLoaded).map(a=>({environmentId:a.environmentId,payload:{}}))}function fp(e){return e.flatMap(a=>(a.data?.projects??[]).map(r=>({id:String(r.projectId??""),environmentId:a.environmentId,title:String(r.title??""),workspaceRoot:String(r.workspaceRoot??""),repositoryIdentity:r.repositoryIdentity??null})))}function An(){let e=Pe(),a=e.useConnectedEnvironments(),o=cp(a),r=e.commands.useQueryEach("workspaceProjects",o,{refreshKey:e.useRepositoryIdentityKey()});return{projects:V(()=>fp(r.rows),[r.rows]),bootstrapped:o.length===0||r.rows.every(s=>!s.isPending)}}function id(){return An().projects}he();la();function Lr(){return{environments:Pe().useConnectedEnvironments().map(a=>({environmentId:a.environmentId,label:a.label,displayUrl:a.label,serverConfig:a.connected?{}:null}))}}function ud(e,a){let o=Pe().useConnectedEnvironments();return V(()=>{let r=new Map;for(let l of a)r.set(l,o.find(s=>s.environmentId===l)?.pluginLoaded===!0);return r},[a,o])}Ne();he();function wr(e,a=!0){let o=typeof a=="boolean"?a:a.enabled!==!1,r=typeof a=="object"?a.key:void 0;ge(()=>{if(!o||typeof document>"u")return;let l=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",l),()=>document.removeEventListener("visibilitychange",l)},[o,r,e])}Ne();Ne();sa();A();Ea();da();Te();ft();sa();Ea();fn();var dd=new Map,cd=e=>typeof e=="string"?e:ua(e);function fd({t:e,detail:a,handoff:o,setHandoff:r,handoffUnsupportedReason:l,acting:s,actingEnvironmentId:i,newThread:u,prepareThread:f,context:c,composerDraftTarget:d}){let p=Xi(c,d),m=$i(p!==null),w=rn({attachAvailable:p!==null,blockedReason:l}),L=(K,U)=>{let J=ln({supported:l===null,existing:Ho.getState().getComposerDraft(K),lastHandoffPrompt:dd.get(cd(K)),task:U});if(!J.ok)return ye.error(e(J.reason)),!1;let B=Ho.getState();return dd.set(cd(K),U.prompt),B.setPrompt(K,J.next.prompt),B.setReviewComments(K,J.next.reviewComments),!0},x=async(K,U,J)=>{let B=J??await u(K).then(E=>E,()=>null);return B===null?null:U===null||L(B.draftId,U)?B:null},D=async(K,U)=>{if(!a||o!==null)return;if(l!==null){ye.error(e(l));return}if(p!==null){if(!L(p,U))return;ye.success(e("notify.addedToComposer"),U.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"));return}r(K);let J=Or(i,s?.projectId??a.projectId),B=await x(J,U);if(r(null),B===null){ye.error(e("notify.couldNotOpenThread"),void 0,{description:e("notify.threadHandoffHint")});return}ye.success(e("notify.askedInThread"),U.prompt.length>0?e("notify.questionInComposer"):e("notify.pullRequestInComposer"))},v=async(K,U,J="worktree")=>{if(!a||o!==null)return;if(l!==null){ye.error(e(l));return}if(p!==null&&U!==null){if(!L(p,U))return;ye.success(e("notify.addedToComposer"),e("notify.taskInComposer"));return}r(K);let B=ye.task({title:e("notify.checkoutPreparing")}),E=Or(i,s?.projectId??a.projectId),Y=await u(E).then(fe=>fe,()=>null);if(Y===null){r(null),B.fail({title:e("notify.checkoutThreadFailed"),description:e("notify.threadHandoffHint")});return}let W=await f.run({reference:a.url,mode:J,threadId:Y.threadId});if(W._tag==="Failure"){r(null);let fe=f.error instanceof Error?f.error.message:null;B.fail({title:e("notify.checkoutFailed"),...fe?{description:fe}:{}});return}if(!await u(E,{branch:W.value.branch,worktreePath:W.value.worktreePath,envMode:W.value.worktreePath===null?"local":"worktree"}).then(fe=>fe!==null,()=>!1)){r(null),B.fail({title:e("notify.checkoutThreadUnmoved"),description:e("notify.checkoutReadyOnBranch",{branch:W.value.branch})});return}r(null);let se={title:e("notify.checkoutStale"),description:e("notify.checkoutStaleDetail")},xe=fe=>{W.value.isOnPullRequestHead?B.succeed(fe):B.fail(se)};if(U===null){xe({title:e(J==="local"?"notify.checkoutHereTitle":"notify.checkoutDoneTitle"),description:e(J==="local"?"notify.checkoutHereDetail":"notify.checkoutWorktreeDetail")});return}await x(E,U,Y),xe({title:e("notify.checkoutReady"),description:e("notify.taskInComposer")})};return{attachTarget:p,handoffLabels:m,addToAgentEntry:w,askAboutPullRequest:()=>{a&&D("ask",{...un({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})},explainPullRequest:()=>{a&&D("explain",{...dn({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})},addSelectionToAgent:K=>{a&&D(`selection:${K.comment.id}`,cn({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,comment:K.comment,request:K.request}))},startCheckout:K=>{a&&v(`checkout:${K}`,null,K)},startFixFinding:K=>{a&&v(Za(K),an({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,finding:K}))},startFixFindings:()=>{a&&v("findings",en({number:a.number,title:a.title,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch,reviewThreads:a.reviewThreads,comments:a.comments,checks:a.checks,commentsTruncated:a.commentsTruncated}))},startResolveConflicts:()=>{a&&v("conflicts",{prompt:Gi({number:a.number,url:a.url,headBranch:a.headBranch,baseBranch:a.baseBranch})})}}}M();function pd({environmentId:e,reference:a,refreshToken:o=0,onActed:r,onStateChange:l,context:s="page",composerDraftTarget:i}){let{t:u}=k(),f=fr(),c=pr(),d=`${a.projectId}:${a.repository}#${a.number}`,[p,m]=C("summary"),[w,L]=C("newest"),[x,D]=C(()=>({pullRequestKey:d,oid:null})),v=x.pullRequestKey===d?x.oid:null,y=ue=>{D({pullRequestKey:d,oid:ue})},_=ue=>{y(ue),m("code")},[oe,j]=C(()=>new Set(["summary"]));ge(()=>{j(ue=>ue.has(p)?ue:new Set(ue).add(p))},[p]);let[H,G]=C(!1),T=Ee({});ge(()=>{G(T.current[p]??!1)},[p]);let K=H,U=Ee(null),J=Ee(null),B=Ee(null),E=Ee(null);Zn(()=>{if(E.current===null)return;let ue=U.current,Ua=E.current;E.current=null,ue&&(ue.scrollTop=Math.max(0,ue.scrollTop+Ua))},[K]);let[Y,W]=C("merge"),[ce,se]=C({open:!1,action:"merge"}),xe=ce.action,[fe,ie]=C(null),{copyToClipboard:Ce,isCopied:ae}=ul({target:u("detail.branchNameTarget"),timeout:1600});ge(()=>{Sn()},[]);let g=xa(ke.detail({environmentId:e,input:a})),$=xa(ke.activity({environmentId:e,input:a})),N=xa(ke.diff({environmentId:e,input:{...a}})),X=g.data,pe=$.data,R=V(()=>X===null?null:{...X,author:pe?.author??X.author,reviewers:pe?.reviewers??X.reviewers,comments:pe?.comments??[],commentCount:pe?.commentCount??0,commentsTruncated:pe?.commentsTruncated??!1,reviewThreads:pe?.reviewThreads??[],commits:pe?.commits??[],reactions:pe?.reactions??[]},[pe,X]),F=R===null?null:ll(R.url),Ie=xa(R===null?null:Ll.listRefs({environmentId:e,input:{cwd:R.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Ae=R!==null&&Zi(R.baseBranch,Ie.data?.refs??[]),ca=$.isPending&&pe===null,ta=pe===null?$.error:null,be=oa(()=>{g.refresh(),$.refresh()},[$.refresh,g.refresh]),Ze=Ee(null);ge(()=>{if(!X)return;let ue={key:d,updatedAt:X.updatedAt};Vi(Ze.current,ue)&&$.refresh(),Ze.current=ue},[$.refresh,X,d]),ge(()=>{R&&l?.({projectId:R.projectId,repository:R.repository,number:R.number,state:R.state,isDraft:R.isDraft})},[R,l]),wr(g.refresh,{key:`pull-request:${a.projectId}:${a.repository}#${a.number}`});let Je=Oe(ke.invalidate,{reportFailure:!1}),[ya,Sa]=C(0),Q=oa(async()=>{await Je({environmentId:e,input:{reference:a}}),be(),Sa(ue=>ue+1)},[e,Je,a,be]),Le=Ee(o);ge(()=>{Le.current!==o&&(Le.current=o,Q())},[o,Q]);let we=Oe(ke.act,{reportFailure:!1}),[Re,P]=C(null),de=Re!==null,[q,ee]=C(null),me=q?.pullRequestKey===d?q.text:null,[qe,We]=C(!1),Ha=Il(),jt=Pe(),Pr=jt.commands.useQuery("workspaceProject",{projectId:a.projectId},{environmentId:e}),Ao=nn(Pr.data),tt=on({canCreateThread:fa(jt,"createThread"),canWriteComposerDraft:fa(jt,"composerDraft"),projectArchived:Ao}),Sr=tt!==null,kr=ue=>tt===null?ue:n(re,{children:[t(le,{render:ue}),t(ne,{side:"top",children:u(tt)})]}),{environments:Mo}=Lr(),O=id(),Be=V(()=>s==="page"?qu({environmentId:e,projectId:a.projectId},O,Mo):[],[s,e,Mo,O,a.projectId]),[Do,Hd]=C(null),Ud=Do?.pullRequestKey===d?Do.environmentId:e,qr=Be.find(ue=>ue.environmentId===Ud)??null,Tr=qr?.environmentId??e,zd=vl({environmentId:Tr,cwd:qr?.workspaceRoot??R?.workspaceRoot??null}),_d=async(ue,Ua,Ct)=>{if(Re!==null)return;P(ue);let Gn=await we({environmentId:e,input:{op:"runAction",...a,action:ue,...Ua?{mergeMethod:Ua}:{},...Ct?{updateMethod:Ct}:{}}});if(P(null),Gn._tag==="Failure"){let uc=Xt(Gn),dc=u(Ct==="rebase"?Yu:Ju[ue]);ye.error(u(Zu[ue]),void 0,{description:So(uc,dc)});return}ye.success(u(Qu[ue])),tu(ue)?Q():be(),r?.()},Gd=async ue=>{let Ua=ue.trim();if(R===null||qe)return;if(Ua.length===0||Ua===R.title){ee(null);return}We(!0);let Ct=await we({environmentId:e,input:{op:"update",...a,title:Ua}});if(We(!1),Ct._tag==="Failure"){ye.error(u("notify.titleSaveFailed"),void 0,{description:So(Xt(Ct),u("notify.titleRefused"))});return}ee(null),be()},{attachTarget:Kd,handoffLabels:Vd,addToAgentEntry:jd,askAboutPullRequest:Wd,explainPullRequest:$d,addSelectionToAgent:Xd,startCheckout:Qd,startFixFinding:Zd,startFixFindings:Jd,startResolveConflicts:Yd}=fd({t:u,detail:R,handoff:fe,setHandoff:ie,handoffUnsupportedReason:tt,acting:qr,actingEnvironmentId:Tr,newThread:Ha,prepareThread:zd,context:s,composerDraftTarget:i}),wt=R?R.capabilities.mergeMethods.filter(ue=>R.mergeCapabilities[ue]):[],zn=wt.includes(Y)?Y:wt[0]??"merge",ec=u(Ir[zn]),Bo=R?.state==="open"&&R.mergeability==="conflicting",Ar=R?.state==="open"&&R.autoMergeEnabled===!0,ac=R===null?null:au(R),Mr=ed.filter(ue=>ue.value!=="code"||R===null||R.capabilities.diff);ge(()=>{Mr.some(ue=>ue.value===p)||m("summary")},[p,Mr]);let ot=ue=>R?.capabilities.actions.includes(ue)===!0&&R.viewerPermissions.actions.includes(ue),_n=R===null||R.state!=="open"?null:Bo?"resolve":R.isDraft&&ot("ready")?"ready":ot("merge")&&wt.length>0?"merge":null,tc=R?.state==="open"&&ot(R.isDraft?"ready":"draft")&&!(R.isDraft&&_n==="ready"),oc=R?.state==="open"&&(Ar&&ot("disable-auto-merge")||!Ar&&!R.isDraft&&!Bo&&ot("enable-auto-merge")&&wt.length>0),rc=R?.state==="open"&&ot("merge")&&!R.isDraft&&!Bo&&wt.length>1,nc=R?Co({state:R.state,isDraft:R.isDraft}):null,lc=R?tr(R.checks):null,sc=R?Bi(R.checks):null,ic=R&&!R.commentsTruncated?nr(R.comments,R.commits).filter(ue=>ue.outcome==="approved"&&!ue.stale).length:0;return{t:u,openOnHostLabel:f,showPullRequestLinkContextMenu:c,pullRequestKey:d,tab:p,setTab:m,timelineOrder:w,setTimelineOrder:L,selectedCodeCommitOid:v,selectCodeCommit:y,openCommit:_,mountedTabs:oe,setChromeCondensed:G,chromeStateByTab:T,condensed:K,scrollerRef:U,foldRef:J,condensedRowRef:B,compensationRef:E,setMergeMethod:W,confirmation:ce,setConfirmation:se,confirmAction:xe,handoff:fe,copyBranchToClipboard:Ce,isBranchCopied:ae,detailQuery:g,activityQuery:$,detail:R,repositoryUrl:F,isStackedPullRequest:Ae,activityPending:ca,activityError:ta,refreshDetail:be,refreshToken:ya,refreshFromHost:Q,pendingAction:Re,actionPending:de,setTitleScope:ee,titleDraft:me,titleSaving:qe,projectArchived:Ao,handoffUnsupportedReason:tt,handoffBlocked:Sr,withBlockedReason:kr,pickableEnvironments:Be,setActingScope:Hd,actingEnvironmentId:Tr,perform:_d,saveTitle:Gd,attachTarget:Kd,handoffLabels:Vd,addToAgentEntry:jd,askAboutPullRequest:Wd,explainPullRequest:$d,addSelectionToAgent:Xd,startCheckout:Qd,startFixFinding:Zd,startFixFindings:Jd,startResolveConflicts:Yd,allowedMergeMethods:wt,selectedMergeMethod:zn,selectedMergeMethodLabel:ec,conflicting:Bo,autoMergeArmed:Ar,freshness:ac,visibleTabs:Mr,can:ot,primaryAction:_n,showsDraftToggle:tc,showsAutoMerge:oc,showsMergeMethods:rc,statePresentation:nc,checksSummary:lc,checksState:sc,approvalCount:ic,context:s}}M();function Cr(e){let{environmentId:a,reference:o,onClose:r}=e,l=pd(e),{t:s,tab:i,timelineOrder:u,selectedCodeCommitOid:f,selectCodeCommit:c,openCommit:d,mountedTabs:p,setChromeCondensed:m,chromeStateByTab:w,scrollerRef:L,foldRef:x,condensedRowRef:D,compensationRef:v,confirmation:y,setConfirmation:_,confirmAction:oe,handoff:j,detailQuery:H,activityQuery:G,detail:T,activityPending:K,activityError:U,refreshDetail:J,refreshToken:B,actionPending:E,projectArchived:Y,perform:W,handoffLabels:ce,addToAgentEntry:se,addSelectionToAgent:xe,startFixFinding:fe,selectedMergeMethod:ie,selectedMergeMethodLabel:Ce}=l;return H.isPending&&!T?t(Pi,{}):n("div",{className:"flex h-full min-h-0 w-full flex-col bg-background",children:[n("div",{className:"grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60",children:[t(rd,{state:l}),t(td,{state:l,onClose:r}),t(nd,{state:l}),t(ld,{state:l}),t(sd,{state:l})]}),t("div",{className:"relative min-h-0 flex-1 overflow-hidden",onScrollCapture:ae=>{let g=ae.target;L.current=g;let $=g.scrollTop;m(N=>{let X=N,pe=x.current?.scrollHeight??0,R=pe-(D.current?.scrollHeight??0);return N?$<4&&pe>0&&(X=!1):pe>0&&$>pe+32&&(v.current=-R,X=!0),w.current[i]=X,X})},children:H.error&&!T?t(Lo,{error:H.error,onRetry:J}):T?n(Se,{children:[p.has("summary")?t("div",{className:S("absolute inset-0",i!=="summary"&&"invisible"),children:t(wu,{environmentId:a,reference:o,detail:T,activityPending:K,activityError:U,pendingFinding:j,fixFindingLabel:ce.fixFinding,fixCheckLabel:ce.fixCheck,...Y?{}:{onFixFinding:fe},onRefresh:J})}):null,p.has("timeline")?t("div",{className:S("absolute inset-0",i!=="timeline"&&"invisible"),children:K?t(ki,{}):U?t(Zo,{error:U,onRetry:G.refresh}):t(Su,{detail:T,environmentId:a,reference:o,order:u,onOpenCommit:d,onRefresh:J})}):null,p.has("code")?t("div",{className:S("absolute inset-0",i!=="code"&&"invisible"),children:t(Vn,{fallback:t(Xu,{label:s("code.loadingDiff")}),children:t(ad,{...se.kind==="hidden"?{}:{onAddToAgentSelection:xe},...se.kind==="disabled"?{addToAgentDisabledReason:s(se.reason)}:{},environmentId:a,reference:o,detail:T,selectedCommitOid:f,onSelectedCommitChange:c,pendingFinding:j,fixFindingLabel:ce.fixFinding,...Y?{}:{onFixFinding:fe},onRefresh:J,refreshToken:B})})}):null]}):null}),t(pi,{open:y.open,onOpenChange:ae=>_(g=>({...g,open:ae})),onOpenChangeComplete:ae=>{ae||_({open:!1,action:"merge"})},children:n(yi,{children:[n(xi,{children:[t(Ii,{children:s(oe==="merge"?"detail.confirmMergeTitle":oe==="enable-auto-merge"?"detail.confirmAutoMergeTitle":"detail.confirmCloseTitle")}),t(gi,{children:oe==="merge"?s("detail.confirmMergeBody",{number:o.number,method:ie}):oe==="enable-auto-merge"?s("detail.confirmAutoMergeBody",{number:o.number,method:ie}):s("detail.confirmCloseBody",{number:o.number})})]}),n(hi,{children:[t(mi,{render:t(b,{variant:"outline",size:"sm"}),children:s("action.cancel")}),t(b,{size:"sm",variant:oe==="close"?"destructive":"default",disabled:E,onClick:()=>{let ae=oe;_(g=>({...g,open:!1})),ae==="merge"&&W("merge",ie),ae==="enable-auto-merge"&&W("enable-auto-merge",ie),ae==="close"&&W("close")},children:oe==="merge"?Ce:s(oe==="enable-auto-merge"?"detail.enableAutoMerge":"detail.close")})]})]})})]})}Fe();ze();Te();M();function md(e){return t("span",{"aria-hidden":!0,className:"size-4 shrink-0 rounded-sm bg-muted"})}A();A();A();A();M();function xd(e,a){return e.filter(r=>r.kind===a.kind).length>1?a.host:Ya(a.kind).providerName}function yd({value:e,busy:a,onChange:o}){let{t:r}=k();return n(jr,{className:"min-w-0 flex-1 **:[input]:h-9 sm:**:[input]:h-8",children:[t(Wr,{children:a?t("span",{className:"inline-flex shrink-0 animate-spin",children:t(Ma,{"aria-hidden":!0})}):t(Da,{"aria-hidden":!0})}),t($r,{type:"search",value:e,onChange:l=>o(l.currentTarget.value),placeholder:r("list.searchPlaceholder"),"aria-label":r("list.searchAria")})]})}var Mn="all",gd="",hd="",vt="all",Ra=e=>JSON.stringify([e.environmentId,e.id]),pp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"only",labelKey:"filter.draftsOnly",Icon:Aa},{value:"hide",labelKey:"filter.hideDrafts",Icon:ao}],mp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"approved",labelKey:"filter.reviewApproved",Icon:$e},{value:"changes-requested",labelKey:"filter.reviewChangesRequested",Icon:Ke},{value:"review-required",labelKey:"filter.reviewRequired",Icon:ka},{value:"none",labelKey:"filter.reviewNone",Icon:Yt}],gp=[{value:vt,labelKey:"filter.all",Icon:He},{value:"passing",labelKey:"filter.checksPassing",Icon:$e},{value:"failing",labelKey:"filter.checksFailing",Icon:Ke}];function It({label:e,value:a,options:o,onChange:r}){let{t:l}=k();return n(Na,{value:a,onValueChange:s=>{s!==a&&r(s)},children:[t(Xr,{children:e}),o.map(s=>{let i=t(La,{value:s.value,className:s.unavailable?"data-disabled:pointer-events-auto":void 0,disabled:s.unavailable!==void 0,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(s.Icon,{"aria-hidden":!0,className:"size-icon-2"}),s.labelKey!==void 0?l(s.labelKey):s.label]})},s.value);return s.unavailable?n(re,{children:[t(le,{render:i}),t(ne,{side:"top",className:"max-w-80",children:s.unavailable})]},s.value):i})]})}function Id({state:e,stateOptions:a,onState:o,involvement:r,involvementOptions:l,onInvolvement:s,filters:i,onFilters:u,host:f,hostOptions:c,onHost:d,server:p,serverOptions:m,onServer:w,projects:L,projectId:x,projectEnvironmentId:D,unavailable:v,onProject:y}){let{t:_}=k(),oe=e!=="open"||r!=="all"||f!==void 0||p!==void 0||x!==void 0||Object.keys(i).length>0,j=(H,G)=>Object.fromEntries(Object.entries({...i,[H]:G===vt?void 0:G}).filter(([,T])=>T!==void 0));return n(ma,{children:[n(ha,{render:t(b,{className:S("relative",oe&&"[--control-icon-color:currentColor]"),size:"icon",variant:"outline","aria-label":_("list.filterAria")}),children:[t(lo,{className:"size-4"}),oe?t("span",{"aria-hidden":!0,className:"absolute top-0.5 right-0.5 size-1.5 rounded-full bg-primary"}):null]}),n(ga,{align:"end",side:"bottom",className:"min-w-56",children:[t(It,{label:_("filter.groupState"),value:e,options:a,onChange:o}),t(je,{}),t(It,{label:_("filter.groupInvolvement"),value:r,options:l,onChange:s}),t(je,{}),t(It,{label:_("filter.groupDraft"),value:i.draft??vt,options:pp,onChange:H=>u(j("draft",H))}),t(je,{}),t(It,{label:_("filter.groupReview"),value:i.review??vt,options:mp,onChange:H=>u(j("review",H))}),t(je,{}),t(It,{label:_("filter.groupChecks"),value:i.checks??vt,options:gp,onChange:H=>u(j("checks",H))}),c.length>2?n(Se,{children:[t(je,{}),t(It,{label:_("filter.groupHost"),value:f??gd,options:c,onChange:H=>d(H===gd?void 0:H)})]}):null,m.length>2?n(Se,{children:[t(je,{}),t(It,{label:_("filter.groupServer"),value:p??hd,options:m,onChange:H=>w(H===hd?void 0:H)})]}):null,t(je,{}),n(Na,{value:x===void 0||D===void 0?Mn:Ra({id:x,environmentId:D}),onValueChange:H=>{if(H===Mn){x!==void 0&&y(void 0,void 0);return}let G=L.find(T=>Ra(T)===H);G!==void 0&&(G.id!==x||G.environmentId!==D)&&y(G.id,G.environmentId)},children:[t(Xr,{children:_("filter.groupProject")}),t(La,{value:Mn,children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(He,{"aria-hidden":!0,className:"size-icon-2"}),_("filter.allProjects")]})}),L.toSorted((H,G)=>Number(v.has(Ra(H)))-Number(v.has(Ra(G)))).map(H=>{let G=v.get(Ra(H)),T=t(La,{value:Ra(H),className:G!==void 0?"data-disabled:pointer-events-auto":void 0,disabled:G!==void 0,children:n("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t(md,{environmentId:H.environmentId,cwd:H.workspaceRoot,fallbackIcon:ut,className:"size-icon-2 shrink-0"}),t("span",{className:"min-w-0 flex-1 truncate",children:H.title}),G===void 0?null:t("span",{className:"shrink-0 rounded-full border border-warning/40 bg-warning-surface px-1.5 py-px text-[10px] font-medium text-warning-foreground",children:_("filter.unavailable")})]})},Ra(H));return G===void 0?T:n(re,{children:[t(le,{render:T}),t(ne,{side:"top",className:"max-w-80",children:G})]},Ra(H))})]})]})]})}Te();Fe();A();A();M();function Dn({joined:e}){return n("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:[t("path",{d:"M10 58h100",className:"text-muted-foreground/30",stroke:"currentColor"}),t("circle",{cx:"10",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),t("circle",{cx:"110",cy:"58",r:"5",fill:"currentColor",fillOpacity:.25}),e?t("path",{d:"M30 58c0-18 8-26 24-26h12c16 0 24 8 24 26"}):n(Se,{children:[t("path",{d:"M30 58c0-18 8-26 24-26h4"}),t("path",{d:"M90 58c0-18-8-26-24-26h-4",strokeDasharray:"2 7",className:"text-muted-foreground/50"})]}),t("circle",{cx:"60",cy:"32",r:e?5:4,fill:e?"currentColor":"none",fillOpacity:.25,className:e?void 0:"text-muted-foreground/45"})]})}function vd({query:e,filtered:a,searching:o,hasProjects:r,canLoadMore:l,loadingMore:s,refreshing:i,onClearQuery:u,onLoadMore:f,onRefresh:c}){let d=gl(),{t:p}=k();return r?o?t(Ot,{rows:5,caption:p("emptyState.searchingCaption",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}):e.length>0?n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p("emptyState.nothingMatches",{query:e.length>48?`${e.slice(0,48)}\u2026`:e})}),t(At,{children:p("emptyState.nothingMatchesDetail")})]}),n(Tt,{className:"flex-row flex-wrap justify-center gap-2",children:[n(b,{size:"sm",variant:"outline",onClick:u,children:[t(Da,{}),p("emptyState.clearSearch")]}),n(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[t(ea,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p(a?"emptyState.nothingUnderFilters":"emptyState.noPullRequests")}),t(At,{children:p(a?"emptyState.widenFilters":"emptyState.workspaceHint")})]}),n(Tt,{className:"flex-row flex-wrap justify-center gap-2",children:[l?t(b,{size:"sm",variant:"outline",disabled:s,onClick:f,children:p(s?"action.loading":"emptyState.loadMore")}):null,n(b,{size:"sm",variant:"outline",disabled:i,onClick:c,children:[t(ea,{}),p(i?"emptyState.checking":"emptyState.checkAgain")]})]})]}):n(qt,{className:"py-16",children:[t(Dn,{joined:!1}),n(Mt,{children:[t(Dt,{children:p("emptyState.noProjectsTitle")}),t(At,{children:p(d?"emptyState.noProjectsDetail":"empty.addProjectWithoutPalette")})]}),d?t(Tt,{children:n(b,{size:"sm",onClick:()=>hl({open:"add-project"}),children:[t(mo,{}),p("emptyState.addProject")]})}):null]})}he();ze();Te();_a();A();da();M();function hp({entry:e,selected:a,showProjectTitle:o,showProvider:r,environmentLabel:l,matchedElsewhere:s,onSelect:i}){let{t:u}=k(),f=fr(),c=pr(),{Icon:d,providerName:p}=Ya(e.provider);return n("button",{type:"button","aria-current":a?"true":void 0,onClick:()=>i(e),className:S("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]",a?"bg-accent":"hover:bg-accent"),children:[t(Ai,{state:e.state,isDraft:e.isDraft,mergeability:e.mergeability,baseBranch:e.baseBranch}),n("span",{className:"min-w-0",children:[t("span",{className:"block truncate text-sm font-medium text-foreground",children:e.title}),n(Ca,{className:"mt-0.5 text-xs text-muted-foreground/70",children:[n("span",{className:"flex shrink-0 items-center gap-1",children:[r?n(re,{children:[t(le,{render:t("span",{className:"inline-flex shrink-0"}),children:t(d,{"aria-label":p,className:"size-3"})}),t(ne,{children:p})]}):null,n("span",{onContextMenu:m=>{m.preventDefault(),m.stopPropagation(),c({url:e.url,openLabel:f(e.provider),position:{x:m.clientX,y:m.clientY}})},children:["#",e.number]})]}),o?t("span",{className:"truncate",children:e.repository}):null,l?t("span",{className:"max-w-32 shrink-0 truncate",children:l}):null,t(wa,{actor:e.author,className:"max-w-40 shrink-0"}),e.reviewDecision==="approved"||e.reviewDecision==="changes-requested"?t("span",{className:S("shrink-0",e.reviewDecision==="approved"?"text-success-foreground":"text-warning-foreground"),children:e.reviewDecision==="approved"?u("reviewOutcome.approved"):u("reviewOutcome.changesRequested")}):null,e.checksState===void 0?null:t(vr,{checksState:e.checksState,environmentId:e.environmentId,reference:{projectId:e.projectId,repository:e.repository,number:e.number}}),s?t("span",{className:"shrink-0 rounded-full border border-border/60 px-1.5 text-[10px]",children:u("row.matchedInDescription")}):null]})]}),n("span",{className:"flex shrink-0 flex-col items-end gap-0.5 text-xs text-muted-foreground/70 tabular-nums",children:[t("span",{children:Ge(e.updatedAt)}),t(Fa,{additions:e.additions,deletions:e.deletions})]})]})}var Ld=Xn(hp);A();da();M();function wd({children:e,documents:a,activeDocumentId:o,widthStorageKey:r,defaultWidth:l,pullRequestStatuses:s,onActivate:i,onCloseDocument:u,onCloseOtherDocuments:f,onCloseDocumentsToRight:c,onCloseAllDocuments:d}){let p=(m,w)=>{let L=a.find(x=>x.id===m);L&&w(L)};return t(di,{tabs:a.map(m=>{let w=s[m.id],L=w?Co(w):null;return{id:m.id,title:`${m.repository.split("/").at(-1)} #${m.number}`,description:`${m.repository} #${m.number}`,...L?{icon:t(L.Icon,{className:`size-3 ${L.toneClassName}`,"aria-hidden":!0})}:{}}}),activeId:o,widthStorageKey:r,...l===void 0?{}:{defaultWidth:l},onActivate:m=>p(m,i),onClose:m=>p(m,u),onCloseOthers:m=>p(m,f),onCloseToRight:m=>p(m,c),onCloseAll:d,children:e})}Fe();A();Te();M();function Cd({rightPanelAvailable:e,rightPanelOpen:a,rightPanelUnavailableLabel:o,rightPanelMaximized:r,onToggleRightPanelMaximized:l,onToggleRightPanel:s}){let{t:i}=k();return n("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&&l!==void 0?n(re,{children:[t(le,{render:t(Ba,{className:"shrink-0",pressed:r,onPressedChange:l,"aria-label":i(r?"panel.restore":"panel.maximize"),variant:"ghost",size:"sm"}),children:r?t(uo,{className:"size-4"}):t(so,{className:"size-4"})}),t(ne,{side:"bottom",children:i(r?"panel.restore":"panel.maximize")})]}):null,n(re,{children:[t(le,{render:t(Ba,{className:"shrink-0",pressed:a,onPressedChange:s,"aria-label":i("panel.toggleRight"),variant:"ghost",size:"sm",disabled:!e}),children:t(dt,{className:"size-4"})}),t(ne,{side:"bottom",children:e?i("panel.toggleRight"):o??i("panel.rightUnavailable")})]})]})}A();A();he();ft();var br={isOpen:!1,activeDocumentId:null,documents:[]},Bn=new Set;function et(){for(let e of Bn)e()}function xp(e){return Bn.add(e),()=>{Bn.delete(e)}}function yp(e){return`pull-request:${e.environmentId===void 0?"":`${encodeURIComponent(e.environmentId)}:`}${encodeURIComponent(e.projectId)}:${encodeURIComponent(e.repository)}:${e.number}`}function Ip(e){return{id:yp(e),kind:"pull-request",...e.environmentId===void 0?{}:{environmentId:e.environmentId},projectId:e.projectId,repository:e.repository,number:e.number}}function at(e,a,o){let r=o(e[a]??br);return{...e,[a]:r}}function vp(e,a){let o=e.documents.find(r=>r.id===a.id);return{...e,isOpen:!0,activeDocumentId:a.id,documents:o?e.documents.map(r=>r.id===a.id?a:r):[...e.documents,a]}}function Lp(e,a,o){let r=e.documents.findIndex(u=>u.id===a);if(r<0)return e;let l=e.documents.filter((u,f)=>o(f,r)),s=l.some(u=>u.id===e.activeDocumentId),i=l[Math.min(r,l.length-1)]??null;return{...e,documents:l,activeDocumentId:s?e.activeDocumentId:i?.id??null,isOpen:l.length>0?e.isOpen:!1}}var De={byThreadKey:{},openPullRequest:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>vp(o,Ip(a)))},et()},activateDocument:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>o.documents.some(r=>r.id===a)?{...o,isOpen:!0,activeDocumentId:a}:o)},et()},closeDocument:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>Lp(o,a,(r,l)=>r!==l))},et()},closeOtherDocuments:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>({...o,documents:o.documents.filter(r=>r.id===a),activeDocumentId:a}))},et()},closeDocumentsToRight:(e,a)=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),o=>{let r=o.documents.findIndex(l=>l.id===a);return r<0?o:{...o,documents:o.documents.slice(0,r+1),activeDocumentId:a}})},et()},closeAllDocuments:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),()=>br)},et()},show:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),a=>({...a,isOpen:a.documents.length>0}))},et()},close:e=>{De={...De,byThreadKey:at(De.byThreadKey,ua(e),a=>({...a,isOpen:!1}))},et()}};function Nn(){return De}var _e=(e=>{let a=Fo(xp,Nn,Nn);return e(a)});_e.getState=Nn;function Rr(e,a){return a?e[ua(a)]??br:br}function Fn(e,a){let o=Rr(e,a);return o.documents.find(r=>r.id===o.activeDocumentId)??null}function En(e,a){return Rr(e,a).isOpen?Fn(e,a):null}function bd(e,a,o){return e[a]?.state===o.state&&e[a]?.isDraft===o.isDraft?e:{...e,[a]:o}}Te();Fe();he();A();A();A();A();A();A();A();ze();M();var Hn=[{value:"all",labelKey:"filter.all",Icon:He},{value:"reviewing",labelKey:"filter.reviewing",Icon:to},{value:"authored",labelKey:"filter.authored",Icon:ja}],Un=[{value:"all",labelKey:"filter.all",Icon:He},{value:"open",labelKey:"filter.open",Icon:Xe},{value:"closed",labelKey:"filter.closed",Icon:pa},{value:"merged",labelKey:"filter.merged",Icon:Ve}];function On({label:e,value:a,options:o,onChange:r}){let{t:l}=k(),s=o.find(i=>i.value===a)??o[0];return s?n(ma,{children:[n(ha,{"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:[s.labelKey!==void 0?l(s.labelKey):s.label,t(Ye,{"aria-hidden":!0,className:"size-3 text-muted-foreground/70"})]}),t(ga,{align:"start",side:"bottom",className:"min-w-40",children:t(Na,{value:a,onValueChange:i=>r(i),children:o.map(i=>{let u=t(La,{value:i.value,disabled:i.unavailable!==void 0,className:"data-disabled:pointer-events-auto",children:n("span",{className:"flex min-w-0 items-center gap-2",children:[t(i.Icon,{"aria-hidden":!0,className:"size-icon-2"}),i.labelKey!==void 0?l(i.labelKey):i.label]})},i.value);return i.unavailable===void 0?u:n(re,{children:[t(le,{render:u}),t(ne,{side:"right",className:"max-w-64 break-words",children:i.unavailable})]},i.value)})})})]}):null}function wp({searchInput:e,searchValue:a,open:o,onOpenChange:r,focusToken:l,onFocusWithin:s}){let{t:i}=k(),u=Ee(null);ge(()=>{o&&u.current?.querySelector("input")?.focus()},[o]);let f=Ee(l);return ge(()=>{if(f.current===l)return;f.current=l;let c=u.current?.querySelector("input");c?.focus(),c?.select()},[l]),o||a.length>0?t("div",{ref:u,className:"w-56 shrink-0",onFocus:()=>s?.(!0),onBlur:()=>{s?.(!1),a.length===0&&r(!1)},children:e}):t(b,{size:"icon-sm",variant:"ghost","aria-label":i("list.searchAria"),onClick:()=>r(!0),children:t(Da,{className:"size-4"})})}function Pd({masterVisible:e,onMasterVisibilityChange:a,onBack:o,refreshing:r,onRefresh:l,searchValue:s,involvement:i,state:u,host:f,hostMenuOptions:c,onInvolvement:d,onState:p,onHost:m,searchInput:w,filtersMenu:L,rightPanelControl:x,rightPanel:D,listBody:v}){let{t:y}=k(),_=Ee(null),oe=Ee(null),[j,H]=C(!1);ge(()=>{let E=oe.current;if(!E||!e)return;let Y=new IntersectionObserver(([W])=>H(W?!W.isIntersecting:!1),{root:_.current});return Y.observe(E),()=>Y.disconnect()},[e]);let G=Ee(!1),T=Ee(null),[K,U]=C(!1),[J,B]=C(0);return ge(()=>{if(!e)return;let E=Y=>{if(Y.defaultPrevented||Y.key.toLowerCase()!=="f"||!(Y.metaKey||Y.ctrlKey)||Y.altKey||Y.shiftKey)return;if(Y.preventDefault(),j){U(!0),B(ce=>ce+1);return}let W=T.current?.querySelector("input");W?.focus(),W?.select()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[j,e]),ge(()=>{if(j||!e||(U(!1),!G.current))return;G.current=!1;let E=T.current?.querySelector("input");E&&(E.focus(),E.setSelectionRange(E.value.length,E.value.length))},[j,e]),n("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[n(Ri,{className:"bg-background",children:[j&&e?n(Qr,{ariaLabel:y("page.scopeAria"),children:[t(Xo,{current:!0,children:t("h1",{className:"truncate",children:y("page.title")})}),t(Ci,{}),n(Xo,{className:"gap-1.5 overflow-hidden",children:[t(On,{label:y("list.filterByState"),value:u,options:Un,onChange:p}),t(On,{label:y("list.filterByInvolvement"),value:i,options:Hn,onChange:d}),c.length>2?t(On,{label:y("list.filterByHost"),value:f??"",options:c,onChange:E=>m(E===""?void 0:E)}):null]})]}):t(Qr,{ariaLabel:y("breadcrumb.ariaLabel"),children:t(Xo,{current:!0,children:t("h1",{className:"truncate",children:y("page.title")})})}),t("div",{className:"min-w-0 flex-1"}),j&&e?n("div",{className:"flex shrink-0 items-center gap-1.5",children:[t(wp,{searchInput:w,searchValue:s,open:K,onOpenChange:U,focusToken:J,onFocusWithin:E=>{G.current=E}}),t(Rd,{compact:!0,refreshing:r,onRefresh:l})]}):null,x]}),t(ci,{detail:D,onBack:o,onMasterVisibilityChange:a,children:t("div",{ref:_,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:n(bi,{className:"gap-4",children:[n("div",{className:"flex flex-col gap-3",children:[n("div",{ref:T,className:"flex items-center gap-2",children:[w,L,j?null:t(Rd,{refreshing:r,onRefresh:l})]}),t("div",{ref:oe,"aria-hidden":!0,className:"-mt-3 h-px w-full"})]}),v]})})})]})}function Rd({compact:e=!1,refreshing:a,onRefresh:o}){let{t:r}=k();return t(b,{size:e?"icon-sm":"icon",variant:e?"ghost":"outline","aria-label":r("list.refreshAria"),onClick:o,disabled:a,children:t("span",{className:S("inline-flex shrink-0",a&&"animate-spin"),children:t(ea,{className:"size-4"})})})}he();St();he();function Sd(e,a){let[o,r]=C(e);return ge(()=>{let l=setTimeout(()=>r(e),a);return()=>clearTimeout(l)},[a,e]),o}Ne();Ne();var Cp=250,Pa=99,Lt=500,kd=[];function qd(e){let{search:a,environmentIds:o,environmentKey:r,pullRequestsSupported:l,projectsKnown:s,projects:i,scopedProjectId:u,scopedProject:f}=e,c=(a.q??"").trim(),d=Sd(c,Cp),p=c===d,m=V(()=>_o(c),[c]),w=V(()=>_o(d),[d]),L=V(()=>({...a.draft?{draft:a.draft}:{},...a.review?{review:a.review}:{},...a.checks?{checks:a.checks}:{}}),[a.checks,a.draft,a.review]),x=Object.keys(L).length>0,D=V(()=>({...L,...w.filters}),[L,w.filters]),v=Object.keys(D).length>0,y=V(()=>({...L,...m.filters}),[L,m.filters]),_=Object.keys(y).length>0,oe=V(()=>si(o,i,f,u,s),[o,i,s,f,u]),j=V(()=>{let q=oe.map(qe=>({environmentId:qe}));if(!s||u!==void 0)return q;let ee=ku(i,oe,oe[0]),me=new Map;for(let qe of i)me.set(qe.environmentId,(me.get(qe.environmentId)??0)+1);return oe.flatMap(qe=>{let We=ee.get(qe);return We===void 0?[]:We.length===(me.get(qe)??0)?[{environmentId:qe}]:[{environmentId:qe,projectIds:We}]})},[i,s,oe,u]),H=V(()=>j.map(({environmentId:q,projectIds:ee})=>`${q}#${ee?.join("+")??"*"}`).join("|"),[j]),G=`${r}:${H}:${a.state}:${a.involvement}:${u??""}:${a.host??""}:${a.draft??""}:${a.review??""}:${a.checks??""}`,T=`${G}:${d}`,[K,U]=C({key:T,size:Pa,cursors:null,regrown:[]}),J=K.key===T?K.size:Pa,B=K.key===T?K.cursors:null,E=K.key===T?K.regrown:[];ge(()=>{U({key:T,size:Pa,cursors:null,regrown:[]})},[T]);let Y=V(()=>j.flatMap(({environmentId:q,projectIds:ee})=>{let me=B?.[q];return B!==null&&me===void 0&&!E.includes(q)?[]:[{environmentId:q,input:{state:a.state,involvement:a.involvement,limit:J,...u?{projectId:u}:{},...ee?{projectIds:ee}:{},...a.host?{host:a.host}:{},...v?{filters:D}:{},...w.text?{query:w.text}:{},...me===void 0?{}:{cursors:me}}}]}),[D,v,J,j,u,a.host,a.involvement,a.state,B,E,w.text]),W=wo(Y),ce=V(()=>j.map(({environmentId:q,projectIds:ee})=>({environmentId:q,input:{state:a.state,involvement:a.involvement,limit:Pa,...u?{projectId:u}:{},...ee?{projectIds:ee}:{},...a.host?{host:a.host}:{},...x?{filters:L}:{}}})),[x,L,j,u,a.host,a.involvement,a.state]),se=wo(ce),xe=a.involvement==="all"&&c.length===0,fe=V(()=>{if(!xe)return{authored:kd,reviewing:kd};let q=ee=>j.map(({environmentId:me,projectIds:qe})=>({environmentId:me,input:{state:a.state,involvement:ee,limit:Pa,...u?{projectId:u}:{},...qe?{projectIds:qe}:{},...a.host?{host:a.host}:{},...x?{filters:L}:{}}}));return{authored:q("authored"),reviewing:q("reviewing")}},[x,L,xe,j,u,a.host,a.state]),ie=wo(fe.authored),Ce=wo(fe.reviewing),ae=Oe(ke.invalidate,{reportFailure:!1}),[g,$]=C(0),[N,X]=C(!1),pe=async q=>{X(!0);try{await Promise.all(oe.map(ee=>ae({environmentId:ee,input:{}})))}finally{X(!1)}de(),se.refresh(),ie.refresh(),Ce.refresh(),q(),$(ee=>ee+1)},R=N||W.isPending,[F,Ie]=C(null),[Ae,ca]=C(null);ge(()=>{r.length!==0&&Ie(q=>{if(q!==null&&q.environmentKey===r)return q;let ee=ri(typeof window>"u"?void 0:window.localStorage,r);return ee===null?null:{environmentKey:r,scope:ee.scope,query:"",data:ee.data,...ee.partitions===void 0?{}:{partitions:ee.partitions}}})},[r]),ge(()=>{if(!W.data||W.isPending)return;let q=W.data;Ie(ee=>{let me=xe&&ie.data!==null&&Ce.data!==null?{authored:ie.data.entries,reviewing:Ce.data.entries}:ee!==null&&ee.environmentKey===r&&ee.scope===G?ee.partitions:void 0;if(r.length>0&&d.length===0){let qe=Ae?.key===T?Ae.entries:q.entries;ni(typeof window>"u"?void 0:window.localStorage,r,{scope:G,data:{...q,entries:qe,viewers:se.data?.viewers??q.viewers,providers:se.data?.providers??q.providers},...me===void 0?{}:{partitions:me}})}return{environmentKey:r,scope:G,query:d,data:q,...me===void 0?{}:{partitions:me}}})},[r,G,d,W.data,W.isPending,xe,ie.data,Ce.data,Ae,T,se.data]);let ta=V(()=>{if(F===null||F.environmentKey!==r||F.scope===G)return null;let q=Qs(F.data.entries,{state:a.state,projectId:u,host:a.host});return q.length===0?null:{...F.data,entries:q}},[r,F,G,u,a.host,a.state]),be=(d.length===0&&B===null&&J===Pa?se.data:W.data)??(F?.scope===G&&F.query===d?F.data:null),Ze=(d.length===0?se.data:void 0)??(F?.scope===G?F.data:null)??ta,Je=be??Ze,ya=be===null&&Ze!==null,Sa=W.isPending&&Je!==null,Q=W.isPending&&Je===null;ge(()=>{be&&ca(q=>{if(q===null||q.key!==T)return{key:T,entries:Vo(be.entries,w.text)};if(B!==null){let ee=new Set(q.entries.map(Xa)),me=be.entries.filter(We=>!ee.has(Xa(We))),qe=Vo(me.toSorted((We,Ha)=>Ha.updatedAt.localeCompare(We.updatedAt)),w.text);return{key:T,entries:[...q.entries,...qe]}}return{key:T,entries:Vo(be.entries,w.text)}})},[be,T,B,w.text]);let Le=be?.nextCursors??{},we=(be?.truncatedEnvironments??[]).filter(q=>Le[q]===void 0),Re=!ya&&Object.keys(Le).length>0,P=()=>{if(Re){U({key:T,size:we.length===0?J:Math.min(J+Pa,Lt),cursors:Le,regrown:we});return}U({key:T,size:Math.min(J+Pa,Lt),cursors:null,regrown:[]})},de=()=>{if(B===null){W.refresh();return}let q=Ae?.key===T?Ae.entries.length:J;U({key:T,regrown:[],size:Math.min(Math.max(J,Math.ceil(q/Pa)*Pa),Lt),cursors:null})};return wr(()=>{de(),ie.refresh(),Ce.refresh()},{enabled:l}),{typedQuery:c,querySettled:p,typedParsed:m,menuFilters:L,localFilters:y,hasLocalFilters:_,scopeKey:G,filterKey:T,pageSize:J,listQuery:W,baselineQuery:se,partitionsWanted:xe,authoredQuery:ie,reviewingQuery:Ce,detailRefreshToken:g,refreshing:R,loaded:F,ordered:Ae,answered:be,listData:Je,showingCarried:ya,loadingMore:Sa,firstLoad:Q,canContinue:Re,loadMore:P,refreshList:de,refreshFromHost:pe}}ft();ft();he();la();function Td(e){let{search:a}=Pe().useLocation();return V(()=>{let o=new URLSearchParams(a.startsWith("?")?a.slice(1):a),r={};for(let[l,s]of o.entries())r[l]=s;return r},[a])}function bp(e){let a=new URLSearchParams;for(let[o,r]of Object.entries(e))r==null||r===""||a.set(o,String(r));return a.toString()}function Ad(){let e=Pe(),a=e.useLocation();return oa(o=>{let r=new URLSearchParams(a.search.startsWith("?")?a.search.slice(1):a.search),l={};for(let[u,f]of r.entries())l[u]=f;let s=typeof o.search=="function"?o.search(l):o.search??l,i=bp(s);e.navigate(i.length>0?`/x/pull-requests?${i}`:"/x/pull-requests")},[e,a.search])}Te();he();St();la();Ne();function Md(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 Dd(e,a){let o={...e,...a};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 Rp=Os.make("pull-requests-panel"),Pp="pull-requests-panel";function Bd(){let[e,a]=C(!0),o=Td({strict:!1}),r=V(()=>Md(o),[o]),l=Ad(),{t:s}=k(),{environments:i}=Lr(),u=V(()=>i.filter(F=>F.serverConfig!==null).map(F=>F.environmentId),[i]),f=ud(Zr,u),c=V(()=>i.filter(F=>f.get(F.environmentId)===!0).toSorted((F,Ie)=>F.environmentId.localeCompare(Ie.environmentId)),[i,f]),d=c.find(F=>F.environmentId===r.environmentId)?.environmentId??null,p=V(()=>new Set(i.map(F=>F.environmentId)),[i]),m=V(()=>c.filter(F=>d===null||F.environmentId===d).map(F=>F.environmentId),[c,d]),w=V(()=>ti(m),[m]),L=f.size>0,x=m.length>0,{projects:D,bootstrapped:v}=An(),y=V(()=>D.filter(F=>m.includes(F.environmentId)),[D,m]),_=V(()=>new Map(i.map(F=>[F.environmentId,F.label])),[i]),oe=V(()=>{let F=new Map;for(let Ie of y)F.set(Ie.title,(F.get(Ie.title)??0)+1);return y.map(Ie=>({id:Ie.id,environmentId:Ie.environmentId,title:(F.get(Ie.title)??0)>1?`${Ie.title} \xB7 ${_.get(Ie.environmentId)??Ie.environmentId}`:Ie.title,workspaceRoot:Ie.workspaceRoot})).toSorted((Ie,Ae)=>Ie.title.localeCompare(Ae.title))},[_,y]),j=V(()=>Kr(r.projectId,y,v),[y,v,r.projectId]),H=V(()=>Vr(y,d,j),[y,d,j]),G=V(()=>{let F=r.repository?.toLowerCase();return F===void 0?void 0:y.find(Ae=>Ae.repositoryIdentity?.owner&&Ae.repositoryIdentity.name&&`${Ae.repositoryIdentity.owner}/${Ae.repositoryIdentity.name}`.toLowerCase()===F&&(r.host===void 0||zo(Ae.repositoryIdentity,Ae.repositoryIdentity.provider)===r.host.toLowerCase()))?.id},[y,r.host,r.repository]),T=V(()=>Kr(r.selectedProjectId,y,v),[y,v,r.selectedProjectId]),K=T??G??j,U=ii(r.selectedEnvironmentId,p,d),J=Pe(),B=V(()=>r.selectedProjectId===void 0||!v||T!==void 0?[]:m.filter(F=>U===null||F===U).map(F=>({environmentId:F,payload:{projectId:r.selectedProjectId}})),[m,T,v,r.selectedProjectId,U]),E=J.commands.useQueryEach("workspaceProject",B,{refreshKey:J.useRepositoryIdentityKey()}),Y=V(()=>li({projectId:r.selectedProjectId,environmentId:U,rows:B.length===0?[]:E.rows}),[E.rows,B.length,r.selectedProjectId,U]),W=V(()=>Y??Vr(y,U,K),[Y,y,U,K]),ce=V(()=>c.length===0?null:Us(Pp,Rp),[c.length]),se=_e(F=>Rr(F.byThreadKey,ce)),xe=_e(F=>Fn(F.byThreadKey,ce)),fe=xe?.kind==="pull-request"?xe:null,ie=se.isOpen?fe:null,Ce=ie?.environmentId??W?.environmentId??null,[ae,g]=C({}),$=ie?.id,N=oa(F=>{let Ie=$;Ie!==void 0&&g(Ae=>bd(Ae,Ie,F))},[$]),X=oa(F=>{l({to:"/x/$pluginId",params:{pluginId:Zr},search:Dd(r,F),replace:!0})},[l,r]),pe={repository:void 0,number:void 0,selectedProjectId:void 0,selectedEnvironmentId:void 0};return{masterVisible:e,setMasterVisible:a,search:r,t:s,capableEnvironments:c,scopedEnvironmentId:d,environmentIds:m,environmentKey:w,capabilityKnown:L,pullRequestsSupported:x,projectsKnown:v,projects:y,environmentLabels:_,scopedProjects:oe,scopedProjectId:j,scopedProject:H,selectedProject:W,rightPanelRef:ce,rightPanelState:se,selectedPullRequestDocument:fe,activePullRequestDocument:ie,panelEnvironmentId:Ce,pullRequestTabStatuses:ae,handlePullRequestTabStatusChange:N,updateSearch:X,clearedSelection:pe,updateListScope:F=>{ce!==null&&_e.getState().close(ce),X({...F,...pe})}}}ft();he();St();Ne();var Sp={};function Nd(e,a){let{masterVisible:o,search:r,environmentKey:l,pullRequestsSupported:s,projects:i,selectedProject:u,rightPanelRef:f,rightPanelState:c,selectedPullRequestDocument:d,activePullRequestDocument:p,updateSearch:m,clearedSelection:w}=e,{querySettled:L,typedParsed:x,localFilters:D,hasLocalFilters:v,scopeKey:y,filterKey:_,pageSize:oe,listQuery:j,baselineQuery:H,partitionsWanted:G,authoredQuery:T,reviewingQuery:K,loaded:U,ordered:J,answered:B,listData:E,showingCarried:Y,canContinue:W,loadMore:ce}=a,se=H.data?.viewers??E?.viewers??Sp,xe=H.data?.errors??E?.errors??[],fe=V(()=>new Set((H.data?.providers??E?.providers??[]).flatMap(Q=>Q.searchesOnHost?[Q.host]:[])),[H.data?.providers,E?.providers]),ie=V(()=>{let Q=J?.key===_?J.entries:E?.entries??[],Le=Xs(Q,se,r.involvement),we=v?Le.filter(P=>Gr(P,D,Ko(P,se))):Le;if(x.text.length===0)return we.toSorted((P,de)=>de.updatedAt.localeCompare(P.updatedAt));let Re=L&&!Y;return we.filter(P=>Re&&fe.has(P.host)||zr(P,x.text))},[_,v,D,E,J,L,r.involvement,fe,Y,x.text,se]),Ce=Ee(null);ge(()=>{let Q=Ce.current;if(!o||!Q||ie.length===0||E?.truncated!==!0||j.isPending||j.error!==null||Y||!W&&oe>=Lt)return;let Le=new IntersectionObserver(we=>{we.some(Re=>Re.isIntersecting)&&ce()},{rootMargin:"240px"});return Le.observe(Q),()=>Le.disconnect()},[o,ie.length,_,W,E?.truncated,j.error,j.isPending,oe,Y]);let ae=V(()=>{if(r.involvement!=="all")return[{key:"others",entries:ie}];let Q=U!==null&&U.environmentKey===l&&U.scope===y?U.partitions:void 0,Le=P=>P===void 0||!v?P:P.filter(de=>Gr(de,D,Ko(de,se))),we=Le(G?T.data?.entries??Q?.authored:void 0),Re=Le(G?K.data?.entries??Q?.reviewing:void 0);return we===void 0||Re===void 0?Zs(ie,se):Js(ie,we,Re)},[v,D,T.data?.entries,ie,l,U,G,K.data?.entries,y,r.involvement,se]),g=V(()=>{let Q=new Map;for(let Le of ae)for(let we of Le.entries){let Re=Q.get(we.environmentId)??[];Re.push({projectId:we.projectId,repository:we.repository,number:we.number}),Q.set(we.environmentId,Re)}return[...Q].map(([Le,we])=>({environmentId:Le,input:{refs:we}}))},[ae]),$=Ti(g),[N,X]=C(()=>new Map);ge(()=>{let Q=$.stats;Q!==null&&X(Le=>Ys(Le,Q))},[$.stats]);let pe=V(()=>r.repository&&r.number&&u?{environmentId:u.environmentId,repository:r.repository,number:r.number,projectId:u.id}:null,[r.number,r.repository,u]),R=d!==null;ge(()=>{!s||f===null||pe===null||_e.getState().openPullRequest(f,pe)},[pe,s,f]);let F=c.isOpen&&p!==null?{environmentId:p.environmentId,repository:p.repository,number:p.number,projectId:p.projectId}:null,Ie=Q=>m(Q===null?w:{repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,...Q.environmentId===void 0?{}:{selectedEnvironmentId:Q.environmentId}}),Ae=()=>{if(f!==null){if(c.isOpen){_e.getState().close(f),m(w);return}d!==null&&(_e.getState().show(f),Ie(d))}},[ca,ta]=C([]);ge(()=>{B!==null&&ta(Q=>r.host===void 0||Q.length===0?B.providers:Q)},[B,r.host]);let be=ca.length>1,Ze=V(()=>{let Q=new Map;for(let Le of i){let we=Le.repositoryIdentity?.provider;if(we===void 0)continue;let Re=zo(Le.repositoryIdentity,we);Q.has(Re)||Q.set(Re,{host:Re,kind:we})}return[...Q.values()]},[i]),Je=V(()=>new Map(xe.map(Q=>[Ra({id:Q.projectId,environmentId:Q.environmentId}),Q.message])),[xe]),ya=oa(Q=>{f!==null&&(_e.getState().openPullRequest(f,Q),m({repository:Q.repository,number:Q.number,selectedProjectId:Q.projectId,selectedEnvironmentId:Q.environmentId}))},[f,m]);return{entries:ie,sentinelRef:Ce,groups:ae,statsByRow:N,rightPanelAvailable:R,selected:F,selectSurfaceInUrl:Ie,toggleRightPanel:Ae,hosts:ca,showProvider:be,expectedHosts:Ze,unavailableProjects:Je,selectEntry:ya,refreshStats:()=>$.refresh()}}M();var kp=10;function Fd(){let e=Bd(),a=qd(e),o=Nd(e,a),{masterVisible:r,setMasterVisible:l,search:s,t:i,capableEnvironments:u,scopedEnvironmentId:f,capabilityKnown:c,pullRequestsSupported:d,projectsKnown:p,projects:m,environmentLabels:w,scopedProjects:L,scopedProjectId:x,scopedProject:D,rightPanelRef:v,rightPanelState:y,activePullRequestDocument:_,panelEnvironmentId:oe,pullRequestTabStatuses:j,handlePullRequestTabStatusChange:H,updateSearch:G,updateListScope:T}=e,{typedQuery:K,querySettled:U,typedParsed:J,menuFilters:B,pageSize:E,listQuery:Y,baselineQuery:W,authoredQuery:ce,reviewingQuery:se,detailRefreshToken:xe,refreshing:fe,listData:ie,showingCarried:Ce,loadingMore:ae,firstLoad:g,canContinue:$,loadMore:N,refreshList:X,refreshFromHost:pe}=a,{entries:R,sentinelRef:F,groups:Ie,statsByRow:Ae,rightPanelAvailable:ca,selected:ta,selectSurfaceInUrl:be,toggleRightPanel:Ze,hosts:Je,showProvider:ya,expectedHosts:Sa,unavailableProjects:Q,selectEntry:Le,refreshStats:we}=o,Re=()=>pe(we),P=t(yd,{value:s.q??"",busy:K.length>0&&(!U||Ce),onChange:O=>G({q:O||void 0})}),de=t(Cd,{showTerminalControl:!1,terminalAvailable:!1,terminalOpen:!1,terminalShortcutLabel:null,rightPanelAvailable:ca,rightPanelOpen:y.isOpen,rightPanelShortcutLabel:null,rightPanelUnavailableLabel:i("list.selectFirst"),onToggleTerminal:()=>{},onToggleRightPanel:Ze}),q=Ce&&Y.isPending&&R.length===0&&K.length===0,ee=n(Se,{children:[c?d?g?t(Ot,{rows:7}):Y.error&&ie===null?t(Lo,{error:Y.error,onRetry:()=>Y.refresh()}):q?t(Ot,{rows:7}):R.length===0?t(vd,{hasProjects:!p||m.length>0,refreshing:fe,onRefresh:()=>{Re()},query:K,filtered:s.state!=="open"||s.involvement!=="all"||x!==void 0||s.host!==void 0,searching:K.length>0&&(!U||Ce),canLoadMore:ie?.truncated===!0&&($||E<Lt),loadingMore:ae,onClearQuery:()=>G({q:void 0}),onLoadMore:N}):t("div",{className:"space-y-3",children:Ie.map(O=>n("div",{className:"space-y-0.5",children:[O.labelKey?t("h2",{className:"px-3 pb-0.5 text-xs font-medium text-muted-foreground/70",children:i(O.labelKey)}):null,O.entries.map(Be=>t(Ld,{entry:ui(Be,Ae),showProjectTitle:!0,showProvider:ya,...u.length>1&&w.get(Be.environmentId)!==void 0?{environmentLabel:w.get(Be.environmentId)}:{},matchedElsewhere:J.text.length>0&&Go(Be,J.text)<=kp,selected:ta?.environmentId===Be.environmentId&&ta.repository===Be.repository&&ta.number===Be.number,onSelect:Le},Xa(Be)))]},O.key))}):t(Lo,{title:i("list.unavailableTitle"),error:i("page.notEnabled")}):t(Ot,{rows:7}),Y.error&&ie!==null?n("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:[t("span",{children:i("list.staleNotice")}),t(b,{size:"xs",variant:"outline",onClick:()=>Y.refresh(),children:i("action.retry")})]}):null,ie?.truncated&&R.length>0?t("div",{ref:F,className:"flex justify-center py-2 text-xs text-muted-foreground",children:ae?n("span",{className:"flex items-center gap-2",children:[t("span",{className:"inline-flex size-icon-2 shrink-0 animate-spin",children:t(Ma,{"aria-hidden":!0,className:"size-icon-2"})}),i("list.loadingMore")]}):null}):null]}),me=Je.length>0?Je:Sa,qe=[{value:"",labelKey:"list.allHosts",Icon:He},...me.map(O=>{let Be=Je.find(Do=>Do.host===O.host);return{value:O.host,label:xd(me,O),Icon:Ya(O.kind).Icon,...Be===void 0||Be.configured?{}:{unavailable:Be.detail??i("list.hostUnreadable")}}})],We=[{value:"",labelKey:"list.allServers",Icon:He},...u.map(O=>({value:O.environmentId,label:O.label,Icon:O.displayUrl===null?co:ct}))],Ha=t(Id,{state:s.state,stateOptions:Un,onState:O=>T({state:O}),involvement:s.involvement,involvementOptions:Hn,onInvolvement:O=>T({involvement:O}),filters:B,onFilters:O=>T({draft:O.draft,review:O.review,checks:O.checks}),host:s.host,hostOptions:qe,onHost:O=>T({host:O}),server:f??void 0,serverOptions:We,onServer:O=>T({environmentId:O,projectId:void 0}),projects:L,projectId:x,projectEnvironmentId:D?.environmentId,unavailable:Q,onProject:(O,Be)=>T(Be===void 0?{projectId:O}:{projectId:O,environmentId:Be})}),jt={masterVisible:r,onMasterVisibilityChange:l,onBack:Ze,refreshing:fe,onRefresh:()=>{Re()},searchValue:s.q??"",involvement:s.involvement,state:s.state,host:s.host,hostMenuOptions:qe,onInvolvement:O=>T({involvement:O}),onState:O=>T({state:O}),onHost:O=>T({host:O}),searchInput:P,filtersMenu:Ha,rightPanelControl:d?de:null,listBody:ee},Pr=O=>{v!==null&&(_e.getState().activateDocument(v,O.id),be(O))},Ao=O=>{if(v===null)return;_e.getState().closeDocument(v,O.id);let Be=En(_e.getState().byThreadKey,v);be(Be?.kind==="pull-request"?Be:null)},tt=O=>{v!==null&&(_e.getState().closeOtherDocuments(v,O.id),be(O))},Sr=O=>{if(v===null)return;_e.getState().closeDocumentsToRight(v,O.id);let Be=En(_e.getState().byThreadKey,v);be(Be?.kind==="pull-request"?Be:null)},kr=()=>{v!==null&&(_e.getState().closeAllDocuments(v),be(null))},Mo=y.isOpen&&_&&oe!==null?t(wd,{widthStorageKey:"ycodium:pull-request-panel-width",defaultWidth:typeof window>"u"?640:Math.floor(window.innerWidth/2),documents:y.documents,activeDocumentId:_.id,onActivate:O=>{O.kind==="pull-request"&&Pr(O)},onCloseDocument:O=>{O.kind==="pull-request"&&Ao(O)},onCloseOtherDocuments:O=>{O.kind==="pull-request"&&tt(O)},onCloseDocumentsToRight:O=>{O.kind==="pull-request"&&Sr(O)},onCloseAllDocuments:kr,pullRequestStatuses:j,children:t(Cr,{environmentId:oe,reference:{projectId:_.projectId,repository:_.repository,number:_.number},refreshToken:xe,onActed:()=>{X(),W.refresh(),ce.refresh(),se.refresh()},onStateChange:H},_.id)}):null;return t(wi,{className:"h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground",children:t(Pd,{...jt,rightPanel:Mo})})}Ea();M();function Od(e){ol(typeof e.notify=="function"?e.notify:()=>{},typeof e.notifyTask=="function"?e.notifyTask:void 0),typeof e.openExternal=="function"&&nl(e.openExternal),typeof e.writeClipboard=="function"&&sl(e.writeClipboard),ml(a=>{if(typeof e.openCommandPalette=="function"&&fa(e,"commandPalette")){e.openCommandPalette(a);return}typeof e.notify=="function"&&e.notify(Yn,"warning")},fa(e,"commandPalette")),e.composerDraft!==void 0&&yl(e.composerDraft)}function Ed({bridge:e}){let a=e.useFormatTimestamp();return ge(()=>{Od(e),cl(a)},[e,a]),null}function qp(e){if(["InputGroup","InputGroupAddon","InputGroupInput","DocumentPanel","MasterDetail","useLinkContextMenu"].some(r=>e.ui[r]===void 0)){let r=function(){let l=e.i18n.usePluginTranslation();return t("p",{role:"status",className:"p-6 text-sm text-muted-foreground",children:l("page.hostUpgradeRequired")})};var o=r;return{pages:{"pull-requests":r},panels:{},views:{detail:r}}}return Od(e),{pages:{"pull-requests":function(){return n(Br,{value:e,children:[t(Ed,{bridge:e}),t("style",{children:Dr}),t(Fd,{})]})}},panels:{},views:{detail:function({threadReference:l,...s}){return n(Br,{value:e,children:[t(Ed,{bridge:e}),t("style",{children:Dr}),t("div",{className:"ycodium-pull-requests-ui flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:t(Cr,{...s,context:l?Wi(l,s.reference)?"thread":"page":s.context??"page"})})]})}}}}export{qp as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-pull-requests",
3
- "version": "0.2.3168",
3
+ "version": "0.2.3188",
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.3168",
33
+ "@ycodium-ai/plugin-api": "0.2.0",
34
34
  "ycodium-markdown-fence": "0.0.0"
35
35
  },
36
36
  "ycodium": {