azdiffs 1.0.0 → 1.1.0

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 (62) hide show
  1. package/README.md +17 -3
  2. package/dist/cli.js +211 -84
  3. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId-BfEZAJVI.js +1 -0
  4. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits._commitId-DvqTmFzX.js +1 -0
  5. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits.index-Bd3xdIex.js +1 -0
  6. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.conflicts-DV0pCnK1.js +1 -0
  7. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.files-Mr-AIHvi.js +1 -0
  8. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.index-DoV2Gs7F.js +1 -0
  9. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId-ChLX3uCr.js +1 -0
  10. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits._commitId-DXZcIPBR.js +1 -0
  11. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits.index-Bd3xdIex.js +1 -0
  12. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.conflicts-DkEZ314x.js +1 -0
  13. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.files-N3xJdxPo.js +1 -0
  14. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.index-Dt7ItZCC.js +1 -0
  15. package/dist/web/assets/_organization.index-DVTzM87W.js +1 -0
  16. package/dist/web/assets/commit-diff-view-BNA-1iz5.js +1 -0
  17. package/dist/web/assets/commits-view-Cq3oHLFX.js +13 -0
  18. package/dist/web/assets/conflicts-view-Bca0Tnmk.js +8 -0
  19. package/dist/web/assets/dev.diff-jb6X8hTd.js +1 -0
  20. package/dist/web/assets/file-header-B2S9b0sl.js +49 -0
  21. package/dist/web/assets/files-view-C2YnVYtG.js +1460 -0
  22. package/dist/web/assets/grammars-B3laSCck.js +2 -0
  23. package/dist/web/assets/{highlights-BJb1-tzP.js → highlights-C-SBVYal.js} +1 -1
  24. package/dist/web/assets/home-page-BUnNaCN6.js +1 -0
  25. package/dist/web/assets/inbox-D8-BBgQT.js +1 -0
  26. package/dist/web/assets/index-DsrXp1aY.js +11 -0
  27. package/dist/web/assets/overview-view-B9qPTEMk.js +2 -0
  28. package/dist/web/assets/pull-request-layout-R9F6zMxd.js +35 -0
  29. package/dist/web/assets/routes-D2t0cGUy.js +1 -0
  30. package/dist/web/assets/shiki-mTy6Inae.js +1 -0
  31. package/dist/web/assets/shortcut-help-D99FihA2.js +1 -0
  32. package/dist/web/assets/{stream-tokenizer-B5Ok5N3S.js → stream-tokenizer-CKeNSKPz.js} +2 -2
  33. package/dist/web/index.html +1 -1
  34. package/package.json +1 -1
  35. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId-D7saE-jO.js +0 -1
  36. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits._commitId-DOwGbBTQ.js +0 -1
  37. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +0 -1
  38. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.conflicts-Cjr34xFt.js +0 -1
  39. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.files-BjjJ4Yb8.js +0 -1
  40. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.index-iY62N_zR.js +0 -1
  41. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId-CrHRklAE.js +0 -1
  42. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits._commitId-WC7fEryq.js +0 -1
  43. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +0 -1
  44. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.conflicts-BhUkafpV.js +0 -1
  45. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.files-_RVmv4sD.js +0 -1
  46. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.index-BJrgfbSD.js +0 -1
  47. package/dist/web/assets/_organization.index-hKcWlBrk.js +0 -1
  48. package/dist/web/assets/commit-diff-view-CQeZylif.js +0 -1
  49. package/dist/web/assets/commits-view-B_TQ6AnD.js +0 -13
  50. package/dist/web/assets/conflicts-view-CnGEkjaP.js +0 -8
  51. package/dist/web/assets/dev.diff-DH1qvnWe.js +0 -1
  52. package/dist/web/assets/file-header-keBlejWu.js +0 -49
  53. package/dist/web/assets/files-view-Bu3bjrNf.js +0 -1460
  54. package/dist/web/assets/grammars-DmFYBwmS.js +0 -2
  55. package/dist/web/assets/home-page-Y5jGxOav.js +0 -1
  56. package/dist/web/assets/inbox-jP8QPtzZ.js +0 -1
  57. package/dist/web/assets/index-B297yCgq.js +0 -11
  58. package/dist/web/assets/overview-view-cEOsI9TY.js +0 -2
  59. package/dist/web/assets/pull-request-layout-DsDKURcq.js +0 -35
  60. package/dist/web/assets/routes-BruvNNp9.js +0 -1
  61. package/dist/web/assets/shiki-DueA5xDi.js +0 -1
  62. package/dist/web/assets/shortcut-help-Cb0be4f3.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{An as t,C as n,Cr as r,Dn as i,F as a,H as o,Hn as s,M as c,On as l,P as u,Sr as d,_r as f,an as p,bn as m,cn as h,dn as g,en as _,hn as v,in as ee,j as te,k as ne,kn as y,ln as b,nn as x,on as S,pn as re,rn as ie,sn as C,tn as ae,un as w,vn as oe,xn as T,yn as se}from"./index-DsrXp1aY.js";import{C as ce,D as le,E,N as ue,T as de,a as fe,d as pe,f as me,g as D,h as he,i as ge,j as _e,k as O,l as ve,m as ye,o as k,r as be,s as xe,t as Se,u as Ce,v as we,y as Te}from"./file-header-B2S9b0sl.js";import{_ as A,a as j,c as Ee,d as M,f as De,g as N,h as P,i as Oe,l as ke,m as Ae,o as je,p as F,r as I,s as L,u as R}from"./inbox-D8-BBgQT.js";import{i as Me,r as Ne,t as Pe}from"./commits-view-Cq3oHLFX.js";import{E as z,M as Fe,N as B,T as Ie,a as Le,c as Re,d as ze,f as Be,i as Ve,l as He,m as Ue,o as We,p as Ge,r as Ke,s as V,t as qe,u as Je}from"./pull-request-layout-R9F6zMxd.js";var H=e(r(),1);function Ye(e){return i().summary.providerNote(e.provider,e.name)}function Xe(e){if(e.included>=e.total)return null;let t=i().summary.coverage,{generated:n,binary:r,unavailable:a}=e.skipped,o=e.skipped[`too-large`]+e.skipped[`over-budget`],s=[[n,t.generated],[r,t.binary],[o,t.oversized],[a,t.unavailable]].filter(([e])=>e>0).map(([e,t])=>t(e)).join(`, `);return t.covers(e.included,e.total,s)}function Ze(e,t){let n=i().summary.errors;switch(e){case`tool-missing`:return n.toolMissing(t.name);case`not-signed-in`:return n.notSignedIn(t.name,t.id);case`timeout`:return n.timeout(t.name);case`too-large`:return n.tooLarge;case`busy`:return n.busy;case`failed`:return n.failed(t.name);case`nothing-to-summarize`:return n.nothingToSummarize;case`server`:return n.server}}function Qe(e){let t=i().summary.elapsed,n=Math.max(0,Math.floor(e/1e3));return n<60?t.seconds(n):t.minutes(Math.floor(n/60),String(n%60).padStart(2,`0`))}var $e=`X-Azdiffs-Key`,et=S({id:C([`claude`,`codex`,`copilot`]),name:h(w(),x(1)),provider:h(w(),x(1))}),tt=S({tools:_(et)}),U=h(p(),ae(),ie(0)),W=S({summary:w(),tool:C([`claude`,`codex`,`copilot`]),generatedAt:w(),iterationId:U,sourceCommit:w(),coverage:S({included:U,total:U,skipped:S({generated:U,binary:U,"too-large":U,"over-budget":U,unavailable:U})})}),nt=g([W,S({summary:ee()})]),rt=S({error:w()}),G=class extends Error{name=`SummaryError`;kind;constructor(e){super(`Summary failed: ${e}`),this.kind=e}};async function K(e,t,n){let r=f();if(r===null)throw new G(`server`);try{return await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,[$e]:r},body:JSON.stringify(t),credentials:`same-origin`,cache:`no-store`,...n===void 0?{}:{signal:n}})}catch(e){throw n?.aborted===!0?e:new G(`server`)}}async function it(){try{let e=await K(`/api/ai/tools`,{});if(!e.ok)return[];let t=b(tt,await e.json().catch(()=>null));return t.success?t.output.tools:[]}catch{return[]}}var at={title:``,description:``,targetBranch:``,sourceBranch:``,patch:``,includedFiles:0,skipped:[]};async function ot(e){let t=await K(`/api/ai/summary`,{...e,...at,cachedOnly:!0});if(!t.ok)throw await q(t);let n=b(nt,await t.json().catch(()=>null));if(!n.success)throw new G(`server`);return n.output.summary===null?null:n.output}async function st(e,t,n){let r=await K(`/api/ai/summary`,{...e,...t,regenerate:n.regenerate},n.signal);if(!r.ok)throw await q(r);let i=b(W,await r.json().catch(()=>null));if(!i.success)throw new G(`failed`);return i.output}var ct=[`tool-missing`,`not-signed-in`,`timeout`,`too-large`,`busy`,`failed`];async function q(e){if(e.status===403)return new G(`server`);let t=b(rt,await e.json().catch(()=>null)),n=ct.find(e=>t.success&&e===t.output.error);return n===void 0?new G(e.status>=500&&e.status!==502?`server`:`failed`):new G(n)}var lt=new TextEncoder;async function ut({changeSet:e,load:t,signal:n,concurrency:r=4}){n?.throwIfAborted();let i=e.files,a=new Map;for(let e of i)a.set(e.path,ft());let o=new Map(i.map(e=>[e.path,e])),s=he({concurrency:r,run:async n=>{let r=await dt(o.get(n),e.baseCommit,t).catch(()=>({kind:`skip`,reason:`unavailable`}));a.get(n)?.resolve(r)}}),c=()=>s.dispose();n?.addEventListener(`abort`,c,{once:!0});try{s.add(i.filter(e=>!D(e.path)).map(e=>e.path));let e=[],t=[],r=0,o=!1;for(let c of i){if(D(c.path)){t.push({path:c.path,reason:`generated`});continue}if(o){t.push({path:c.path,reason:`over-budget`});continue}let i=await pt(a.get(c.path).promise,n);i.kind===`skip`?t.push({path:c.path,reason:i.reason}):r+i.bytes>307200?(o=!0,s.dispose(),t.push({path:c.path,reason:`over-budget`})):(e.push(i.patch),r+=i.bytes)}return{patch:e.join(``),files:{included:e.length,total:i.length},skipped:t}}finally{n?.removeEventListener(`abort`,c),s.dispose()}}async function dt(e,t,n){let r=async e=>{if(e===null)return{kind:`text`,text:``};try{return ye(await n(me(e),e))}catch{return null}},[i,a]=await Promise.all([r(pe(e,t)),r(Ce(e))]);if(i===null||a===null)return{kind:`skip`,reason:`unavailable`};if(i.kind===`binary`||a.kind===`binary`)return{kind:`skip`,reason:`binary`};if(i.kind===`too-large`||a.kind===`too-large`)return{kind:`skip`,reason:`too-large`};let o=Me(e.change===`added`?`/dev/null`:`a/${e.originalPath??e.path}`,e.change===`deleted`?`/dev/null`:`b/${e.path}`,i.text,a.text,void 0,void 0,{context:3,headerOptions:Ne}),s=lt.encode(o).byteLength;return s>40960?{kind:`skip`,reason:`too-large`}:{kind:`patch`,patch:o,bytes:s}}function ft(){let e=()=>{};return{promise:new Promise(t=>{e=t}),resolve:e}}function pt(e,t){return t===void 0?e:new Promise((n,r)=>{let i=()=>r(t.reason);if(t.aborted)return i();t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})})}var J={tools:[`ai`,`tools`],summary:e=>[`ai`,`summary`,e.tool,e.pullRequest.organization.toLowerCase(),e.pullRequest.project,e.pullRequest.repository,e.pullRequest.pullRequestId,e.iterationId,e.sourceCommit,e.language]};function mt(){return t({queryKey:J.tools,queryFn:it,staleTime:1/0,retry:!1})}var ht=`azdiffs.summaryTool`;function gt(){try{return window.localStorage.getItem(ht)}catch{return null}}function _t(e){try{window.localStorage.setItem(ht,e)}catch{}}function vt({tools:e,pullRequest:n,scope:r,latest:i,changeSet:a}){let o=s(),[c,u]=(0,H.useState)(gt),d=e.find(e=>e.id===c)??e[0],[f,p]=(0,H.useState)({kind:`idle`}),m=(0,H.useRef)(null),h=l(),g=(0,H.useMemo)(()=>({tool:d.id,pullRequest:{organization:r.organization,project:n.repository.projectName,repository:n.repository.name,pullRequestId:n.pullRequestId},iterationId:i.id,sourceCommit:i.sourceCommit,language:h}),[d.id,r.organization,n,i.id,i.sourceCommit,h]),_=t({queryKey:J.summary(g),queryFn:()=>ot(g),staleTime:1/0,retry:!1}).data??null;(0,H.useEffect)(()=>()=>m.current?.abort(),[]);let v=(0,H.useCallback)(({regenerate:e})=>{if(a===void 0)return;m.current?.abort();let t=new AbortController;m.current=t,p({kind:`running`,startedAt:Date.now()}),(async()=>{try{let i=await ut({changeSet:a,load:(e,t)=>ve(o,r,e,t),signal:t.signal});if(i.files.included===0)throw new G(`nothing-to-summarize`);let s=await st(g,{title:n.title,description:n.description,targetBranch:n.targetBranch,sourceBranch:n.sourceBranch,patch:i.patch,includedFiles:i.files.included,skipped:i.skipped},{regenerate:e,signal:t.signal});if(t.signal.aborted)return;o.setQueryData(J.summary(g),s),p({kind:`idle`})}catch(e){if(t.signal.aborted)return;p({kind:`error`,error:e instanceof G?e.kind:`failed`})}})()},[a,o,r,g,n]),ee=(0,H.useCallback)(()=>{m.current?.abort(),m.current=null,p({kind:`idle`})},[]);return{tool:d,chooseTool:(0,H.useCallback)(e=>{_t(e),u(e),p({kind:`idle`})},[]),summary:_,stale:_!==null&&_.iterationId!==i.id,run:f,ready:a!==void 0,start:v,cancel:ee}}var Y=d(),yt=`rounded-[10px] border border-border bg-surface px-4 py-3`;function bt(){let{pullRequest:e,scope:t}=V(),n=mt(),r=B(e.supportsIterations?t:null).data?.at(-1),i=l();return n.data===void 0||n.data.length===0||r===void 0||r.sourceCommit===null?null:(0,Y.jsx)(xt,{tools:n.data,pullRequest:e,latest:{...r,sourceCommit:r.sourceCommit}},`${r.id}:${i}`)}function xt({tools:e,pullRequest:t,latest:n}){let{scope:r}=V(),i=(0,H.useMemo)(()=>({iteration:n,since:null}),[n]),a=vt({tools:e,pullRequest:t,scope:r,latest:n,changeSet:Fe(r,i).data}),o=y(),s=(0,H.useId)(),c=(0,H.useRef)(null),l=(0,H.useRef)(!1);return(0,H.useEffect)(()=>{let e=a.run.kind===`running`;l.current&&!e&&c.current?.contains(document.activeElement)!==!0&&c.current?.focus(),l.current=e},[a.run.kind]),(0,Y.jsxs)(`section`,{ref:c,tabIndex:-1,"aria-labelledby":s,className:`mt-6 ${yt}`,"data-testid":`summary-card`,"data-state":a.run.kind===`idle`&&a.summary!==null?`done`:a.run.kind,children:[(0,Y.jsx)(`h2`,{id:s,className:`sr-only`,children:o.summary.heading}),(0,Y.jsx)(St,{summary:a,tools:e})]})}function St({summary:e,tools:t}){let n=y(),{run:r,tool:i}=e;return r.kind===`running`?(0,Y.jsx)(wt,{summary:e,startedAt:r.startedAt}):r.kind===`error`?(0,Y.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-[13px]`,children:[(0,Y.jsxs)(`p`,{className:`min-w-0 flex-1 text-fg`,children:[(0,Y.jsx)(P,{className:`mr-1.5 inline size-3.5 align-[-2px] text-danger`}),Ze(r.error,i)]}),(0,Y.jsx)(`button`,{type:`button`,className:T,onClick:()=>e.start({regenerate:e.summary!==null}),children:n.summary.tryAgain})]}):e.summary===null?(0,Y.jsx)(Ct,{summary:e,tools:t}):(0,Y.jsx)(Tt,{summary:e})}function Ct({summary:e,tools:t}){let n=y().summary;return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:m,disabled:!e.ready,onClick:()=>e.start({regenerate:!1}),"data-testid":`summarize`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),n.summarize]}),t.length>1&&(0,Y.jsx)(ne,{label:n.summarizeWith,align:`start`,entries:t.map(t=>({kind:`radio`,label:t.name,checked:t.id===e.tool.id,onSelect:()=>e.chooseTool(t.id)})),trigger:t=>(0,Y.jsxs)(`button`,{type:`button`,...t,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-7 px-2 text-muted hover:bg-hover hover:text-fg`,"aria-label":n.chooseTool(e.tool.name),children:[e.tool.name,(0,Y.jsx)(u,{className:`size-3.5`})]})})]}),(0,Y.jsx)(`p`,{className:`min-w-0 text-xs text-muted`,"data-testid":`summary-provider`,children:Ye(e.tool)})]})}function wt({summary:e,startedAt:t}){let n=y().summary,[r,i]=(0,H.useState)(()=>Date.now()),a=(0,H.useRef)(null);return(0,H.useEffect)(()=>{a.current?.focus();let e=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(e)},[]),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 text-[13px]`,children:[(0,Y.jsx)(Et,{}),(0,Y.jsxs)(`p`,{className:`min-w-0 flex-1 text-fg`,children:[(0,Y.jsx)(`span`,{role:`status`,children:n.running(e.tool.name)}),` `,(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted tabular-nums`,children:Qe(r-t)})]}),(0,Y.jsx)(`button`,{ref:a,type:`button`,className:T,onClick:e.cancel,"data-testid":`summary-cancel`,children:n.cancel})]})}function Tt({summary:e}){let t=y().summary,[n,r]=(0,H.useState)(!0),i=(0,H.useId)(),o=e.summary;if(o===null)return null;let s=Xe(o.coverage),c=(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-fg hover:underline`,onClick:()=>e.start({regenerate:!0}),children:t.regenerate});return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`p`,{"aria-hidden":`true`,className:`text-[13px] font-medium text-muted`,children:[(0,Y.jsx)(`span`,{className:`mr-1.5`,children:`✦`}),t.heading]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,"aria-label":n?t.hideSummary:t.showSummary,onClick:()=>r(e=>!e),className:`${v} ml-auto`,children:[n?(0,Y.jsx)(u,{className:`size-3.5`}):(0,Y.jsx)(a,{className:`size-3.5`}),n?t.hide:t.show]})]}),n&&(0,Y.jsx)(`div`,{id:i,className:`mt-2`,"data-testid":`summary-text`,children:(0,Y.jsx)(k,{source:o.summary})}),e.stale&&(0,Y.jsxs)(`p`,{className:`mt-3 text-xs text-fg`,"data-testid":`summary-stale`,children:[(0,Y.jsx)(P,{className:`mr-1 inline size-3.5 align-[-2px] text-modified`}),t.stale(c)]}),(0,Y.jsxs)(`div`,{className:`mt-3 space-y-0.5 border-t border-border pt-2.5 text-xs text-muted`,children:[(0,Y.jsxs)(`p`,{"data-testid":`summary-footer`,children:[e.tool.name,` · `,t.forUpdate(o.iterationId),` ·`,` `,(0,Y.jsx)(`time`,{dateTime:o.generatedAt,title:N(o.generatedAt),children:A(o.generatedAt)}),` `,`· `,c]}),s!==null&&(0,Y.jsx)(`p`,{"data-testid":`summary-coverage`,children:s})]})]})}function Et(){return(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`size-4 shrink-0 animate-spin text-accent motion-reduce:animate-none`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,className:`opacity-25`}),(0,Y.jsx)(`path`,{d:`M14 8a6 6 0 0 0-6-6`})]})}var Dt={VoteUpdate:`vote`,RefUpdate:`push`,ReviewersUpdate:`reviewers`,StatusUpdate:`status`,PolicyStatusUpdate:`policy`,MergeAttempt:`merge`};function Ot(e){return Dt[e.threadType??``]??`other`}function kt(e){let t=e.comments[0]?.publishedDate??null,n=t===null?NaN:Date.parse(t);return Number.isNaN(n)?ue(e):n}function At(e){let t=[];for(let n of e){let e=O(n);e.kind===`pull-request`?t.push({kind:`thread`,at:kt(n),thread:n}):e.kind===`system`&&t.push({kind:`activity`,at:kt(n),thread:n,activity:Ot(n)})}return t.sort((e,t)=>e.at-t.at||e.thread.id-t.thread.id)}function jt(e){let t=0,n=0;for(let r of e){let e=O(r).kind;(e===`line`||e===`file`)&&(t++,_e(r.status)||n++)}return{total:t,active:n}}var Mt=/@<([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})>/gi,Nt=/^[A-Za-z][\w-]*(?:\.[A-Za-z][\w-]*)+:\s+(?=\S)/;function Pt(e){return/^[A-Za-z][\w-]*(?:\.[A-Za-z][\w-]*)+$/.test(e.trim())}function Ft(e){let t=i().overview.votes;switch(e){case 10:return t.approved;case 5:return t.approvedWithSuggestions;case 0:return t.reset;case-5:return t.waitingForAuthor;case-10:return t.rejected;default:return}}var It=/^(.*?)\s*\bvoted\s+(-?\d+)\.?$/;function Lt(e){let t=e.comments[0];if(t===void 0)return``;let n=new Map(e.identities.map(e=>[e.id.toLowerCase(),e])),r=t.content.replace(Mt,(e,t)=>{let r=n.get(t.toLowerCase());return r===void 0?e:`@${r.displayName}`}).replace(/\s+/g,` `).trim().replace(Nt,``),i=t.author.displayName.trim(),a=e.threadType===`VoteUpdate`?It.exec(r):null;if(a!==null){let t=Ft(e.voteResult??Number(a[2]));if(t!==void 0){let e=(a[1]??``).trim();return e.length>0?`${e} ${t}`:i.length>0&&!Pt(i)?`${i} ${t}`:t}}return i.length===0||i===`Unknown`||Pt(i)||r.includes(i)?r:r.length===0?i:`${i}: ${r}`}function X(e){return e.vote>=10?`approved`:e.vote>0?`approved-with-suggestions`:e.vote<=-10?`rejected`:e.vote<0?`waiting-for-author`:e.hasDeclined?`declined`:`no-response`}var Rt={rejected:0,"waiting-for-author":1,approved:2,"approved-with-suggestions":3,"no-response":4,declined:5};function zt(e){let t=[...e].sort((e,t)=>Rt[X(e)]-Rt[X(t)]||e.displayName.localeCompare(t.displayName));return{required:t.filter(e=>e.isRequired),optional:t.filter(e=>!e.isRequired)}}function Bt(e){return/^\[[^\]]+\]\\(.+)$/.exec(e.displayName)?.[1]??e.displayName}var Vt={approved:`text-added`,"approved-with-suggestions":`text-added`,"waiting-for-author":`text-warning`,rejected:`text-danger`,"no-response":`text-muted`,declined:`text-muted`};function Ht({state:e}){let t=`size-3.5 ${Vt[e]}`;switch(e){case`approved`:case`approved-with-suggestions`:return(0,Y.jsx)(I,{className:t});case`waiting-for-author`:return(0,Y.jsx)(j,{className:t});case`rejected`:return(0,Y.jsx)(je,{className:t});case`declined`:return(0,Y.jsx)(Ae,{className:t});case`no-response`:return(0,Y.jsx)(Oe,{className:t})}}function Ut({reviewer:e}){let t=y(),n=X(e),r=e.isContainer===!0;return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2.5 py-1 text-[13px]`,"data-testid":`reviewer`,"data-state":n,children:[(0,Y.jsx)(`span`,{className:`mt-0.5`,children:(0,Y.jsx)(Ht,{state:n})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`truncate text-fg`,title:e.displayName,children:Bt(e)}),r&&(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 rounded-md border border-border px-1 text-[11px] leading-4 text-muted`,children:[(0,Y.jsx)(ke,{className:`size-3`}),t.overview.reviewers.group]})]}),(0,Y.jsx)(`span`,{className:`block text-xs ${Vt[n]}`,"data-testid":`reviewer-vote`,children:t.overview.reviewers.states[n]})]})]})}function Wt({pullRequest:e}){let t=y().overview.reviewers,{required:n,optional:r}=zt(e.reviewers),i=e.reviewers.filter(e=>e.vote>0).length;return(0,Y.jsx)(M,{title:t.title,testId:`reviewers`,aside:e.reviewers.length>0?t.approvedOf(i,e.reviewers.length):void 0,children:e.reviewers.length===0?(0,Y.jsx)(L,{children:t.none}):(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[n.length>0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`mb-0.5 text-xs text-muted`,children:t.required}),(0,Y.jsx)(`ul`,{"aria-label":t.requiredList,children:n.map(e=>(0,Y.jsx)(Ut,{reviewer:e},e.id))})]}),r.length>0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`mb-0.5 text-xs text-muted`,children:t.optional}),(0,Y.jsx)(`ul`,{"aria-label":t.optionalList,children:r.map(e=>(0,Y.jsx)(Ut,{reviewer:e},e.id))})]})]})})}var Gt={failed:`text-danger`,running:`text-accent`,pending:`text-warning`,passed:`text-added`};function Kt({state:e}){let t=`size-3.5 ${Gt[e]}`;switch(e){case`failed`:return(0,Y.jsx)(je,{className:t});case`running`:return(0,Y.jsx)(De,{className:t});case`pending`:return(0,Y.jsx)(j,{className:t});case`passed`:return(0,Y.jsx)(I,{className:t})}}function qt({check:e}){let t=y().overview.checks;return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2.5 py-1 text-[13px]`,"data-testid":`check`,"data-state":e.state,"data-blocking":e.blocking?`true`:`false`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5`,children:(0,Y.jsx)(Kt,{state:e.state})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[e.url===void 0?(0,Y.jsx)(`span`,{className:`block truncate text-fg`,title:e.name,children:e.name}):(0,Y.jsxs)(Ie,{href:e.url,className:`flex min-w-0 items-center gap-1 text-fg hover:underline`,children:[(0,Y.jsx)(`span`,{className:`truncate`,title:e.name,children:e.name}),(0,Y.jsx)(Ee,{className:`size-3 text-muted`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t.opensInNewTab})]}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:Gt[e.state],"data-testid":`check-state`,children:t.states[e.state]}),` · `,e.blocking?t.required:t.optional,e.detail!==void 0&&(0,Y.jsx)(`span`,{className:`block truncate`,title:e.detail,children:e.detail})]})]})]})}function Jt({result:e}){let t=y().overview.checks,{checks:n,pending:r,evaluationsError:i,statusesError:a}=e,o=i!==null&&a!==null,s=Ge(n),c;return c=r?(0,Y.jsx)(R,{label:t.loading}):o?(0,Y.jsx)(F,{what:t.loadFailed,error:i,onRetry:e.retry}):(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] ${s.requiredNotPassed>0?`text-fg`:`text-muted`}`,"data-testid":`checks-summary`,children:[s.required>0&&(s.requiredNotPassed===0?(0,Y.jsx)(I,{className:`size-3.5 text-added`}):(0,Y.jsx)(P,{className:`size-3.5 text-warning`})),s.text]}),n.length>0&&(0,Y.jsx)(`ul`,{"aria-label":t.list,className:`space-y-0.5`,children:n.map(e=>(0,Y.jsx)(qt,{check:e},e.id))}),(i!==null||a!==null)&&(0,Y.jsx)(Yt,{what:i===null?t.statusesFailed:t.policiesFailed,onRetry:e.retry})]}),(0,Y.jsx)(M,{title:t.title,testId:`checks`,children:c})}function Yt({what:e,onRetry:t}){let n=y();return(0,Y.jsxs)(`p`,{role:`alert`,className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,Y.jsx)(P,{className:`size-3.5 text-danger`}),e,(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`font-medium text-fg hover:underline`,children:n.overview.parts.tryAgain})]})}function Xt(e,t){let n=e.targetBranch;if(e.status===`completed`)return{text:t.completedInto(n),tone:`good`};if(e.status===`abandoned`)return{text:t.abandoned,tone:`neutral`};switch(e.mergeStatus){case`conflicts`:return{text:t.conflictsWith(n),tone:`bad`};case`queued`:return{text:t.checking,tone:`neutral`};case`succeeded`:return{text:t.noConflicts,tone:`good`};case`rejectedByPolicy`:return{text:t.rejectedByPolicy,tone:`bad`};case`failure`:return{text:t.checkFailed,tone:`bad`};default:return{text:t.notChecked,tone:`neutral`}}}function Zt({pullRequest:e,children:t}){let n=y().overview.merge,r=Xt(e,n);return(0,Y.jsxs)(M,{title:n.title,testId:`merge`,children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] ${r.tone===`bad`?`text-danger`:r.tone===`good`?`text-fg`:`text-muted`}`,"data-testid":`merge-state`,children:[r.tone===`bad`?(0,Y.jsx)(P,{className:`size-3.5`}):r.tone===`good`?(0,Y.jsx)(I,{className:`size-3.5 text-added`}):(0,Y.jsx)(j,{className:`size-3.5`}),r.text]}),(0,Y.jsxs)(`p`,{className:`mt-1 truncate pl-[22px] font-mono text-xs text-muted`,title:`${e.sourceBranch} → ${e.targetBranch}`,children:[e.sourceBranch,` → `,e.targetBranch]}),t!==void 0&&(0,Y.jsx)(`div`,{className:`mt-2.5`,children:t})]})}function Qt(e,t,n){return`https://dev.azure.com/${encodeURIComponent(e)}/${encodeURIComponent(t)}/_workitems/edit/${n}`}function $t({organization:e,project:t,query:n}){let r=y().overview.workItems,i;if(n.isPending)i=(0,Y.jsx)(R,{label:r.loading,lines:2});else if(n.data===void 0)i=(0,Y.jsx)(F,{what:r.loadFailed,error:n.error,onRetry:()=>void n.refetch()});else if(n.data.ids.length===0)i=(0,Y.jsx)(L,{children:r.none});else{let{ids:a,details:o,detailsProblem:s}=n.data;i=(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`ul`,{"aria-label":r.list,className:`space-y-1`,children:a.map(n=>{let i=o?.get(n);return(0,Y.jsxs)(`li`,{className:`text-[13px]`,"data-testid":`work-item`,children:[(0,Y.jsxs)(Ie,{href:Qt(e,t,n),className:`group flex min-w-0 items-baseline gap-1.5 text-fg`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted group-hover:text-fg`,children:[`#`,n]}),i!==void 0&&(0,Y.jsx)(`span`,{className:`min-w-0 truncate group-hover:underline`,title:i.title,children:i.title.length>0?i.title:r.untitled})]}),i!==void 0&&(0,Y.jsx)(`span`,{className:`block text-xs text-muted`,children:[i.type,i.state].filter(e=>e.length>0).join(` · `)})]},n)})}),o===null&&(0,Y.jsx)(`p`,{className:`text-xs text-muted`,"data-testid":`work-items-restricted`,children:s===`access`?r.titlesNoAccess:r.titlesMissing})]})}return(0,Y.jsx)(M,{title:r.title,testId:`work-items`,aside:n.data!==void 0&&n.data.ids.length>0?String(n.data.ids.length):void 0,children:i})}function en({labels:e}){let t=y();return e.length===0?null:(0,Y.jsx)(M,{title:t.overview.labels.title,testId:`labels`,children:(0,Y.jsx)(`ul`,{"aria-label":t.overview.labels.title,className:`flex flex-wrap gap-1`,children:e.map(e=>(0,Y.jsx)(`li`,{className:`rounded-full bg-raised px-2.5 text-xs leading-6 text-fg shadow-[0_0_0_1px_var(--azd-border)]`,children:e},e))})})}function tn({section:e}){let t=y(),{location:r,pullRequest:i}=V();return(0,Y.jsx)(n,{sidebarLabel:t.overview.sidebarLabel,sidebar:(0,Y.jsx)(qe,{location:r}),topBar:(0,Y.jsx)(Ke,{mode:`overview`}),children:(0,Y.jsx)(an,{section:e},`${i.repository.id}:${i.pullRequestId}`)})}var nn=[],rn=()=>null;function an({section:e}){let t=y(),{location:n,shortForm:r,pullRequest:i,scope:a}=V(),o=(0,H.useMemo)(()=>He.threads(a),[a]),s=de({scope:a,comparison:null,repositoryName:i.repository.name,files:nn,lineText:rn,threadsKey:o}),c=Je(a),l=Be(a),u=ze(a),d=(0,H.useMemo)(()=>u.data===void 0?null:At(u.data).filter(e=>e.kind===`thread`).length,[u.data]);return(0,Y.jsx)(ce,{controller:s,children:(0,Y.jsx)(`div`,{className:`azd-scrollbar min-h-0 flex-1 overflow-auto`,"data-testid":`overview`,children:(0,Y.jsxs)(`div`,{className:`mx-auto grid w-full max-w-[1240px] gap-x-12 gap-y-10 px-8 pt-10 pb-20 xl:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[820px] min-w-0`,children:[(0,Y.jsx)(on,{pullRequest:i}),(0,Y.jsx)(bt,{}),(0,Y.jsx)(cn,{location:n,shortForm:r,section:e,discussionCount:d}),(0,Y.jsxs)(`div`,{className:`mt-5`,children:[e===`description`&&(0,Y.jsx)(dn,{pullRequest:i}),e===`discussion`&&(0,Y.jsx)(fn,{scope:a,review:s,location:n,shortForm:r}),e===`commits`&&(0,Y.jsx)(Pe,{location:n,shortForm:r,scope:a})]}),(0,Y.jsx)(hn,{})]}),(0,Y.jsxs)(`aside`,{"aria-label":t.overview.details,className:`min-w-0 space-y-7`,children:[(0,Y.jsx)(Wt,{pullRequest:i}),(0,Y.jsx)(Jt,{result:c}),(0,Y.jsx)(Zt,{pullRequest:i,children:(0,Y.jsx)(Ue,{})}),(0,Y.jsx)($t,{organization:n.organization,project:n.project,query:l}),(0,Y.jsx)(en,{labels:i.labels})]})]})})})}function on({pullRequest:e}){let t=y().overview.header,n=We(e),{counts:r,scope:i}=V(),a=B(e.supportsIterations?i:null).data?.at(-1)?.id,o=a===void 0?void 0:we(Te({...i,iteration:a}));return(0,Y.jsxs)(`header`,{className:`space-y-3.5`,children:[(0,Y.jsxs)(`h1`,{className:`text-[28px] leading-[1.2] font-semibold tracking-[-0.02em] text-fg-strong [text-wrap:balance]`,children:[e.title,` `,(0,Y.jsxs)(`span`,{className:`font-normal text-muted tabular-nums`,children:[`#`,e.pullRequestId]})]}),(0,Y.jsxs)(`dl`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-[13px] text-muted`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:t.status}),(0,Y.jsxs)(`dd`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full bg-raised px-2.5 font-medium shadow-[0_0_0_1px_var(--azd-border)] ${Le[n]}`,children:[(0,Y.jsx)(Re,{status:n,className:`size-3.5`}),(0,Y.jsx)(`span`,{"data-testid":`pull-request-status`,children:Ve[n]})]})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:t.author}),(0,Y.jsxs)(`dd`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(re,{name:e.author.displayName,size:`sm`}),(0,Y.jsx)(`span`,{className:`text-fg`,children:e.author.displayName})]})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:t.createdLabel}),(0,Y.jsx)(`dd`,{children:t.created((0,Y.jsx)(`time`,{dateTime:e.creationDate,title:N(e.creationDate),children:A(e.creationDate)}))})]}),r.files!==null&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:t.filesChangedLabel}),(0,Y.jsxs)(`dd`,{className:`flex items-baseline gap-2 tabular-nums`,children:[t.fileCount(r.files),o!==void 0&&(0,Y.jsx)(oe,{additions:o.additions,deletions:o.deletions})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,"data-testid":`pull-request-branches`,children:[e.sourceBranch,` → `,e.targetBranch]}),(0,Y.jsx)(sn,{name:e.targetBranch,label:t.targetBranch}),(0,Y.jsx)(te,{className:`size-3.5 text-muted`}),(0,Y.jsx)(sn,{name:e.sourceBranch,label:t.sourceBranch,copy:!0})]})]})}function Z(){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted/60`,children:`·`})}function sn({name:e,label:t,copy:n=!1}){let r=y().overview.header,[i,a]=(0,H.useState)(!1);return(0,Y.jsxs)(`span`,{className:`inline-flex h-7 max-w-full min-w-0 items-center gap-1 rounded-[7px] border border-border bg-surface pr-1 pl-2.5 font-mono text-xs text-fg`,title:`${t}: ${e}`,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n?(0,Y.jsx)(`button`,{type:`button`,"aria-label":i?r.copied:r.copyBranchName(e),title:r.copyBranchTitle,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a(!0),window.setTimeout(()=>a(!1),1200)},()=>a(!1))},className:`inline-flex size-5 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:i?(0,Y.jsx)(`span`,{className:`text-[10px]`,children:`✓`}):(0,Y.jsx)(o,{className:`size-3.5`})}):(0,Y.jsx)(`span`,{className:`w-1.5`})]})}var Q=`inline-flex h-8 items-center gap-1.5 rounded-[6px] px-3 text-[13px] font-medium text-muted transition-colors hover:text-fg aria-[current=page]:bg-[var(--azd-selected)] aria-[current=page]:text-fg aria-[current=page]:shadow-[0_0_0_1px_var(--azd-border)]`;function cn({location:e,shortForm:t,section:n,discussionCount:r}){let{counts:i}=V(),a=y().overview.tabs;return(0,Y.jsxs)(`nav`,{"aria-label":a.label,className:`mt-7 inline-flex items-center gap-0.5 rounded-[8px] bg-raised p-0.5`,children:[(0,Y.jsx)(z,{location:e,shortForm:t,page:{tab:`overview`},current:n===`description`,className:Q,testId:`tab-description`,children:a.description}),(0,Y.jsxs)(z,{location:e,shortForm:t,page:{tab:`discussion`},current:n===`discussion`,className:Q,testId:`tab-discussion`,children:[a.discussion,r!==null&&r>0&&(0,Y.jsxs)(`span`,{className:`font-normal tabular-nums text-muted`,children:[r,(0,Y.jsx)(`span`,{className:`sr-only`,children:a.threadsSuffix})]})]}),(0,Y.jsxs)(z,{location:e,shortForm:t,page:{tab:`commits`},current:n===`commits`,className:Q,testId:`tab-commits`,children:[a.commits,i.commits!==null&&(0,Y.jsxs)(`span`,{className:`font-normal tabular-nums text-muted`,children:[i.commits,(0,Y.jsx)(`span`,{className:`sr-only`,children:a.commitsSuffix})]})]})]})}var ln=1500,un=30;function dn({pullRequest:e}){let t=y().overview.description,n=e.description.trim(),r=n.length>ln||n.split(`
2
+ `).length>un,[i,a]=(0,H.useState)(!1),o=r&&!i;return(0,Y.jsx)(`section`,{"aria-label":t.label,"data-testid":`description`,children:n.length===0?(0,Y.jsx)(`p`,{className:`text-[14px] text-muted`,children:t.none}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{id:`overview-description-body`,className:`text-[14px] leading-[1.65] text-fg ${o?`relative max-h-96 overflow-hidden`:``}`,children:[(0,Y.jsx)(k,{source:e.description}),o&&(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-[var(--azd-canvas)] to-transparent`})]}),r&&(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":`overview-description-body`,onClick:()=>a(e=>!e),className:`mt-2 text-[13px] font-medium text-muted hover:text-fg`,children:i?t.showLess:t.showFull})]})})}function fn({scope:e,review:t,location:n,shortForm:r}){let i=y().overview.discussion,a=ze(e),[o,s]=(0,H.useState)(!0),c=(0,H.useMemo)(()=>At(a.data??[]),[a.data]),l=(0,H.useMemo)(()=>jt(a.data??[]),[a.data]),u=o?c:c.filter(e=>e.kind===`thread`),d=c.length-c.filter(e=>e.kind===`thread`).length,f;return f=a.isPending?(0,Y.jsx)(R,{label:i.loading}):a.data===void 0?(0,Y.jsx)(F,{what:i.loadFailed,error:a.error,onRetry:()=>void a.refetch()}):(0,Y.jsxs)(Y.Fragment,{children:[u.length===0?(0,Y.jsx)(L,{children:c.length===0?i.empty:i.emptyActivityHidden}):(0,Y.jsx)(`ol`,{id:`overview-timeline`,"aria-label":i.timeline,className:`space-y-2.5`,"data-testid":`timeline`,children:u.map(e=>(0,Y.jsx)(pn,{entry:e},e.thread.id))}),l.total>0&&(0,Y.jsx)(`p`,{className:`mt-4 text-[13px] text-muted`,"data-testid":`file-comments`,children:i.fileComments(l.total,l.active,(0,Y.jsx)(z,{location:n,shortForm:r,page:{tab:`files`},className:`font-medium text-fg hover:underline`,onClick:()=>xe({commentFilter:l.active>0?`active`:`all`}),children:l.active>0?i.showActiveInFiles:i.showInFiles}))})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`overview-discussion`,"data-testid":`discussion`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,Y.jsx)(`h2`,{id:`overview-discussion`,className:`sr-only`,children:i.heading}),d>0&&(0,Y.jsx)(`button`,{type:`button`,"aria-controls":`overview-timeline`,onClick:()=>s(e=>!e),className:`ml-auto h-7 rounded-[7px] px-2 text-xs font-medium text-muted hover:bg-hover hover:text-fg`,"data-testid":`activity-toggle`,"data-showing":o?`true`:`false`,children:i.activityToggle(o,d)})]}),f,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(mn,{review:t})})]})}function pn({entry:e}){let t=y();if(e.kind===`thread`)return(0,Y.jsx)(`li`,{"data-testid":`timeline-thread`,children:(0,Y.jsx)(be,{thread:e.thread})});let n=e.thread.comments[0]?.publishedDate??e.thread.publishedDate;return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-3 px-3 text-[13px] text-muted`,"data-testid":`activity`,"data-activity":e.activity,children:[(0,Y.jsx)(`span`,{className:`w-20 shrink-0 text-xs text-muted`,children:t.overview.activity[e.activity]}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-fg/90`,children:Lt(e.thread)}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs tabular-nums`,dateTime:n??void 0,title:N(n),children:A(n)})]})}function mn({review:e}){let t=y().overview.composer,n=le,[r,i]=(0,H.useState)(!1),a=E(e.store,e=>e.busy.has(n)),o=E(e.store,e=>e.errors.get(n)),s=E(e.store,e=>e.focus===n),c=(0,H.useRef)(null),l=e.drafts.read(n).length>0;return a||!r&&!l&&o===void 0?(0,Y.jsx)(`button`,{ref:c,type:`button`,disabled:a,onClick:()=>{i(!0),e.store.update(()=>({focus:n}))},className:`flex h-10 w-full items-center rounded-[10px] border border-border bg-surface px-3.5 text-left text-[13px] text-muted hover:border-border-strong hover:text-fg disabled:opacity-60`,"data-testid":`pull-request-comment-opener`,children:a?t.sending:t.opener}):(0,Y.jsx)(fe,{drafts:e.drafts,draftKey:n,label:t.label,submitLabel:t.submit,busy:a,autoFocus:s,onFocused:()=>e.store.update(()=>({focus:null})),onSubmit:t=>{i(!1),e.commentOnPullRequest(t)},onCancel:()=>{i(!1),e.clearError(n)},returnFocus:()=>requestAnimationFrame(()=>c.current?.focus()),problem:o===void 0?null:(0,Y.jsx)(ge,{review:e,errorKey:n,error:o,organization:e.organization}),testId:`pull-request-composer`})}var $=12;function hn(){let e=y().overview.changedFiles,{location:t,shortForm:n,pullRequest:r,scope:i}=V(),a=B(r.supportsIterations?i:null).data?.at(-1),o=(0,H.useMemo)(()=>a===void 0?null:{iteration:a,since:null},[a]),s=Fe(r.supportsIterations?i:null,o).data?.files;return(0,Y.jsxs)(`section`,{"aria-labelledby":`overview-files`,className:`mt-12 border-t border-border pt-6`,"data-testid":`changed-files`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`h2`,{id:`overview-files`,className:`text-[18px] font-semibold tracking-[-0.01em] text-fg-strong`,children:s===void 0?e.heading:e.count(s.length)}),(0,Y.jsx)(z,{location:t,shortForm:n,page:{tab:`files`},className:`${se} ml-auto`,testId:`review-changes`,children:e.review})]}),s!==void 0&&s.length>0&&(0,Y.jsxs)(`ul`,{className:`mt-4 overflow-hidden rounded-[10px] border border-border bg-surface`,children:[s.slice(0,$).map(e=>(0,Y.jsx)(_n,{file:e},e.path)),s.length>$&&(0,Y.jsx)(`li`,{className:`border-t border-border px-3.5 py-2 text-[13px] text-muted`,children:e.more(s.length-$)})]})]})}var gn={added:`text-added`,modified:`text-modified`,deleted:`text-deleted`,renamed:`text-renamed`};function _n({file:e}){let t=e.path.lastIndexOf(`/`),n=e.path.slice(t+1),r=t===-1?``:e.path.slice(0,t);return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2.5 border-t border-border px-3.5 py-2 text-[13px] first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:gn[e.change],title:Se[e.change],children:[(0,Y.jsx)(c,{change:e.change}),(0,Y.jsx)(`span`,{className:`sr-only`,children:Se[e.change]})]}),(0,Y.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:n}),r.length>0&&(0,Y.jsx)(`span`,{className:`ml-2 text-muted`,children:r})]})]})}export{tn as t};
@@ -0,0 +1,35 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-DfsS1UI1.js","assets/rolldown-runtime-BLXQ4ufn.js","assets/lib-C2gVWm_O.js","assets/lib-rf_jxHx0.js","assets/highlights-C-SBVYal.js","assets/stream-tokenizer-CKeNSKPz.js","assets/lineChanges-Dw4ZXwVU.js","assets/shiki-mTy6Inae.js","assets/utils-Tkdy0sOA.js","assets/index-DsrXp1aY.js","assets/index-CjZUV4-4.css","assets/grammars-B3laSCck.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-BLXQ4ufn.js";import{$ as n,$t as r,An as i,At as a,Bn as o,Bt as s,C as c,Cr as l,Dn as u,E as d,Et as f,Fn as p,Hn as m,Ht as h,In as g,It as _,Jt as v,Kn as y,Kt as b,L as x,Ln as S,Lt as C,Mn as w,Mt as T,N as E,Nn as ee,On as D,P as O,Pn as k,Qt as te,Rn as ne,Rt as re,S as ie,Sr as ae,T as oe,U as se,Un as A,Ut as ce,V as le,Vn as ue,Vt as de,W as fe,Wt as pe,X as me,Xt as he,Yt as ge,Zt as _e,_n as ve,_t as ye,bn as be,br as xe,dt as Se,fn as j,gt as Ce,ht as M,jn as we,jt as N,k as Te,kn as P,mn as Ee,mt as F,p as De,qt as Oe,rr as ke,st as Ae,tr as je,ut as Me,vt as Ne,w as Pe,x as Fe,xr as Ie,xt as Le,yn as Re,yt as ze,zn as Be,zt as Ve}from"./index-DsrXp1aY.js";import{n as He,t as Ue}from"./inbox-D8-BBgQT.js";var I=e(l(),1),L,We=0,Ge=class extends Error{constructor(){super(`Highlighter is disposed`),this.name=`HighlighterDisposedError`}};function Ke(){return L}function R(e){return e??L??`shiki-js`}function qe(e){if(L!=null&&L!==e)throw Error(`Cannot load the "${e}" highlighter while "${L}" is in use. Only one highlighter type can be active at a time; dispose every "${L}" instance (disposeHighlighter() disposes the shared one) before switching.`)}function Je(e){qe(e),L=e,We++}function Ye(){We--,We===0&&(L=void 0)}var Xe=new Map,Ze=new Map,Qe=new Map,$e=new Map,et=new Map,tt=new Set;function z(e=je){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function nt(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}function rt(e){let t;return()=>t??=e().then(e=>(t=e,e),e=>{throw t=void 0,e})}function it(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var at=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},ot=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},st=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function ct(e={}){let t=new Map,n=new Map,r=new Map,i=0;function a(e,n){if(t.has(e))throw new at(e);t.set(e,n)}function o(e,n){return!t.has(e)&&(t.set(e,n),!0)}function s(e){return t.has(e)}function c(a){let o=n.get(a);if(o!==void 0)return Promise.resolve(o);let s=r.get(a);if(s!==void 0)return s;let c=t.get(a);if(c===void 0&&e.fallbackLoader===void 0)return Promise.reject(new ot(a));let l=i,u=Promise.resolve().then(()=>c===void 0?e.fallbackLoader?.(a):c()).then(async t=>{if(t===void 0)throw new ot(a);let o=it(t),s=e.normalizeTheme===void 0?o:await e.normalizeTheme(o,a);return l===i&&n.set(a,s),r.get(a)===u&&r.delete(a),s}).catch(e=>{throw r.get(a)===u&&r.delete(a),e});return r.set(a,u),u}function l(e){return Promise.all(e.map(e=>c(e)))}function u(e,t){n.set(e,t)}function d(e){for(let[t,n]of e)u(t,n)}function f(e){return n.get(e)}function p(e){let t=[];for(let r of e){let e=n.get(r);if(e===void 0)throw new st(r);t.push(e)}return t}function m(e){return n.has(e)}function h(e){for(let t of e)if(!n.has(t))return!1;return!0}function g(e){let t=n.get(e);return t===void 0?c(e):t}function _(){i++,n.clear(),r.clear()}return{clearResolvedThemes:_,getResolvedOrResolveTheme:g,getResolvedTheme:f,getResolvedThemes:p,hasRegisteredTheme:s,hasResolvedTheme:m,hasResolvedThemes:h,registerTheme:a,registerThemeIfAbsent:o,resolveTheme:c,resolveThemes:l,seedResolvedTheme:u,seedResolvedThemes:d}}var lt=new Map,ut=new Map,dt=rt(()=>y(()=>import(`./loader-BljfpPoZ.js`),[])),ft=rt(()=>y(()=>import(`./themes-SQq_asFq.js`),[])),pt=rt(()=>y(()=>import(`./core-DfsS1UI1.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3]))),mt=[[`editor.lineHighlightBackground`,`editor.active_line.background`],[`editor.selectionBackground`,`element.selected`],[`editor.findMatchHighlightBackground`,`search.match_background`],[`editorBracketMatch.background`,`editor.document_highlight.bracket_background`],[`editorError.foreground`,`error`],[`editorWarning.foreground`,`warning`],[`editorInfo.foreground`,`info`],[`editorHint.foreground`,`hint`],[`gitDecoration.addedResourceForeground`,`created`,`terminal.ansi.green`],[`gitDecoration.deletedResourceForeground`,`deleted`,`terminal.ansi.red`],[`gitDecoration.modifiedResourceForeground`,`modified`,`terminal.ansi.blue`]];function ht(e,t){let n=`themes`in t?t.themes[0]:t;if(n==null)throw Error(`Theme "${e}" is an empty Zed theme family.`);let r={...n,name:e},i={};for(let[e,t]of Object.entries(r.style))typeof t==`string`&&(i[e]=t);let a=r.style.players?.[0];a?.cursor!=null&&(i[`editorCursor.foreground`]??=a.cursor),a?.selection!=null&&(i[`editor.selectionBackground`]??=a.selection);for(let[e,...t]of mt){if(i[e]!=null)continue;let n=t.find(e=>i[e]!=null);n!=null&&(i[e]=i[n])}if(r.cssVariables===!0)i[`editor.foreground`]=`var(--hls-foreground)`,i[`editor.background`]=`var(--hls-background)`;else if(typeof r.cssVariables==`object`){i[`editor.foreground`]??=i.text??i.foreground??`foreground`,i[`editor.background`]??=i.background??`background`;let{prefix:e=`--hls-`,defaults:t}=r.cssVariables;for(let[n,r]of Object.entries(i)){let a=t?.[r];i[n]=`var(${e}${r}${a?`, ${a}`:``})`}}let o=r.appearance===`light`?`light`:`dark`;return{name:e,type:o,colors:i,zed:r,fg:i[`editor.foreground`]??i.text??i.foreground??(o===`light`?`#333333`:`#bbbbbb`),bg:i[`editor.background`]??i.background??(o===`light`?`#ffffff`:`#1e1e1e`)}}function gt(e){let t=ut.get(e);return t??(t=ct({fallbackLoader:async t=>{if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:nt())throw Error(`Theme "${t}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);let n=lt.get(t);if(e===`highlights`){let e=n?.zed??n?.diffs;if(e!=null){let n=await e(),r=`default`in n?n.default:n;if(`zed`in r&&r.zed!=null)return r;if(`style`in r||`themes`in r)return ht(t,r);throw Error(`Theme "${t}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`)}let r=dt(),{themes:i}=r instanceof Promise?await r:r,a=i[t];if(a!=null)return ht(t,(await a()).default);if(n?.textmate!=null)throw Error(`Theme "${t}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`)}else{let e=n?.textmate??n?.diffs,r;if(e!=null){let t=await e();r=`default`in t?t.default:t}else{let e=ft(),{themes:i}=e instanceof Promise?await e:e,a=i.getTheme(t);if(a==null&&n?.zed!=null)throw Error(`Theme "${t}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);if(a==null)throw Error(`No valid theme loader registered for "${t}"`);let o=await a.load();r=`default`in o?o.default:o}if(`style`in r||`themes`in r)throw Error(`Theme "${t}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);let i=pt(),{normalizeTheme:a,createCssVariablesTheme:o}=i instanceof Promise?await i:i;if(`cssVariables`in r&&r.cssVariables!=null)return{...r,textmate:a(o(r.cssVariables))};if(`textmate`in r&&r.textmate!=null)return{...r,textmate:a(r.textmate)};let s=a(r);return{name:s.name,type:s.type,fg:s.fg,bg:s.bg,colors:s.colors,textmate:s}}throw Error(`No valid theme loader registered for "${t}"`)},normalizeTheme:(e,t)=>{if(e.name!==t)throw Error(`resolvedTheme: themeName: ${t} does not match theme.name: ${e.name}`);return e}}),ut.set(e,t)),t}function _t(e,t=R()){return typeof t!=`string`&&t.isDisposed?!1:(typeof t==`string`?gt(t):t.themeResolver).hasResolvedThemes(z(e))}var B;async function vt(e){let t=R(e);Je(t);try{if(t===`highlights`){let{HighlightsHighlighter:e}=await y(async()=>{let{HighlightsHighlighter:e}=await import(`./highlights-C-SBVYal.js`);return{HighlightsHighlighter:e}},__vite__mapDeps([4,5,6,2,3,1]));return new e}let{ShikiHighlighter:e}=await y(async()=>{let{ShikiHighlighter:e}=await import(`./shiki-mTy6Inae.js`);return{ShikiHighlighter:e}},__vite__mapDeps([7,5,6,2,3,1,8,0,9,10]));return await e.create(t)}finally{Ye()}}async function yt({themes:e,langs:t,preferredHighlighter:n}){bt();let r=B??=vt(Ke()??n),i;try{i=await r}catch(e){throw B===r&&(B=void 0),e}if(B===r&&(B=i),await Promise.all([i.themeResolver.resolveThemes(e),i.loadLanguages(t)]),i.isDisposed)throw new Ge;return i}function bt(){B!=null&&!(`then`in B)&&B.isDisposed&&(B=void 0)}function V({theme:e,lang:t,langs:n}={}){bt();let r=B;if(!(r==null||`then`in r||e!=null&&!_t(e,r)||(t!=null||n!=null)&&!r.hasLoadedLanguages([...t==null?[]:[t],...n??[]])))return r}async function xt(e){await yt(e)}function H(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var St=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Ct=/^0(?:\.0+)?%?$/;function wt(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Tt(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Et(e){if(e==null)return null;let t=Tt(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Dt(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||St.test(t))return!0;let n=wt(t);return n!=null&&Ct.test(n)}function Ot(e,t,n){if(t==null||n==null)return!1;let r=Et(e),i=Et(t),a=Et(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var kt=new WeakMap;function At(e){let t=kt.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;U(r,`editor.background`,i),U(r,`editor.foreground`,a),U(r,`sideBar.background`,o),U(r,`sideBar.foreground`,s),U(r,`input.background`,n[`input.background`]??o),U(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),U(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),U(r,`gitDecoration.addedResourceForeground`,jt(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),U(r,`gitDecoration.modifiedResourceForeground`,jt(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),U(r,`gitDecoration.deletedResourceForeground`,jt(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Dt(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Dt(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Mt(l,o)||Ot(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return kt.set(e,u),u}function U(e,t,n){n!=null&&n!==``&&(e[t]=n)}function jt(...e){for(let t of e)if(t!=null&&t!==``)return t}function Mt(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Nt({theme:e=je,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Pt(i,t);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${H(`global`)}fg:${a.fg};`,r+=`${H(`global`)}bg:${a.bg};`,r+=Ft(i,n),r+=It(i)}else{let n=t.getTheme(e.dark),i=Pt(n,t);r+=`${H(`global`)}dark:${i.fg};`,r+=`${H(`global`)}dark-bg:${i.bg};`,r+=Ft(n,`dark`),r+=It(n,`dark`),n=t.getTheme(e.light),i=Pt(n,t),r+=`${H(`global`)}light:${i.fg};`,r+=`${H(`global`)}light-bg:${i.bg};`,r+=Ft(n,`light`),r+=It(n,`light`)}return r}function Pt(e,t){if(t.name===`highlights`&&e.zed?.cssVariables===!0){let e=H(`token`);return{fg:`var(${e}foreground)`,bg:`var(${e}background)`}}return At(e)}function Ft(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${H(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${H(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${H(`global`)}${t}modified-color:${a};`),n}function It(e,t){t=t==null?``:`${t}-`;let n=H(`global`),r=e.colors,i=``,a=r?.[`editor.findMatchHighlightBackground`],o=r?.[`editor.findMatchHighlightForeground`];a!=null&&o!=null&&(i+=`${n}${t}bg-search-match-theme:${a};`,i+=`${n}${t}fg-search-match-theme:${o};`);let s=r?.[`editor.findMatchBackground`],c=r?.[`editor.findMatchForeground`];return s!=null&&c!=null&&(i+=`${n}${t}bg-search-match-current-theme:${s};`,i+=`${n}${t}fg-search-match-current-theme:${c};`),i}function Lt(e,t){return e-(t===0?0:1)}function Rt(e,t){return Lt(e,t)+t}function zt(e){return{type:`text`,value:e}}function W({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Bt({name:e,width:t=16,height:n=16,properties:r}){return W({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[W({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Vt(e){return W({tagName:`div`,properties:{"data-gutter":``},children:e})}function Ht(e,t,n,r={}){return W({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[W({tagName:`span`,properties:{"data-line-number-content":``},children:[zt(`${t}`)]})]})}function Ut(e,t,n){return W({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Wt(e){return W({tagName:`div`,children:e.map(([e,t,n])=>e===0&&t===``?n===``?W({tagName:`br`}):zt(n):W({tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[zt(n)]}))})}function Gt(e){return W({tagName:`div`,children:e===``?[W({tagName:`br`})]:[W({tagName:`span`,properties:{"data-char":0},children:[zt(e)]})]})}function Kt(e,t){let n=t===`additions`?e.additionLines:e.deletionLines;if(n.length===0)return!1;if(e.isPartial){let n=e.hunks.at(-1);return n!=null&&!(t===`additions`?n.noEOFCRAdditions:n.noEOFCRDeletions)}return n.at(-1)?.endsWith(`
3
+ `)===!0}function qt(e){return{...ke,...e}}function Jt(e,t){return Yt(e,t)+Xt(e,t)}function Yt(e,t){return t?0:e.diffHeaderHeight}function Xt(e,t){return e.paddingTop??(t?e.spacing:0)}function Zt(e){return e.paddingBottom??e.spacing}function Qt(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function $t(e){return[Lt(e.additionStart,e.additionCount)+1,Rt(e.additionStart,e.additionCount)+1]}function en(e){return[Lt(e.deletionStart,e.deletionCount)+1,Rt(e.deletionStart,e.deletionCount)+1]}function tn(e,t){return t===`additions`?$t(e):en(e)}function nn(e,t,n){let r={fromStart:e?.fromStart??0,fromEnd:e?.fromEnd??0};return(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),r}function rn({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function an({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Rt(n.additionStart,n.additionCount),i=e.deletionLines.length-Rt(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function on({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=an({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function sn({fileDiff:e,lineNumber:t,side:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return!1;for(let[a,o]of e.hunks.entries()){let[s,c]=tn(o,n);if(t<s){let n=rn({isPartial:e.isPartial,rangeSize:o.collapsedBefore,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:i}),c=s-n.rangeSize;return!n.renderAll&&t>=c+n.fromStart&&t<s-n.fromEnd}if(t<c)return!1}let a=on({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`isDiffLineInCollapsedContext`});if(a==null||a.renderAll)return!1;let[,o]=tn(e.hunks[e.hunks.length-1],n);return t>=o+a.fromStart&&t<o+a.rangeSize}function cn({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=$t(n),l=rn({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=on({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t)}else for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function ln({type:e,metrics:t}){return t.hunkSeparatorHeight??Qt(e)}function un({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function dn({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function fn(e){return e!==`simple`&&e!==`metadata`}function pn({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!dn({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=ln({type:e,metrics:t}),a=un({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function mn({type:e,metrics:t}){if(!fn(e))return;let n=ln({type:e,metrics:t}),r=un({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function G(e){throw Error(`DiffRowCursor: row has no ${e} line`)}var hn=0,gn=1,_n=2,vn=3,yn=4,bn=5,xn=6,Sn=7,Cn=class{diff;diffStyle;expandedHunks;collapsedContextThreshold;includeTrailingNewline;startingLine;windowEnd;unifiedCount=0;splitCount=0;rowType=`context`;rowHunkIndex=0;rowHunk=void 0;rowHasDeletion=!1;rowHasAddition=!1;index=-1;end=0;secondStretchFirst=0;secondStretchEnd=0;deletionIndexStart=0;deletionNumberStart=0;deletionUnifiedStart=0;additionIndexStart=0;additionNumberStart=0;additionUnifiedStart=0;splitStart=0;firstRowCollapsedBefore=0;collapsedAfterValue=0;collapsedAfterRow=-1;deletionNoEOFCRRow=-1;additionNoEOFCRRow=-1;part=hn;walkHunkIndex=0;walkHunk=void 0;contentIndex=0;pendingCollapsed=0;leadingStartRows=0;leadingEndRows=0;leadingRangeSize=0;trailingRows=-1;trailingCollapsed=0;unifiedAt=0;splitAt=0;deletionIndexAt=0;additionIndexAt=0;deletionNumberAt=0;additionNumberAt=0;collapsedAfterAt=-1;constructor({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,includeTrailingNewline:o=!1}){this.diff=e,this.diffStyle=t,this.startingLine=n,this.windowEnd=n+r,this.expandedHunks=i,this.collapsedContextThreshold=a,this.includeTrailingNewline=o,r===0?this.part=Sn:n>0&&this.findStartingHunk()}next(){let{index:e,end:t}=this,n=e+1;return n<t?(this.index=n,!0):this.nextRun()}get type(){return this.rowType}get hunkIndex(){return this.rowHunkIndex}get hunk(){return this.rowHunk}get hasDeletion(){return this.rowHasDeletion}get hasAddition(){return this.rowHasAddition}get deletionLineIndex(){let{rowHasDeletion:e,deletionIndexStart:t,index:n}=this;return e||G(`deletion`),t+n}get deletionLineNumber(){let{rowHasDeletion:e,deletionNumberStart:t,index:n}=this;return e||G(`deletion`),t+n}get deletionUnifiedLineIndex(){let{rowHasDeletion:e,deletionUnifiedStart:t,index:n}=this;return e||G(`deletion`),t+n}get deletionNoEOFCR(){let{rowHasDeletion:e,deletionNoEOFCRRow:t,index:n}=this;return e||G(`deletion`),n===t}get additionLineIndex(){let{rowHasAddition:e,additionIndexStart:t,index:n}=this;return e||G(`addition`),t+n}get additionLineNumber(){let{rowHasAddition:e,additionNumberStart:t,index:n}=this;return e||G(`addition`),t+n}get additionUnifiedLineIndex(){let{rowHasAddition:e,additionUnifiedStart:t,index:n}=this;return e||G(`addition`),t+n}get additionNoEOFCR(){let{rowHasAddition:e,additionNoEOFCRRow:t,index:n}=this;return e||G(`addition`),n===t}get unifiedLineIndex(){let{rowHasAddition:e,additionUnifiedStart:t,deletionUnifiedStart:n,index:r}=this;return(e?t:n)+r}get splitLineIndex(){let{splitStart:e,index:t}=this;return e+t}get collapsedBefore(){let{index:e,firstRowCollapsedBefore:t}=this;return e===0?t:0}get collapsedAfter(){let{index:e,collapsedAfterRow:t,collapsedAfterValue:n}=this;return e===t?n:0}findStartingHunk(){let{diff:e,diffStyle:t,startingLine:n}=this,r=e.hunks.length-1,i=0;for(let a of e.hunks){let e=this.getLeadingRegion(a,i),o=e.fromStart+e.fromEnd;if(i===r){let e=this.getTrailingRegion();o+=(e?.fromStart??0)+(e?.fromEnd??0),this.hasTrailingNewlineRow(e?.collapsedLines??0)&&o++}let s=o+a.unifiedLineCount,c=o+a.splitLineCount,{unifiedCount:l,splitCount:u}=this;if((t===`split`?u+c:l+s)>n)break;this.unifiedCount+=s,this.splitCount+=c,i++}this.walkHunkIndex=i}getLeadingRegion(e,t){let{diff:n,expandedHunks:r,collapsedContextThreshold:i}=this;return rn({isPartial:n.isPartial,rangeSize:e.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i})}getTrailingRegion(){let{diff:e,expandedHunks:t,collapsedContextThreshold:n}=this;return on({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`DiffRowCursor`})}hasTrailingNewlineRow(e){let{diff:t,includeTrailingNewline:n}=this;return n&&e===0&&Kt(t,`additions`)}clipRun(e,t,n,r){let{diffStyle:i,startingLine:a,windowEnd:o}=this;if(a===0&&o===1/0)return this.index=0,this.end=e,e>0;if(i!==`both`){let r=i===`unified`?t:n;return this.index=Math.max(0,a-r),this.end=Math.min(e,o-r),this.index<this.end}let s=Math.max(0,a-t),c=Math.min(e,o-t),l=Math.max(0,a-n),u=Math.min(e,o-n),d=0,f=0;if(l<u&&(s<c?l<=c?c=Math.max(c,u):(d=l,f=u):(s=l,c=u)),r!=null){let t=Math.max(0,a-r),n=Math.min(e,o-r);t<n&&(s<c?n>=s?s=t:(d=s,f=c,s=t,c=n):(s=t,c=n))}return s>=c?!1:(this.index=s,this.end=c,d<f&&(this.secondStretchFirst=d,this.secondStretchEnd=f),!0)}isPastWindow(){let{diffStyle:e,unifiedCount:t,splitCount:n,windowEnd:r}=this;return e===`unified`?t>=r:(e===`split`||t>=r)&&n>=r}nextRun(){let{diff:e,secondStretchFirst:t,secondStretchEnd:n}=this;if(t<n)return this.index=t,this.end=n,this.secondStretchFirst=0,this.secondStretchEnd=0,!0;for(;;){if(this.part===Sn||this.isPastWindow())return this.part=Sn,!1;switch(this.part){case hn:{let t=e.hunks[this.walkHunkIndex];if(t==null)return this.part=Sn,!1;this.enterHunk(t),this.part=gn;break}case gn:if(this.part=_n,this.leadingStartRows>0&&this.startExpandedRun(this.leadingStartRows,this.leadingRangeSize,0))return!0;break;case _n:if(this.part=vn,this.leadingEndRows>0&&this.startExpandedRun(this.leadingEndRows,this.leadingEndRows,this.takePendingCollapsed()))return!0;this.startingLine>0&&this.skipBlocksBeforeWindow();break;case vn:{let{walkHunk:e}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);let t=e.hunkContent[this.contentIndex];if(t==null){this.part=bn;break}let n=this.contentIndex===e.hunkContent.length-1;if(t.type===`context`){if(this.contentIndex++,this.startContextRun(e,t,n))return!0;break}if(this.part=yn,this.startChangeRun(e,t,n,!1))return!0;break}case yn:{let{walkHunk:e}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);let t=e.hunkContent[this.contentIndex];if(t==null||t.type!==`change`)throw Error(`DiffRowCursor: missing change content`);let n=this.contentIndex===e.hunkContent.length-1;this.part=vn,this.contentIndex++;let r=this.startChangeRun(e,t,n,!0),{deletions:i,additions:a}=t;if(this.unifiedCount+=i+a,this.splitCount+=Math.max(i,a),this.unifiedAt+=i+a,this.splitAt+=Math.max(i,a),this.deletionIndexAt+=i,this.additionIndexAt+=a,this.deletionNumberAt+=i,this.additionNumberAt+=a,r)return!0;break}case bn:if(this.part=xn,this.trailingRows>0&&this.startTrailingRun())return!0;break;case xn:{let t=this.walkHunkIndex===e.hunks.length-1;if(this.walkHunkIndex++,this.part=hn,t&&this.hasTrailingNewlineRow(this.trailingCollapsed)&&this.startTrailingNewlineRun())return!0;break}}}}skipBlocksBeforeWindow(){let{walkHunk:e,diffStyle:t,startingLine:n,unifiedCount:r}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);for(;this.contentIndex<e.hunkContent.length;){let r=e.hunkContent[this.contentIndex],i=r.type===`context`?r.lines:r.deletions,a=r.type===`context`?r.lines:r.additions,o=r.type===`context`?r.lines:i+a,s=Math.max(i,a),{unifiedCount:c,splitCount:l}=this;if((t===`split`?l+s:c+o)>n)break;this.unifiedCount+=o,this.splitCount+=s,this.unifiedAt+=o,this.splitAt+=s,this.deletionIndexAt+=i,this.additionIndexAt+=a,this.deletionNumberAt+=i,this.additionNumberAt+=a,this.contentIndex++}this.unifiedCount>r&&(this.pendingCollapsed=0)}enterHunk(e){let{diff:t,diffStyle:n,walkHunkIndex:r}=this,i=Lt(e.deletionStart,e.deletionCount),a=Lt(e.additionStart,e.additionCount),o=this.getLeadingRegion(e,r),s=r===t.hunks.length-1?this.getTrailingRegion():void 0;this.walkHunk=e,this.contentIndex=0,this.leadingStartRows=o.fromStart,this.leadingEndRows=o.fromEnd,this.leadingRangeSize=o.rangeSize,this.pendingCollapsed=o.collapsedLines,this.trailingRows=s==null?-1:s.fromStart+s.fromEnd,this.trailingCollapsed=s?.collapsedLines??0,this.unifiedAt=e.unifiedLineStart,this.splitAt=e.splitLineStart,this.deletionIndexAt=!t.isPartial&&e.deletionCount===0?i:e.deletionLineIndex,this.additionIndexAt=!t.isPartial&&e.additionCount===0?a:e.additionLineIndex,this.deletionNumberAt=i+1,this.additionNumberAt=a+1,this.collapsedAfterAt=s!=null&&s.collapsedLines>0&&s.fromStart+s.fromEnd===0?n===`unified`?e.unifiedLineStart+e.unifiedLineCount-1:e.splitLineStart+e.splitLineCount-1:-1}takePendingCollapsed(){let{pendingCollapsed:e}=this;return this.pendingCollapsed=0,e}startExpandedRun(e,t,n){let{unifiedCount:r,splitCount:i,walkHunkIndex:a,walkHunk:o,deletionIndexAt:s,deletionNumberAt:c,additionIndexAt:l,additionNumberAt:u,unifiedAt:d,splitAt:f}=this;return this.rowType=`context-expanded`,this.rowHunkIndex=a,this.rowHunk=o,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=s-t,this.deletionNumberStart=c-t,this.deletionUnifiedStart=d-t,this.additionIndexStart=l-t,this.additionNumberStart=u-t,this.additionUnifiedStart=d-t,this.splitStart=f-t,this.firstRowCollapsedBefore=n,this.collapsedAfterRow=-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount+=e,this.splitCount+=e,this.clipRun(e,r,i)}startContextRun(e,t,n){let{lines:r}=t,{diffStyle:i,unifiedCount:a,splitCount:o,walkHunkIndex:s,deletionIndexAt:c,deletionNumberAt:l,additionIndexAt:u,additionNumberAt:d,unifiedAt:f,splitAt:p}=this,m=r>0;return m&&(this.rowType=`context`,this.rowHunkIndex=s,this.rowHunk=e,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=c,this.deletionNumberStart=l,this.deletionUnifiedStart=f,this.additionIndexStart=u,this.additionNumberStart=d,this.additionUnifiedStart=f,this.splitStart=p,this.firstRowCollapsedBefore=this.takePendingCollapsed(),this.setCollapsedAfterRow(i===`unified`?f:p),this.deletionNoEOFCRRow=n&&e.noEOFCRDeletions?r-1:-1,this.additionNoEOFCRRow=n&&e.noEOFCRAdditions?r-1:-1),this.unifiedCount+=r,this.splitCount+=r,this.unifiedAt+=r,this.splitAt+=r,this.deletionIndexAt+=r,this.additionIndexAt+=r,this.deletionNumberAt+=r,this.additionNumberAt+=r,m&&this.clipRun(r,a,o)}startChangeRun(e,t,n,r){let{deletions:i,additions:a}=t,{diffStyle:o,unifiedCount:s,splitCount:c,walkHunkIndex:l,deletionIndexAt:u,deletionNumberAt:d,additionIndexAt:f,additionNumberAt:p,unifiedAt:m,splitAt:h}=this,g=o===`unified`,_=Math.min(i,a),v=g?r?i:0:r?_:0,y=g?r?a:i:r?Math.max(i,a)-_:_;if(y<=0)return!1;let b=g?!r:!r||i>a,x=g?r:!r||a>i;this.rowType=`change`,this.rowHunkIndex=l,this.rowHunk=e,this.rowHasDeletion=b,this.rowHasAddition=x;let S=g?0:v;this.deletionIndexStart=u+S,this.deletionNumberStart=d+S,this.deletionUnifiedStart=m+S,this.additionIndexStart=f+S,this.additionNumberStart=p+S,this.additionUnifiedStart=m+i+S,this.splitStart=h+S,this.firstRowCollapsedBefore=this.takePendingCollapsed(),this.setCollapsedAfterRow(g?m+v:h+v);let C=g||r||i===a;this.deletionNoEOFCRRow=n&&b&&C&&e.noEOFCRDeletions?y-1:-1,this.additionNoEOFCRRow=n&&x&&C&&e.noEOFCRAdditions?y-1:-1;let w=s+v,T=s+i+S;return this.clipRun(y,b?w:T,c+v,b&&x?T:void 0)}startTrailingRun(){let{diff:e,trailingRows:t,trailingCollapsed:n,unifiedCount:r,splitCount:i,deletionIndexAt:a,deletionNumberAt:o,additionIndexAt:s,additionNumberAt:c,unifiedAt:l,splitAt:u}=this;return this.rowType=`context-expanded`,this.rowHunkIndex=e.hunks.length,this.rowHunk=void 0,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=a,this.deletionNumberStart=o,this.deletionUnifiedStart=l,this.additionIndexStart=s,this.additionNumberStart=c,this.additionUnifiedStart=l,this.splitStart=u,this.firstRowCollapsedBefore=0,this.collapsedAfterValue=n,this.collapsedAfterRow=t-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount+=t,this.splitCount+=t,this.clipRun(t,r,i)}startTrailingNewlineRun(){let{diff:e,trailingRows:t,unifiedCount:n,splitCount:r,deletionIndexAt:i,deletionNumberAt:a,additionIndexAt:o,additionNumberAt:s,unifiedAt:c,splitAt:l}=this,u=Math.max(t,0),d=Kt(e,`deletions`),f=o+u,p=i+u;return this.rowType=d?`context`:`change`,this.rowHunkIndex=e.hunks.length,this.rowHunk=void 0,this.rowHasDeletion=d,this.rowHasAddition=!0,this.deletionIndexStart=p,this.deletionNumberStart=a+u,this.deletionUnifiedStart=c+u,this.additionIndexStart=f,this.additionNumberStart=s+u,this.additionUnifiedStart=c+u,this.splitStart=l+u,this.firstRowCollapsedBefore=0,this.collapsedAfterRow=-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount++,this.splitCount++,this.clipRun(1,n,r)}setCollapsedAfterRow(e){let{collapsedAfterAt:t,trailingCollapsed:n}=this;t===-1?this.collapsedAfterRow=-1:(this.collapsedAfterValue=n,this.collapsedAfterRow=t-e)}};function wn(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Tn(e,t){let n=Array.isArray(e)?e:[e];return t==null?n.every(e=>e===`text`||e===`ansi`||tt.has(e)):t.hasLoadedLanguages(n)}var En=10,Dn=13,On=4,kn=40;function An(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
4
+ `),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
5
+ `,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
6
+ `,o)),t.push(o),++a===On){if(o-i<=kn){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===En||r===Dn)&&(r===Dn&&n+1<e.length&&e.charCodeAt(n+1)===En&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function jn(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===En||r===Dn)&&(r===Dn&&n+1<e.length&&e.charCodeAt(n+1)===En&&n++,t++)}return t}function Mn(e){let t=An(e),n=t.length,r=Array(n);for(let i=0;i<n;i++){let a=i+1<n?t[i+1]:e.length;r[i]=e.slice(t[i],a)}return r}function Nn(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}function Pn(e,t){return wn(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var K=new Map,Fn=0,In={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,cppm:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,odin:`odin`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,BUCK:`python`,BUILD:`python`,PACKAGE:`python`,WORKSPACE:`python`,Tiltfile:`python`,bazel:`python`,bxl:`python`,bzl:`python`,bzlmod:`python`,star:`python`,sky:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function q(e){let t=Ln(e);if(t!=null)return t;let n=e.split(/[/\\]/).pop()??e;return n===e?`text`:Ln(n)??`text`}function Ln(e){if(K.has(e))return K.get(e)??`text`;if(Object.hasOwn(In,e))return In[e]??null;let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(K.has(t[1]))return K.get(t[1])??`text`;if(Object.hasOwn(In,t[1]))return In[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return K.has(n)?K.get(n)??`text`:Object.hasOwn(In,n)?In[n]??`text`:null}function Rn(){return Fn}function zn(){return Object.fromEntries(K)}function Bn(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(zt(`
7
+ `)),e}var Vn=new WeakMap;function Hn(e,t=!1){let{htmlStyle:n}=e;if(n!=null){let e=t?Vn.get(n):void 0;if(e==null){e=``;for(let t in n)e+=`${e===``?``:`;`}${t}:${n[t]}`;t&&Vn.set(n,e)}return e}let r=e.color==null?``:`color:${e.color}`;if(e.bgColor!=null&&(r+=`;background-color:${e.bgColor}`),e.fontStyle!=null){e.fontStyle&1&&(r+=`;font-style:italic`),e.fontStyle&2&&(r+=`;font-weight:bold`);let t=!!(e.fontStyle&4),n=!!(e.fontStyle&8);(t||n)&&(r+=`;text-decoration:${t?`underline`:``}${t&&n?` `:``}${n?`line-through`:``}`)}return r.replace(/^;/,``)}var Un=class{parent;nextEdge;#e;#t;#n=[];#r=0;#i=[];#a=[];constructor(e,t,n,r){this.parent=this.#e=e,this.#t=r,t.length>1&&t.sort((e,t)=>e.start.line===t.start.line?e.start.character===t.start.character?e.end.line===t.end.line?t.end.character-e.end.character:t.end.line-e.end.line:e.start.character-t.start.character:e.start.line-t.start.line);let i=this.#n;for(let e=0;e<t.length;e++){let a=t[e],o={decoration:a,order:e,from:a.start.line===n?a.start.character:0,to:a.end.line===n?a.end.character:r};i.push({position:Math.max(0,Math.min(o.from,r)),range:o,start:!0},{position:Math.max(0,Math.min(o.to,r)),range:o,start:!1})}i.sort((e,t)=>e.position-t.position),this.nextEdge=i[0]?.position??r}moveTo(e){this.nextEdge===e&&this.#r<this.#n.length&&this.#o(e)}#o(e){let t=this.#n,n=this.#t,r=this.#r,i=r;for(;t[i]?.position===e;)i++;this.#r=i,this.nextEdge=t[i]?.position??this.#t;let a=!1;for(let a=r;a<i;a++){let{range:r,start:i}=t[a];!i&&r.from!==r.to&&e<n&&this.#s(r,!1)}for(let o=r;o<i;o++){let{range:r,start:i}=t[o];i&&r.from<=e&&r.to>=e&&(r.to>e||r.from===e||e===n)&&(this.#s(r,!0),r.from===r.to&&(a=!0))}if(a){this.#c();for(let e=r;e<i;e++){let{range:n,start:r}=t[e];r&&n.from===n.to&&this.#s(n,!1)}}e<n&&(this.parent=this.#c())}#s(e,t){let n=this.#i,r=0,i=n.length;for(;r<i;){let t=r+i>>>1;n[t].order<e.order?r=t+1:i=t}t?n.splice(r,0,e):n[r]===e&&n.splice(r,1)}#c(){let e=this.#a,t=this.#e,n=0;for(let r of this.#i){if(e[n]?.range!==r){e.length=n;let i={type:`element`,tagName:`span`,properties:{...r.decoration.properties},children:[]};t.children.push(i),e.push({range:r,node:i})}t=e[n++].node}return e.length=n,t}};function Wn(e,t,n,{retain:r=!0}={}){let i=!1,a;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){if(i)return a;let o=n();return r?(a=o,i=!0,Object.getOwnPropertyDescriptor(e,t)?.configurable===!0&&Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:a}),a):o},set(n){if(Object.getOwnPropertyDescriptor(e,t)?.configurable===!0)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n});else if(Object.isFrozen(e))throw TypeError(`Cannot assign to read only array index '${t}'`);else a=n,i=!0}})}var Gn=Symbol(`no-token`),Kn=Symbol(`multiple-tokens`);function qn(e){let t=Jn(e);if(t!=null)return t;let n=Gn,r=[],i=[],a,o=()=>{if(i.length===0||a==null)i=[],a=void 0;else if(i.length===1){let e=i[0];if(e?.type===`element`){Xn(e,a);for(let t of e.children)Yn(t)}else Yn(e);r.push(e),i=[],a=void 0}else{for(let e of i)Yn(e);r.push(W({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0}},s=e=>{e!==Gn&&(e===Kn?n=Kn:n===Gn?n=e:n!==e&&(n=Kn))};for(let t of e.children){let e=t.type===`element`?qn(t):Gn;s(e),typeof e==`number`?(a!=null&&a!==e&&o(),a??=e,i.push(t)):(o(),r.push(t))}return o(),e.children=r,n}function Jn(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Yn(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Yn(t)}}function Xn(e,t){e.properties[`data-char`]=t}function Zn(e,{state:t,lazyLineAST:n=!1,cacheHtmlStyles:r=!1,useTokenTransformer:i=!1,mergeWhitespaces:a=`always`,decorations:o=[],lineOffsets:s=[]}){let c;for(let t of o){let n=c??=new Map,r={...t,start:tr(t.start,s),end:tr(t.end,s)},i=Math.min(r.end.line,e.length-1);for(let e=r.start.line;e<=i;e++){let t=n.get(e);t??n.set(e,t=[]),t.push(r)}}let l=(e,n)=>{let o;if(i||a!==`never`){let t=``,n=0;for(let r=0;r<e.length;r++){let a=e[r];if(i){let t=a.content.trim();if(t!==``&&t!==a.content){o??=e.slice(0,r);let n=a.content.indexOf(t);n>0&&o.push({content:a.content.slice(0,n),offset:a.offset}),o.push({...a,content:t,offset:a.offset+n});let i=n+t.length;i<a.content.length&&o.push({content:a.content.slice(i),offset:a.offset+i});continue}}else{let i=!!((a.fontStyle??0)&12);if(!i&&/^\s+$/.test(a.content)&&r<e.length-1){o??=e.slice(0,r),t===``&&(n=a.offset),t+=a.content;continue}t!==``&&o!=null&&(i?o.push({content:t,offset:n}):a={...a,content:t+a.content,offset:n},t=``)}o?.push(a)}}o??=e;let s={type:`element`,tagName:t==null?`span`:`div`,properties:t==null?{class:`line`}:{},children:[]},l=c?.get(n),u=l==null?Qn(s,o,i,r):$n(s,o,l,n,i,r);return i&&u===0&&s.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),i&&l!=null&&qn(s),t==null?s:Bn(s,n+1,t)};if(!n)return e.map(l);let u=Array(e.length);for(let t=0;t<e.length;t++){let n=e[t];Wn(u,t,()=>l(n,t))}return u}function Qn(e,t,n,r){let i=0;for(let a of t)a.content!==``&&(e.children.push(er(a,Hn(a,r),a.content,i,n)),i+=a.content.length);return i}function $n(e,t,n,r,i,a){let o=0;for(let e of t)o+=e.content.length;let s=new Un(e,n,r,o),c=0;for(let e of t){let{content:t}=e;if(t===``)continue;let n=c,r=n+t.length,o=Hn(e,a);for(;c<r;){s.moveTo(c);let a=Math.min(r,s.nextEdge);s.parent.children.push(er(e,o,c===n&&a===r?t:t.slice(c-n,a-n),n,i)),c=a}}return s.moveTo(c),c}function er(e,t,n,r,i){let a=e.htmlAttrs==null?{}:{...e.htmlAttrs};return t!==``&&(a.style=t),i&&(a[`data-char`]=r),{type:`element`,tagName:`span`,properties:a,children:[{type:`text`,value:n}]}}function tr(e,t){if(typeof e!=`number`)return e;let n=0,r=t.length;for(;n+1<r;){let i=n+r>>>1;t[i]<=e?n=i:r=i}return{line:n,character:e-(t[n]??0)}}function nr(e,t){for(let n of t)e.push(n)}function rr(e,t,n){return{lang:e,...typeof t==`string`?{theme:t}:{themes:t},defaultColor:!1,cssVariablePrefix:H(`token`),tokenizeMaxLineLength:n,tokenizeTimeLimit:0}}var ir={forcePlainText:!1};function ar(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,lazyLineAST:o=!1,startingLine:s,totalLines:c,lines:l}=ir){a?(s??=0,c??=1/0):(s=0,c=1/0);let u=s>0||c<1/0,d=u?l??Mn(e.contents):void 0,f={lineInfo:[]},p=a?`text`:e.lang??q(e.name),m=typeof n==`string`?t.getTheme(n).type:void 0,h=Nt({theme:n,highlighter:t});if(d!=null&&Math.min(s+c,d.length)<=s)return{code:Array(s),themeStyles:h,baseThemeType:m};f.lineInfo=e=>({type:`context`,lineIndex:e-1+s,lineNumber:e+s});let g=Zn(t.codeToTokens(or(d==null?e.contents:sr(d,s,c)),rr(p,n,r)).tokens,{state:f,useTokenTransformer:i,lazyLineAST:o&&!a&&!i,cacheHtmlStyles:t.name===`highlights`}),_=u?Array(s):g;return u&&nr(_,g),{code:_,themeStyles:h,baseThemeType:m}}function or(e){return e.replace(/\r(?!\n)/g,`
8
+ `)}function sr(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length),i=e.slice(t,r).join(``);return r<e.length?Nn(i):i}function cr(e){return(e.lang??q(e.name))===`text`}var lr=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`),this.name=`WorkerPoolTerminatedError`}},ur=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`),this.name=`WorkerPoolTaskCanceledError`}},J=class extends Error{constructor(e,t){super(e,t),this.name=`WorkerPoolWorkerError`}},dr=new WeakSet;function fr(e){dr.add(e)}function pr(e){return e instanceof lr||e instanceof ur}function mr(e){return pr(e)||e instanceof J&&dr.has(e)}function hr(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function gr(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function _r(e,t){return wn(e.theme,t.theme)&&(e.preferredDiffLib??`jsdiff`)===(t.preferredDiffLib??`jsdiff`)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}var vr={forcePlainText:!1};function yr(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=vr){r?(a??=0,o??=1/0):(a=0,o=1/0);let l=a>0||o<1/0;i&&=!r&&!n.useTokenTransformer;let u=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,d=Nt({theme:n.theme,highlighter:t}),f={deletionLines:[],additionLines:[]},p=!r&&!e.isPartial,m=r?s:void 0,h=new Map;function g(e){let t=p?0:e,n=h.get(t)??br();return h.set(t,n),n}function _(e,t,n,r){if(l){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}let v=new Cn({diff:e,diffStyle:`both`,startingLine:a,totalLines:o,expandedHunks:!l||m,collapsedContextThreshold:c});for(;v.next();){let{hunkIndex:t,type:n,splitLineIndex:r}=v,i=g(t);if(v.hasDeletion){let{deletionLineIndex:t,deletionLineNumber:a,deletionUnifiedLineIndex:o}=v;_(e.deletionLines[t],t,i.deletionSegments,i.deletionContent),i.deletionInfo.push({type:n===`change`?`change-deletion`:n,lineNumber:a,altLineNumber:n===`change`?void 0:v.additionLineNumber,lineIndex:`${o},${r}`})}if(v.hasAddition){let{additionLineIndex:t,additionLineNumber:a,additionUnifiedLineIndex:o}=v;_(e.additionLines[t],t,i.additionSegments,i.additionContent),i.additionInfo.push({type:n===`change`?`change-addition`:n,lineNumber:a,altLineNumber:n===`change`?void 0:v.deletionLineNumber,lineIndex:`${o},${r}`})}}for(let a of h.values()){if(a.deletionContent.length===0&&a.additionContent.length===0)continue;let o={name:e.prevName??e.name,contents:a.deletionContent.value},s={name:e.name,contents:a.additionContent.value},{deletionLines:c,additionLines:l}=xr({deletionFile:o,deletionInfo:a.deletionInfo,additionFile:s,additionInfo:a.additionInfo,highlighter:t,options:n,languageOverride:r?`text`:e.lang,lazyLineAST:i});if(p)f.deletionLines=c,f.additionLines=l;else for(let[e,t,n]of[[f.deletionLines,c,a.deletionSegments],[f.additionLines,l,a.additionSegments]])if(n.length>0)for(let r of n)for(let n=0;n<r.count;n++)e[r.targetIndex+n]=t[r.originalOffset+n];else if(i){let n=e.length;for(let r=0;r<t.length;r++)Wn(e,n+r,()=>t[r])}else nr(e,t)}return{code:f,themeStyles:d,baseThemeType:u}}function br(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionSegments:[],additionSegments:[]}}function xr({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:r,additionInfo:i,highlighter:a,languageOverride:o,options:{theme:s,useTokenTransformer:c,tokenizeMaxLineLength:l}}){let u=(t,n)=>t.contents===``?[]:Zn(a.codeToTokens(Nn(t.contents),rr(o??q(t.name),s,l)).tokens,{state:{lineInfo:n},useTokenTransformer:c,lazyLineAST:e,cacheHtmlStyles:a.name===`highlights`});return{deletionLines:u(t,r),additionLines:u(n,i)}}function Sr(e){let t=e.lang??q(e.name),n=e.lang??(e.prevName==null?`text`:q(e.prevName));return t===`text`&&n===`text`}function Cr(e){let t=[];for(let n of e){let e=Xe.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}async function wr(e){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:nt())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=Ze.get(e);if(t!=null)return t;let n=(async()=>{let t=Qe.get(e);if(t==null){let{bundledLanguages:n}=await y(async()=>{let{bundledLanguages:e}=await import(`./grammars-B3laSCck.js`).then(e=>e.n);return{bundledLanguages:e}},__vite__mapDeps([11,1,9,10]));Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}if(t==null&&!$e.has(e))throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n={name:e,data:t==null?[{name:e,scopeName:`text.${e}`,patterns:[],repository:{}}]:(await t()).default};return Xe.has(e)||Xe.set(e,n),n})();Ze.set(e,n);try{return await n}finally{Ze.get(e)===n&&Ze.delete(e)}}function Tr(e){return Xe.get(e)??wr(e)}function Er(e){for(let t of Array.isArray(e)?e:[e])if(!Xe.has(t))return!1;return!0}async function Dr(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Tr(r)??wr(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function Or(e,t=R()){return gt(t).getResolvedThemes(e)}function kr(e,t=R()){return gt(t).hasResolvedThemes(e)}function Ar(e,t,n=`textmate`){let r=lt.get(e)??{};r[n]==null?(r[n]=t,lt.set(e,r)):console.error(`SharedHighlight.registerCustomTheme: theme name and type already registered`,e,n)}function jr(e,t=R()){return gt(t).resolveThemes(e)}function Mr(){let e=globalThis.navigator?.hardwareConcurrency??1;return Math.min(3,Math.max(1,e-1))}var Nr=class extends ee{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:p(t,n.data),hasPreviousPage:g(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Pr=class extends ue{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Be(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??w();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){k.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Fr(e,t){let n=m(t),[r]=I.useState(()=>new Pr(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(ne)},[r]);if(i.error&&o(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Ir(e,t){return we(e,Nr,t)}async function Lr(e,{objectId:t,...n}){let r=await e.binary({path:[n.project,`_apis`,`git`,`repositories`,n.repositoryId,`blobs`,t],query:{$format:`octetstream`},accept:`application/octet-stream`,...n.signal===void 0?{}:{signal:n.signal}});return{bytes:r.data,contentType:r.headers.get(`content-type`)}}async function Rr(e,{path:t,commitId:n,...r}){let i=await e.binary({path:[r.project,`_apis`,`git`,`repositories`,r.repositoryId,`items`],query:{path:t,"versionDescriptor.version":n,"versionDescriptor.versionType":`commit`,$format:`octetStream`,download:!1},accept:`application/octet-stream`,...r.signal===void 0?{}:{signal:r.signal}});return{bytes:i.data,contentType:i.headers.get(`content-type`)}}function zr(e){let t=[],n=[];for(let r of e){let e=$e.get(r);if(e==null)continue;let i=et.get(r);if(i!=null){t.push(i);continue}let a=t.push({name:r,data:[]})-1;n.push(e().then(({default:e})=>{let n=et.get(r);n??(n={name:r,data:[],highlights:e},et.set(r,n)),t[a]=n}))}return n.length===0?t:Promise.all(n).then(()=>t)}var Br=0,Vr=1,Hr=2,Ur=4,Wr=5,Gr=6,Kr=[void 0,null,!0,!1];function qr(e){if(Array.isArray(e))return e;let{ops:t,offsets:n,strings:r,text:i,extras:a}=e,o=Array(n.length/2),s=0,c=0;function l(e){let n=Array(e);for(let o=0;o<e;o++){let e=t[s++];if(e!==Br){if(e===Vr){let e=c+t[s++];n[o]={type:`text`,value:i.slice(c,e)},c=e}else if(e===Hr){let e=r[t[s++]],i={};for(let e=t[s++];e>0;e--){let e=r[t[s++]],n=t[s++],o=n===Ur?r[t[s++]]:n===Wr?t[s++]:n===Gr?a[t[s++]]:Kr[n];e===`__proto__`?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o}n[o]={type:`element`,tagName:e,properties:i,children:l(t[s++])}}else n[o]=a[t[s++]]}}return n}for(let e=0;e<o.length;e++)t[n[e*2]]!==Br&&Wn(o,e,()=>(s=n[e*2],c=n[e*2+1],l(1)[0]),{retain:!1});return o}var Jr=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?i(e):typeof r==`function`&&r.amd?r([`exports`],i):i((n||=self).lru_map=n.lru_map||{})})(n,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),Yr=Symbol(`IGNORE_RESPONSE`),Xr=5e3,Zr=class{options;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialization;configuredWorkers;workerSlots=[];readyWorkerCount=0;workerSlotsExhausted=!1;resolvedWorkerThemes=[];resolvedWorkerLanguages=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;failedHighlightKeys;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;pendingThemeRenders=new Map;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=je,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,preferredDiffLib:a,maxLineDiffLength:o=1e3,tokenizeMaxLineLength:s=1e3,preferredHighlighter:c}){this.options=e,this.configuredWorkers=e.poolSize??Mr(),this.preferredHighlighter=R(c),this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,preferredDiffLib:a,maxLineDiffLength:o,tokenizeMaxLineLength:s},this.fileCache=new Jr.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Jr.default.LRUMap(e.totalASTLRUCacheSize??100),this.failedHighlightKeys=new Jr.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.terminated&&!this.shouldUseLocalFallback()}shouldUseLocalFallback(){let{initialization:e}=this;return e?.state===`failed`||e?.state===`succeeded`&&this.readyWorkerCount===0}renderWhenLocalThemeLoads(e,t,n=[]){return V({theme:this.renderOptions.theme})==null?(this.pendingThemeRenders.set(e,t),this.loadLocalThemeForRender(this.isWorkingPool()?void 0:e),n.length>0&&this.loadSharedHighlighter([],n).catch(()=>{}),!0):(this.pendingThemeRenders.delete(e),!1)}cancelLocalThemeRender(e){this.pendingThemeRenders.delete(e)}loadLocalThemeForRender(e){let{theme:t}=this.renderOptions,{lifecycleGeneration:n}=this;this.loadSharedHighlighter(z(t),[`text`]).then(()=>{(this.terminated||this.isCurrentLifecycle(n))&&wn(t,this.renderOptions.theme)&&this.renderPendingThemeViews()},t=>e?.onHighlightError(t))}renderPendingThemeViews(){if(V({theme:this.renderOptions.theme})!=null)for(let e of[...this.pendingThemeRenders.keys()]){let t=this.pendingThemeRenders.get(e);if(t!=null){this.pendingThemeRenders.delete(e);try{t()}catch(e){console.error(e)}}}}shouldHighlightOnMainThread(e){let{mainThreadMaxCharacters:t=-1}=this.options;return(`contents`in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}didHighlightFail(e){let t=`contents`in e?this.getFileHighlightKey(e):this.getDiffHighlightKey(e);return t!=null&&this.failedHighlightKeys.has(t)}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}setFileResultCache(e,{result:t,options:n}){return e==null||!Pn(n,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:n}){return e==null||!_r(n,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??je,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,preferredDiffLib:r=this.renderOptions.preferredDiffLib,maxLineDiffLength:i=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:a=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:o}=this,s=++this.renderOptionsRequestVersion,c=()=>this.isCurrentLifecycle(o)&&this.renderOptionsRequestVersion===s;try{let o={theme:e,useTokenTransformer:t,lineDiffType:n,preferredDiffLib:r,maxLineDiffLength:i,tokenizeMaxLineLength:a};if(this.terminated&&this.queueInitialization(),!c()||_r(o,this.renderOptions))return;let s=z(e),l=!wn(e,this.renderOptions.theme),u=!l&&this.resolvedWorkerThemes.length>0?this.resolvedWorkerThemes:kr(s,this.preferredHighlighter)?Or(s,this.preferredHighlighter):await jr(s,this.preferredHighlighter);if(!c()||V({theme:e})==null&&(await this.loadSharedHighlighter(s,[`text`]),!c()))return;if(this.renderOptions=o,this.resolvedWorkerThemes=u,this.renderOptionsVersion++,this.initialization?.state===`pending`&&this.initialization.stopThemeWait?.(),this.diffCache.clear(),this.fileCache.clear(),this.failedHighlightKeys.clear(),this.invalidateRenderTasks(),l&&this.initialization?.state===`failed`&&this.initialization.reason===`preparation`){let{languages:e}=this.initialization;this.initialization=void 0,this.queueInitialization(e)}let d=this.setRenderOptionsOnWorkers(l);for(let e of this.themeSubscribers)e.onThemeChange();l&&this.renderPendingThemeViews(),await d}catch(e){if(e instanceof lr||!c())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e){let{renderOptionsVersion:t}=this,n=[];for(let r of this.workerSlots){let{worker:i}=r;if(r.state===`ready`&&i!=null){let a=e||i.pendingSetupRequestId!=null?this.resolvedWorkerThemes:[];n.push(this.setRenderOptionsOnWorker(i,a).catch(e=>{throw r.worker===i&&this.renderOptionsVersion===t&&this.failWorkerSlot(r,ni(e)),e}))}}await Promise.all(n)}setRenderOptionsOnWorker(e,t){let{renderOptionsVersion:n}=this;return new Promise((r,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:this.renderOptions,resolvedThemes:t},resolve(){e.renderOptionsVersion=n,r()},reject:i,requestStart:Date.now()};this.postWorkerSetup(e,o)})}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);Y(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialization?.state===`succeeded`}async initialize(e){let{initialization:t}=this;if(t?.state===`succeeded`){V({theme:this.renderOptions.theme})??await this.preloadLocalHighlighter(e??[]);return}if(t?.state===`pending`)return t.promise;if(t?.state===`failed`){if(t.reason===`workers`)throw t.error;e??=t.languages}this.terminated=!1;let n=this.initialization={state:`pending`,promise:Promise.resolve(),resolve(){},reject(){}};return n.promise=new Promise((e,t)=>{n.resolve=e,n.reject=t}),this.workerSlots=Array.from({length:this.configuredWorkers},()=>({state:`starting`})),this.startPool(n,e??[]),this.queueBroadcastStateChanges(),n.promise}async startPool(e,t){let{lifecycleGeneration:n,renderOptionsVersion:r}=this,i=z(this.renderOptions.theme);this.preloadLocalHighlighter(t).catch(e=>{this.isCurrentLifecycle(n)&&console.error(e)});try{try{let t=kr(i,this.preferredHighlighter)?Or(i,this.preferredHighlighter):await this.waitForWorkerThemes(e,i);this.initialization===e&&this.renderOptionsVersion===r&&(this.resolvedWorkerThemes=t)}catch(e){if(this.renderOptionsVersion===r)throw e}if(this.initialization!==e)return;let n=this.resolveWorkerLanguages(t),a=Array.isArray(n)?n:await n;if(this.initialization!==e)return;if(this.resolvedWorkerLanguages=a,this.workerSlots.length===0){let t=new J(`WorkerPoolManager: no workers configured`);this.workerSlotsExhausted=!0,this.rejectInitialization(e,{reason:`workers`,error:t}),this.rejectAllQueuedRenderTasks(t);return}this.startWorkerAttempts(this.workerSlots,`starting`)}catch(n){if(this.initialization!==e)return;this.workerSlots=[];let r=ti(n);this.rejectInitialization(e,{reason:`preparation`,error:r,languages:[...t]}),this.rejectAllQueuedRenderTasks(r)}}waitForWorkerThemes(e,t){let n=new Promise(t=>{e.stopThemeWait=()=>t(this.resolvedWorkerThemes)});return Promise.race([jr(t,this.preferredHighlighter),n])}preloadLocalHighlighter(e){return this.pendingThemeRenders.size>0&&this.loadLocalThemeForRender(),this.loadSharedHighlighter(z(this.renderOptions.theme),[`text`,...e])}async loadSharedHighlighter(e,t){try{await yt({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(e){if(!(e instanceof Ge))throw e}}async retryFailedWorkers(){let e=this.workerSlots.filter(e=>e.state===`failed`);return e.length>0&&await Promise.all(this.startWorkerAttempts(e,`retrying`)),this.getStats()}startWorkerAttempts(e,t){let n=e.map(e=>new Promise(n=>{let r={resolve:n};e.startup=r,e.state=t,e.error=void 0,this.startWorkerAttempt(e,r)}));return this.queueBroadcastStateChanges(),n}async startWorkerAttempt(e,t){let n=this.options.workerInitializationTimeout??Xr;t.timeout=setTimeout(()=>{this.failWorkerAttempt(e,t,new J(`WorkerPoolManager: worker initialization timed out after ${n}ms`))},n);try{let n=this.options.workerFactory(),r={worker:n,requestId:void 0,pendingSetupRequestId:void 0,renderOptionsVersion:this.renderOptionsVersion,langs:new Set([`text`,...this.resolvedWorkerLanguages.map(({name:e})=>e)]),customExtensionsVersion:0};for(e.worker=r,n.addEventListener(`message`,t=>{e.worker===r&&this.handleWorkerMessage(r,t.data)}),n.addEventListener(`error`,t=>{e.worker===r&&this.handleWorkerError(e,r,t)}),await new Promise((e,t)=>{let n=this.generateRequestId(),i={type:`initialize`,id:n,request:{type:`initialize`,resultFormat:`hast-ops-v1`,id:n,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:this.resolvedWorkerThemes,resolvedLanguages:this.resolvedWorkerLanguages},resolve:e,reject:t,requestStart:Date.now()};this.postWorkerSetup(r,i)});e.startup===t&&r.renderOptionsVersion!==this.renderOptionsVersion;)await this.setRenderOptionsOnWorker(r,this.resolvedWorkerThemes);if(e.startup!==t)return;e.state=`ready`,this.settleWorkerStartup(e),this.readyWorkerCount++,this.workerSlotsExhausted=!1;let{initialization:i}=this;i?.state!==`succeeded`&&(this.initialization={state:`succeeded`},i?.state===`pending`&&i.resolve()),this.queueDrain(),this.queueBroadcastStateChanges()}catch(n){this.failWorkerAttempt(e,t,n)}}postWorkerSetup(e,t){this.cancelWorkerSetup(e),this.activeTaskById.set(t.id,t),e.pendingSetupRequestId=t.id,this.executeTask(e,t)}cancelWorkerSetup(e,t){let{pendingSetupRequestId:n}=e;if(n!=null){let r=this.activeTaskById.get(n);(r?.type===`initialize`||r?.type===`set-render-options`)&&r.reject(t??new ur),this.cleanWorkerAndTask(e,r,n)}}retireWorker(e,t){let{worker:n}=e;n!=null&&(e.worker=void 0,this.cancelWorkerSetup(n,t),n.worker.terminate())}failWorkerAttempt(e,t,n){if(e.startup!==t)return;let r=ni(n);if(e.state!==`starting`){this.failWorkerSlot(e,r);return}clearTimeout(t.timeout);let i={resolve:t.resolve};e.startup=i,e.state=`retrying`,this.retireWorker(e,r),this.queueBroadcastStateChanges(),this.startWorkerAttempt(e,i)}failWorkerSlot(e,t){let n=e.state===`ready`;if(this.retireWorker(e,t),e.state=`failed`,e.error=t,this.settleWorkerStartup(e),n&&this.readyWorkerCount--,this.queueBroadcastStateChanges(),this.readyWorkerCount>0||this.workerSlotsExhausted)return;let r=this.workerSlots.map(({error:e})=>e);if(!r.every(e=>e!=null)){n&&this.rejectAllQueuedRenderTasks(e.error);return}this.workerSlotsExhausted=!0;let i=r.length===1?e.error:new J(`WorkerPoolManager: all ${r.length} worker slots failed`,{cause:AggregateError(r,`Worker slot failures`)});r.length>1&&r.every(mr)&&fr(i);let{initialization:a}=this;a?.state===`pending`&&this.rejectInitialization(a,{reason:`workers`,error:i}),this.rejectAllQueuedRenderTasks(i)}settleWorkerStartup(e){let{startup:t}=e;t!=null&&(e.startup=void 0,clearTimeout(t.timeout),t.resolve())}rejectInitialization(e,t){this.initialization={state:`failed`,...t},e.reject(t.error)}rejectAllQueuedRenderTasks(e){let t=new Set;for(let n of this.removeAllQueuedRenderTasks()){this.rejectRenderTaskCallbacks(n,e);for(let e of ei(n))t.add(e)}this.queueBroadcastStateChanges();for(let e of t)try{e.onLocalFallback()}catch(e){console.error(e)}}handleWorkerError(e,t,n){let{onWorkerError:r}=this.options;if(r!=null)try{r(n,t.worker)}catch(e){console.error(`WorkerPoolManager: onWorkerError threw:`,e)}else console.error(`Worker error:`,n,t);let{pendingSetupRequestId:i}=t;if(e.startup==null||i==null)return;let a=this.activeTaskById.get(i);if(a==null||!(`reject`in a))return;let o=ri(n);r!=null&&fr(o),this.cleanWorkerAndTask(t,a),a.reject(o)}drainQueue=()=>{if(this._queuedDrain=void 0,this.readyWorkerCount!==0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=$r(t.request),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);cr(t)||n!=null&&Pn(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread($r({type:`file`,file:e}),t.theme,n=>this.setFileResultCache(e.cacheKey,{result:ar(e,n,t),options:t}))}let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;let t=this.getFileResultCache(e);return!cr(e)&&(t==null||!Pn(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){let t=this.getFileHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`file`,file:e},t);if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created`);return n}}getPlainFileAST(e,t,n,r){let i=V({theme:this.renderOptions.theme});if(i==null)this.queueInitialization();else return ar(e,i,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Sr(t)||n!=null&&_r(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread($r({type:`diff`,diff:e}),t.theme,n=>this.setDiffResultCache(e.cacheKey,{result:yr(e,n,t),options:t}))}let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;let t=this.getDiffResultCache(e);return!Sr(e)&&(t==null||!_r(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,n){function r(){let r=V({theme:t,langs:e});return r!=null&&n(r)}if(r())return Promise.resolve();let{lifecycleGeneration:i}=this;return this.loadSharedHighlighter(z(t),[`text`,...e]).then(()=>{if(!this.isCurrentLifecycle(i))throw new lr;if(!r())throw new ur})}getOrCreateDiffHighlightCacheTask(e){let t=this.getDiffHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`diff`,diff:e},t);if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created`);return n}}getPlainDiffAST(e,t,n,r,i){let a=V({theme:this.renderOptions.theme});if(a==null)this.queueInitialization();else return yr(e,a,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++;let e=new lr;this.terminated=!0,this.readyWorkerCount=0,this.workerSlotsExhausted=!1,this.initialization?.state===`pending`&&(this.initialization.stopThemeWait?.(),this.initialization.resolve()),this.initialization=void 0;for(let t of this.workerSlots)this.settleWorkerStartup(t),this.retireWorker(t,e);this.workerSlots.length=0,this.resolvedWorkerThemes.length=0,this.resolvedWorkerLanguages.length=0;for(let t of this.removeAllQueuedRenderTasks())this.rejectRenderTaskCallbacks(t,e);for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Y(t)&&this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.failedHighlightKeys.clear(),this.activeRequestByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}initializeIfNeeded(){this.initialization??this.queueInitialization()}queueInitialization(e){this.initialization?.state!==`failed`&&this.initialize(e).catch(e=>{mr(e)||console.error(e)})}removeAllQueuedRenderTasks(){let{queuedTasks:e}=this;this.queuedTasks=[],this.queuedTaskByInstance.clear();for(let t of e)this.clearHighlightKey(t);return e}getStats(){let e=this.initialization?.state,t=0,n=0,r=0,i=0;for(let{state:e,worker:a}of this.workerSlots)switch(a!=null&&(t++,(a.requestId!=null||a.pendingSetupRequestId!=null)&&n++),e){case`retrying`:r++;break;case`failed`:i++}return{managerState:e===`succeeded`?`initialized`:e===`pending`?`initializing`:`waiting`,configuredWorkers:this.configuredWorkers,totalWorkers:t,readyWorkers:this.readyWorkerCount,retryingWorkerSlots:r,failedWorkerSlots:i,workersFailed:this.workerSlotsExhausted,busyWorkers:n,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){if(this.shouldUseLocalFallback())return;this.initializeIfNeeded();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initializeIfNeeded();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}resolveWorkerLanguages(e){return this.preferredHighlighter===`highlights`?zr(e):Er(e)?Cr(e):Dr(e)}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=V(),i=n.filter(e=>r==null||!Tn(e,r));i.length>0&&this.loadSharedHighlighter(z(this.renderOptions.theme),[`text`,...i]).catch(e=>{console.error(e)});let a=n.filter(t=>!e.langs.has(t)&&(this.preferredHighlighter!==`highlights`||$e.has(t)));if(a.length>0){let e=this.resolveWorkerLanguages(a);t.request.resolvedLanguages=Array.isArray(e)?e:await e}if(!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,ti(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw Yr;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Y(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(Y(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!Pn(r,this.getFileRenderOptions()))throw Yr;let{request:i}=n,a={...t.result,code:qr(t.result.code)};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,a,r);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!_r(r,this.getDiffRenderOptions()))throw Yr;let{request:i}=n,a={...t.result,code:{deletionLines:qr(t.result.code.deletionLines),additionLines:qr(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,a,r);break}}}catch(e){e!==Yr&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(Y(t)&&(this.rejectRenderTaskCallbacks(t,new ur),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){Qr(t.request)&&this.maybeAttachCustomExtensions(e,t.request);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),Y(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,ti(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=Rn();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=zn())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let{state:n,worker:r}of this.workerSlots){if(n!==`ready`||r==null||r.requestId!=null||r.pendingSetupRequestId!=null||r.renderOptionsVersion!==this.renderOptionsVersion)continue;if(t=r,e.length===0)break;let i=!0;for(let t of e)if(!r.langs.has(t)&&(this.preferredHighlighter!==`highlights`||$e.has(t))){i=!1;break}if(i)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of ei(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new ur),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new ur),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){e.highlightKey!=null&&this.failedHighlightKeys.delete(e.highlightKey);for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))Y(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of ei(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of ei(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of ei(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){e.highlightKey!=null&&this.failedHighlightKeys.set(e.highlightKey,!0);for(let n of ei(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&gr(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&hr(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())Y(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function Qr(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function $r(e){let t=new Set;switch(e.type){case`file`:t.add(e.file.lang??q(e.file.name));break;case`diff`:t.add(e.diff.lang??q(e.diff.name)),t.add(e.diff.lang??q(e.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Y(e){return e?.type===`file`||e?.type===`diff`}function ei(e){return e.instances}function ti(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}function ni(e){return e instanceof J?e:new J(ti(e).message,{cause:e})}function ri(e){let t=`error`in e?e.error:void 0;return new J(`WorkerPoolManager: worker failed: ${`message`in e&&typeof e.message==`string`&&e.message!==``?e.message:t instanceof Error?t.message:`the worker script failed to load (the error event carries no message)`}`,t instanceof Error?{cause:t}:void 0)}var ii;function ai({poolOptions:e,highlighterOptions:t}){return ii??=new Zr(e,t),ii}function oi(){ii!=null&&(ii.terminate(),ii=void 0)}var X=ae(),si=(0,I.createContext)(void 0),ci=0;function li({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,I.useState)(()=>{if(typeof window<`u`)return ai({poolOptions:t,highlighterOptions:n})});return(0,I.useInsertionEffect)(()=>{if(r!=null)return ci++,()=>{ci--}},[r]),(0,I.useEffect)(()=>()=>{ci===0&&oi()},[]),(0,X.jsx)(si.Provider,{value:r,children:e})}function ui(e){return new Worker(`/assets/worker-B--T_fs_.js`,{type:`module`,name:e?.name})}var di={dark:`pierre-dark`,light:`pierre-light`},fi=`
9
+ :host {
10
+ --diffs-dark-bg: #131313;
11
+ --diffs-light-bg: #ffffff;
12
+ --diffs-header-font-family: var(--font-sans, system-ui, sans-serif);
13
+ --diffs-bg-separator-override: light-dark(#f6f6f7, #191919);
14
+ --diffs-addition-color-override: light-dark(#13784f, #7ee2b8);
15
+ --diffs-deletion-color-override: light-dark(#c23434, #ff8a8a);
16
+ }
17
+ [data-separator-content],
18
+ [data-expand-button] {
19
+ font-size: 12px;
20
+ }
21
+ /* The comment \`+\` sits just past the line numbers (over the code's first columns, as on
22
+ GitHub), so the whole number column stays a target for selecting lines. */
23
+ [data-gutter-utility-slot] {
24
+ right: -22px;
25
+ }
26
+ `;Ar(di.dark,(()=>y(()=>import(`./pierre-dark-DMS-zpcK.js`),[])),`textmate`),Ar(di.light,(()=>y(()=>import(`./pierre-light-BHq6aQNU.js`),[])),`textmate`);var pi={workerFactory:()=>new ui({name:`azdiffs-highlighter`})},mi={theme:di,preferredHighlighter:`shiki-js`};function hi({children:e}){return(0,X.jsx)(li,{poolOptions:pi,highlighterOptions:mi,children:e})}var gi=/^( {0,3})(`{3,}|~{3,})(.*)$/;function _i(e){let t=e.replace(/\r\n?/g,`
27
+ `).split(`
28
+ `),n=[],r=0;for(;r<t.length;){let e=gi.exec(t[r]??``);if(r++,e===null)continue;let i=(e[1]??``).length,a=e[2]??"```",o=(e[3]??``).trim();if(a.startsWith("`")&&o.includes("`"))continue;let s=RegExp(`^ {0,3}${a[0]==="`"?"`":`~`}{${a.length},}\\s*$`),c=[];for(;r<t.length&&!s.test(t[r]??``);)c.push(vi(t[r]??``,i)),r++;r++,o.split(/\s+/)[0]?.toLowerCase()===`suggestion`&&n.push({lines:c})}return n}function vi(e,t){let n=0;for(;n<t&&e[n]===` `;)n++;return e.slice(n)}function yi(e){let t=e.replace(/\r\n?/g,`
29
+ `);return t.length===0?[]:t.replace(/\n$/,``).split(`
30
+ `)}function bi(e){return e.map(e=>`${e}\n`).join(``)}function xi(e){let t=0;for(let n of e){let e=/^ {0,3}(`{3,})/.exec(n)?.[1]?.length??0;t=Math.max(t,e)}let n="`".repeat(Math.max(3,t+1)),r=`${n}suggestion\n`,i=e.join(`
31
+ `);return{text:`${r}${i}\n${n}`,innerStart:r.length,innerEnd:r.length+i.length}}function Si(e,t){return[...e.map(e=>({kind:`removed`,text:e})),...t.map(e=>({kind:`added`,text:e}))]}var Ci=[239,187,191];function wi(e){if(e.includes(0))return{ok:!1,reason:`not-text`};let t=Ci.every((t,n)=>e[n]===t),n;try{n=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(t?e.subarray(3):e)}catch{return{ok:!1,reason:`not-text`}}let r=n.match(/\r\n/g)?.length??0,i=(n.match(/\n/g)?.length??0)-r,a=r>0&&r>=i?`\r
32
+ `:`
33
+ `,o=n.endsWith(`
34
+ `),s=o?n.replace(/\r?\n$/,``):n;return{ok:!0,file:{lines:n.length===0?[]:s.split(/\r?\n/),bom:t,eol:a,finalNewline:o}}}function Ti(e){let t=e.lines.length===0?``:`${e.lines.join(e.eol)}${e.finalNewline?e.eol:``}`,n=new TextEncoder().encode(t);if(!e.bom)return n;let r=new Uint8Array(n.length+3);return r.set(Ci,0),r.set(n,3),r}function Ei(e,t,n,r){let i=wi(e);if(!i.ok)return i;let{file:a}=i;if(!Number.isInteger(t)||!Number.isInteger(n)||t<1||n<t||n>a.lines.length)return{ok:!1,reason:`out-of-range`};let o=yi(r),s=[...a.lines.slice(0,t-1),...o,...a.lines.slice(n)];return{ok:!0,bytes:Ti({...a,lines:s})}}function Di(e,t,n){return t<1||n<t||n>e.lines.length?null:e.lines.slice(t-1,n)}function Oi(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function ki(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return btoa(t)}function Ai(e){return u().review.suggestion.commitMessage(e.reviewer,e.pullRequestId,e.threadId)}var ji={all:e=>[`pr-conflicts`,`list`,e.organization.toLowerCase(),e.repositoryId,e.pullRequestId],list:(e,t,n)=>[...ji.all(e),t,n],blob:(e,t)=>[`pr-conflicts`,`blob`,e.organization.toLowerCase(),e.repositoryId,t]};function Mi(e,t,n=!0){return i({queryKey:ji.list(e,t.lastMergeSourceCommit,t.lastMergeTargetCommit),queryFn:({signal:t})=>pe(F(e.organization),{project:e.project,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId,signal:t}),enabled:n&&t.status===`active`,retry:M})}function Ni(e){if(e.byteLength>8388608)return{kind:`too-large`,size:e.byteLength};let t=wi(e);return t.ok?{kind:`text`,file:t.file,bytes:e}:{kind:`not-text`,size:e.byteLength}}function Pi(e,t){return{queryKey:ji.blob(e,t),queryFn:async({signal:n})=>{let{bytes:r}=await Lr(F(e.organization),{project:e.project,repositoryId:e.repositoryId,objectId:t,signal:n});return Ni(new Uint8Array(r))},staleTime:1/0}}function Fi(e,t){return i({...Pi(e,t??``),enabled:t!==null,gcTime:18e5,retry:M})}function Ii(e){let t=e.filter(e=>e.kind!==`unsupported`),n=t.filter(e=>e.resolutionStatus===`resolved`),r=e.filter(e=>e.kind===`unsupported`&&e.resolutionStatus!==`resolved`);return{total:e.length,resolved:n.length+(e.length-t.length-r.length),unresolved:e.filter(e=>e.resolutionStatus!==`resolved`).length,unsupported:r.length,done:e.every(e=>e.resolutionStatus===`resolved`),anyResolved:e.some(e=>e.resolutionStatus===`resolved`)}}function Li(e){let t=new Set(e.split(`,`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0));return t.has(`delete`)&&!t.has(`undelete`)?`deleted`:t.has(`add`)||t.has(`undelete`)?`added`:t.has(`rename`)||t.has(`sourcerename`)||t.has(`targetrename`)?`renamed`:`modified`}function Ri(e){return e.replace(/^\/+/,``)}function zi(e){return e.startsWith(`/`)?e:`/${e}`}function Bi(e){let t=Ri(e.path);if(t.length===0)return null;let n=Li(e.changeType),r=e.originalPath===null?null:Ri(e.originalPath);n===`renamed`&&(r===null||r===t)&&(n=`modified`);let i={path:t,change:n,changeTrackingId:e.changeTrackingId};if(n===`renamed`&&r!==null&&(i.originalPath=r),n===`deleted`){let t=e.originalObjectId??e.objectId;return t!==null&&(i.originalObjectId=t),i}if(e.objectId!==null)i.objectId=e.objectId;else return null;return n!==`added`&&e.originalObjectId!==null&&(i.originalObjectId=e.originalObjectId),i}function Vi({baseCommit:e,targetCommit:t,entries:n}){let r=new Map;for(let e of n){let t=Bi(e);t!==null&&!r.has(t.path)&&r.set(t.path,t)}return{baseCommit:e,targetCommit:t,files:[...r.values()].sort((e,t)=>Gi(e.path,t.path))}}function Hi(e){return e.match(/\d+|\D+/g)?.map(e=>/^\d/.test(e)?Number(e):e)??[``]}function Ui(e,t){let n=Hi(e.toLowerCase()),r=Hi(t.toLowerCase());for(let e=0;e<Math.min(n.length,r.length);e++){let t=n[e],i=r[e];if(t!==i)return typeof t==`number`&&typeof i==`number`?t<i?-1:1:String(t)<String(i)?-1:1}if(n.length!==r.length)return n.length<r.length?-1:1;let i=e.toLowerCase(),a=t.toLowerCase();return i===a?e===t?0:e<t?-1:1:i<a?-1:1}function Wi(e,t){return e.isDirectory===t.isDirectory?Ui(e.name,t.name):e.isDirectory?-1:1}function Gi(e,t){let n=e.split(`/`),r=t.split(`/`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=n[e]??``,i=r[e]??``;if(t!==i)return Wi({name:t,isDirectory:e<n.length-1},{name:i,isDirectory:e<r.length-1})}return n.length-r.length}var Ki=e=>[e.organization.toLowerCase(),e.repositoryId,e.pullRequestId],qi={iterations:e=>[`pr-files`,`iterations`,...Ki(e)],changes:(e,t,n)=>[`pr-files`,`changes`,...Ki(e),t,n],threads:(e,t,n)=>[`pr-files`,`threads`,...Ki(e),t,n],allThreads:e=>[`pr-files`,`threads`,...Ki(e)],content:(e,t)=>[`pr-files`,`content`,e.organization.toLowerCase(),e.repositoryId,t]};function Ji(e,t){return{project:e.project,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId,signal:t}}function Yi(e){return i({queryKey:e===null?[`pr-files`,`iterations`,`none`]:qi.iterations(e),queryFn:({signal:t})=>r(F(e?.organization??null),Ji(e,t)),enabled:e!==null,retry:M})}function Xi(e){return e.since===null?e.iteration.commonCommit:e.since.sourceCommit}function Zi(e,t){let n=t?.since?.id??0,r=t?.iteration.id??0;return i({queryKey:e===null||t===null?[`pr-files`,`changes`,`none`]:qi.changes(e,r,n),queryFn:async({signal:i})=>{let a=t,o=await te(F(e.organization),{...Ji(e,i),iterationId:r,compareTo:n});return Vi({baseCommit:Xi(a),targetCommit:a.iteration.sourceCommit,entries:o})},enabled:e!==null&&t!==null,staleTime:1/0,retry:M})}var Qi=6e4;function $i(e,t){let n=t?.since?.id??0,r=t?.iteration.id??0;return i({queryKey:e===null||t===null?[`pr-files`,`threads`,`none`]:qi.threads(e,r,n),queryFn:({signal:t})=>f(F(e.organization),{...Ji(e,t),iteration:r,...n>0?{baseIteration:n}:{}}),enabled:e!==null&&t!==null,refetchOnWindowFocus:`always`,refetchInterval:Qi,refetchIntervalInBackground:!1,retry:M})}function ea(e,t){if(ye(e)||j(e,`unauthorized`))return{kind:`sign-in`};let n=u().review.writeErrors;if(j(e,`forbidden`)){let e=n.forbidden(t.repository);return{kind:`message`,message:t.method===`pat`?`${e} ${n.patHint}`:e}}if(j(e,`rate-limited`))return{kind:`message`,message:n.throttled};if(j(e,`network`))return{kind:`message`,message:n.network};if(j(e,`not-found`))return{kind:`message`,message:n.notFound};let r=e instanceof Error?e.message:n.unknownError;return{kind:`message`,message:n.refused(r)}}var ta={detail:e=>[`pull-request`,e.organization.toLowerCase(),e.project,e.pullRequestId]},na=6e4;function ra(e){return i({queryKey:ta.detail(e),queryFn:({signal:t})=>Ve(F(e.organization),{project:e.project,pullRequestId:e.pullRequestId,signal:t}),refetchOnWindowFocus:`always`,refetchInterval:na,refetchIntervalInBackground:!1,retry:M})}var Z=`/$organization/$project/_git/$repository/pullrequest/$pullRequestId`,Q=`/$organization/_git/$repository/pullrequest/$pullRequestId`,ia={long:{overview:Z,discussion:Z,files:`${Z}/files`,commits:`${Z}/commits`,commit:`${Z}/commits/$commitId`,conflicts:`${Z}/conflicts`,"files-commits":`${Z}/files`},short:{overview:Q,discussion:Q,files:`${Q}/files`,commits:`${Q}/commits`,commit:`${Q}/commits/$commitId`,conflicts:`${Q}/conflicts`,"files-commits":`${Q}/files`}};function aa(e){return e.tab===`discussion`?{section:`discussion`}:e.tab===`files-commits`?{panel:`commits`}:e.tab===`conflicts`&&e.file!==void 0?{file:e.file}:{}}function oa(e,t,n){let r=t?ia.short:ia.long,i={organization:e.organization,project:e.project,repository:e.repository,pullRequestId:e.pullRequestId,...n.tab===`commit`?{commitId:n.commitId}:{}};return{to:r[n.tab],params:i,search:aa(n)}}function sa({location:e,shortForm:t,page:n,className:r,children:i,activeExact:a=!1,keepSearch:o=!1,onClick:s,testId:c,current:l,title:u}){let{to:d,params:f,search:p}=oa(e,t,n);return(0,X.jsx)(xe,{to:d,params:f,search:o?e=>e:p,...r===void 0?{}:{className:r},...s===void 0?{}:{onClick:s},...c===void 0?{}:{"data-testid":c},...u===void 0?{}:{title:u},...l===void 0?{activeOptions:{exact:a,includeSearch:!1},activeProps:{"aria-current":`page`}}:{activeOptions:{exact:!0},...l?{"aria-current":`page`}:{}},children:i})}function ca(e,t){let n=Ie(),{organization:r,project:i,repository:a,pullRequestId:o}=e;return(0,I.useCallback)(e=>{let{to:s,params:c,search:l}=oa({organization:r,project:i,repository:a,pullRequestId:o},t,e);n({to:s,params:c,search:l})},[n,r,i,a,o,t])}function la({href:e,children:t,className:n=`text-accent hover:underline`}){return(0,X.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:n,children:t})}var ua=e=>[e.organization.toLowerCase(),e.repositoryId,e.pullRequestId],da={list:e=>[`pr-commits`,`list`,...ua(e)],diff:(e,t)=>[`pr-commits`,`diff`,e.organization.toLowerCase(),e.repositoryId,t]};function fa(e){return Ir({queryKey:e===null?[`pr-commits`,`list`,`none`]:da.list(e),queryFn:({signal:t,pageParam:n})=>{let r=e;return _e(F(r.organization),{project:r.project,repositoryId:r.repositoryId,pullRequestId:r.pullRequestId,top:50,continuationToken:n,signal:t})},initialPageParam:null,getNextPageParam:e=>e.continuationToken??void 0,enabled:e!==null,retry:M})}function pa(e,t){return i({queryKey:da.diff(e,t),queryFn:async({signal:n})=>{let r=F(e.organization),i={project:e.project,repositoryId:e.repositoryId,signal:n},[a,o]=await Promise.all([ge(r,{...i,commitId:t}),he(r,{...i,commitId:t})]),s=a.parents[0]??null;return{commit:a,changeSet:Vi({baseCommit:s,targetCommit:a.commitId,entries:s===null?o.map(e=>/delete/i.test(e.changeType)?e:{...e,changeType:`add`}):o})}},staleTime:1/0,retry:M})}function ma(e){return e.split(`
35
+ `).find(e=>e.trim().length>0)?.trim()??``}function ha(e){return e.slice(0,7)}var ga=[{keys:`j / k`,description:e=>e.files.shortcuts.nextFile},{keys:`n / p`,description:e=>e.files.shortcuts.nextThread},{keys:`c`,description:e=>e.files.shortcuts.comment},{keys:`v`,description:e=>e.files.shortcuts.viewed},{keys:`x`,description:e=>e.files.shortcuts.collapse},{keys:`s`,description:e=>e.files.shortcuts.layout},{keys:`w`,description:e=>e.files.shortcuts.wrap},{keys:`t`,description:e=>e.files.shortcuts.filter},{keys:`⌘F / Ctrl+F`,description:e=>e.files.shortcuts.search},{keys:`⌘K / Ctrl+K`,description:e=>e.files.shortcuts.goToPullRequest},{keys:`g o / g f / g c`,description:e=>e.files.shortcuts.goToTabs},{keys:`g x`,description:e=>e.files.shortcuts.goToConflicts},{keys:`?`,description:e=>e.files.shortcuts.help}],_a=[{keys:`j / k`,description:e=>e.files.shortcuts.nextFile},{keys:`n / p`,description:e=>e.files.shortcuts.conflicts.nextConflict},{keys:`c`,description:e=>e.files.shortcuts.conflicts.combine},{keys:`1 / 2 / 3`,description:e=>e.files.shortcuts.conflicts.pick},{keys:`space`,description:e=>e.files.shortcuts.conflicts.pickLine},{keys:`e`,description:e=>e.files.shortcuts.conflicts.edit},{keys:`o`,description:e=>e.files.shortcuts.conflicts.original},{keys:`⌘↵ / Ctrl+↵`,description:e=>e.files.shortcuts.conflicts.resolve},{keys:`⌘Z / Ctrl+Z`,description:e=>e.files.shortcuts.conflicts.undo},{keys:`g o / g f / g x`,description:e=>e.files.shortcuts.conflicts.goToTabs},{keys:`?`,description:e=>e.files.shortcuts.help}];function va(e){let t=e.composedPath()[0]??e.target;if(!(t instanceof HTMLElement))return!1;if(t.isContentEditable)return!0;let n=t.tagName;if(n===`TEXTAREA`||n===`SELECT`)return!0;if(n!==`INPUT`)return!1;let r=t.type;return![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`].includes(r)}function ya(e,t=!0){let n=(0,I.useRef)(e);n.current=e,(0,I.useEffect)(()=>{if(!t)return;let e=e=>{if(e.defaultPrevented||e.repeat&&e.key===`?`||e.ctrlKey||e.metaKey||e.altKey||va(e))return;let t=n.current[e.key];t!==void 0&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t])}var ba=2e3,xa={conflicts:`conflicts`,failure:`failure`,rejectedByPolicy:`rejectedByPolicy`};function Sa(e){if(e.status===`completed`)return{kind:`merged`};let t=u().merge.failures;if(e.status===`abandoned`)return{kind:`failed`,reason:t.abandoned};let n=xa[e.mergeStatus];if(n!==void 0){let r=t[n];return{kind:`failed`,reason:e.mergeFailureMessage===null?r:`${r} ${e.mergeFailureMessage}`}}return{kind:`pending`}}function Ca(){return u().merge.staleCommit}function wa(e){return e.slice(0,7)}function Ta(e){return u().merge.actions[e]}var Ea=(e,t)=>t!==null&&e.toLowerCase()===t.toLowerCase();function Da(e){return e.filter(e=>e.blocking&&e.state!==`passed`)}function Oa({pullRequest:e,checks:t,currentUserId:n,conflictCount:r=null}){let i=u().merge.explanations;if(e.status===`completed`)return{primary:null,secondary:[]};if(e.status===`abandoned`)return{primary:`reactivate`,secondary:[]};if(e.isDraft)return{primary:null,secondary:[`abandon`],explanation:i.draft};let a=e.autoCompleteSetBy;if(a!==null){let e=Ea(a.id,n)?i.you:a.displayName.length>0?a.displayName:i.someoneElse;return{primary:`cancel-auto-complete`,secondary:[`abandon`],explanation:i.autoCompleteSetBy(e)}}if(e.mergeStatus===`conflicts`){let t=e.targetBranch;return{primary:`resolve-conflicts`,secondary:[`abandon`],explanation:r===null||r===0?i.conflicts(t):i.filesConflict(r,t)}}let o=Da(t);if(o.length>0){let e=o.filter(e=>e.state===`failed`).length,t=o.length-e;return{primary:`set-auto-complete`,secondary:[`abandon`],explanation:i.requiredChecks(e,t)}}return{primary:`complete`,secondary:[`set-auto-complete`,`abandon`]}}var ka=`require a merge strategy`,Aa={noFastForward:`allowNoFastForward`,squash:`allowSquash`,rebase:`allowRebase`,rebaseMerge:`allowRebaseMerge`};function ja(e){let{type:t,isEnabled:n,isDeleted:r}=e.configuration;return!n||r?!1:t.id.toLowerCase()===`fa4e907d-c16b-4a4c-9dfa-4916e5d171ab`||t.displayName.trim().toLowerCase()===ka}function Ma(e){let t=b.map(t=>e[Aa[t]]);if(t.some(e=>typeof e==`boolean`)){if(t.some(e=>e!==void 0&&typeof e!=`boolean`))return null;let e=b.filter((e,n)=>t[n]===!0);return e.length>0?e:null}return e.useSquashMerge===!0?[`squash`]:null}function Na(e){let t=[...b];if(e==null)return t;let n=null;for(let r of e){if(!ja(r))continue;let e=Ma(r.configuration.settings);if(e===null)return t;n=n===null?e:n.filter(t=>e.includes(t))}return n===null||n.length===0?t:n}function Pa(e,t){return t!==null&&e.includes(t)?t:e.includes(`noFastForward`)?`noFastForward`:e[0]??`noFastForward`}var Fa=[`noFastForward`,`squash`];function Ia(e,t){return t?e.filter(e=>Fa.includes(e)):[...e]}function La({titleId:e,busy:t,onClose:n,testId:r,children:i}){let a=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let e=a.current;return e!==null&&!e.open&&e.showModal(),()=>{e?.open&&e.close()}},[]),(0,X.jsx)(`dialog`,{ref:a,"aria-labelledby":e,onKeyDown:Fe,onCancel:e=>{e.preventDefault(),t||n()},className:`m-auto w-[min(30rem,calc(100vw-2rem))] rounded-[12px] border border-border bg-surface p-5 text-[14px] text-fg shadow-[var(--azd-shadow)] backdrop:bg-black/50 backdrop:backdrop-blur-[2px]`,"data-testid":r,children:i})}var Ra=`azdiffs.merge.deleteSourceBranch:`;function za(e){try{return window.localStorage.getItem(`${Ra}${e}`)===`1`}catch{return!1}}function Ba(e,t){try{window.localStorage.setItem(`${Ra}${e}`,t?`1`:`0`)}catch{}}function Va({mode:e,pullRequest:t,commitId:n,allowed:r,policyRestricts:i,resolutionsRestrict:a=!1,hasWorkItems:o,busy:s,onConfirm:c,onClose:l}){let u=P(),d=u.merge.dialog,f=(0,I.useId)(),p=(0,I.useId)(),[m,h]=(0,I.useState)(()=>Pa(r,t.completionOptions?.mergeStrategy??null)),[g,_]=(0,I.useState)(()=>za(t.repository.id)),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(()=>Oe(t.pullRequestId,t.title)),C=e===`complete`,w=C&&n===null,T=C&&n!==null&&t.lastMergeSourceCommit!==n,E=r.length===0,ee=t.sourceBranch,D=t.targetBranch,O=e=>{e.preventDefault(),s||T||w||E||(Ba(t.repository.id,g),c({mergeStrategy:m,deleteSourceBranch:g,transitionWorkItems:o&&y,mergeCommitMessage:v(m)?x:null}))},k=d.summary(ee,D,u.merge.strategyPhrases[m]);return(0,X.jsx)(La,{titleId:f,busy:s,onClose:l,testId:C?`complete-dialog`:`auto-complete-dialog`,children:(0,X.jsxs)(`form`,{onSubmit:O,className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{id:f,className:`text-[16px] font-semibold text-fg-strong`,children:C?d.completeTitle:d.autoCompleteTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted`,children:C?d.completeNote:d.autoCompleteNote})]}),(0,X.jsxs)(`fieldset`,{className:`space-y-1.5`,children:[(0,X.jsx)(`legend`,{className:`mb-1.5 text-xs font-medium text-muted`,children:d.mergeType}),r.map(e=>(0,X.jsxs)(`label`,{className:`flex h-9 items-center gap-2.5 rounded-[8px] border border-border px-3 text-[13px] text-fg hover:bg-hover has-[:checked]:border-border-strong has-[:checked]:bg-[var(--azd-selected)]`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`merge-strategy`,value:e,checked:m===e,onChange:()=>h(e),className:`accent-[var(--azd-accent)]`}),u.merge.strategies[e]]},e)),a&&!E&&(0,X.jsx)(`p`,{className:`pt-0.5 text-xs text-muted`,"data-testid":`strategy-resolutions-note`,children:d.resolutionsNote}),E&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13px] text-danger`,"data-testid":`strategy-none`,children:d.noStrategy(D)}),i&&!E&&(0,X.jsx)(`p`,{className:`pt-0.5 text-xs text-muted`,"data-testid":`strategy-policy-note`,children:d.policyNote(D,r.length)})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex items-start gap-2.5 text-[13px] text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 accent-[var(--azd-accent)]`}),(0,X.jsx)(`span`,{children:d.deleteBranch((0,X.jsx)(`span`,{className:`font-mono`,children:ee}))})]}),o&&(0,X.jsxs)(`label`,{className:`flex items-start gap-2.5 text-[13px] text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5 accent-[var(--azd-accent)]`}),d.completeWorkItems]})]}),v(m)&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:p,className:`block text-xs font-medium text-muted`,children:d.commitMessage}),(0,X.jsx)(`textarea`,{id:p,value:x,onChange:e=>S(e.target.value),rows:3,className:`w-full resize-y rounded-[8px] border border-border bg-canvas px-2.5 py-2 font-mono text-xs text-fg focus:border-[var(--azd-focus)] focus:outline-none`})]}),(0,X.jsx)(`p`,{className:`rounded-[8px] bg-raised px-3 py-2 text-[13px] text-fg`,"data-testid":`completion-summary`,children:k}),C&&n!==null&&(0,X.jsx)(`p`,{className:`text-xs text-muted`,children:d.sourceCommit((0,X.jsx)(`span`,{className:`font-mono text-fg`,"data-testid":`completion-commit`,children:wa(n)}))}),w&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13px] text-danger`,children:d.missingCommit}),T&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13px] text-danger`,"data-testid":`completion-stale`,children:u.merge.staleCommit}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:be,children:d.cancel}),(0,X.jsx)(`button`,{type:`submit`,disabled:s||T||w||E,className:Re,"data-testid":`completion-confirm`,children:s?C?d.completing:d.setting:C?d.completeMerge:d.setAutoComplete})]})]})})}var Ha=(0,I.createContext)(null);function Ua(){return(0,I.useContext)(Ha)}function Wa({location:e,scope:t,pullRequest:n,checks:r,checksPending:i,evaluations:a,hasWorkItems:o,conflicts:s=null,onResolveConflicts:c=()=>{},children:l}){let d=m();D();let f=Se(e.organization),p=ta.detail(e),[g,v]=(0,I.useState)(null),[y,b]=(0,I.useState)({kind:`idle`}),[x,S]=(0,I.useState)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(!1),E={project:t.project,repositoryId:t.repositoryId,pullRequestId:t.pullRequestId},ee=(0,I.useCallback)(e=>{e!==null&&d.setQueryData(p,e),d.invalidateQueries({queryKey:p})},[d,p]),O=(0,I.useCallback)(()=>{v(null);let e=w.current;window.setTimeout(()=>{e?.isConnected&&e.focus()},0)},[]),k=Fr({retry:!1,mutationFn:t=>{let n=F(e.organization);switch(t.action){case`complete`:return re(n,{...E,lastMergeSourceCommit:t.commitId,options:t.choices});case`set-auto-complete`:return h(n,{...E,userId:t.userId,options:t.choices});case`cancel-auto-complete`:return C(n,E);case`abandon`:return _(n,E);case`reactivate`:return de(n,E)}},onSettled:()=>{T.current=!1}}),te=t=>{let r=ea(t,{repository:n.repository.name,method:Ce(e.organization)});return r.kind===`sign-in`?u().merge.status.signInRejected:r.message},ne=(e,t)=>{T.current||(T.current=!0,S(null),k.mutate(e,t))},ie=(e,t,n)=>{if(e===`complete`){if(t===null)return;ne({action:`complete`,commitId:t,choices:n},{onSuccess:e=>{O(),e!==null&&d.setQueryData(p,e),e?.status===`completed`?b({kind:`merged`}):b({kind:`completing`,since:Date.now()})},onError:e=>{O(),ae(e,t)}});return}let r=f.data?.id;r!==void 0&&ne({action:`set-auto-complete`,userId:r,choices:n},{onSuccess:e=>{O(),ee(e)},onError:e=>{O(),S({tone:`error`,text:()=>te(e)})}})},ae=async(t,n)=>{let r=null;try{r=await Ve(F(e.organization),{project:e.project,pullRequestId:e.pullRequestId}),d.setQueryData(p,r)}catch{}r!==null&&r.lastMergeSourceCommit!==n?S({tone:`error`,text:Ca}):S({tone:`error`,text:()=>te(t)})},oe=e=>{ne({action:e},{onSuccess:t=>{e===`abandon`&&O(),b({kind:`idle`}),ee(t)},onError:t=>{e===`abandon`&&O(),S({tone:`error`,text:()=>te(t)})}})};Ja(y,e,p,b,S);let se=i&&n.status===`active`?null:Oa({pullRequest:n,checks:r,currentUserId:f.data?.id??null,conflictCount:s?.unresolved??null}),A=k.isPending,ce=Na(a),le=s?.anyResolved===!0,ue=Ia(ce,le),fe=ce.length<4,pe={actions:se,busy:A,phase:y,notice:x,run:(e,t)=>{if(!(A||T.current))switch(w.current=t,S(null),e){case`resolve-conflicts`:c();return;case`complete`:v({kind:`complete`,commitId:n.lastMergeSourceCommit});return;case`set-auto-complete`:v({kind:`auto-complete`,commitId:n.lastMergeSourceCommit});return;case`abandon`:v({kind:`abandon`});return;case`cancel-auto-complete`:case`reactivate`:oe(e);return}},targetBranch:n.targetBranch};return(0,X.jsxs)(Ha.Provider,{value:pe,children:[l,g!==null&&g.kind!==`abandon`&&(0,X.jsx)(Va,{mode:g.kind,pullRequest:n,commitId:g.commitId,allowed:ue,policyRestricts:fe,resolutionsRestrict:le&&ue.length<ce.length,hasWorkItems:o,busy:A,onConfirm:e=>ie(g.kind,g.commitId,e),onClose:O}),g?.kind===`abandon`&&(0,X.jsx)(qa,{pullRequestId:n.pullRequestId,busy:A,onConfirm:()=>oe(`abandon`),onClose:O})]})}function Ga(){let e=P().merge.status,t=Ua();if(t===null||t.actions===null)return null;let{actions:n,phase:r,notice:i}=t,a=r.kind===`idle`;return(0,X.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`merge-controls`,children:[r.kind===`completing`&&(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5 text-[13px] text-fg`,"data-testid":`merge-progress`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`azd-pulse size-2 rounded-full bg-accent`}),e.completing]}),r.kind===`merged`&&(0,X.jsx)(`p`,{role:`status`,className:`text-[13px] font-medium text-added`,"data-testid":`merge-progress`,children:e.mergedInto(t.targetBranch)}),r.kind===`timed-out`&&(0,X.jsx)(`p`,{role:`status`,className:`text-[13px] text-muted`,"data-testid":`merge-progress`,children:e.stillCompleting}),a&&n.explanation!==void 0&&(0,X.jsx)(`p`,{className:`text-[13px] leading-snug text-muted`,"data-testid":`merge-explanation`,children:n.explanation}),i!==null&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13px] leading-snug ${i.tone===`error`?`text-danger`:`text-muted`}`,"data-testid":`merge-notice`,children:i.text()})]})}function Ka({showNotice:e=!1}){let t=P(),n=Ua();if(n===null||n.actions===null)return null;let{actions:r,busy:i,phase:a,notice:o,run:s}=n;if(a.kind===`completing`)return(0,X.jsxs)(`span`,{className:`${be} pointer-events-none gap-2`,"data-testid":`merge-button-progress`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`azd-pulse size-2 rounded-full bg-accent`}),t.merge.status.completing]});if(a.kind===`merged`||a.kind===`timed-out`)return null;let{primary:c,secondary:l}=r;if(c===null&&l.length===0)return null;let u=l.map(e=>({label:Ta(e),onSelect:()=>{let t=document.querySelector(`[data-testid="merge-menu-button"]`);t!==null&&s(e,t)},disabled:i,danger:e===`abandon`,testId:`merge-action-${e}`}));return(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e&&o!==null&&(0,X.jsx)(`p`,{role:`alert`,className:`max-w-xs truncate text-xs text-danger`,title:o.text(),"data-testid":`merge-notice`,children:o.text()}),(0,X.jsxs)(`div`,{className:`flex items-center`,"data-testid":`merge-button`,children:[c!==null&&(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:e=>s(c,e.currentTarget),className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 bg-primary text-primary-fg hover:opacity-90 ${l.length>0?`rounded-r-none`:``}`,"data-testid":`merge-action-${c}`,"data-kind":`primary`,children:[c===`resolve-conflicts`?(0,X.jsx)(le,{className:`size-3.5`}):(0,X.jsx)(me,{className:`size-3.5`}),Ta(c)]}),l.length>0&&(0,X.jsx)(Te,{label:t.merge.button.menu,entries:u,trigger:e=>(0,X.jsxs)(`button`,{type:`button`,...e,ref:e.ref,"aria-label":c===null?void 0:t.merge.button.more,title:c===null?r.explanation:t.merge.button.more,className:c===null?`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 border border-border bg-raised text-fg hover:border-border-strong hover:bg-hover gap-1.5`:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 bg-primary text-primary-fg hover:opacity-90 rounded-l-none border-l border-[color-mix(in_srgb,var(--azd-primary-fg)_18%,transparent)] px-2`,"data-testid":`merge-menu-button`,children:[c===null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(me,{className:`size-3.5`}),t.merge.button.merge]}),(0,X.jsx)(O,{className:`size-3.5`})]})})]})]})}function qa({pullRequestId:e,busy:t,onConfirm:n,onClose:r}){let i=P().merge.abandon,a=(0,I.useId)();return(0,X.jsx)(La,{titleId:a,busy:t,onClose:r,testId:`abandon-dialog`,children:(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t||n()},className:`space-y-3`,children:[(0,X.jsx)(`h2`,{id:a,className:`text-[16px] font-semibold text-fg-strong`,children:i.title(e)}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted`,children:i.note}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:r,disabled:t,className:be,children:i.cancel}),(0,X.jsx)(`button`,{type:`submit`,disabled:t,className:Ee,"data-testid":`abandon-confirm`,children:t?i.abandoning:i.confirm})]})]})})}function Ja(e,t,n,r,i){let a=m(),o=e.kind===`completing`?e.since:null,{organization:s,project:c,pullRequestId:l}=t;(0,I.useEffect)(()=>{if(o===null)return;let e=new AbortController,t,u=async()=>{if(Date.now()-o>=12e4)r({kind:`timed-out`});else{try{let t=await Ve(F(s),{project:c,pullRequestId:l,signal:e.signal});if(e.signal.aborted)return;a.setQueryData(n,t);let o=Sa(t);if(o.kind===`merged`){r({kind:`merged`});return}if(o.kind===`failed`){r({kind:`idle`}),i({tone:`error`,text:()=>{let e=Sa(t);return e.kind===`failed`?e.reason:o.reason}});return}}catch{if(e.signal.aborted)return}t=window.setTimeout(()=>void u(),ba)}};return t=window.setTimeout(()=>void u(),ba),()=>{e.abort(),window.clearTimeout(t)}},[o,s,c,l,a])}var Ya={rejected:`failed`,broken:`failed`,running:`running`,queued:`pending`,approved:`passed`},Xa={failed:`failed`,error:`failed`,pending:`pending`,notSet:`pending`,succeeded:`passed`};function Za(e,t=A()){let n=e.configuration.settings.displayName;if(typeof n==`string`&&n.trim().length>0)return n.trim();let r=e.configuration.type.displayName.trim();return r.length>0?r:u(t).overview.checks.policyFallback}function Qa(e,t=A()){let{genre:n,name:r}=e.context,i=r.trim().length>0?r.trim():u(t).overview.checks.statusFallback;return n.trim().length>0?`${n.trim()}/${i}`:i}function $a(e){if(e!=null)try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.href:void 0}catch{return}}function eo(e,t){let n=e.context?.buildId;if(!(typeof n!=`number`||!Number.isSafeInteger(n)||n<=0))return`https://dev.azure.com/${encodeURIComponent(t.organization)}/${encodeURIComponent(t.project)}/_build/results?buildId=${n}`}function to(e,t,n=A()){let r=[];for(let i of e){let e=i.configuration;if(!e.isEnabled||e.isDeleted)continue;let a=Ya[i.status];if(a===void 0)continue;let o={id:`policy:${i.evaluationId||e.id}`,name:Za(i,n),state:a,blocking:e.isBlocking,source:`policy`},s=eo(i,t);s!==void 0&&(o.url=s),i.context?.isExpired===!0&&(o.detail=u(n).overview.checks.expired),r.push(o)}return r}function no(e,t=A()){let n=new Map;for(let t of e){let e=`${t.context.genre.toLowerCase()}/${t.context.name.toLowerCase()}`,r=n.get(e);(r===void 0||ro(t,r))&&n.set(e,t)}let r=[];for(let e of n.values()){let n=Xa[e.state];if(n===void 0)continue;let i={id:`status:${e.context.genre}/${e.context.name}`,name:Qa(e,t),state:n,blocking:!1,source:`status`},a=$a(e.targetUrl);a!==void 0&&(i.url=a),e.description.trim().length>0&&(i.detail=e.description.trim()),r.push(i)}return r}function ro(e,t){let n=e=>Date.parse(e.updatedDate??e.creationDate??``)||0;return n(e)===n(t)?e.id>t.id:n(e)>n(t)}var io={failed:0,running:1,pending:2,passed:3};function ao(e,t){return io[e.state]-io[t.state]||Number(t.blocking)-Number(e.blocking)||e.name.localeCompare(t.name)}function oo(e){return[...e].sort(ao)}function so(e){let t=e.filter(e=>e.blocking),n=t.filter(e=>e.state!==`passed`).length,r=e.filter(e=>e.state===`failed`).length,i=u().overview.checks,a;return a=e.length===0?i.none:t.length===0?i.noneRequired:n===0?i.allPassed:i.notPassed(n,t.length),{required:t.length,requiredNotPassed:n,failed:r,text:a}}function co(e){return e.some(e=>e.state===`running`||e.state===`pending`)}var lo=e=>[e.organization.toLowerCase(),e.repositoryId,e.pullRequestId],$={threads:e=>[...qi.allThreads(e),`overview`],evaluations:e=>[`pr-overview`,`evaluations`,...lo(e)],statuses:e=>[`pr-overview`,`statuses`,...lo(e)],workItems:e=>[`pr-overview`,`work-items`,...lo(e)]},uo=6e4,fo=15e3,po=(e,t)=>({project:e.project,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId,signal:t});function mo(e){return i({queryKey:$.threads(e),queryFn:({signal:t})=>f(F(e.organization),po(e,t)),refetchOnWindowFocus:`always`,refetchInterval:Qi,refetchIntervalInBackground:!1,retry:M})}function ho(e,t,n,r){return oo([...to(e??[],n,r),...no(t??[],r)])}function go(e){let t=m(),n={refetchOnWindowFocus:`always`,refetchInterval:co(ho(t.getQueryData($.evaluations(e)),t.getQueryData($.statuses(e)),e))?fo:uo,refetchIntervalInBackground:!1,retry:M},r=i({queryKey:$.evaluations(e),queryFn:({signal:t})=>ce(F(e.organization),{project:e.project,projectId:e.projectId,pullRequestId:e.pullRequestId,signal:t}),...n}),o=i({queryKey:$.statuses(e),queryFn:({signal:t})=>a(F(e.organization),po(e,t)),...n}),{organization:s,project:c}=e,l=D();return{checks:(0,I.useMemo)(()=>ho(r.data,o.data,{organization:s,project:c},l),[r.data,o.data,s,c,l]),pending:r.isPending&&o.isPending,evaluationsError:r.error,statusesError:o.error,evaluations:r.data,retry:()=>{r.isError&&r.refetch(),o.isError&&o.refetch()}}}function _o(e){return j(e,`forbidden`)||j(e,`unauthorized`)||j(e,`network`)}function vo(e){return i({queryKey:$.workItems(e),queryFn:async({signal:t})=>{let n=F(e.organization),r=(await ze(n,po(e,t))).map(e=>e.id);if(r.length===0)return{ids:r,details:new Map,detailsProblem:null};try{let n=await Ne(F(e.organization,{keepSessionOnUnauthorized:!0}),{ids:r,signal:t});return{ids:r,details:new Map(n.map(e=>[e.id,e])),detailsProblem:null}}catch(e){if(t.aborted)throw e;return{ids:r,details:null,detailsProblem:_o(e)?`access`:`failed`}}},staleTime:3e5,retry:M})}var yo={approved:`text-[var(--azd-added)]`,approvedWithSuggestions:`text-[var(--azd-added)]`,waitingForAuthor:`text-[var(--azd-modified)]`,rejected:`text-danger`,none:`text-muted`},bo=[`approved`,`approvedWithSuggestions`,`waitingForAuthor`,`rejected`,`none`];function xo(){let e=u().review.votes;return bo.map(t=>({vote:N[t],...e[t],tone:yo[t]}))}function So(e){return xo().find(t=>t.vote===e)}var Co=(e,t)=>e.toLowerCase()===t.toLowerCase();function wo(e,t,n){let r=e.reviewers.find(e=>Co(e.id,t.id)),i=r?e.reviewers.map(e=>e===r?{...e,vote:n}:e):[...e.reviewers,{isRequired:!1,hasDeclined:!1,...t,vote:n}];return{...e,reviewers:i}}var To=`flex w-full items-center gap-2 rounded-[6px] px-2 py-1.5 text-left text-[13px] text-fg outline-none hover:bg-hover focus:bg-hover aria-disabled:cursor-not-allowed aria-disabled:text-muted`,Eo=`flex h-8 items-center border border-border bg-raised px-2.5 text-[13px] font-medium text-fg hover:border-border-strong hover:bg-hover focus-visible:z-10 disabled:cursor-not-allowed disabled:opacity-50`;function Do({location:e,pullRequest:t}){let n=P(),r=Se(e.organization),i=m(),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(null),l=(0,I.useRef)(null),u=(0,I.useRef)(null),d=(0,I.useRef)([]),f=(0,I.useId)(),p=ta.detail(e),h=Fr({retry:!1,mutationFn:({vote:n})=>T(F(e.organization),{project:e.project,repositoryId:t.repository.id,pullRequestId:t.pullRequestId,reviewerId:r.data.id,vote:n}),onMutate:async({vote:e,previous:t})=>{c(null),await i.cancelQueries({queryKey:p});let n=r.data;return n!==void 0&&i.setQueryData(p,t=>t===void 0?t:wo(t,n,e)),{previous:t}},onSuccess:e=>{i.setQueryData(p,t=>t===void 0?t:wo(t,e,e.vote))},onError:(e,t,n)=>{let a=r.data;a!==void 0&&n!==void 0&&i.setQueryData(p,e=>e===void 0?e:wo(e,a,n.previous)),c({failure:e})}}),g=r.data,_=g===void 0?0:t.reviewers.find(e=>Co(e.id,g.id))?.vote??0,v=So(_),y=xo().filter(e=>e.vote!==N.none),b=s===null?null:ea(s.failure,{repository:t.repository.name,method:Ce(e.organization)}),x=b===null?null:b.kind===`sign-in`?n.review.voteControl.signInFailed:b.message,S=g===void 0,C=h.isPending,w=e=>{o(!1),l.current?.focus(),S||C||e===_||h.mutate({vote:e,previous:_})};(0,I.useEffect)(()=>{if(!a)return;let e=Math.max(0,xo().filter(e=>e.vote!==N.none).findIndex(e=>e.vote===_));d.current[e]?.focus();let t=e=>{let t=e.target;!u.current?.contains(t)&&!l.current?.contains(t)&&o(!1)};return document.addEventListener(`pointerdown`,t),()=>document.removeEventListener(`pointerdown`,t)},[a,_]);let ee=e=>{let t=d.current.filter(e=>e!==null),n=t.indexOf(document.activeElement),r=null;if(e.key===`ArrowDown`)r=(n+1)%t.length;else if(e.key===`ArrowUp`)r=(n-1+t.length)%t.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else if(e.key===`Escape`){e.preventDefault(),o(!1),l.current?.focus();return}else if(e.key===`Tab`){o(!1);return}r!==null&&(e.preventDefault(),t[r]?.focus())},D=_===N.approved,k=_!==N.none&&!D;return(0,X.jsxs)(`div`,{className:`relative flex items-center gap-2`,"data-testid":`vote-control`,children:[x!==null&&(0,X.jsx)(`p`,{role:`alert`,className:`max-w-[16rem] truncate text-xs text-danger`,title:x,children:x}),(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`${Eo} gap-1.5 rounded-l-[7px] ${D?`text-added`:``}`,"aria-pressed":D,"aria-disabled":C,disabled:S,onClick:()=>w(N.approved),"data-testid":`vote-approve`,children:[(0,X.jsx)(E,{className:`size-3.5`}),D?n.review.votes.approved.state:n.review.votes.approved.action]}),(0,X.jsxs)(`button`,{ref:l,type:`button`,className:`${Eo} -ml-px gap-1 rounded-r-[7px] px-1.5`,"aria-haspopup":`menu`,"aria-expanded":a,"aria-controls":a?f:void 0,"aria-label":k&&v!==void 0?n.review.voteControl.yourVote(v.state):n.review.voteControl.otherVotes,disabled:S,onClick:()=>o(e=>!e),onKeyDown:e=>{e.key===`ArrowDown`&&!a&&(e.preventDefault(),o(!0))},"data-testid":`vote-menu-button`,children:[k&&v!==void 0&&(0,X.jsx)(`span`,{className:v.tone,"data-testid":`vote-state`,children:v.state}),(0,X.jsx)(O,{className:`size-3.5 text-muted`})]})]}),a&&(0,X.jsxs)(`div`,{ref:u,id:f,role:`menu`,"aria-label":n.review.voteControl.menu,tabIndex:-1,onKeyDown:ee,className:`absolute top-[calc(100%+6px)] right-0 w-60 z-50 min-w-48 rounded-[10px] border border-border bg-surface p-1 shadow-[var(--azd-shadow)]`,children:[y.map((e,t)=>(0,X.jsxs)(`button`,{ref:e=>{d.current[t]=e},type:`button`,role:`menuitemradio`,"aria-checked":e.vote===_,tabIndex:-1,onClick:()=>w(e.vote),className:To,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex w-4 justify-center text-fg`,children:e.vote===_&&(0,X.jsx)(E,{className:`size-3.5`})}),e.action]},e.vote)),(0,X.jsx)(`hr`,{className:`my-1 border-border`}),(0,X.jsxs)(`button`,{ref:e=>{d.current[y.length]=e},type:`button`,role:`menuitem`,"aria-disabled":_===N.none,tabIndex:-1,onClick:()=>w(N.none),className:To,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`w-4`}),n.review.votes.none.action]})]})]})}function Oo({status:e,className:t=`size-4`}){switch(e){case`draft`:return(0,X.jsx)(se,{className:t});case`completed`:return(0,X.jsx)(me,{className:t});case`abandoned`:return(0,X.jsx)(x,{className:t});default:return(0,X.jsx)(n,{className:t})}}var ko=(0,I.createContext)(null);function Ao(){let e=(0,I.useContext)(ko);if(e===null)throw Error(`usePullRequestPage outside a pull request page`);return e}function jo({location:e,shortForm:t,children:n}){return(0,X.jsx)(hi,{children:(0,X.jsx)(Po,{location:e,shortForm:t,children:n})})}function Mo({location:e,children:t}){let n=P();return(0,X.jsx)(c,{sidebarLabel:n.inbox.label,sidebar:(0,X.jsx)(No,{location:e,quietProblems:!0}),topBar:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(`span`,{className:`truncate text-muted`,children:e.repository}),(0,X.jsx)(Pe,{}),(0,X.jsxs)(`span`,{className:`text-fg tabular-nums`,children:[`#`,e.pullRequestId]})]}),(0,X.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:(0,X.jsx)(De,{})})]}),children:(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:t})})}function No({location:e,quietProblems:t=!1}){let n=i(Ae()),r=Me(n.data,e.organization),a=n.isPending?[]:[{name:r?.name??e.organization,project:r?.project??null}];return(0,X.jsx)(Ue,{organizations:a,linkOrganizations:!0,current:{organization:e.organization,pullRequestId:e.pullRequestId},quietProblems:t})}function Po({location:e,shortForm:t,children:n}){let r=Se(e.organization);return r.isPending?(0,X.jsx)(Mo,{location:e,children:(0,X.jsx)(ie,{})}):r.isError?(0,X.jsx)(Mo,{location:e,children:(0,X.jsx)(He,{error:r.error,organization:e.organization,onRetry:()=>void r.refetch()})}):(0,X.jsx)(Fo,{location:e,shortForm:t,children:n})}function Fo({location:e,shortForm:t,children:n}){let r=P(),i=ra(e);return i.isPending?(0,X.jsx)(Mo,{location:e,children:(0,X.jsx)(ie,{})}):i.data===void 0?j(i.error,`not-found`)?(0,X.jsx)(Mo,{location:e,children:(0,X.jsxs)(d,{title:r.pullRequest.notFound.title,children:[(0,X.jsx)(`p`,{children:r.pullRequest.notFound.text(e.organization,e.project,e.pullRequestId)}),(0,X.jsx)(la,{href:Le(s(e)),children:r.pullRequest.openInAzureDevOps})]})}):(0,X.jsx)(Mo,{location:e,children:(0,X.jsx)(He,{error:i.error,organization:e.organization,onRetry:()=>void i.refetch()})}):(0,X.jsx)(Io,{location:e,shortForm:t,pullRequest:i.data,children:n})}function Io({location:e,shortForm:t,pullRequest:n,children:r}){let i=(0,I.useMemo)(()=>({organization:e.organization,project:e.project,projectId:n.repository.projectId,repositoryId:n.repository.id,pullRequestId:e.pullRequestId}),[e.organization,e.project,e.pullRequestId,n.repository.id,n.repository.projectId]),a=Wo(i,n),o=ca(e,t),s=go(i),c=vo(i);qo(e,t);let l=(0,I.useMemo)(()=>({location:e,shortForm:t,pullRequest:n,scope:i,counts:a}),[e,t,n,i,a]);return(0,X.jsx)(ko.Provider,{value:l,children:(0,X.jsx)(Wa,{location:e,scope:i,pullRequest:n,checks:s.checks,checksPending:s.pending,evaluations:s.evaluations,hasWorkItems:(c.data?.ids.length??0)>0,conflicts:a.conflicts,onResolveConflicts:()=>o({tab:`conflicts`}),children:r},`${n.repository.id}:${n.pullRequestId}`)})}function Lo(e){let{projectName:t,name:n}=e.repository;return t===n?n:`${t}/${n}`}function Ro({mode:e,lead:t,title:n,tools:r,merge:i=!0}){let a=P(),{location:o,shortForm:c,pullRequest:l}=Ao();return(0,X.jsxs)(X.Fragment,{children:[t,(0,X.jsxs)(oe,{children:[(0,X.jsx)(`span`,{className:`truncate text-muted ${e===`review`?`max-w-[11rem] shrink-0 max-[1100px]:hidden`:``}`,title:`${o.organization} / ${Lo(l)}`,children:Lo(l)}),(0,X.jsx)(`span`,{className:e===`review`?`max-[1100px]:hidden`:``,children:(0,X.jsx)(Pe,{})}),e===`overview`?(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-fg`,children:[(0,X.jsx)(zo,{pullRequest:l}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,l.pullRequestId]})]}):(0,X.jsxs)(`span`,{className:`flex min-w-[8rem] items-center gap-1.5`,children:[(0,X.jsx)(zo,{pullRequest:l}),(0,X.jsx)(sa,{location:o,shortForm:c,page:{tab:`overview`},className:`min-w-0 truncate font-medium text-fg hover:underline`,children:(0,X.jsxs)(`h1`,{className:`inline`,title:l.title,children:[l.title,` `,(0,X.jsxs)(`span`,{className:`font-normal text-muted tabular-nums`,children:[`#`,l.pullRequestId]})]})}),n]})]}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[r,(0,X.jsx)(De,{}),(0,X.jsx)(ve,{href:Le(s(o)),label:a.pullRequest.openInAzureDevOps,framed:!0,children:(0,X.jsx)(fe,{})}),l.status===`active`&&(0,X.jsx)(Do,{location:o,pullRequest:l}),i&&(0,X.jsx)(Ka,{showNotice:e===`review`})]})]})}function zo({pullRequest:e}){let t=P(),n=Bo(e),r=t.pullRequest.status[n];return(0,X.jsxs)(`span`,{title:r,className:Uo[n],children:[(0,X.jsx)(Oo,{status:n}),(0,X.jsx)(`span`,{className:`sr-only`,children:r})]})}function Bo(e){return e.status===`active`?e.isDraft?`draft`:`active`:e.status===`completed`?`completed`:e.status===`abandoned`?`abandoned`:`active`}function Vo(e){return u().pullRequest.status[e]}var Ho={get active(){return Vo(`active`)},get draft(){return Vo(`draft`)},get completed(){return Vo(`completed`)},get abandoned(){return Vo(`abandoned`)}},Uo={active:`text-added`,draft:`text-muted`,completed:`text-renamed`,abandoned:`text-deleted`};function Wo(e,t){let n=Yi(t.supportsIterations?e:null),r=n.data?.at(-1),i=(0,I.useMemo)(()=>r===void 0?null:{iteration:r,since:null},[r]),a=Zi(t.supportsIterations?e:null,i),o=fa(e),s=Mi(e,t).data,c=s===void 0||s.length===0||t.status!==`active`?null:Ii(s),l=c?.total??null,u=c?.unresolved??null,d=c?.anyResolved??!1,f=(0,I.useMemo)(()=>l===null||u===null?null:{total:l,unresolved:u,anyResolved:d},[l,u,d]),p=o.data?.pages.reduce((e,t)=>e+t.commits.length,0),m=a.data===void 0?n.data?.length===0?`0`:null:String(a.data.files.length),h=p===void 0?null:`${p}${o.hasNextPage?`+`:``}`;return(0,I.useMemo)(()=>({files:m,commits:h,conflicts:f}),[m,h,f])}var Go=1500,Ko={o:{tab:`overview`},f:{tab:`files`},c:{tab:`commits`},x:{tab:`conflicts`}};function qo(e,t){let n=ca(e,t);(0,I.useEffect)(()=>{let e=null,t=()=>{e!==null&&window.clearTimeout(e),e=null},r=r=>{if(r.ctrlKey||r.metaKey||r.altKey||va(r))t();else if(e!==null){let e=Ko[r.key];if(t(),e===void 0)return;r.preventDefault(),r.stopPropagation(),n(e)}else r.key===`g`&&!r.repeat&&(r.preventDefault(),e=window.setTimeout(t,Go))};return window.addEventListener(`keydown`,r,!0),()=>{t(),window.removeEventListener(`keydown`,r,!0)}},[n])}export{Ti as $,H as $t,ea as A,pn as At,Fi as B,Zt as Bt,pa as C,jn as Ct,ca as D,Cn as Dt,sa as E,wn as Et,Ri as F,nn as Ft,wi as G,W as Gt,Ei as H,Ut as Ht,zi as I,sn as It,xi as J,zt as Jt,Oi as K,Bt as Kt,Pi as L,qt as Lt,Zi as M,an as Mt,Yi as N,on as Nt,ta as O,rn as Ot,$i as P,mn as Pt,ki as Q,Nt as Qt,ji as R,Yt as Rt,ha as S,Nn as St,la as T,Tn as Tt,_i as U,Ht as Ut,Mi as V,Kt as Vt,Di as W,Vt as Wt,Si as X,Rt as Xt,yi as Y,Wt as Yt,bi as Z,Lt as Zt,_a as _,Zn as _t,Uo as a,z as an,Rr as at,ya as b,q as bt,Oo as c,$e as cn,Sr as ct,mo as d,Ge as dn,gr as dt,V as en,di as et,vo as f,Je as fn,hr as ft,La as g,nr as gt,Ua as h,ar as ht,Ho as i,gt as in,Lr as it,qi as j,cn as jt,ra as k,tn as kt,$ as l,et as ln,yr as lt,Ga as m,R as mn,cr as mt,jo as n,xt as nn,si as nt,Bo as o,tt as on,Fr as ot,so as p,Ye as pn,mr as pt,Ai as q,Gt as qt,Ro as r,_t as rn,zr as rt,Ao as s,Qe as sn,Dr as st,No as t,yt as tn,fi as tt,go as u,Xe as un,_r as ut,ga as v,qn as vt,fa as w,Mn as wt,ma as x,Pn as xt,va as y,Un as yt,Ii as z,Jt as zt};
@@ -0,0 +1 @@
1
+ import{Sr as e,St as t,bt as n,f as r}from"./index-DsrXp1aY.js";import{n as i}from"./home-page-BUnNaCN6.js";var a=e();function o(){let e=r.useNavigate();return(0,a.jsx)(i,{onOpen:r=>{let i=n(r);return i!==null&&(e({href:t(i)}),!0)}})}export{o as component};
@@ -0,0 +1 @@
1
+ import{gt as e,in as t,ln as n,on as r,sn as i,st as a,un as o}from"./pull-request-layout-R9F6zMxd.js";import{n as s,r as c,t as l}from"./stream-tokenizer-CKeNSKPz.js";import{n as u}from"./utils-Tkdy0sOA.js";import{n as d,t as f}from"./lineChanges-Dw4ZXwVU.js";import{createCssVariablesTheme as p,createHighlighterCore as m,n as h,r as g}from"./core-DfsS1UI1.js";import{Kn as _}from"./index-DsrXp1aY.js";function v(e,t){let n=Array.isArray(e)?e:[e];if(n.length>1&&t.name!==`highlights`){for(let e of n){let n=y(e);t.attachLanguages([n]),r.add(n.name)}return}let i=n.map(y);t.attachLanguages(i);for(let e of i)r.add(e.name)}function y(e){let t=e.highlights==null?o:n;return t.get(e.name)??(t.set(e.name,e),e)}var b=0,x=1,S=0,C=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[{state:g,brackets:void 0}];#d=[];#f=-1;#p=!1;#m=0;#h=++S;#g=!1;#_=u(async e=>{if(!this.#l){if(this.#t==null&&!T(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#f=Math.max(this.#f,e),this.#b()}},500);#v=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#h&&r===this.#m&&this.#y()};constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}applyChange(e,t){if(this.#O(),this.#D(),this.#t==null&&!T(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let n=f(e);this.#u=d(this.#u,n,()=>void 0).entries,this.#C(n),this.#S(e.changedLineRanges??[[e.startLine,e.endLine]]),this.#p=!1;let r=t==null?this.#i.lineCount:t[1],i=this.advance(r,t==null?void 0:x);return this.#b(),i}flush(e){this.#O(),this.#D();let t=this.advance(e);return this.#b(),t}prime(e){this.#O(),this.#_(e[1])}bracketIgnoredRanges(e){if(this.#O(),this.#t==null)return null;if(this.#u[e]?.brackets===void 0){let t=this.#A(e,this.#T(e));this.#u[e+1]??this.#E(e+1,t)}return this.#u[e]?.brackets??null}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.#S([[0,this.#i.lineCount-1]]),this.#b())}pause(){this.#p||(this.#p=!0,this.#m++)}resume(){this.#p&&(this.#p=!1,this.#b())}dispose(){this.#l=!0,this.#m++,this.#d=[],this.#f=-1,this.#x()}advance(e,t){let n=new Map;if(this.#t==null&&!T(this.#i.languageId))return n;let r=t==null?0:performance.now(),i=Math.min(e,this.#i.lineCount);for(;this.#d.length>0;){let e=this.#d[0],a=e[0];if(a>=i)break;let o=this.#T(a),s=!1;for(;a<i;){let i=this.#u[a+1]?.state,c=this.#k(a,o);if(n.set(a,c.resolvedTokens),o=c.state,this.#E(a+1,o),a++,a>e[1]&&i!=null&&o.equals(i)){s=!0;break}if(t!=null&&performance.now()-r>t)break}if(s||a>=this.#i.lineCount){for(this.#d.shift();this.#d.length>0&&this.#d[0][1]<a;)this.#d.shift();this.#d.length>0&&this.#d[0][0]<a&&(this.#d[0][0]=a)}else{e[0]=a,e[1]<a&&(e[1]=a);break}}return n}#y(){if(this.#p||this.#l)return;this.#D();let e=performance.now(),t=this.advance(this.#i.lineCount,x);if(t.size>0&&this.#o(t),this.#d.length===0&&this.#f>=0){let t=Math.min(this.#f,this.#i.lineCount),n=this.#w(),r=this.#u[n]?.state??g;for(;n<t&&(r=this.#A(n,r),n++,this.#E(n,r),!(performance.now()-e>x)););n>=t&&(this.#f=-1)}this.#b()}#b(){if(this.#p||this.#l||this.#d.length===0&&this.#f<0||T(this.#i.languageId)){this.#x();return}let e=++this.#m;this.#g||=(globalThis.addEventListener(`message`,this.#v),!0),globalThis.postMessage({type:`tokenize`,tokenizerId:this.#h,jobId:e})}#x(){this.#g&&=(globalThis.removeEventListener(`message`,this.#v),!1)}#S(e){let t=[],n=0,r=0;for(;n<this.#d.length||r<e.length;){let i=this.#d[n],a=e[r],o;if(a==null||i!=null&&i[0]<=a[0]?(o=i,n++):(o=a,r++),o[1]<o[0])continue;let s=t[t.length-1];s!=null&&o[0]<=s[1]+1?s[1]=Math.max(s[1],o[1]):t.push([o[0],o[1]])}this.#d=t}#C(e){for(let[t,n,r]of e){let e=n-r;for(let i of this.#d)i[1]<t||(i[0]>e?(i[0]+=r,i[1]+=r):(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1]+r,n)))}}#w(){let e=Math.min(this.#u.length-1,this.#i.lineCount);for(;e>0&&this.#u[e]==null;)e--;return e}#T(e){let t=this.#u[e]?.state;if(t!=null)return t;let n=this.#w();if(n>e)for(n=e;n>0&&this.#u[n]==null;)n--;let r=this.#u[n]?.state??g;for(;n<e;n++)r=this.#A(n,r),this.#E(n+1,r);return r}#E(e,t){let n=this.#u[e];n==null?this.#u[e]={state:t,brackets:void 0}:n.state=t}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}#O(){this.#t==null&&!T(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#j(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#j(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=w(this.#t,this.#r,n,t,b,this.#s);return this.#j(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#A(e,t){let n=this.#i.getLineText(e);if(this.#t==null||n.length>=this.#a||n===``||n.trim()===``)return this.#j(e,null),t;let r=w(this.#t,this.#r,n,t,b,this.#s,!1);return this.#j(e,r.bracketIgnoredRanges),r.ruleStack}#j(e,t){if(!this.#s)return;let n=this.#u[e];if(n==null)throw Error(`ShikiEditorTokenizer: line ${e} has no record`);n.brackets=t}};function w(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=h.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&h.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function T(e){return e===`text`||e===`ansi`}var E=class t extends l{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(t,n){let r=(this.#e+t).split(/(\r\n|\r|\n)/),i=[];for(let t=0;t<r.length;t+=2){let a=r[t],o=this.highlighter.codeToTokens(a,{...this.options,grammarState:this.#t}),s=o.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));t+1<r.length?(e(n,s),this.pushLineBreak(n,a.length,r[t+1]),this.#t=o.grammarState):(i=s,this.#e=a)}return{unstable:i,tailLength:this.#e.length}}clone(){this.assertActive();let e=new t(this.highlighter,this.options);return this.copyStateTo(e),e.#e=this.#e,e.#t=this.#t,e}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},D=class e extends s{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await _(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-D--T0LcV.js`);return{createOnigurumaEngine:e}},[])).createOnigurumaEngine(_(()=>import(`./wasm-C7N7kd8H.js`),[])):(await _(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-C4Jk_eU2.js`);return{createJavaScriptRegexEngine:e}},[])).createJavaScriptRegexEngine(),r=await m({themes:[],langs:[],engine:n});return new e(t,r)}constructor(e,n){super(e,t(e)),this.raw=n}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:p(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new c(new C(this.raw,e,this),e)}createStreamTokenizer(e){return new E(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed();let t=e.filter(e=>!this.attachedLanguages.has(e));v(await a(t),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let t;return e.every(e=>this.attachedLanguages.has(e)?!0:!i.has(e)&&(t??=this.raw.getLoadedLanguages(),t.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{D as ShikiHighlighter};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{B as t,Cr as n,D as r,G as i,I as a,N as o,P as s,Sn as c,Sr as l,V as u,bn as d,et as f,j as p,kn as m,wn as h}from"./index-DsrXp1aY.js";import{D as g,E as _,s as v,v as y}from"./pull-request-layout-R9F6zMxd.js";import{t as b}from"./commits-view-Cq3oHLFX.js";var x=e(n(),1),S=l(),C=!0;function w({filesCount:e,filter:t,onFilterChange:n,filterRef:i,tree:a,totals:o,currentCommit:s,panel:c,onPanelChange:l}){let u=m(),{location:d,shortForm:h,scope:g}=v(),y=(0,x.useId)();return(0,S.jsxs)(r,{top:(0,S.jsxs)(_,{location:d,shortForm:h,page:{tab:`overview`},className:`flex h-8 items-center gap-1.5 rounded-[7px] px-2 text-[13px] text-muted hover:bg-hover hover:text-fg`,testId:`back-to-overview`,children:[(0,S.jsx)(p,{className:`size-3.5`}),u.files.sidebar.back]}),children:[(0,S.jsxs)(`div`,{className:`shrink-0 space-y-2 px-3 pb-2`,children:[(0,S.jsx)(T,{value:c,onChange:l,filesCount:e}),c===`files`&&(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`label`,{className:`sr-only`,htmlFor:y,children:u.files.sidebar.filterLabel}),(0,S.jsx)(f,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`}),(0,S.jsx)(`input`,{id:y,ref:i,type:`search`,value:t,onChange:e=>n(e.currentTarget.value),onKeyDown:e=>{e.key===`Escape`&&(n(``),e.currentTarget.blur())},placeholder:u.files.sidebar.filterPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-keyshortcuts":`t`,className:`h-8 w-full rounded-[7px] border border-border bg-surface pr-7 pl-8 text-[13px] text-fg placeholder:text-muted hover:border-border-strong focus:border-[var(--azd-focus)] focus:outline-none`}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded border border-border px-1 font-mono text-[10px] leading-4 text-muted`,children:`t`})]})]}),c===`files`?(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-1`,children:a}):(0,S.jsx)(`div`,{className:`azd-scrollbar min-h-0 flex-1 overflow-y-auto pb-3`,children:(0,S.jsx)(b,{location:d,shortForm:h,scope:g,variant:`sidebar`,currentCommit:s})}),o!==null&&(0,S.jsx)(E,{totals:o})]})}function T({value:e,onChange:n,filesCount:r}){let a=m().files.sidebar,{location:s,shortForm:l,counts:d}=v(),f=g(s,l),p=d.conflicts,h=[{value:`files`,name:a.filesName(r),testId:`sidebar-files`,label:(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(i,{className:`size-3.5`}),a.files,r!==null&&(0,S.jsx)(`span`,{className:`font-normal tabular-nums text-muted`,children:r})]})},{value:`commits`,name:a.commitsName(d.commits),testId:`sidebar-commits`,label:(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(t,{className:`size-3.5`}),(0,S.jsx)(`span`,{className:p===null?``:`sr-only`,children:a.commits}),d.commits!==null&&(0,S.jsx)(`span`,{className:`font-normal tabular-nums text-muted`,children:d.commits})]})}];return p!==null&&h.push({value:`conflicts`,name:p.unresolved===0?a.conflictsResolved:a.conflictsName(p.unresolved),testId:`sidebar-conflicts`,label:(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(u,{className:`size-3.5`}),a.conflicts,p.unresolved===0?(0,S.jsx)(o,{className:`size-3 text-added`}):(0,S.jsx)(`span`,{className:`font-normal tabular-nums text-muted`,children:p.unresolved})]})}),(0,S.jsx)(c,{label:a.review,value:e,onChange:e=>{e===`conflicts`?f({tab:`conflicts`}):n(e)},size:`lg`,stretch:!0,choices:h})}function E({totals:e}){let t=m(),[n,r]=(0,x.useState)(C),i=e=>{C=e,r(e)},o=(0,x.useId)(),c=e.ready<e.files;return(0,S.jsxs)(`section`,{"aria-label":t.files.stats.title,className:`shrink-0 border-t border-border px-3 py-1.5 text-[13px]`,"data-testid":`diff-totals`,"data-partial":c?`true`:`false`,children:[(0,S.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":o,onClick:()=>i(!n),className:`flex h-7 w-full items-center gap-2 rounded-md px-1 text-muted hover:text-fg`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:t.files.stats.title}),c&&(0,S.jsx)(`span`,{className:`text-xs tabular-nums`,children:t.files.filesCounted(e.ready,e.files)}),(0,S.jsx)(`span`,{className:`ml-auto`,children:n?(0,S.jsx)(s,{className:`size-3.5`}):(0,S.jsx)(a,{className:`size-3.5`})})]}),n&&(0,S.jsxs)(`dl`,{id:o,className:`space-y-1 px-1 pt-0.5 pb-1 tabular-nums`,children:[(0,S.jsx)(D,{label:t.files.stats.files,value:h(e.files)}),(0,S.jsx)(D,{label:t.files.stats.additions,value:`+${h(e.additions)}`,tone:`text-added`}),(0,S.jsx)(D,{label:t.files.stats.deletions,value:`−${h(e.deletions)}`,tone:`text-deleted`})]})]})}function D({label:e,value:t,tone:n=`text-fg`}){return(0,S.jsxs)(`div`,{className:`flex items-center justify-between text-[13px]`,children:[(0,S.jsx)(`dt`,{className:`text-muted`,children:e}),(0,S.jsx)(`dd`,{className:`font-mono text-xs ${n}`,children:t})]})}function O({open:e,onClose:t,shortcuts:n=y}){let r=m(),i=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let t=i.current;t!==null&&(e&&!t.open&&t.showModal(),!e&&t.open&&t.close())},[e]),(0,S.jsxs)(`dialog`,{ref:i,onClose:t,"aria-labelledby":`azd-shortcuts-title`,className:`m-auto w-[22rem] rounded-[12px] border border-border bg-surface p-5 text-fg shadow-[var(--azd-shadow)] backdrop:bg-black/50`,children:[(0,S.jsx)(`h2`,{id:`azd-shortcuts-title`,className:`mb-4 text-[15px] font-semibold text-fg-strong`,children:r.files.shortcuts.title}),(0,S.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-[13px]`,children:n.map(e=>(0,S.jsxs)(`div`,{className:`contents`,children:[(0,S.jsx)(`dt`,{children:(0,S.jsx)(`kbd`,{className:`inline-flex h-6 items-center rounded-md border border-border bg-raised px-1.5 font-mono text-xs text-fg`,children:e.keys})}),(0,S.jsx)(`dd`,{className:`text-muted`,children:e.description(r)})]},e.keys))}),(0,S.jsx)(`p`,{className:`mt-4 text-xs text-muted`,children:r.files.shortcuts.typingNote}),(0,S.jsx)(`form`,{method:`dialog`,className:`mt-3 text-right`,children:(0,S.jsx)(`button`,{type:`submit`,className:d,children:r.files.shortcuts.close})})]})}export{w as n,T as r,O as t};
@@ -1,4 +1,4 @@
1
- import{At as e,dn as t,ln as n,un as r}from"./pull-request-layout-DsDKURcq.js";import{i,t as a}from"./lineChanges-Dw4ZXwVU.js";function o(t,n,r,a=!1){let o=[0];if(r.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let e=t.indexOf(`
1
+ import{_t as e,dn as t,fn as n,pn as r}from"./pull-request-layout-R9F6zMxd.js";import{i,t as a}from"./lineChanges-Dw4ZXwVU.js";function o(t,n,r,a=!1){let o=[0];if(r.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let e=t.indexOf(`
2
2
  `);e!==-1;e=t.indexOf(`
3
3
  `,e+1))o.push(e+1);let s={type:`element`,tagName:`code`,properties:{},children:[]},c=e(n.tokens,{decorations:r.decorations,mergeWhitespaces:r.mergeWhitespaces,lineOffsets:o,cacheHtmlStyles:a});for(let e=0;e<c.length;e++)e>0&&s.children.push({type:`text`,value:`
4
- `}),s.children.push(c[e]);let l={type:`root`,children:[{type:`element`,tagName:`pre`,properties:{class:`diffs`,style:n.rootStyle===!1?void 0:n.rootStyle??[n.fg==null?``:`color:${n.fg}`,n.bg==null?``:`background-color:${n.bg}`].filter(Boolean).join(`;`),tabIndex:0},children:[s]}]};return i(l)}function s(e,t){let n=c([[e,e]],t);return n.length===0?void 0:n[0][0]}function c(e,t){let{changes:n}=t,r=a(t),i=[];for(let[t,a]of e){let e=t,o=0;for(let[t,{range:s}]of n.entries()){let n=r[t][2];if(s.end.line<e)o+=n;else{if(s.start.line>a)break;e<s.start.line&&i.push([e+o,s.start.line-1+o]),e=s.end.line+1,o+=n}}e<=a&&i.push([e+o,a+o])}return i}var l=class{#e;#t;#n=!1;#r;constructor(e,t){this.#e=e,this.#t=t}tokenize(e,t){let n=new Map,r=this.#r;if(this.#r=void 0,r!=null)for(let[t,i]of r){let r=s(t,e);r!=null&&n.set(r,i)}let i=this.#e.applyChange(e,t==null?void 0:this.#i(t));for(let[e,t]of i)n.set(e,t);return n}prebuildStateStack(e,t=!1){this.#e.prime(this.#i(e),t)}flush(e){let t=this.#e.flush(this.#i(e)[1]);if(this.#r!=null)for(let e of t.keys())this.#r.delete(e);return t}getStringCommentRegexpRangesInLine(e){let t=this.#t.textDocument;return this.#t.matchBrackets===!1||e<0||e>=t.lineCount?null:(this.#a(this.#e.flush(e+1)),this.#e.bracketIgnoredRanges(e))}setTheme(e){this.#r=void 0,this.#e.setTheme(e)}pauseBackgroundTokenize(){this.#e.pause()}resumeBackgroundTokenize(){this.#e.resume()}dispose(){this.#n=!0,this.#r=void 0,this.#e.dispose()}#i(e){let{lineCount:t}=this.#t.textDocument,n=Math.min(e?.startingLine??0,t);return[n,Math.min(n+(e?.totalLines??1/0),t)]}#a(e){if(e.size===0)return;let t=this.#r;if(t!=null)for(let[n,r]of e)t.set(n,r);else this.#r=e,queueMicrotask(()=>{let e=this.#r;this.#r=void 0,e!=null&&e.size>0&&!this.#n&&this.#t.onDeferTokenize(e)})}},u=class{name;themeResolver;disposed=!1;constructor(e,t){this.name=e,this.themeResolver=t,r(e)}codeToHtml(e,t){return o(e,this.codeToTokens(e,t),t,this.name===`highlights`)}get isDisposed(){return this.disposed}dispose(){this.disposed||(this.disposed=!0,this.releaseResources(),t())}assertNotDisposed(){if(this.disposed)throw new n}},d=class{disposed=!1;stableOffset=0;unstable=[];pendingCarriageReturn=``;enqueue(e){this.assertActive(),e=this.pendingCarriageReturn+e,this.pendingCarriageReturn=e.endsWith(`\r`)?`\r`:``,this.pendingCarriageReturn!==``&&(e=e.slice(0,-1));let t=this.unstable.length,n=[],{unstable:r,tailLength:i}=this.tokenizeChunk(e,n);return this.pendingCarriageReturn!==``&&r.push({content:`\r`,offset:this.stableOffset+i}),this.unstable=r,{recall:t,stable:n,unstable:r}}pushLineBreak(e,t,n){for(let r=0;r<n.length;r++)e.push({content:n[r],offset:this.stableOffset+t+r});this.stableOffset+=t+n.length}close(){let e=this.unstable;return this.dispose(),{stable:e}}clear(){this.assertActive(),this.stableOffset=0,this.unstable=[],this.pendingCarriageReturn=``,this.resetSource()}dispose(){this.disposed||(this.disposed=!0,this.unstable=[],this.releaseSource())}copyStateTo(e){e.stableOffset=this.stableOffset,e.unstable=this.unstable.slice(),e.pendingCarriageReturn=this.pendingCarriageReturn}assertActive(){if(this.disposed)throw Error(`stream tokenizer is disposed`)}};export{u as n,l as r,d as t};
4
+ `}),s.children.push(c[e]);let l={type:`root`,children:[{type:`element`,tagName:`pre`,properties:{class:`diffs`,style:n.rootStyle===!1?void 0:n.rootStyle??[n.fg==null?``:`color:${n.fg}`,n.bg==null?``:`background-color:${n.bg}`].filter(Boolean).join(`;`),tabIndex:0},children:[s]}]};return i(l)}function s(e,t){let n=c([[e,e]],t);return n.length===0?void 0:n[0][0]}function c(e,t){let{changes:n}=t,r=a(t),i=[];for(let[t,a]of e){let e=t,o=0;for(let[t,{range:s}]of n.entries()){let n=r[t][2];if(s.end.line<e)o+=n;else{if(s.start.line>a)break;e<s.start.line&&i.push([e+o,s.start.line-1+o]),e=s.end.line+1,o+=n}}e<=a&&i.push([e+o,a+o])}return i}var l=class{#e;#t;#n=!1;#r;constructor(e,t){this.#e=e,this.#t=t}tokenize(e,t){let n=new Map,r=this.#r;if(this.#r=void 0,r!=null)for(let[t,i]of r){let r=s(t,e);r!=null&&n.set(r,i)}let i=this.#e.applyChange(e,t==null?void 0:this.#i(t));for(let[e,t]of i)n.set(e,t);return n}prebuildStateStack(e,t=!1){this.#e.prime(this.#i(e),t)}flush(e){let t=this.#e.flush(this.#i(e)[1]);if(this.#r!=null)for(let e of t.keys())this.#r.delete(e);return t}getStringCommentRegexpRangesInLine(e){let t=this.#t.textDocument;return this.#t.matchBrackets===!1||e<0||e>=t.lineCount?null:(this.#a(this.#e.flush(e+1)),this.#e.bracketIgnoredRanges(e))}setTheme(e){this.#r=void 0,this.#e.setTheme(e)}pauseBackgroundTokenize(){this.#e.pause()}resumeBackgroundTokenize(){this.#e.resume()}dispose(){this.#n=!0,this.#r=void 0,this.#e.dispose()}#i(e){let{lineCount:t}=this.#t.textDocument,n=Math.min(e?.startingLine??0,t);return[n,Math.min(n+(e?.totalLines??1/0),t)]}#a(e){if(e.size===0)return;let t=this.#r;if(t!=null)for(let[n,r]of e)t.set(n,r);else this.#r=e,queueMicrotask(()=>{let e=this.#r;this.#r=void 0,e!=null&&e.size>0&&!this.#n&&this.#t.onDeferTokenize(e)})}},u=class{name;themeResolver;disposed=!1;constructor(e,t){this.name=e,this.themeResolver=t,n(e)}codeToHtml(e,t){return o(e,this.codeToTokens(e,t),t,this.name===`highlights`)}get isDisposed(){return this.disposed}dispose(){this.disposed||(this.disposed=!0,this.releaseResources(),r())}assertNotDisposed(){if(this.disposed)throw new t}},d=class{disposed=!1;stableOffset=0;unstable=[];pendingCarriageReturn=``;enqueue(e){this.assertActive(),e=this.pendingCarriageReturn+e,this.pendingCarriageReturn=e.endsWith(`\r`)?`\r`:``,this.pendingCarriageReturn!==``&&(e=e.slice(0,-1));let t=this.unstable.length,n=[],{unstable:r,tailLength:i}=this.tokenizeChunk(e,n);return this.pendingCarriageReturn!==``&&r.push({content:`\r`,offset:this.stableOffset+i}),this.unstable=r,{recall:t,stable:n,unstable:r}}pushLineBreak(e,t,n){for(let r=0;r<n.length;r++)e.push({content:n[r],offset:this.stableOffset+t+r});this.stableOffset+=t+n.length}close(){let e=this.unstable;return this.dispose(),{stable:e}}clear(){this.assertActive(),this.stableOffset=0,this.unstable=[],this.pendingCarriageReturn=``,this.resetSource()}dispose(){this.disposed||(this.disposed=!0,this.unstable=[],this.releaseSource())}copyStateTo(e){e.stableOffset=this.stableOffset,e.unstable=this.unstable.slice(),e.pendingCarriageReturn=this.pendingCarriageReturn}assertActive(){if(this.disposed)throw Error(`stream tokenizer is disposed`)}};export{u as n,l as r,d as t};
@@ -6,7 +6,7 @@
6
6
  <meta name="color-scheme" content="dark light" />
7
7
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
8
  <title>azdiffs</title>
9
- <script type="module" crossorigin src="/assets/index-B297yCgq.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-DsrXp1aY.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-BLXQ4ufn.js">
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-CjZUV4-4.css">
12
12
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azdiffs",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Fast pull request review for Azure DevOps, served from your terminal",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{In as e,u as t,zn as n}from"./index-B297yCgq.js";import{n as r}from"./pull-request-layout-DsDKURcq.js";var i=n();function a(){let{organization:n,repository:a,pullRequestId:o}=t.useParams();return(0,i.jsx)(r,{location:{organization:n,project:a,repository:a,pullRequestId:o},shortForm:!0,children:(0,i.jsx)(e,{})})}export{a as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./commit-diff-view-CQeZylif.js";import{n as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{organization:n,repository:i,pullRequestId:a,commitId:o}=t.useParams();return(0,r.jsx)(e,{location:{organization:n,project:i,repository:i,pullRequestId:a},commitId:o,shortForm:!0})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./overview-view-cEOsI9TY.js";import{zn as t}from"./index-B297yCgq.js";var n=t();function r(){return(0,n.jsx)(e,{section:`commits`})}export{r as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./conflicts-view-CnGEkjaP.js";import{s as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{file:n}=t.useSearch(),i=t.useNavigate();return(0,r.jsx)(e,{file:n??null,onFileChange:e=>void i({search:{file:e},replace:!0})})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./files-view-Bu3bjrNf.js";import{o as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{organization:n,repository:i,pullRequestId:a}=t.useParams(),{since:o,panel:s}=t.useSearch(),c=t.useNavigate();return(0,r.jsx)(e,{location:{organization:n,project:i,repository:i,pullRequestId:a},since:o??null,initialPanel:s??`files`,onSinceChange:e=>void c({search:e===null?{}:{since:e}})})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./overview-view-cEOsI9TY.js";import{c as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{section:n}=t.useSearch();return(0,r.jsx)(e,{section:n??`description`})}export{i as component};
@@ -1 +0,0 @@
1
- import{In as e,l as t,zn as n}from"./index-B297yCgq.js";import{n as r}from"./pull-request-layout-DsDKURcq.js";var i=n();function a(){let{organization:n,project:a,repository:o,pullRequestId:s}=t.useParams();return(0,i.jsx)(r,{location:{organization:n,project:a,repository:o,pullRequestId:s},shortForm:!1,children:(0,i.jsx)(e,{})})}export{a as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./commit-diff-view-CQeZylif.js";import{t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{organization:n,project:i,repository:a,pullRequestId:o,commitId:s}=t.useParams();return(0,r.jsx)(e,{location:{organization:n,project:i,repository:a,pullRequestId:o},commitId:s,shortForm:!1})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./overview-view-cEOsI9TY.js";import{zn as t}from"./index-B297yCgq.js";var n=t();function r(){return(0,n.jsx)(e,{section:`commits`})}export{r as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./conflicts-view-CnGEkjaP.js";import{i as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{file:n}=t.useSearch(),i=t.useNavigate();return(0,r.jsx)(e,{file:n??null,onFileChange:e=>void i({search:{file:e},replace:!0})})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./files-view-Bu3bjrNf.js";import{r as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{organization:n,project:i,repository:a,pullRequestId:o}=t.useParams(),{since:s,panel:c}=t.useSearch(),l=t.useNavigate();return(0,r.jsx)(e,{location:{organization:n,project:i,repository:a,pullRequestId:o},since:s??null,initialPanel:c??`files`,onSinceChange:e=>void l({search:e===null?{}:{since:e}})})}export{i as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./overview-view-cEOsI9TY.js";import{a as t,zn as n}from"./index-B297yCgq.js";var r=n();function i(){let{section:n}=t.useSearch();return(0,r.jsx)(e,{section:n??`description`})}export{i as component};
@@ -1 +0,0 @@
1
- import{$ as e,Ln as t,at as n,ct as r,d as i,xn as a,zn as o}from"./index-B297yCgq.js";import{i as s,r as c,t as l}from"./home-page-Y5jGxOav.js";import{t as u}from"./inbox-jP8QPtzZ.js";var d=o();function f({organization:i}){let o=a(n());if(o.isPending)return null;let f=r(o.data,i);return(0,d.jsx)(e,{sidebarLabel:`Inbox`,sidebar:(0,d.jsx)(u,{organizations:[{name:f?.name??i,project:f?.project??null}],linkOrganizations:!1}),topBar:(0,d.jsx)(c,{title:i}),children:(0,d.jsx)(l,{title:i,text:`Select a pull request from the sidebar, or paste a link.`,aside:(0,d.jsx)(t,{to:`/`,className:`block text-xs text-muted hover:text-fg hover:underline`,children:`All organizations`}),children:(0,d.jsx)(s,{})})})}function p(){let{organization:e}=i.useParams();return(0,d.jsx)(f,{organization:e},e.toLowerCase())}export{p as component};