@acemarke/diffloupe 0.4.0 → 0.5.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.
- package/README.md +89 -16
- package/dist/index.js +279 -230
- package/dist/review-core/opencode/governor.ts +106 -17
- package/dist/review-core/system.md +2 -0
- package/dist/web/assets/index-DY3NZSRS.js +14 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index--5PmAinD.js +0 -14
|
@@ -78,6 +78,8 @@ import path from "node:path";
|
|
|
78
78
|
const NUDGE_AT = 0.75;
|
|
79
79
|
/** Multiple of the binding limit at which an agent with no findings file is interrupted. */
|
|
80
80
|
const ABORT_AT = 2;
|
|
81
|
+
/** Steps kept back below OpenCode's `steps` cap for writing the findings file. */
|
|
82
|
+
const STEP_RESERVE = 5;
|
|
81
83
|
/**
|
|
82
84
|
* Ceiling on any single shell command, in milliseconds.
|
|
83
85
|
*
|
|
@@ -229,7 +231,9 @@ const splitSegments = (cmd: string): { sep: string; text: string }[] => {
|
|
|
229
231
|
continue;
|
|
230
232
|
}
|
|
231
233
|
const two = cmd.slice(i, i + 2);
|
|
232
|
-
const
|
|
234
|
+
const background = c === "&" && cmd[i - 1] !== ">" && cmd[i - 1] !== "|" && cmd[i + 1] !== ">";
|
|
235
|
+
const found =
|
|
236
|
+
two === "&&" || two === "||" ? two : c === ";" || c === "|" || c === "\n" || background ? c : "";
|
|
233
237
|
if (!found) continue;
|
|
234
238
|
out.push({ sep, text: cmd.slice(start, i) });
|
|
235
239
|
sep = found;
|
|
@@ -245,7 +249,8 @@ const commandCore = (segment: string): string =>
|
|
|
245
249
|
segment
|
|
246
250
|
.trim()
|
|
247
251
|
.replace(/^(?:[A-Za-z_][A-Za-z0-9_]*=(?:'[^']*'|"[^"]*"|\S*)\s+)+/, "")
|
|
248
|
-
.replace(/^(?:
|
|
252
|
+
.replace(/^(?:timeout|env|xargs)(?:\s+(?:-\S+|\d[\w.]*|[A-Z][A-Z0-9_]*|[A-Za-z_]\w*=\S*|\{\}))*\s+/, "")
|
|
253
|
+
.replace(/^(?:command|nohup)\s+/, "")
|
|
249
254
|
.trim();
|
|
250
255
|
|
|
251
256
|
/**
|
|
@@ -278,8 +283,68 @@ const fileArgs = (core: string): string[] =>
|
|
|
278
283
|
(tok.includes("/") || /\.[A-Za-z0-9]+$/.test(tok)),
|
|
279
284
|
);
|
|
280
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Commands that reach the network, refused on sight wherever they appear in a
|
|
288
|
+
* command line, pipe targets included.
|
|
289
|
+
*
|
|
290
|
+
* Nothing a review needs is on the network: the pipeline gathers the PR's
|
|
291
|
+
* description and prior comments before any agent starts. What is out there is
|
|
292
|
+
* the rest of the PR thread, which carries the author's arguments and is how a
|
|
293
|
+
* reviewer gets argued out of a finding without judging the code, and on a CI
|
|
294
|
+
* runner the job's token is in the agent's environment. This catches the
|
|
295
|
+
* commands, not every way to open a socket, so CI should restrict outbound
|
|
296
|
+
* network as well. The web tools are denied in the agent config.
|
|
297
|
+
*/
|
|
298
|
+
const NETWORK_COMMAND = new RegExp(
|
|
299
|
+
[
|
|
300
|
+
/^(?:curl|wget|nc|ncat|netcat|telnet|ssh|scp|sftp|ftp|http|https|xh)\b/.source,
|
|
301
|
+
/^gh\s+(?:api|pr|issue|repo|run|search|browse|release|gist|workflow|auth)\b/.source,
|
|
302
|
+
/^git\s+(?:-[Cc]\s+\S+\s+)*(?:fetch|pull|push|clone|ls-remote|remote\s+update|submodule\s+update)\b/.source,
|
|
303
|
+
].join("|"),
|
|
304
|
+
);
|
|
305
|
+
/** Interpreters whose inline code is checked for network calls. */
|
|
306
|
+
const INTERPRETER = /^(?:node|bun|deno|python[0-9.]*|ruby|perl|php)\b/;
|
|
307
|
+
const NETWORK_CODE =
|
|
308
|
+
/\bfetch\s*\(|\bhttps?\.(?:get|request)\b|['"](?:node:)?https?['"]|\burllib\b|\brequests\.|\bhttp\.client\b|\bsocket\b|Net::HTTP|LWP::|XMLHttpRequest|WebSocket|\b(?:Bun|Deno)\.connect\b/;
|
|
309
|
+
|
|
310
|
+
/** Commands nested inside a segment: `$(...)`, backticks, `sh -c '...'` and `eval '...'`. */
|
|
311
|
+
const nestedCommands = (text: string): string[] =>
|
|
312
|
+
[
|
|
313
|
+
/\$\((?<inner>[^()]*)\)/g,
|
|
314
|
+
/`(?<inner>[^`]*)`/g,
|
|
315
|
+
/\b(?:ba|z|da)?sh\s+(?:-[A-Za-z]+\s+)*-[A-Za-z]*c\s+(['"])(?<inner>.*?)\1/g,
|
|
316
|
+
/\beval\s+(['"])(?<inner>.*?)\1/g,
|
|
317
|
+
].flatMap((re) => [...text.matchAll(re)].map((m) => m.groups?.inner ?? ""));
|
|
318
|
+
|
|
319
|
+
const reachesNetwork = (cmd: string, depth = 0): boolean => {
|
|
320
|
+
if (depth > 3) return false;
|
|
321
|
+
for (const segment of splitSegments(cmd)) {
|
|
322
|
+
let core = commandCore(segment.text);
|
|
323
|
+
for (let prev = ""; prev !== core; ) {
|
|
324
|
+
prev = core;
|
|
325
|
+
core = commandCore(
|
|
326
|
+
core
|
|
327
|
+
.replace(/^[({!&]\s*/, "")
|
|
328
|
+
.replace(/^(?:sudo|exec|nice)\s+/, "")
|
|
329
|
+
.replace(/^[^\s'"]*\//, ""),
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
if (NETWORK_COMMAND.test(core)) return true;
|
|
333
|
+
if (INTERPRETER.test(core) && NETWORK_CODE.test(core)) return true;
|
|
334
|
+
if (nestedCommands(segment.text).some((inner) => reachesNetwork(inner, depth + 1))) return true;
|
|
335
|
+
}
|
|
336
|
+
return false;
|
|
337
|
+
};
|
|
338
|
+
|
|
281
339
|
/** Classify a shell command: refused outright, warned, or fine. */
|
|
282
340
|
const checkShellCommand = (cmd: string): { rule: string; tip: string; deny: boolean } | null => {
|
|
341
|
+
if (reachesNetwork(cmd))
|
|
342
|
+
return {
|
|
343
|
+
rule: "network",
|
|
344
|
+
deny: true,
|
|
345
|
+
tip: "reach the network during a review. Everything the review needs is in the checkout and in your instructions; judge the code as it stands.",
|
|
346
|
+
};
|
|
347
|
+
|
|
283
348
|
for (const segment of splitSegments(cmd)) {
|
|
284
349
|
if (segment.sep === "|") continue;
|
|
285
350
|
const core = commandCore(segment.text);
|
|
@@ -433,6 +498,16 @@ async function setup(ctx: GovernorContext) {
|
|
|
433
498
|
const usageFile = process.env.REVIEW_GOVERNOR_USAGE_FILE ?? "";
|
|
434
499
|
const waitForTools = process.env.REVIEW_GOVERNOR_WAIT_FOR_TOOLS ?? "";
|
|
435
500
|
const expectTools = (process.env.REVIEW_GOVERNOR_EXPECT_TOOLS ?? "").split(",").filter(Boolean);
|
|
501
|
+
const maxSteps = Number(process.env.REVIEW_GOVERNOR_MAX_STEPS ?? 0);
|
|
502
|
+
/**
|
|
503
|
+
* The step count at which only the findings write is left. OpenCode's own
|
|
504
|
+
* `steps` cap ends the session with a text-only turn, so a reviewer that
|
|
505
|
+
* reaches it mid-investigation never writes its file. Measured on one
|
|
506
|
+
* 16-slice PR: DeepSeek V4.1 Flash and MiniMax M3.1 Flash each lost three
|
|
507
|
+
* slices this way, at 80 steps and four to nine minutes, long before the
|
|
508
|
+
* time limit would have nudged them. The reserve leaves room for the write.
|
|
509
|
+
*/
|
|
510
|
+
const stepLimit = maxSteps > STEP_RESERVE ? maxSteps - STEP_RESERVE : 0;
|
|
436
511
|
|
|
437
512
|
/**
|
|
438
513
|
* Taken when the plugin loads, which is process start: the whole point is to
|
|
@@ -482,25 +557,36 @@ async function setup(ctx: GovernorContext) {
|
|
|
482
557
|
}
|
|
483
558
|
};
|
|
484
559
|
|
|
485
|
-
/** No limit of
|
|
486
|
-
const capped = budget > 0 || deadlineMs > 0;
|
|
560
|
+
/** No limit of any kind configured means no governing: every stage is inert. */
|
|
561
|
+
const capped = budget > 0 || deadlineMs > 0 || stepLimit > 0;
|
|
487
562
|
const elapsedMs = () => Date.now() - startedAt;
|
|
563
|
+
/** Each limit's progress as a fraction; an unconfigured one stays at zero. */
|
|
564
|
+
const fractions = () => ({
|
|
565
|
+
cost: budget > 0 ? spent / budget : 0,
|
|
566
|
+
time: deadlineMs > 0 ? elapsedMs() / deadlineMs : 0,
|
|
567
|
+
steps: stepLimit > 0 ? usage.numTurns / stepLimit : 0,
|
|
568
|
+
});
|
|
488
569
|
/**
|
|
489
570
|
* How far along the binding limit is, as a fraction. An unconfigured limit
|
|
490
|
-
* contributes zero and so can never be the binding one;
|
|
491
|
-
*
|
|
492
|
-
* ladder rather than
|
|
571
|
+
* contributes zero and so can never be the binding one; otherwise the one
|
|
572
|
+
* nearest its ceiling decides, which makes cost, time and steps a single
|
|
573
|
+
* ladder rather than several that have to agree.
|
|
493
574
|
*/
|
|
494
|
-
const pressure = () =>
|
|
495
|
-
Math.max(budget > 0 ? spent / budget : 0, deadlineMs > 0 ? elapsedMs() / deadlineMs : 0);
|
|
575
|
+
const pressure = () => Math.max(...Object.values(fractions()));
|
|
496
576
|
/** Which limit is in force, for messages the model reads. */
|
|
497
|
-
const binding = (): "cost" | "time" =>
|
|
498
|
-
|
|
577
|
+
const binding = (): "cost" | "time" | "steps" => {
|
|
578
|
+
const f = fractions();
|
|
579
|
+
if (f.steps > f.time && f.steps > f.cost) return "steps";
|
|
580
|
+
return deadlineMs > 0 && (budget <= 0 || f.time >= f.cost) ? "time" : "cost";
|
|
581
|
+
};
|
|
499
582
|
/** One clause naming the limit that is out, in the units it is measured in. */
|
|
500
|
-
const limitNote = () =>
|
|
501
|
-
binding()
|
|
583
|
+
const limitNote = () => {
|
|
584
|
+
const b = binding();
|
|
585
|
+
if (b === "steps") return `Step limit reached: ${usage.numTurns} of ${stepLimit} steps`;
|
|
586
|
+
return b === "time"
|
|
502
587
|
? `Time limit reached: ${Math.round(elapsedMs() / 1000)}s of ${Math.round(deadlineMs / 1000)}s`
|
|
503
588
|
: `Budget exhausted: $${spent.toFixed(2)} of $${budget.toFixed(2)}`;
|
|
589
|
+
};
|
|
504
590
|
const over = () => capped && pressure() >= 1;
|
|
505
591
|
const delivered = () => outFile !== "" && existsSync(outFile);
|
|
506
592
|
|
|
@@ -624,10 +710,13 @@ async function setup(ctx: GovernorContext) {
|
|
|
624
710
|
if (!capped || over() || pressure() < NUDGE_AT) return;
|
|
625
711
|
// Above the limit this is silent, because the refusal in `execute.before`
|
|
626
712
|
// carries the message.
|
|
713
|
+
const b = binding();
|
|
627
714
|
const used =
|
|
628
|
-
|
|
629
|
-
? `You have used ${
|
|
630
|
-
:
|
|
715
|
+
b === "steps"
|
|
716
|
+
? `You have used ${usage.numTurns} of ${stepLimit} steps.`
|
|
717
|
+
: b === "time"
|
|
718
|
+
? `You have used ${Math.round(elapsedMs() / 1000)}s of a ${Math.round(deadlineMs / 1000)}s time limit.`
|
|
719
|
+
: `You have spent $${spent.toFixed(2)} of a $${budget.toFixed(2)} budget.`;
|
|
631
720
|
appendToResult(
|
|
632
721
|
call.result,
|
|
633
722
|
`\n\n[WRAP UP] ${used} ` +
|
|
@@ -708,7 +797,7 @@ async function setup(ctx: GovernorContext) {
|
|
|
708
797
|
);
|
|
709
798
|
});
|
|
710
799
|
|
|
711
|
-
log("setup", { budget, deadlineMs, cwd: process.cwd() });
|
|
800
|
+
log("setup", { budget, deadlineMs, stepLimit, cwd: process.cwd() });
|
|
712
801
|
return () => events.abort();
|
|
713
802
|
}
|
|
714
803
|
|
|
@@ -27,6 +27,7 @@ When you are done, write your findings as JSON to the exact path given in the ta
|
|
|
27
27
|
"confidence": "high" | "medium" | "low",
|
|
28
28
|
"effort": "quick" | "moderate" | "involved",
|
|
29
29
|
"cross_file_refs": ["src/other/file.ts:88"],
|
|
30
|
+
"also_at": ["src/path/to/sibling.ts:41"],
|
|
30
31
|
"suggestion": "concrete fix",
|
|
31
32
|
"suggested_code": "replacement source for the cited lines, if a mechanical fix exists",
|
|
32
33
|
"preexisting": false
|
|
@@ -44,6 +45,7 @@ Rules for the object:
|
|
|
44
45
|
- Every line number you write, in any field, refers to the file **as it exists in the current checkout** — the post-change state. Diff hunk headers look like `@@ -350,7 +380,9 @@`: the `-350` is the old file and must never be cited, the `+380` is the current one. If you are citing a line you have not read directly in this checkout, read it first rather than deriving it from the diff.
|
|
45
46
|
- In prose, lead with the symbol and let the line follow it: "`parseConfig` (`src/config/parse.ts:57`)". A reader who has to correct one of your line numbers can still find the code by name.
|
|
46
47
|
- `cross_file_refs` lists locations outside the diff that you read to support the finding. Empty array if the finding is entirely diff-local.
|
|
48
|
+
- When the same defect appears in more than one place, write one finding at the place you would fix first and list every other occurrence in `also_at` as `path:line`. Do not write a separate finding per copy, and do not leave the other copies only in `evidence`; the author sees `also_at` without expanding anything. Each entry must need the same fix, and you must have read it in this checkout. Omit the field when there is only one occurrence.
|
|
47
49
|
- `effort` is how much work the fix is, judged from the code and not from how much it matters: `quick` for a change confined to the lines you cited, `moderate` for one that touches a few call sites, `involved` for one that needs a design decision or a change to an interface other code depends on. It is what lets a reader pick which findings to clear before merging.
|
|
48
50
|
- `line` is the first line the comment applies to. Set `end_line` only for a multi-line span; omit it otherwise.
|
|
49
51
|
- `severity: "question"` is for a discrepancy you investigated and could not resolve from the code alone, where the author's intent settles it. State both sides in `explanation`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,r as n,t as r}from"./react-jlQz0HNM.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./diffs-D52k9AsX.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./router-DvNvfdSS.js";import{a as x,c as S,i as C,l as w,n as ee,o as te,r as ne,s as T,t as re,u as E}from"./state-a-GRkbSP.js";import{t as D}from"./arktype-bg7F_Ihs.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var O=e(n(),1),ie=r(),k=S.withTypes(),A=w.withTypes(),ae=E.withTypes(),oe=`diffloupe:view`,se={diffStyle:`split`,wrap:!1,theme:`system`,fileTreeLayout:`tree`,sidebar:!0,collapsedFiles:{},collapsedGroups:{}};function ce(){try{let e=JSON.parse(localStorage.getItem(`diffloupe:view`)??`{}`);if(!e||typeof e!=`object`)return{};let t=e,n={};return(t.diffStyle===`split`||t.diffStyle===`unified`)&&(n.diffStyle=t.diffStyle),typeof t.wrap==`boolean`&&(n.wrap=t.wrap),(t.theme===`system`||t.theme===`light`||t.theme===`dark`)&&(n.theme=t.theme),(t.fileTreeLayout===`tree`||t.fileTreeLayout===`list`)&&(n.fileTreeLayout=t.fileTreeLayout),typeof t.sidebar==`boolean`&&(n.sidebar=t.sidebar),n}catch{return{}}}function le(e,t){let n=e??[];return n.includes(t)?n.filter(e=>e!==t):[...n,t]}var j=x({name:`view`,initialState:()=>({...se,...ce()}),reducers:{diffStyleSet(e,t){e.diffStyle=t.payload},wrapToggled(e){e.wrap=!e.wrap},themeSet(e,t){e.theme=t.payload},fileTreeLayoutSet(e,t){e.fileTreeLayout=t.payload},sidebarToggled(e){e.sidebar=!e.sidebar},filesCollapsedSet(e,t){e.collapsedFiles[t.payload.runId]=t.payload.paths},fileCollapseToggled(e,t){let{runId:n,path:r}=t.payload;e.collapsedFiles[n]=le(e.collapsedFiles[n],r)},fileExpanded(e,t){let{runId:n,path:r}=t.payload,i=e.collapsedFiles[n];i?.includes(r)&&(e.collapsedFiles[n]=i.filter(e=>e!==r))},groupFoldToggled(e,t){let{runId:n,groupId:r}=t.payload;e.collapsedGroups[n]=le(e.collapsedGroups[n],r)}},selectors:{selectSavedView:e=>({diffStyle:e.diffStyle,wrap:e.wrap,theme:e.theme,fileTreeLayout:e.fileTreeLayout,sidebar:e.sidebar}),selectDiffStyle:e=>e.diffStyle,selectWrap:e=>e.wrap,selectTheme:e=>e.theme,selectFileTreeLayout:e=>e.fileTreeLayout,selectSidebar:e=>e.sidebar,selectCollapsedFiles:(e,t)=>e.collapsedFiles[t],selectCollapsedGroups:(e,t)=>e.collapsedGroups[t]}}),{diffStyleSet:ue,wrapToggled:de,themeSet:fe,fileTreeLayoutSet:pe,sidebarToggled:me,filesCollapsedSet:he,fileCollapseToggled:ge,fileExpanded:_e,groupFoldToggled:ve}=j.actions,{selectSavedView:ye,selectDiffStyle:be,selectWrap:xe,selectTheme:Se,selectFileTreeLayout:Ce,selectSidebar:we,selectCollapsedFiles:Te,selectCollapsedGroups:Ee}=j.selectors,De={message:`_message_1k4pr_1`,error:`_error_1k4pr_15`,actions:`_actions_1k4pr_26`,button:`_button_1k4pr_32`},M=t(),Oe=()=>null;function ke(){let e=A(Se);(0,O.useEffect)(()=>{let t=document.documentElement;e===`system`?delete t.dataset.theme:t.dataset.theme=e},[e])}function Ae(){return ke(),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_,{}),(0,M.jsx)(O.Suspense,{children:(0,M.jsx)(Oe,{position:`bottom-right`})})]})}function je(){return(0,M.jsxs)(`main`,{className:De.message,children:[(0,M.jsx)(`h1`,{children:`Not found`}),(0,M.jsx)(`p`,{children:`There is nothing at this address.`}),(0,M.jsx)(v,{to:`/`,children:`Back to runs`})]})}function Me({error:e}){let t=m();return(0,M.jsxs)(`main`,{className:De.message,children:[(0,M.jsx)(`h1`,{children:`Something went wrong`}),(0,M.jsx)(`pre`,{className:De.error,children:Ne(e)}),(0,M.jsxs)(`div`,{className:De.actions,children:[(0,M.jsx)(`button`,{type:`button`,className:De.button,onClick:()=>void t.invalidate(),children:`Retry`}),(0,M.jsx)(v,{to:`/`,children:`Back to runs`})]})]})}function Ne(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e;if(t.data&&typeof t.data==`object`&&`error`in t.data)return String(t.data.error);if(typeof t.error==`string`)return t.error;if(t.status!==void 0)return`Request failed (${String(t.status)})`}return String(e)}var Pe=p()({component:Ae,notFoundComponent:je,errorComponent:Me});function Fe(e){let t=new Map;for(let n of s(e))for(let e of n.files)t.set(e.name,e);return t}var Ie=new Map;function Le(e,t){let n=Ie.get(e);if(n&&n.patch===t)return n.files;let r=Fe(t);return Ie.set(e,{patch:t,files:r}),r}var N={dialog:`_dialog_14w5c_1`,header:`_header_14w5c_16`,title:`_title_14w5c_20`,hint:`_hint_14w5c_26`,text:`_text_14w5c_31`,keys:`_keys_14w5c_43`,key:`_key_14w5c_43`,actions:`_actions_14w5c_70`,button:`_button_14w5c_76`};function Re({text:e,onClose:t}){let n=(0,O.useRef)(null),r=(0,O.useRef)(null);return(0,O.useEffect)(()=>{n.current?.showModal(),r.current?.select()},[]),(0,M.jsxs)(`dialog`,{ref:n,className:N.dialog,"aria-labelledby":`copy-fallback-title`,onClose:t,children:[(0,M.jsx)(`header`,{className:N.header,children:(0,M.jsx)(`h2`,{id:`copy-fallback-title`,className:N.title,children:`Copy this text`})}),(0,M.jsx)(`p`,{className:N.hint,children:`The browser blocked clipboard access. The text is selected; press Ctrl+C or ⌘C.`}),(0,M.jsx)(`textarea`,{ref:r,className:N.text,readOnly:!0,value:e,rows:16}),(0,M.jsx)(`div`,{className:N.actions,children:(0,M.jsx)(`button`,{type:`button`,className:N.button,onClick:()=>n.current?.close(),children:`Close`})})]})}var ze=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`m213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32`})]})),Be=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`m181.66 133.66l-80 80a8 8 0 0 1-11.32-11.32L164.69 128L90.34 53.66a8 8 0 0 1 11.32-11.32l80 80a8 8 0 0 1 0 11.32`})]})),Ve={blocker:`Blocker`,"should-fix":`Should fix`,"nice-to-have":`Nice to have`,question:`Question`};function He(e){switch(e.kind){case`pr`:return`#${e.number} ${e.title}`;case`staged`:return e.branch?`Staged changes on ${e.branch}`:`Staged changes`;case`worktree`:return e.branch?`Working tree on ${e.branch}`:`Working tree`;default:return`${e.kind[0].toUpperCase()}${e.kind.slice(1)} ${e.spec}`}}function Ue(e){return e===0?`$0`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function We(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`}var Ge=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Ke(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:Ge.format(t)}function qe(e,t=Date.now()){let n=(t-new Date(e).getTime())/1e3;return Number.isFinite(n)?n<60?`just now`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:Ke(e):e}function P(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Je(e){return/^[0-9a-f]{40}$/i.test(e)?e.slice(0,12):e}function Ye(e,t,n){return e.filter(e=>e.bottom>t&&e.top<n).map(e=>e.id)}function Xe(e,t,n){if(e.length===0||t<=n)return null;let r=e[0];for(let t of e){if(t.top>n)break;r=t}return r.path}var Ze={groups:[],files:{}},Qe=`[data-app-header]`,$e=`[data-group-section]`,et=`[data-file-start]`;function tt(){let e=document.querySelector(Qe);return e?Math.max(0,e.getBoundingClientRect().bottom):0}function nt(){let e=tt(),t=window.innerHeight,n=[...document.querySelectorAll($e)].map(e=>{let t=e.getBoundingClientRect();return{id:e.dataset.groupSection??``,top:t.top,bottom:t.bottom,el:e}}),r=Ye(n,e,t),i={};for(let t of n){if(!r.includes(t.id))continue;let n=Xe([...t.el.querySelectorAll(et)].map(e=>({path:e.dataset.path??``,top:e.getBoundingClientRect().top})),t.bottom,e);n!==null&&(i[t.id]=n)}return{groups:r,files:i}}var rt=(e,t)=>e.groups.length===t.groups.length&&e.groups.every((e,n)=>e===t.groups[n])&&Object.keys(e.files).length===Object.keys(t.files).length&&Object.entries(e.files).every(([e,n])=>t.files[e]===n);function it(e,t){let[n,r]=(0,O.useState)(Ze);return(0,O.useEffect)(()=>{if(!e)return;let t=0,n=()=>{t=0;let e=nt();r(t=>rt(t,e)?t:e)},i=()=>{t===0&&(t=requestAnimationFrame(n))};i(),document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),window.addEventListener(`resize`,i);let a=new ResizeObserver(i);return a.observe(document.body),()=>{document.removeEventListener(`scroll`,i,{capture:!0}),window.removeEventListener(`resize`,i),a.disconnect(),t!==0&&cancelAnimationFrame(t)}},[e,t]),n}var at=e=>`group-${e}`;function ot(e){document.getElementById(at(e))?.scrollIntoView({behavior:`smooth`,block:`start`})}function st(e,t,n=8){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top+n?e.scrollTop-=r.top+n-i.top:i.bottom>r.bottom-n&&(e.scrollTop+=i.bottom-(r.bottom-n))}function ct(e,t){return document.getElementById(at(e))?.querySelector(`[data-file-start][data-path="${CSS.escape(t)}"]`)??null}function lt(e,t,n={}){let r=0,i=()=>{let a=ct(e,t);if(!a)return;let o=a.getBoundingClientRect().top-tt();Math.abs(o)>2&&window.scrollBy({top:o,behavior:`instant`}),++r<6&&(r<2||Math.abs(o)>2)?requestAnimationFrame(i):n.focus&&a.focus({preventScroll:!0})};requestAnimationFrame(i)}var ut=120;function dt(e,t,n){let r=0,i=0,a=!1,o=()=>{if(++r>90)return;let s=document.getElementById(n);if(s&&s.getClientRects().length>0){let e=s.getBoundingClientRect().top-tt()-ut;Math.abs(e)>2?(window.scrollBy({top:e,behavior:`instant`}),i=0):i++,i<2?requestAnimationFrame(o):s.focus({preventScroll:!0});return}let c=ct(e,t);if(c){if(!a)a=!0,window.scrollBy({top:c.getBoundingClientRect().top-tt(),behavior:`instant`});else if(r%3==0){if((c.nextElementSibling?.getBoundingClientRect().bottom??0)<=window.innerHeight)return;window.scrollBy({top:window.innerHeight*.8,behavior:`instant`})}requestAnimationFrame(o)}};requestAnimationFrame(o)}function ft(){let e=tt()+4,t=null;for(let n of document.querySelectorAll(`[data-file-start]`))if(n.getBoundingClientRect().top<=e)t=n;else break;let n=t?.closest(`[data-group-section]`),r=t?.dataset.path;return n?.dataset.groupSection&&r?{groupId:n.dataset.groupSection,path:r}:null}var pt={stats:`_stats_1audl_1`,add:`_add_1audl_9`,del:`_del_1audl_13`,binary:`_binary_1audl_17`};function F({additions:e,deletions:t,binary:n}){return n&&e===0&&t===0?(0,M.jsx)(`span`,{className:pt.binary,children:`binary`}):(0,M.jsxs)(`span`,{className:pt.stats,children:[(0,M.jsxs)(`span`,{className:pt.add,children:[`+`,e]}),(0,M.jsxs)(`span`,{className:pt.del,children:[`-`,t]})]})}var mt=D(`'running' | 'complete' | 'failed' | 'cancelled'`),ht=D({kind:`'pr'`,number:`number`,url:`string`,title:`string`,author:`string`,baseRef:`string`,headRef:`string`,state:`string`,isDraft:`boolean`}).or({kind:`'range' | 'branch' | 'commit'`,spec:`string`}).or({kind:`'staged' | 'worktree'`,"branch?":`string`}),gt=D(`'additions' | 'deletions'`),_t=D(`'not-in-diff' | 'far-from-diff' | 'no-line' | 'deleted-file' | 'no-hunks'`),vt=D({file:`string`,side:gt,kind:`'line' | 'nearby' | 'file'`,line:`number`,"endLine?":`number`,cited:{line:`number`,"endLine?":`number`},"text?":`string`,"reason?":_t}),yt=D(`'added' | 'removed' | 'modified' | 'renamed' | 'copied'`),bt=D(`'product' | 'deploy' | 'tooling'`),xt=D({path:`string`,"previousPath?":`string`,status:yt,additions:`number`,deletions:`number`,isBinary:`boolean`,"blob?":`string`,groupId:`string`,classification:`'code' | 'docs' | 'skip'`,"surface?":bt}),St=D(`'bug' | 'wrench' | 'path' | 'flask' | 'doc' | 'gear'`),Ct=D({id:`string`,"parentId?":`string`,title:`string`,"summary?":`string`,"icon?":St,files:`string[]`,findingIds:`string[]`,stopIds:`string[]`,critical:`boolean`}),wt=D({id:`string`,chapterId:`string`,index:`number`,title:`string`,"prose?":`string`,importance:`'critical' | 'normal' | 'context'`,locations:vt.and({"label?":`string`}).array()}),Tt=D(`'blocker' | 'should-fix' | 'nice-to-have' | 'question'`),Et=D({id:`string`,file:`string`,anchor:vt,severity:Tt,category:`string`,title:`string`,explanation:`string`,evidence:`string`,"impact?":`string`,confidence:`'high' | 'medium' | 'low'`,"effort?":`'quick' | 'moderate' | 'involved'`,"suggestion?":`string`,"suggestedCode?":`string`,"crossFileRefs?":D({file:`string`,"line?":`number`}).array(),"alsoAt?":D({file:`string`,"line?":`number`}).array(),"repeatOf?":`number`,"carriedFrom?":`string`,"surface?":bt,"preexisting?":`boolean`}),Dt=D({input:`number`,output:`number`,reasoning:`number`,cacheRead:`number`,cacheWrite:`number`,"firstStep?":{input:`number`,cacheRead:`number`,cacheWrite:`number`}}),Ot=D({unit:`string`,part:`number`,parts:`number`,status:`'ok' | 'failed'`,costUsd:`number`,wallMs:`number`,"usage?":Dt}),kt=D({costUsd:`number`,wallMs:`number`,"usage?":Dt}),At=D({root:`string`,"slug?":`string`,"remote?":`boolean`}),jt=D(`'review' | 'diff'`);function Mt(e){return e.meta.kind??`review`}var Nt=D({fp:`string`,outcome:`'withdrawn' | 'upheld' | 'unjudged'`,"earlier?":`boolean`,"file?":`string`,"line?":`string`,"claim?":`string`,"note?":`string`}),Pt=D({open:`number`,fixed:`number`,withdrawn:`number`,upheld:`number`,fixedThisRound:`number`,withdrawnThisRound:`number`,new:`number`}),Ft=D({id:`string`,acted:`boolean`,control:`boolean`}),It=D({schemaVersion:`1`,id:`string`,status:mt,createdAt:`string`,repo:At,target:ht,base:`string`,head:`string`,intent:{"stated?":`string`,"inferred?":`string`,"alignment?":`'aligned' | 'partial' | 'misaligned'`,"matches?":`string[]`,"mismatches?":`string[]`,"unstated?":`string[]`,"missing?":`string[]`},overview:{"focus?":`string`,"changeType?":`string`,startHere:D({file:`string`,why:`string`}).array()},files:xt.array(),groups:Ct.array(),stops:wt.array(),findings:Et.array(),overCapFindings:Et.array(),resolved:D({id:`string`,"note?":`string`,"title?":`string`,"file?":`string`}).array(),"disputes?":Nt.array(),"roundProgress?":Pt,unreviewed:{overCap:`string[]`,failed:`string[]`,"budget?":`string[]`},meta:{"model?":`string`,"effort?":`string`,"models?":{"review?":{model:`string`,"source?":`string`},"coordinator?":{model:`string`,"source?":`string`},"walkthrough?":{model:`string`,"source?":`string`},"intent?":{model:`string`,"source?":`string`}},"kind?":jt,wallMs:`number`,costUsd:`number`,slices:Ot.array(),"stages?":{"coordinator?":kt,"walkthrough?":kt,"intent?":kt},rejectedCount:`number`,coreSource:`string`,"mergeMode?":`'coordinator' | 'nothing-to-merge' | 'deterministic-fallback'`,"budgetStopped?":`boolean`,"postMinSeverity?":Tt,"reviewScope?":`'full' | 'incremental'`,"reviewedFiles?":`number`,"scopeReason?":`string`,"promptVersion?":`string`,"instructionsHash?":`string`,"roundLimit?":{maxRounds:`number`,round:`number`}},untrackedSkipped:`string[]`,"priorRunId?":`string`,"round?":`number`,"priorActedOn?":Ft.array(),"error?":`string`}),Lt=D(`'open' | 'accepted' | 'dismissed'`),Rt=D(`'wrong' | 'not-worth-fixing' | 'already-handled' | 'duplicate' | 'other'`),zt=[`wrong`,`not-worth-fixing`,`already-handled`,`duplicate`,`other`],Bt=D({reason:Rt,"note?":`string`,at:`string`}),Vt=D({reviewedFiles:D.Record(`string`,`string`),findingStatus:D.Record(`string`,Lt),"findingNotes?":D.Record(`string`,Bt),comments:D({id:`string`,file:`string`,side:gt,line:`number`,"endLine?":`number`,body:`string`}).array(),"submitted?":{at:`string`,"url?":`string`}}),Ht=D({id:`string`,status:mt,createdAt:`string`,target:ht,repo:At,"kind?":jt,findingCounts:{blocker:`number`,"should-fix":`number`,"nice-to-have":`number`,question:`number`},costUsd:`number`,"roundLimited?":`true`,"invalid?":`string`}),Ut=class extends Error{constructor(e){super(e),this.name=`StateOpError`}};function Wt(){return{reviewedFiles:{},findingStatus:{},comments:[]}}var Gt=/^0+$/;function Kt(e,t,n){let r=t.filter(e=>!n.has(e));if(r.length>0)throw new Ut(`unknown ${e}: ${r.join(`, `)}`)}function qt(e,t,n){if(t.op===`reviewed`){let r=new Map(n.files.map(e=>[e.path,e]));Kt(t.paths.length===1?`file`:`files`,t.paths,new Set(r.keys()));let i={...e.reviewedFiles};for(let e of t.paths){let n=r.get(e);t.value?i[e]=n?.status===`removed`||!n?.blob||Gt.test(n.blob)?``:n.blob:delete i[e]}return{...e,reviewedFiles:i}}if(t.ids.length===0)throw new Ut(`no finding ids given`);let r=new Set([...n.findings,...n.overCapFindings].map(e=>e.id));if(Kt(t.ids.length===1?`finding`:`findings`,t.ids,r),t.status===`dismissed`&&!t.reason)throw new Ut(`dismissing a finding needs a reason`);let i={...e.findingStatus},a={...e.findingNotes};for(let e of t.ids)delete a[e],t.status===`open`?delete i[e]:i[e]=t.status,t.status===`dismissed`&&t.reason&&(a[e]={reason:t.reason,...t.note?{note:t.note}:{},at:t.at});let o={...e,findingStatus:i,findingNotes:a};return Object.keys(a).length===0&&delete o.findingNotes,o}D({"+":`reject`,"target?":`string`,"repo?":`string`,"base?":`string`,"intent?":`string`,"models?":{"+":`reject`,"review?":`string`,"coordinator?":`string`,"walkthrough?":`string`,"intent?":`string`},"effort?":`string`,"maxCostUsd?":`number > 0`,"maxRounds?":`number.integer > 0`,"settingsFile?":`string`,"kind?":jt,"walkthrough?":`boolean`,"fromRun?":`string`,"full?":`boolean`,"github?":`boolean`,"head?":/^[0-9a-fA-F]{40}$/});var Jt=D({id:`string`,url:`string`});D({status:Lt,"reason?":Rt,"note?":`string`}),D({path:`string`,reviewed:`boolean`});var Yt=D(`'resolving_target' | 'checking_registry' | 'building_map' | 'grouping' | 'reviewing' | 'coordinating' | 'walkthrough' | 'verifying' | 'writing'`),Xt=D({type:`'stage'`,stage:Yt}).or({type:`'slice'`,index:`number`,total:`number`,title:`string`,status:`'started' | 'ok' | 'failed'`,"costUsd?":`number`,"wallMs?":`number`,"findings?":`number`}).or({type:`'log'`,message:`string`}).or({type:`'cost'`,totalUsd:`number`}).or({type:`'budget'`,totalUsd:`number`,limitUsd:`number`,skippedSlices:`number`}),Zt=D({type:`'groups'`,groups:Ct.array(),files:D({path:`string`,groupId:`string`,classification:`'code' | 'docs' | 'skip'`}).array()}),Qt=Xt.or(Zt).or({type:`'done'`,status:`'complete'`,findings:`number`,"carriedOver?":`number`,costUsd:`number`,wallMs:`number`,"noChanges?":`boolean`,"roundLimit?":`number`,"kind?":jt,"files?":`number`}).or({type:`'cancelled'`}).or({type:`'error'`,message:`string`}).and({seq:`number`,at:`string`}),$t=D({app:`'diffloupe'`,version:`string`,pid:`number`,defaultRepo:`string | null`,activeRunId:`string | null`,gh:{available:`boolean`,authed:`boolean`,"message?":`string`},opencode:{path:`string | null`,version:`string | null`}});D({error:`string`,"activeRunId?":`string`});function en(e,t){let n=new Map(t.files.map(e=>[e.path,e]));return{...e,groups:t.groups,files:e.files.map(e=>{let t=n.get(e.path);return t?{...e,groupId:t.groupId,classification:t.classification}:e})}}var tn=[`stage`,`slice`,`log`,`cost`,`budget`,`done`,`cancelled`,`error`],nn=new Set([`done`,`cancelled`,`error`]);function rn(e,t){let n=new EventSource(`/api/runs/${encodeURIComponent(e)}/events`),r=!1,i=()=>{r||(r=!0,n.close(),t.onEnd())},a=r=>{if(!(r instanceof MessageEvent)){n.readyState===EventSource.CLOSED&&i();return}let a;try{a=JSON.parse(String(r.data))}catch{console.warn(`[diffloupe] run ${e}: event is not JSON`,r.data);return}let o=Qt(a);o instanceof D.errors?console.warn(`[diffloupe] run ${e}: skipping malformed event: ${o.summary}`):(t.onEvent(o),nn.has(o.type)&&i())};for(let e of tn)n.addEventListener(e,a);return n.addEventListener(`end`,i),()=>{r=!0,n.close()}}var an=D(`string > 0`),on=()=>({slicesTotal:0,slicesDone:0,slicesFailed:0,activeSlices:[],costUsd:0}),I=re({reducerPath:`api`,baseQuery:ee({baseUrl:`/api`}),tagTypes:[`Run`,`RunList`,`RunState`],onSchemaFailure:(e,t)=>{console.error(`[diffloupe] ${t.endpoint} ${e.schemaName} failed:`,e.issues)},catchSchemaFailure:(e,t)=>({status:`CUSTOM_ERROR`,error:`${t.endpoint} returned data that does not match the expected shape: ${e.message}`}),endpoints:e=>({getHealth:e.query({query:e=>`/health`,responseSchema:$t}),listRuns:e.query({query:e=>`/runs`,responseSchema:Ht.array(),providesTags:[`RunList`]}),getRun:e.query({query:e=>`/runs/${encodeURIComponent(e)}`,argSchema:an,responseSchema:It,providesTags:(e,t,n)=>[{type:`Run`,id:n}],async onCacheEntryAdded(e,{cacheDataLoaded:t,cacheEntryRemoved:n,updateCachedData:r,dispatch:i,getCacheEntry:a}){try{await t}catch{return}if(a().data?.status!==`running`)return;let o=rn(e,{onEvent(e){e.type===`groups`?r(t=>{let n=en(t,e);t.groups=n.groups,t.files=n.files}):r(t=>{let n=t.progress??=on();switch(e.type){case`stage`:n.stage=e.stage;break;case`slice`:n.slicesTotal=e.total,e.status===`started`?n.activeSlices.push(e.title):(n.activeSlices=n.activeSlices.filter(t=>t!==e.title),e.status===`ok`?n.slicesDone+=1:n.slicesFailed+=1),e.costUsd!==void 0&&(n.costUsd=Math.max(n.costUsd,e.costUsd));break;case`cost`:n.costUsd=e.totalUsd;break;case`log`:n.lastMessage=e.message;break;case`budget`:n.lastMessage=`Budget reached: $${e.totalUsd.toFixed(2)} of $${e.limitUsd.toFixed(2)}`}})},onEnd(){i(I.util.invalidateTags([{type:`Run`,id:e},{type:`RunState`,id:e},`RunList`]))}});await n,o()}}),getRunPatch:e.query({query:e=>({url:`/runs/${encodeURIComponent(e)}/diff`,responseHandler:`text`}),argSchema:an,providesTags:(e,t,n)=>[{type:`Run`,id:n}]}),getRunState:e.query({query:e=>`/runs/${encodeURIComponent(e)}/state`,argSchema:an,responseSchema:Vt,providesTags:(e,t,n)=>[{type:`RunState`,id:n}]}),updateRunState:e.mutation({query:({runId:e,op:t})=>{let n=`/runs/${encodeURIComponent(e)}/state`;if(t.op===`reviewed`)return{url:`${n}/files`,method:`PUT`,body:{path:t.paths[0],reviewed:t.value}};let{status:r,reason:i,note:a}=t;return{url:`${n}/findings/${encodeURIComponent(t.ids[0]??``)}`,method:`PUT`,body:{status:r,...i?{reason:i}:{},...a?{note:a}:{}}}},responseSchema:Vt,async onQueryStarted({runId:e,op:t},{dispatch:n,getState:r,queryFulfilled:i}){let a=I.endpoints.getRun.select(e)(r()).data,o=a?n(I.util.updateQueryData(`getRunState`,e,e=>{try{return qt(e,t,a)}catch{return e}})):void 0;try{let{data:t}=await i;n(I.util.upsertQueryData(`getRunState`,e,t))}catch{o?.undo()}}}),startRun:e.mutation({query:e=>({url:`/runs`,method:`POST`,body:e}),responseSchema:Jt,invalidatesTags:[`RunList`]}),deleteRun:e.mutation({query:e=>({url:`/runs/${encodeURIComponent(e)}`,method:`DELETE`}),argSchema:an,invalidatesTags:[`RunList`]})})}),{useGetHealthQuery:sn,useListRunsQuery:cn,useGetRunQuery:ln,useGetRunPatchQuery:un,useGetRunStateQuery:dn,useUpdateRunStateMutation:fn,useStartRunMutation:pn,useDeleteRunMutation:mn}=I,hn=Wt();function gn(e){return dn(e).data??hn}function _n(e){let t=gn(e);return(0,O.useMemo)(()=>new Set(Object.entries(t.findingStatus).flatMap(([e,t])=>t===`dismissed`?[e]:[])),[t.findingStatus])}function vn(e){let[t]=fn();return(0,O.useCallback)(n=>void t({runId:e,op:n}),[e,t])}var yn=`(max-width: 639.98px)`,bn=`(min-width: 1024px)`;function xn(e){return(0,O.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches)}var Sn=(0,O.createContext)(null);function L(){let e=(0,O.useContext)(Sn);if(!e)throw Error(`useRunNav needs a RunNavContext provider`);return e}var Cn={status:`_status_11pfu_1`},wn={added:`A`,removed:`D`,modified:`M`,renamed:`R`,copied:`C`};function Tn({status:e}){return(0,M.jsx)(`span`,{className:Cn.status,"data-status":e,title:e,children:wn[e]})}function En(e,t=``){let n=e.match(/`+/g)??[],r=Math.max(3,...n.map(e=>e.length+1)),i="`".repeat(r);return`${i}${t}\n${e.replace(/\n$/,``)}\n${i}`}function R(e){let t=e.match(/`+/g)??[],n=Math.max(1,...t.map(e=>e.length+1)),r="`".repeat(n),i=e.startsWith("`")||e.endsWith("`")?` `:``;return`${r}${i}${e}${i}${r}`}function Dn(e){return e.kind===`pr`?`PR #${e.number} ${e.title}`:`spec`in e?`${e.kind} ${e.spec}`:e.branch?`${e.kind} (${e.branch})`:e.kind}function On(e){if(!e.round||e.round<2)return;let{reviewScope:t,reviewedFiles:n,scopeReason:r}=e.meta;if(t===`incremental`){let t=n??0;return t===0?`Round ${e.round}: no code changed since the last review`:`Round ${e.round}: only the ${t===1?`file`:`${t} files`} changed since the last review ${t===1?`was`:`were`} reviewed again`}return`Round ${e.round}: full review${r?` (${r})`:``}`}var z=[`blocker`,`should-fix`,`nice-to-have`,`question`],kn={ts:`ts`,mts:`ts`,cts:`ts`,tsx:`tsx`,js:`js`,mjs:`js`,cjs:`js`,jsx:`jsx`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`md`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,sh:`sh`,bash:`sh`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`};function An(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0?kn[t.slice(n+1).toLowerCase()]??``:``}function jn(e,t){return t&&t!==e?`${e}-${t}`:`${e}`}function Mn(e){let t=e.side===`deletions`?` (old)`:``;return e.kind===`file`?e.cited.line>0?`${e.file}:${jn(e.cited.line,e.cited.endLine)}`:e.file:e.kind===`nearby`?`${e.file}:${jn(e.cited.line,e.cited.endLine)}${t}`:`${e.file}:${jn(e.line,e.endLine)}${t}`}function Nn(e,t){let n=t?.findingStatus[e.id];if(n===`accepted`)return` (accepted)`;if(n!==`dismissed`)return``;let r=t?.findingNotes?.[e.id]?.reason;return r?` (dismissed: ${r})`:` (dismissed)`}function Pn(e,t,n={}){let r=[`### [${e.severity}] ${e.title}${Nn(e,t)}`,`${R(Mn(e.anchor))} · id ${R(e.id)}`],i=t?.findingStatus[e.id]===`dismissed`?t.findingNotes?.[e.id]?.note?.trim():void 0;i&&r.push(`> Dismissed: ${i}`);let a=[!n.github&&e.carriedFrom&&`Open since run ${e.carriedFrom}.`,e.repeatOf!==void 0&&`Repeats PR comment #${e.repeatOf}.`,e.preexisting&&`Pre-existing: not introduced by this change.`].filter(Boolean);return a.length&&r.push(`_${a.join(` `)}_`),r.push(e.explanation.trim()),e.impact?.trim()&&r.push(`**Impact:** ${e.impact.trim()}`),e.alsoAt?.length&&r.push(`**Also at:** ${e.alsoAt.map(e=>R(e.line?`${e.file}:${e.line}`:e.file)).join(`, `)}`),e.evidence.trim()&&r.push(`**Evidence:** ${e.evidence.trim()}`),e.suggestedCode?(e.suggestion?.trim()&&r.push(`**Suggestion:** ${e.suggestion.trim()}`),r.push(En(e.suggestedCode,An(e.file)))):e.suggestion?.trim()&&r.push(`**Suggestion:** ${e.suggestion.trim()}`),r.join(`
|
|
2
|
+
|
|
3
|
+
`)}function Fn(e){return[...e].sort((e,t)=>z.indexOf(e.severity)-z.indexOf(t.severity)||e.file.localeCompare(t.file)||e.anchor.line-t.anchor.line)}function In(e,t,n){let r=(t.length?` ${t.length} pre-existing.`:``)+(n?` ${n} more over the posting cap.`:``);if(e.length===0)return`${t.length?`No issues found in this change.`:`No issues found.`}${r}`;let i=z.map(t=>[t,e.filter(e=>e.severity===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${e}`),a=e.length;return`${a} finding${a===1?``:`s`}: ${i.join(`, `)}.${r}`}function Ln(e,t){return[`### [${e.severity}] ${e.title}${Nn(e,t)}`,`${R(Mn(e.anchor))} · id ${R(e.id)}`].join(`
|
|
4
|
+
|
|
5
|
+
`)}function Rn(e,t={}){let n=On(e),r=[`# Review findings: ${Dn(e.target)}`,`Base ${R(e.base.slice(0,12))}, head ${R(e.head.slice(0,12))}${n?`. ${n}.`:``}`],{state:i}=t,a=e=>t.includeDismissed||i?.findingStatus[e.id]!==`dismissed`,o=e.findings.filter(a),s=e.overCapFindings.filter(a),c=t.includeOverCap?s:[],l=o.filter(e=>!e.preexisting),u=o.filter(e=>e.preexisting),d=e.findings.length-o.length+e.overCapFindings.length-s.length;r.push(In(l,u,s.length)+(d?` ${d} dismissed finding${d===1?``:`s`} left out.`:``));let f=[Fn(l),Fn(u),Fn(c)],p=Math.min(t.shorten?.count??0,f.flat().length),m=new Set(p>0?f.flat().slice(-p):[]);p>0&&t.shorten&&r.push(t.shorten.note);let h=e=>m.has(e)?Ln(e,i):Pn(e,i,t),[g=[],_=[],v=[]]=f;for(let e of g)r.push(h(e));if(_.length){r.push(`## Pre-existing (not introduced by this change)`);for(let e of _)r.push(h(e))}if(v.length){r.push(`## Over the posting cap (${v.length})`);for(let e of v)r.push(h(e))}return`${r.join(`
|
|
6
|
+
|
|
7
|
+
`)}\n`}var zn=e=>z.indexOf(e.severity);function Bn(e,t){if(e.lineNumber!==t.lineNumber)return e.lineNumber-t.lineNumber;if(e.side!==t.side)return e.side===`deletions`?-1:1;let n=e.metadata,r=t.metadata;return n.kind===r.kind?n.kind===`finding`&&r.kind===`finding`?n.overCap===r.overCap?zn(n.finding)-zn(r.finding):n.overCap?1:-1:0:n.kind===`finding`?-1:1}function Vn(e,t={}){let n=new Map,r=(e,t)=>{let r=n.get(e.file),i={side:e.side,lineNumber:e.kind===`file`?0:e.line,metadata:t};r?r.push(i):n.set(e.file,[i])},i=e=>!t.hidden?.has(e.id);for(let t of e.findings.filter(i))r(t.anchor,{kind:`finding`,finding:t,overCap:!1});if(t.showOverCap)for(let t of e.overCapFindings.filter(i))r(t.anchor,{kind:`finding`,finding:t,overCap:!0});for(let t of e.stops)t.locations.forEach((e,n)=>r(e,{kind:`stop`,stop:t,location:n}));for(let e of n.values())e.sort(Bn);return n}function Hn(e){return e.kind===`file`?null:{start:e.line,end:e.endLine??e.line,side:e.side}}function Un(e){let{line:t,endLine:n}=e.cited;return n!==void 0&&n!==t?`lines ${t}-${n}`:`line ${t}`}function Wn(e){if(e.kind===`line`)return;if(e.kind===`nearby`)return`Cited ${Un(e)}, which the diff does not show. Placed at the nearest changed line.`;let t=e.cited.line>0?`Cited ${Un(e)}. `:``;switch(e.reason){case`not-in-diff`:return`${t}This file is not part of the diff.`;case`far-from-diff`:return`${t}That is too far from any changed line to place on the diff.`;case`deleted-file`:return`${t}The file was deleted.`;case`no-hunks`:return`${t}The file has no content changes to show.`;case`no-line`:return`About the whole file; no line cited.`;default:return t?t.trim():void 0}}var Gn={runId:null,file:null,finding:null,stop:null,stopLocation:0,sidebarMode:`groups`,showOverCap:!1,showDismissed:!1,helpOpen:!1},Kn=x({name:`focus`,initialState:Gn,reducers:{runEntered(e,t){if(e.runId!==t.payload)return{...Gn,runId:t.payload,sidebarMode:e.sidebarMode}},fileFocused(e,t){e.file=t.payload},findingFocused(e,t){e.finding=t.payload.id,t.payload.file&&(e.file=t.payload.file),t.payload.id&&(e.stop=null)},stopFocused(e,t){e.stop=t.payload.id,e.stopLocation=t.payload.location??0,t.payload.file&&(e.file=t.payload.file),t.payload.id&&(e.finding=null)},sidebarModeSet(e,t){e.sidebarMode=t.payload},overCapToggled(e){e.showOverCap=!e.showOverCap},dismissedToggled(e){e.showDismissed=!e.showDismissed},helpSet(e,t){e.helpOpen=t.payload}},selectors:{selectFocusedFile:e=>e.file,selectFocusedFinding:e=>e.finding,selectFocusedStop:e=>e.stop,selectStopLocation:e=>e.stopLocation,selectSidebarMode:e=>e.sidebarMode,selectShowOverCap:e=>e.showOverCap,selectShowDismissed:e=>e.showDismissed,selectHelpOpen:e=>e.helpOpen}}),{runEntered:qn,fileFocused:Jn,findingFocused:Yn,stopFocused:Xn,sidebarModeSet:Zn,overCapToggled:Qn,dismissedToggled:$n,helpSet:er}=Kn.actions,{selectFocusedFile:tr,selectFocusedFinding:nr,selectFocusedStop:rr,selectStopLocation:ir,selectSidebarMode:ar,selectShowOverCap:or,selectShowDismissed:sr,selectHelpOpen:cr}=Kn.selectors,lr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`m229.66 77.66l-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69L218.34 66.34a8 8 0 0 1 11.32 11.32`})]})),ur=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8m-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z`})]})),dr={button:`_button_12iod_1`};function fr({text:e,label:t,title:n}){let{copy:r}=L(),[i,a]=(0,O.useState)(!1);return(0,O.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),1500);return()=>clearTimeout(e)},[i]),(0,M.jsxs)(`button`,{type:`button`,className:dr.button,title:n??t,onClick:async t=>{t.stopPropagation(),await r(e())&&a(!0)},children:[i?(0,M.jsx)(lr,{"aria-hidden":!0}):(0,M.jsx)(ur,{"aria-hidden":!0}),(0,M.jsx)(`span`,{children:i?`Copied`:t})]})}var pr={markdown:`_markdown_c7bef_1`,heading:`_heading_c7bef_42`},mr=/^\s*(?:([-*+])|(\d+)[.)])\s+(.*)$/;function hr(e){let t=[],n=e.replace(/\r\n/g,`
|
|
8
|
+
`).split(`
|
|
9
|
+
`),r=[],i=()=>{r.length>0&&t.push({kind:`p`,text:r.join(` `)}),r=[]};for(let e=0;e<n.length;e++){let a=n[e];if(a.trim()===``){i();continue}if(a.trimStart().startsWith("```")){i();let r=[];for(;++e<n.length&&!n[e].trimStart().startsWith("```");)r.push(n[e]);t.push({kind:`code`,text:r.join(`
|
|
10
|
+
`)});continue}let o=/^(#{1,6})\s+(.*)$/.exec(a);if(o){i(),t.push({kind:`h`,level:o[1].length,text:o[2]});continue}let s=mr.exec(a);if(s){i();let e=s[1]?`ul`:`ol`,n=t.at(-1);n&&n.kind===e?n.items.push(s[3]):t.push({kind:e,items:[s[3]]});continue}let c=t.at(-1);r.length===0&&c&&(c.kind===`ul`||c.kind===`ol`)&&/^\s+\S/.test(a)?c.items[c.items.length-1]+=` ${a.trim()}`:r.push(a.trim())}return i(),t}var gr=/`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*\s][^*]*)\*|_([^_\s][^_]*)_|\[([^\]]+)\]\(([^)\s]+)\)/g;function _r(e){let t=[],n=0;for(let r of e.matchAll(gr)){r.index>n&&t.push(e.slice(n,r.index));let i=r.index;if(r[1]!==void 0)t.push((0,M.jsx)(`code`,{children:r[1]},i));else if(r[2]!==void 0||r[3]!==void 0)t.push((0,M.jsx)(`strong`,{children:_r(r[2]??r[3])},i));else if(r[4]!==void 0||r[5]!==void 0)t.push((0,M.jsx)(`em`,{children:_r(r[4]??r[5])},i));else if(r[6]!==void 0&&r[7]!==void 0){let e=/^(https?:|\/|#)/.test(r[7]);t.push(e?(0,M.jsx)(`a`,{href:r[7],target:`_blank`,rel:`noreferrer`,children:_r(r[6])},i):r[6])}n=r.index+r[0].length}return n<e.length&&t.push(e.slice(n)),t}function vr(e,t){switch(e.kind){case`p`:return(0,M.jsx)(`p`,{children:_r(e.text)},t);case`h`:return(0,M.jsx)(`p`,{className:pr.heading,children:_r(e.text)},t);case`code`:return(0,M.jsx)(`pre`,{children:(0,M.jsx)(`code`,{children:e.text})},t);case`ul`:case`ol`:{let n=e.kind;return(0,M.jsx)(n,{children:e.items.map((e,t)=>(0,M.jsx)(`li`,{children:_r(e)},t))},t)}}}function B({source:e,className:t}){return(0,M.jsx)(`div`,{className:[pr.markdown,t].filter(Boolean).join(` `),children:hr(e).map(vr)})}var V={card:`_card_kmb34_1`,head:`_head_kmb34_50`,severity:`_severity_kmb34_56`,title:`_title_kmb34_65`,meta:`_meta_kmb34_73`,badge:`_badge_kmb34_81`,note:`_note_kmb34_94`,body:`_body_kmb34_101`,details:`_details_kmb34_105`,code:`_code_kmb34_121`,triage:`_triage_kmb34_139`,status:`_status_kmb34_180`,more:`_more_kmb34_184`},yr={wrong:`Wrong`,"not-worth-fixing":`Not worth fixing`,"already-handled":`Already handled`,duplicate:`Duplicate`,other:`Other`};function br({finding:e}){let{runId:t}=L(),n=gn(t),r=vn(t),i=ln(t).data?.status===`running`,[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(`wrong`),[u,d]=(0,O.useState)(``),f=a();(0,O.useEffect)(()=>{f?.markDOMDirty()},[o,f]);let p=n.findingStatus[e.id]??`open`,m=n.findingNotes?.[e.id],h=(t,n={})=>{r({op:`finding`,ids:[e.id],status:t,...n,at:new Date().toISOString()}),s(!1)},g=i?`Available when the run finishes`:void 0;return o?(0,M.jsxs)(`form`,{className:V.triage,onSubmit:e=>{e.preventDefault(),h(`dismissed`,{reason:c,...u.trim()?{note:u.trim()}:{}})},children:[(0,M.jsx)(`select`,{"aria-label":`Reason`,value:c,onChange:e=>l(e.target.value),children:zt.map(e=>(0,M.jsx)(`option`,{value:e,children:yr[e]},e))}),(0,M.jsx)(`input`,{"aria-label":`Note`,placeholder:`Note (optional)`,value:u,onChange:e=>d(e.target.value)}),(0,M.jsx)(`button`,{type:`submit`,children:`Dismiss`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>s(!1),children:`Cancel`})]}):p===`open`?(0,M.jsxs)(`div`,{className:V.triage,children:[(0,M.jsx)(`button`,{type:`button`,disabled:i,title:g??`Mark this finding worth fixing`,onClick:()=>h(`accepted`),children:`Accept`}),(0,M.jsx)(`button`,{type:`button`,disabled:i,title:g??`Dismiss this finding with a reason`,onClick:()=>s(!0),children:`Dismiss`})]}):(0,M.jsxs)(`div`,{className:V.triage,children:[(0,M.jsx)(`span`,{className:V.status,children:p===`accepted`?`Accepted`:`Dismissed: ${yr[m?.reason??`other`]}`}),m?.note&&(0,M.jsx)(`span`,{children:m.note}),(0,M.jsx)(`button`,{type:`button`,disabled:i,title:g,onClick:()=>h(`open`),children:`Reopen`})]})}var xr=(0,O.memo)(function({finding:e,overCap:t}){let n=L(),r=a(),i=gn(n.runId),o=i.findingStatus[e.id]??`open`,s=A(nr)===e.id,[c,l]=(0,O.useState)(!1),u=c||s;(0,O.useEffect)(()=>{r?.markDOMDirty()},[u,o,r]);let d=Wn(e.anchor),f=!!(e.impact||e.evidence||e.suggestion||e.suggestedCode);return(0,M.jsxs)(`article`,{id:`finding-${e.id}`,tabIndex:-1,className:V.card,"data-severity":e.severity,"data-focused":s,"data-preexisting":e.preexisting??!1,"data-status":o,"aria-label":`${Ve[e.severity]}: ${e.title}`,onClick:t=>{t.target.closest(`a, button, select, input`)||s||n.goToFinding(e.id,{scroll:!1})},children:[(0,M.jsxs)(`header`,{className:V.head,children:[(0,M.jsx)(`span`,{className:V.severity,children:Ve[e.severity]}),(0,M.jsx)(`h3`,{className:V.title,children:e.title}),(0,M.jsx)(fr,{label:`Copy`,title:`Copy this finding as Markdown`,text:()=>Pn(e,i)})]}),(0,M.jsxs)(`div`,{className:V.meta,children:[(0,M.jsx)(`span`,{children:e.category}),(0,M.jsxs)(`span`,{children:[e.confidence,` confidence`]}),e.preexisting&&(0,M.jsx)(`span`,{className:V.badge,title:`The problem is in code this change did not add or modify`,children:`pre-existing`}),t&&(0,M.jsx)(`span`,{className:V.badge,children:`over the posting cap`}),e.carriedFrom&&(0,M.jsx)(v,{to:`/runs/$runId`,params:{runId:e.carriedFrom},className:V.badge,children:`from earlier run`}),e.repeatOf!==void 0&&(0,M.jsxs)(`span`,{className:V.badge,children:[`repeats comment #`,e.repeatOf]})]}),d&&(0,M.jsx)(`p`,{className:V.note,children:d}),(0,M.jsx)(B,{source:e.explanation,className:V.body}),e.alsoAt?.length?(0,M.jsx)(B,{source:`Same problem at: ${e.alsoAt.map(e=>`\`${e.line?`${e.file}:${e.line}`:e.file}\``).join(`, `)}`,className:V.note}):null,f&&u&&(0,M.jsxs)(`div`,{className:V.details,children:[e.impact&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h4`,{children:`Impact`}),(0,M.jsx)(B,{source:e.impact})]}),e.evidence&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h4`,{children:`Evidence`}),(0,M.jsx)(B,{source:e.evidence})]}),(e.suggestion||e.suggestedCode)&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h4`,{children:`Suggestion`}),e.suggestion&&(0,M.jsx)(B,{source:e.suggestion}),e.suggestedCode&&(0,M.jsx)(`pre`,{className:V.code,children:(0,M.jsx)(`code`,{children:e.suggestedCode})})]})]}),f&&!s&&(0,M.jsx)(`button`,{type:`button`,className:V.more,onClick:()=>l(!c),"aria-expanded":u,children:u?`Hide details`:`Show details`}),(0,M.jsx)(br,{finding:e})]})}),Sr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M224 128a8 8 0 0 1-8 8H59.31l58.35 58.34a8 8 0 0 1-11.32 11.32l-72-72a8 8 0 0 1 0-11.32l72-72a8 8 0 0 1 11.32 11.32L59.31 120H216a8 8 0 0 1 8 8`})]})),Cr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`m221.66 133.66l-72 72a8 8 0 0 1-11.32-11.32L196.69 136H40a8 8 0 0 1 0-16h156.69l-58.35-58.34a8 8 0 0 1 11.32-11.32l72 72a8 8 0 0 1 0 11.32`})]})),wr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M246 106.65L212.33 69.3a16 16 0 0 0-11.89-5.3H136V32a8 8 0 0 0-16 0v32H40a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h80v64a8 8 0 0 0 16 0v-64h64.44a16 16 0 0 0 11.89-5.3L246 117.35a8 8 0 0 0 0-10.7M200.44 144H40V80h160.44l28.8 32Z`})]})),H={card:`_card_se589_1`,head:`_head_se589_32`,icon:`_icon_se589_38`,kicker:`_kicker_se589_44`,title:`_title_se589_53`,importance:`_importance_se589_61`,label:`_label_se589_71`,note:`_note_se589_76`,body:`_body_se589_82`,nav:`_nav_se589_86`},Tr=(0,O.memo)(function({stop:e,location:t}){let n=L(),r=a(),i=A(n=>rr(n)===e.id&&ir(n)===t);(0,O.useEffect)(()=>{r?.markDOMDirty()},[i,r]);let o=n.stops.findIndex(t=>t.id===e.id),s=n.stops[o-1],c=n.stops[o+1],l=e.locations[t],u=l?Wn(l):void 0,d=e.locations.length>1;return(0,M.jsxs)(`aside`,{id:`stop-${e.id}-${t}`,tabIndex:-1,className:H.card,"data-importance":e.importance,"data-focused":i,"aria-label":`Walkthrough stop ${o+1} of ${n.stops.length}: ${e.title}`,onClick:r=>{r.target.closest(`a, button`)||i||n.goToStop(e.id,t,{scroll:!1})},children:[(0,M.jsxs)(`header`,{className:H.head,children:[(0,M.jsx)(wr,{"aria-hidden":!0,className:H.icon}),(0,M.jsxs)(`span`,{className:H.kicker,children:[`Stop `,o+1,` of `,n.stops.length]}),(0,M.jsx)(`h3`,{className:H.title,children:e.title}),e.importance!==`normal`&&(0,M.jsx)(`span`,{className:H.importance,children:e.importance})]}),l?.label&&(0,M.jsx)(`p`,{className:H.label,children:l.label}),u&&(0,M.jsx)(`p`,{className:H.note,children:u}),e.prose&&(0,M.jsx)(B,{source:e.prose,className:H.body}),(0,M.jsxs)(`nav`,{className:H.nav,"aria-label":`Walkthrough`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:!s,onClick:()=>s&&n.goToStop(s.id),children:[(0,M.jsx)(Sr,{"aria-hidden":!0}),` Previous stop`]}),d&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n.goToStop(e.id,(t+1)%e.locations.length),title:`Location ${t+1} of ${e.locations.length}`,children:[`Next location (`,t+1,`/`,e.locations.length,`)`]}),(0,M.jsxs)(`button`,{type:`button`,disabled:!c,onClick:()=>c&&n.goToStop(c.id),children:[`Next stop `,(0,M.jsx)(Cr,{"aria-hidden":!0})]})]})]})}),U={frame:`_frame_1chdr_1`,caret:`_caret_1chdr_8`,plainHeader:`_plainHeader_1chdr_20`,path:`_path_1chdr_29`,meta:`_meta_1chdr_39`,tag:`_tag_1chdr_45`,count:`_count_1chdr_50`,reviewed:`_reviewed_1chdr_59`,cards:`_cards_1chdr_78`,placeholder:`_placeholder_1chdr_83`},Er=`[data-diffs-header][data-sticky] { top: calc(var(--header-height, 0px) - 1px); }
|
|
11
|
+
[data-diffs-header] [data-additions-count], [data-diffs-header] [data-deletions-count] { display: none; }`,Dr=[];function Or({meta:e}){return e.kind===`finding`?(0,M.jsx)(xr,{finding:e.finding,overCap:e.overCap}):(0,M.jsx)(Tr,{stop:e.stop,location:e.location})}function kr({annotations:e}){let t=e.filter(e=>e.metadata.kind===`finding`).length,n=e.length-t;if(!t&&!n)return null;let r=[t?`${t} finding${t===1?``:`s`}`:``,n?`${n} stop${n===1?``:`s`}`:``];return(0,M.jsx)(`span`,{className:U.count,children:r.filter(Boolean).join(`, `)})}var Ar=(0,O.memo)(function({runId:e,file:t,diff:n,collapsed:r,annotations:i=Dr,selection:a}){let s=k(),c=A(be),l=A(xe),u=A(Se),d=xn(yn),f=L(),p=t.path in gn(e).reviewedFiles,m=ln(e).data?.status===`running`,h=t.status===`added`||t.status===`removed`,g=c===`unified`||h||d?`unified`:`split`,_=(0,O.useMemo)(()=>({diffStyle:g,overflow:l?`wrap`:`scroll`,themeType:u,collapsed:r,stickyHeader:!0,unsafeCSS:Er}),[g,l,u,r]),v=(0,O.useCallback)(e=>(0,M.jsx)(Or,{meta:e.metadata}),[]),y=(0,M.jsxs)(`label`,{className:U.reviewed,title:m?`Available when the run finishes`:`Mark this file reviewed (r)`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:p,disabled:m,onChange:e=>f.setReviewed(t.path,e.target.checked)}),`Viewed`]}),b=(0,M.jsx)(`button`,{type:`button`,className:U.caret,onClick:()=>s(ge({runId:e,path:t.path})),"aria-expanded":!r,title:r?`Expand file`:`Collapse file`,children:r?(0,M.jsx)(Be,{"aria-hidden":!0}):(0,M.jsx)(ze,{"aria-hidden":!0})}),x=n!==void 0&&n.hunks.length>0;return t.isBinary||!x?(0,M.jsxs)(`div`,{className:U.frame,"data-collapsed":r,children:[(0,M.jsxs)(`div`,{className:U.plainHeader,children:[b,(0,M.jsx)(`span`,{className:U.path,title:t.path,children:t.previousPath?`${t.previousPath} → ${t.path}`:t.path}),(0,M.jsxs)(`span`,{className:U.meta,children:[(0,M.jsx)(kr,{annotations:i}),t.isBinary?(0,M.jsx)(`span`,{className:U.tag,children:`binary`}):(0,M.jsx)(F,{additions:t.additions,deletions:t.deletions}),(0,M.jsx)(Tn,{status:t.status}),y]})]}),!r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:U.placeholder,children:t.isBinary?`Binary file not shown.`:n?`No content changes.`:`This file is not in the saved patch.`}),i.length>0&&(0,M.jsx)(`div`,{className:U.cards,children:i.map((e,t)=>(0,M.jsx)(Or,{meta:e.metadata},t))})]})]}):(0,M.jsx)(`div`,{className:U.frame,"data-collapsed":r,children:(0,M.jsx)(o,{fileDiff:n,options:_,lineAnnotations:i,selectedLines:a,renderAnnotation:v,renderHeaderPrefix:()=>b,renderHeaderMetadata:()=>(0,M.jsxs)(`span`,{className:U.meta,children:[r&&(0,M.jsx)(kr,{annotations:i}),(0,M.jsx)(F,{additions:t.additions,deletions:t.deletions}),(0,M.jsx)(Tn,{status:t.status}),y]})})})}),jr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 88v112.89a7.11 7.11 0 0 1-7.11 7.11H40a8 8 0 0 1-8-8V64a8 8 0 0 1 8-8h53.33a8 8 0 0 1 4.8 1.6L128 80h88a8 8 0 0 1 8 8`,opacity:.2}),(0,M.jsx)(`path`,{d:`M216 72h-85.33l-27.74-20.8a16.12 16.12 0 0 0-9.6-3.2H40a16 16 0 0 0-16 16v136a16 16 0 0 0 16 16h176.89A15.13 15.13 0 0 0 232 200.89V88a16 16 0 0 0-16-16m0 128H40V64h53.33l29.87 22.4A8 8 0 0 0 128 88h88Z`})]})]}));function Mr(e){if(e.kind===`file`)return`file`;let t=e.kind===`line`?e.line:e.cited.line;return t?`L${t}`:`file`}function Nr(e){if(e.kind===`file`)return`whole file`;let t=e.kind===`line`?e.line:e.cited.line,n=e.kind===`line`?e.endLine:e.cited.endLine,r=n!==void 0&&n!==t?`lines ${t}-${n}`:`line ${t}`;return e.side===`deletions`?`old ${r}`:r}function Pr(e,t){let n=new Map(t.map((e,t)=>[e.id,t+1]));return e.flatMap(e=>{let t=e.metadata;if(t.kind===`finding`){let e=t.finding,n=Ve[e.severity],r=Nr(e.anchor),i=Wn(e.anchor);return[{kind:`finding`,key:`finding:${e.id}`,id:e.id,severity:e.severity,overCap:t.overCap,title:e.title,line:Mr(e.anchor),side:e.anchor.side,label:`${n} finding, ${r}: ${e.title}`,tooltip:[`${n}${t.overCap?` (over the posting cap)`:``}: ${e.title}`,r,i].filter(Boolean).join(`
|
|
12
|
+
`)}]}let{stop:r,location:i}=t,a=r.locations[i];if(!a)return[];let o=n.get(r.id)??0,s=`${r.importance===`critical`?`Critical walkthrough stop`:`Walkthrough stop`} ${o}`,c=Nr(a),l=r.locations.length>1?` (location ${i+1} of ${r.locations.length})`:``;return[{kind:`stop`,key:`stop:${r.id}:${i}`,id:r.id,location:i,number:o,importance:r.importance,title:r.title,line:Mr(a),side:a.side,label:`${s}${l}, ${c}: ${r.title}`,tooltip:[`${s}${l}: ${r.title}`,a.label,c,Wn(a)].filter(Boolean).join(`
|
|
13
|
+
`)}]})}function Fr(e,t,n){let r=[...e.map(e=>({path:e.path,file:e})),...t.map(e=>({path:e,file:void 0}))];if(n===`list`)return r.map(({path:e,file:t})=>t?{key:`file:${e}`,depth:0,type:`file`,name:e,file:t}:{key:`missing:${e}`,depth:0,type:`missing`,name:e});let i={name:``,children:new Map};for(let{path:e,file:t}of r){let n=e.split(`/`),r=i;for(let e=0;e<n.length-1;e++){let t=n[e],i=r.children.get(t);i||(i={name:t,children:new Map},r.children.set(t,i)),r=i}r.children.set(`\0file:${e}`,{name:n[n.length-1],children:new Map,file:t,missing:!t})}function a(e){let t=[];for(let n of e.children.values())t.push(...n.file?[n.file]:a(n));return t}let o=[];function s(e,t,n){for(let[r,i]of e.children){if(i.file){o.push({key:`file:${i.file.path}`,depth:t,type:`file`,name:i.name,file:i.file});continue}if(i.missing){o.push({key:`missing:${n}${i.name}`,depth:t,type:`missing`,name:i.name});continue}let e=i.name,c=i,l=`${n}${r}/`;for(;c.children.size===1;){let[t,n]=[...c.children.entries()][0];if(n.file||n.missing)break;e+=`/${n.name}`,c=n,l+=`${t}/`}o.push({key:`folder:${l}`,depth:t,type:`folder`,name:e,files:a(c)}),s(c,t+1,l)}}return s(i,0,``),o}var W={tree:`_tree_mjw0z_1`,row:`_row_mjw0z_10`,folder:`_folder_mjw0z_26`,file:`_file_mjw0z_34`,name:`_name_mjw0z_48`,missing:`_missing_mjw0z_60`,notes:`_notes_mjw0z_65`,note:`_note_mjw0z_65`,noteTitle:`_noteTitle_mjw0z_108`,dot:`_dot_mjw0z_116`,signpost:`_signpost_mjw0z_125`,stopNumber:`_stopNumber_mjw0z_143`,line:`_line_mjw0z_154`};function Ir({files:e,activePath:t,annotations:n,onSelect:r}){let i=A(Ce),a=L(),o=gn(a.runId).reviewedFiles,s=(0,O.useMemo)(()=>Fr(e,[],i),[e,i]),c=(0,O.useMemo)(()=>{let t=new Map;for(let r of e){let e=n.get(r.path);e?.length&&t.set(r.path,Pr(e,a.stops))}return t},[n,e,a.stops]),l=(0,O.useRef)(null);return(0,O.useEffect)(()=>{let e=l.current,t=e?.querySelector(`[data-active="true"]`);e&&t&&st(e,t)},[t]),(0,M.jsx)(`ul`,{ref:l,className:W.tree,"data-layout":i,children:s.map(e=>{let n=e.file&&c.get(e.file.path);return(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`div`,{className:W.row,"data-active":e.file?.path===t,style:{paddingLeft:`${.5+e.depth}em`},children:e.type===`folder`?(0,M.jsxs)(`span`,{className:W.folder,children:[(0,M.jsx)(jr,{"aria-hidden":!0}),(0,M.jsx)(`span`,{className:W.name,children:e.name})]}):e.file?(0,M.jsxs)(`button`,{type:`button`,className:W.file,"data-reviewed":e.file.path in o,onClick:()=>r(e.file.path),title:e.file.path in o?`${e.file.path} (viewed)`:e.file.path,children:[(0,M.jsx)(`span`,{className:W.name,children:e.name}),(0,M.jsx)(F,{additions:e.file.additions,deletions:e.file.deletions,binary:e.file.isBinary}),(0,M.jsx)(Tn,{status:e.file.status})]}):(0,M.jsx)(`span`,{className:W.missing,children:e.name})}),n&&(0,M.jsx)(Lr,{notes:n,depth:e.depth,file:e.name})]},e.key)})})}function Lr({notes:e,depth:t,file:n}){let r=L(),i=A(nr),a=A(rr),o=A(ir);return(0,M.jsx)(`ul`,{className:W.notes,style:{marginLeft:`${.5+t+.45}em`},"aria-label":`Notes on ${n}`,children:e.map(e=>{let t=e.kind===`finding`?e.id===i:e.id===a&&e.location===o;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,className:W.note,"data-kind":e.kind,"data-severity":e.kind===`finding`?e.severity:void 0,"data-importance":e.kind===`stop`?e.importance:void 0,"data-over-cap":e.kind===`finding`&&e.overCap?`true`:void 0,"aria-current":t?`true`:void 0,"aria-label":e.label,title:e.tooltip,onClick:()=>e.kind===`finding`?r.goToFinding(e.id):r.goToStop(e.id,e.location),children:[e.kind===`finding`?(0,M.jsx)(`span`,{className:W.dot,"aria-hidden":!0}):(0,M.jsx)(wr,{className:W.signpost,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:W.noteTitle,children:e.title}),e.kind===`stop`&&e.number>0&&(0,M.jsxs)(`span`,{className:W.stopNumber,"aria-hidden":!0,children:[`(`,e.number,`)`]}),(0,M.jsx)(`span`,{className:W.line,"data-side":e.side,children:e.line})]})},e.key)})})}var Rr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M232 56v144h-72a32 32 0 0 0-32 32a32 32 0 0 0-32-32H24V56h72a32 32 0 0 1 32 32a32 32 0 0 1 32-32Z`,opacity:.2}),(0,M.jsx)(`path`,{d:`M232 48h-72a40 40 0 0 0-32 16a40 40 0 0 0-32-16H24a8 8 0 0 0-8 8v144a8 8 0 0 0 8 8h72a24 24 0 0 1 24 24a8 8 0 0 0 16 0a24 24 0 0 1 24-24h72a8 8 0 0 0 8-8V56a8 8 0 0 0-8-8M96 192H32V64h64a24 24 0 0 1 24 24v112a39.8 39.8 0 0 0-24-8m128 0h-64a39.8 39.8 0 0 0-24 8V88a24 24 0 0 1 24-24h64Z`})]})]})),zr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M208 128v16a80 80 0 0 1-160 0v-16Z`,opacity:.2}),(0,M.jsx)(`path`,{d:`M144 92a12 12 0 1 1 12 12a12 12 0 0 1-12-12m-44-12a12 12 0 1 0 12 12a12 12 0 0 0-12-12m116 64a87.8 87.8 0 0 1-3 23l22.24 9.72A8 8 0 0 1 232 192a7.9 7.9 0 0 1-3.2-.67L207.38 182a88 88 0 0 1-158.76 0l-21.42 9.33a7.9 7.9 0 0 1-3.2.67a8 8 0 0 1-3.2-15.33L43 167a87.8 87.8 0 0 1-3-23v-8H16a8 8 0 0 1 0-16h24v-8a87.8 87.8 0 0 1 3-23l-22.2-9.67a8 8 0 1 1 6.4-14.66L48.62 74a88 88 0 0 1 158.76 0l21.42-9.36a8 8 0 0 1 6.4 14.66L213 89.05a87.8 87.8 0 0 1 3 23v8h24a8 8 0 0 1 0 16h-24ZM56 120h144v-8a72 72 0 0 0-144 0Zm64 95.54V136H56v8a72.08 72.08 0 0 0 64 71.54M200 144v-8h-64v79.54A72.08 72.08 0 0 0 200 144`})]})]})),Br=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M232 128c0 12.5-17.8 22-22.7 33.7s1.4 30.6-7.8 39.8s-28.5 3.1-39.8 7.8S140.5 232 128 232s-22-17.8-33.7-22.7s-30.6 1.4-39.8-7.8s-3.1-28.5-7.8-39.8S24 140.5 24 128s17.8-22 22.7-33.7s-1.4-30.6 7.8-39.8s28.5-3.1 39.8-7.8S115.5 24 128 24s22 17.8 33.7 22.7s30.6-1.4 39.8 7.8s3.1 28.5 7.8 39.8S232 115.5 232 128Z`,opacity:.2}),(0,M.jsx)(`path`,{fill:`currentColor`,d:`M225.9 102.8c-3.8-3.9-7.7-8-9.2-11.5s-1.4-8.7-1.5-14c-.1-9.7-.3-20.8-8-28.5s-18.8-7.9-28.5-8c-5.3-.1-10.7-.2-14-1.5s-7.6-5.4-11.5-9.2C146.3 23.5 138.4 16 128 16s-18.3 7.5-25.2 14.1c-3.9 3.8-8 7.7-11.5 9.2s-8.7 1.4-14 1.5c-9.7.1-20.8.3-28.5 8s-7.9 18.8-8 28.5c-.1 5.3-.2 10.7-1.5 14s-5.4 7.6-9.2 11.5C23.5 109.7 16 117.6 16 128s7.5 18.3 14.1 25.2c3.8 3.9 7.7 8 9.2 11.5s1.4 8.7 1.5 14c.1 9.7.3 20.8 8 28.5s18.8 7.9 28.5 8c5.3.1 10.7.2 14 1.5s7.6 5.4 11.5 9.2c6.9 6.6 14.8 14.1 25.2 14.1s18.3-7.5 25.2-14.1c3.9-3.8 8-7.7 11.5-9.2s8.7-1.4 14-1.5c9.7-.1 20.8-.3 28.5-8s7.9-18.8 8-28.5c.1-5.3.2-10.7 1.5-14s5.4-7.6 9.2-11.5c6.6-6.9 14.1-14.8 14.1-25.2s-7.5-18.3-14.1-25.2Zm-11.6 39.3c-4.8 5-9.7 10.2-12.4 16.5s-2.6 13.1-2.7 19.8s-.2 14.4-3.3 17.5s-10.4 3.2-17.5 3.3s-13.7.2-19.8 2.7s-11.5 7.6-16.5 12.4S132 224 128 224s-9.1-4.9-14.1-9.7s-10.2-9.7-16.5-12.4s-13.1-2.6-19.8-2.7s-14.4-.2-17.5-3.3s-3.2-10.4-3.3-17.5s-.2-13.7-2.7-19.8s-7.6-11.5-12.4-16.5S32 132 32 128s4.9-9.1 9.7-14.1s9.7-10.2 12.4-16.5s2.6-13.1 2.7-19.8s.2-14.4 3.3-17.5s10.4-3.2 17.5-3.3s13.7-.2 19.8-2.7s11.5-7.6 16.5-12.4S124 32 128 32s9.1 4.9 14.1 9.7s10.2 9.7 16.5 12.4s13.1 2.6 19.8 2.7s14.4.2 17.5 3.3s3.2 10.4 3.3 17.5s.2 13.7 2.7 19.8s7.6 11.5 12.4 16.5S224 124 224 128s-4.9 9.1-9.7 14.1ZM120 136V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0Zm20 36a12 12 0 1 1-12-12a12 12 0 0 1 12 12Z`})]})),Vr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,M.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m0 192a88 88 0 1 1 88-88a88.1 88.1 0 0 1-88 88m56-88a12 12 0 1 1-12-12a12 12 0 0 1 12 12m-44 0a12 12 0 1 1-12-12a12 12 0 0 1 12 12m-44 0a12 12 0 1 1-12-12a12 12 0 0 1 12 12`})]})]})),Hr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M208 216H48a8 8 0 0 1-6.86-12.12l30.48-50.8c13.23-2.48 32-1.41 56.37 10.92c32.25 16.33 54.75 12.91 67.5 7.65l19.34 32.23A8 8 0 0 1 208 216`,opacity:.2}),(0,M.jsx)(`path`,{d:`M221.69 199.77L160 96.92V40h8a8 8 0 0 0 0-16H88a8 8 0 0 0 0 16h8v56.92L34.31 199.77A16 16 0 0 0 48 224h160a16 16 0 0 0 13.72-24.23Zm-110.83-96.52a7.93 7.93 0 0 0 1.14-4.11V40h32v59.14a7.93 7.93 0 0 0 1.14 4.11L183.36 167c-12 2.37-29.07 1.37-51.75-10.11c-15.91-8.05-31.05-12.32-45.22-12.81ZM48 208l28.54-47.58c14.25-1.73 30.31 1.85 47.82 10.72c19 9.61 35 12.88 48 12.88a69.9 69.9 0 0 0 19.55-2.7L208 208Z`})]})]})),Ur=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`m207.86 123.18l16.78-21a99 99 0 0 0-10.07-24.29l-26.7-3a81 81 0 0 0-6.81-6.81l-3-26.71a99.4 99.4 0 0 0-24.3-10l-21 16.77a82 82 0 0 0-9.64 0l-21-16.78a99 99 0 0 0-24.21 10.07l-3 26.7a81 81 0 0 0-6.81 6.81l-26.71 3a99.4 99.4 0 0 0-10 24.3l16.77 21a82 82 0 0 0 0 9.64l-16.78 21a99 99 0 0 0 10.07 24.29l26.7 3a81 81 0 0 0 6.81 6.81l3 26.71a99.4 99.4 0 0 0 24.3 10l21-16.77a82 82 0 0 0 9.64 0l21 16.78a99 99 0 0 0 24.29-10.07l3-26.7a81 81 0 0 0 6.81-6.81l26.71-3a99.4 99.4 0 0 0 10-24.3l-16.77-21a82 82 0 0 0-.08-9.64M128 168a40 40 0 1 1 40-40a40 40 0 0 1-40 40`,opacity:.2}),(0,M.jsx)(`path`,{d:`M128 80a48 48 0 1 0 48 48a48.05 48.05 0 0 0-48-48m0 80a32 32 0 1 1 32-32a32 32 0 0 1-32 32m88-29.84q.06-2.16 0-4.32l14.92-18.64a8 8 0 0 0 1.48-7.06a107.6 107.6 0 0 0-10.88-26.25a8 8 0 0 0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186 40.54a8 8 0 0 0-3.94-6a107.3 107.3 0 0 0-26.25-10.86a8 8 0 0 0-7.06 1.48L130.16 40h-4.32L107.2 25.11a8 8 0 0 0-7.06-1.48a107.6 107.6 0 0 0-26.25 10.88a8 8 0 0 0-3.93 6l-2.64 23.76q-1.56 1.49-3 3L40.54 70a8 8 0 0 0-6 3.94a107.7 107.7 0 0 0-10.87 26.25a8 8 0 0 0 1.49 7.06L40 125.84v4.32L25.11 148.8a8 8 0 0 0-1.48 7.06a107.6 107.6 0 0 0 10.88 26.25a8 8 0 0 0 6 3.93l23.72 2.64q1.49 1.56 3 3L70 215.46a8 8 0 0 0 3.94 6a107.7 107.7 0 0 0 26.25 10.87a8 8 0 0 0 7.06-1.49L125.84 216q2.16.06 4.32 0l18.64 14.92a8 8 0 0 0 7.06 1.48a107.2 107.2 0 0 0 26.25-10.88a8 8 0 0 0 3.93-6l2.64-23.72q1.56-1.48 3-3l23.78-2.8a8 8 0 0 0 6-3.94a107.7 107.7 0 0 0 10.87-26.25a8 8 0 0 0-1.49-7.06Zm-16.1-6.5a74 74 0 0 1 0 8.68a8 8 0 0 0 1.74 5.48l14.19 17.73a91.6 91.6 0 0 1-6.23 15l-22.6 2.56a8 8 0 0 0-5.1 2.64a74 74 0 0 1-6.14 6.14a8 8 0 0 0-2.64 5.1l-2.51 22.58a91.3 91.3 0 0 1-15 6.23l-17.74-14.19a8 8 0 0 0-5-1.75h-.48a74 74 0 0 1-8.68 0a8.06 8.06 0 0 0-5.48 1.74l-17.78 14.2a91.6 91.6 0 0 1-15-6.23L82.89 187a8 8 0 0 0-2.64-5.1a74 74 0 0 1-6.14-6.14a8 8 0 0 0-5.1-2.64l-22.58-2.52a91.3 91.3 0 0 1-6.23-15l14.19-17.74a8 8 0 0 0 1.74-5.48a74 74 0 0 1 0-8.68a8 8 0 0 0-1.74-5.48L40.2 100.45a91.6 91.6 0 0 1 6.23-15L69 82.89a8 8 0 0 0 5.1-2.64a74 74 0 0 1 6.14-6.14A8 8 0 0 0 82.89 69l2.51-22.57a91.3 91.3 0 0 1 15-6.23l17.74 14.19a8 8 0 0 0 5.48 1.74a74 74 0 0 1 8.68 0a8.06 8.06 0 0 0 5.48-1.74l17.77-14.19a91.6 91.6 0 0 1 15 6.23L173.11 69a8 8 0 0 0 2.64 5.1a74 74 0 0 1 6.14 6.14a8 8 0 0 0 5.1 2.64l22.58 2.51a91.3 91.3 0 0 1 6.23 15l-14.19 17.74a8 8 0 0 0-1.74 5.53Z`})]})]})),Wr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 200a24 24 0 1 1-24-24a24 24 0 0 1 24 24`,opacity:.2}),(0,M.jsx)(`path`,{d:`M200 168a32.06 32.06 0 0 0-31 24H72a32 32 0 0 1 0-64h96a40 40 0 0 0 0-80H72a8 8 0 0 0 0 16h96a24 24 0 0 1 0 48H72a48 48 0 0 0 0 96h97a32 32 0 1 0 31-40m0 48a16 16 0 1 1 16-16a16 16 0 0 1-16 16`})]})]})),Gr=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 96a64 64 0 0 1-94.94 56L73 217a24 24 0 0 1-34-34l65-56.06a64 64 0 0 1 80-90.29L144 80l5.66 26.34L176 112l43.35-40A63.8 63.8 0 0 1 224 96`,opacity:.2}),(0,M.jsx)(`path`,{d:`M226.76 69a8 8 0 0 0-12.84-2.88l-40.3 37.19l-17.23-3.7l-3.7-17.23l37.19-40.3A8 8 0 0 0 187 29.24A72 72 0 0 0 88 96a72.3 72.3 0 0 0 6 28.94L33.79 177c-.15.12-.29.26-.43.39a32 32 0 0 0 45.26 45.26c.13-.13.27-.28.39-.42L131.06 162A72 72 0 0 0 232 96a71.6 71.6 0 0 0-5.24-27M160 152a56.14 56.14 0 0 1-27.07-7a8 8 0 0 0-9.92 1.77l-55.9 64.74a16 16 0 0 1-22.62-22.62L109.18 133a8 8 0 0 0 1.77-9.93a56 56 0 0 1 58.36-82.31l-31.2 33.81a8 8 0 0 0-1.94 7.1l5.66 26.33a8 8 0 0 0 6.14 6.14l26.35 5.66a8 8 0 0 0 7.1-1.94l33.81-31.2A56.06 56.06 0 0 1 160 152`})]})]})),Kr={icon:`_icon_144da_1`,critical:`_critical_144da_30`},qr={bug:zr,wrench:Gr,path:Wr,flask:Hr,doc:Rr,gear:Ur};function Jr({icon:e,className:t}){let n=e?qr[e]:Vr;return(0,M.jsx)(n,{className:[Kr.icon,t].filter(Boolean).join(` `),"data-icon":e??`missing`,"aria-hidden":!0})}function Yr({reason:e}){let t=e?`Needs close review: ${e}`:`Needs close review`;return(0,M.jsx)(`span`,{className:Kr.critical,title:t,role:`img`,"aria-label":t,children:(0,M.jsx)(Br,{"aria-hidden":!0})})}var G={panel:`_panel_oufx1_1`,head:`_head_oufx1_17`,crumb:`_crumb_oufx1_23`,titleRow:`_titleRow_oufx1_34`,caret:`_caret_oufx1_40`,icon:`_icon_oufx1_52`,title:`_title_oufx1_34`,stats:`_stats_oufx1_63`,summary:`_summary_oufx1_72`};function Xr({group:e,parent:t,stats:n,files:r,allCollapsed:i,activePath:a,annotations:o,onToggleFiles:s,onSelectFile:c}){return(0,M.jsxs)(`aside`,{className:G.panel,children:[(0,M.jsxs)(`div`,{className:G.head,children:[t&&(0,M.jsxs)(`button`,{type:`button`,className:G.crumb,onClick:()=>ot(t.id),children:[t.title,` ›`]}),(0,M.jsxs)(`div`,{className:G.titleRow,children:[(0,M.jsx)(`button`,{type:`button`,className:G.caret,onClick:s,title:i?`Expand all files in this group`:`Collapse all files in this group`,children:i?(0,M.jsx)(Be,{"aria-hidden":!0}):(0,M.jsx)(ze,{"aria-hidden":!0})}),(0,M.jsx)(Jr,{icon:e.icon,className:G.icon}),(0,M.jsx)(`h2`,{className:G.title,children:e.title}),n.critical&&(0,M.jsx)(Yr,{reason:n.criticalReason})]}),(0,M.jsxs)(`div`,{className:G.stats,children:[(0,M.jsx)(F,{additions:n.additions,deletions:n.deletions,binary:n.binary===n.files}),(0,M.jsx)(`span`,{children:P(n.files,`file`)})]})]}),e.summary&&(0,M.jsx)(B,{source:e.summary,className:G.summary}),(0,M.jsx)(Ir,{files:r,activePath:a,annotations:o,onSelect:c})]})}var K={chapter:`_chapter_wsoz0_1`,unit:`_unit_wsoz0_2`,chapterTitle:`_chapterTitle_wsoz0_14`,caret:`_caret_wsoz0_27`,chapterIcon:`_chapterIcon_wsoz0_32`,chapterStats:`_chapterStats_wsoz0_36`,chapterSummary:`_chapterSummary_wsoz0_45`,files:`_files_wsoz0_67`,file:`_file_wsoz0_67`,marker:`_marker_wsoz0_78`,empty:`_empty_wsoz0_82`},Zr=(0,O.memo)(function({chapter:e,stats:t,unitCount:n,folded:r,onToggleFold:i}){return(0,M.jsxs)(`section`,{id:at(e.id),"data-group-section":e.id,className:K.chapter,children:[(0,M.jsxs)(`button`,{type:`button`,className:K.chapterTitle,onClick:i,"aria-expanded":!r,children:[r?(0,M.jsx)(Be,{"aria-hidden":!0,className:K.caret}):(0,M.jsx)(ze,{"aria-hidden":!0,className:K.caret}),(0,M.jsx)(Jr,{icon:e.icon,className:K.chapterIcon}),(0,M.jsx)(`h2`,{children:e.title}),t.critical&&(0,M.jsx)(Yr,{reason:t.criticalReason})]}),t.files>0?(0,M.jsxs)(`div`,{className:K.chapterStats,children:[(0,M.jsx)(F,{additions:t.additions,deletions:t.deletions,binary:t.binary===t.files}),(0,M.jsx)(`span`,{children:P(t.files,`file`)}),n>0&&(0,M.jsx)(`span`,{children:P(n,`unit`)})]}):e.stopIds.length>0&&(0,M.jsx)(`div`,{className:K.chapterStats,children:(0,M.jsx)(`span`,{children:`Walkthrough only: no files of its own. Its stops point at files in other groups.`})}),e.summary&&(0,M.jsx)(B,{source:e.summary,className:K.chapterSummary})]})}),Qr=(0,O.memo)(function({runId:e,group:t,parent:n,stats:r,files:i,diffs:a,collapsed:o,activePath:s,annotations:c,selection:l}){let u=k(),d=i.length>0&&i.every(e=>o.has(e.path)),f=(0,O.useCallback)(()=>{let t=new Set(o);for(let e of i)d?t.delete(e.path):t.add(e.path);u(he({runId:e,paths:[...t]}))},[d,o,u,i,e]),p=(0,O.useCallback)(n=>{u(_e({runId:e,path:n})),lt(t.id,n)},[u,t.id,e]);return(0,M.jsxs)(`section`,{id:at(t.id),"data-group-section":t.id,className:K.unit,children:[(0,M.jsx)(Xr,{group:t,parent:n,stats:r,files:i,allCollapsed:d,activePath:s,annotations:c,onToggleFiles:f,onSelectFile:p}),(0,M.jsxs)(`div`,{className:K.files,children:[i.map(t=>(0,M.jsxs)(`div`,{className:K.file,children:[(0,M.jsx)(`div`,{"data-file-start":!0,"data-path":t.path,className:K.marker,tabIndex:-1,"aria-label":`File ${t.path}`}),(0,M.jsx)(Ar,{runId:e,file:t,diff:a.get(t.path),collapsed:o.has(t.path),annotations:c.get(t.path),selection:l?.path===t.path?l.range:null})]},t.path)),i.length===0&&(0,M.jsx)(`p`,{className:K.empty,children:`No files in this group.`})]})]})}),$r=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M104 32H64a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176H64V48h40Zm88-176h-40a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176h-40V48h40Z`})]})),ei=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M208 40H48a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h72v16H96a8 8 0 0 0 0 16h64a8 8 0 0 0 0-16h-24v-16h72a24 24 0 0 0 24-24V64a24 24 0 0 0-24-24M48 56h160a8 8 0 0 1 8 8v80H40V64a8 8 0 0 1 8-8m160 128H48a8 8 0 0 1-8-8v-16h176v16a8 8 0 0 1-8 8`})]})),ti=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`m219.31 108.68l-80-80a16 16 0 0 0-22.62 0l-80 80A15.87 15.87 0 0 0 32 120v96a8 8 0 0 0 8 8h64a8 8 0 0 0 8-8v-56h32v56a8 8 0 0 0 8 8h64a8 8 0 0 0 8-8v-96a15.87 15.87 0 0 0-4.69-11.32M208 208h-48v-56a8 8 0 0 0-8-8h-48a8 8 0 0 0-8 8v56H48v-88l80-80l80 80Z`})]})),ni=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M80 64a8 8 0 0 1 8-8h128a8 8 0 0 1 0 16H88a8 8 0 0 1-8-8m136 56H88a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16m0 64H88a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16M44 52a12 12 0 1 0 12 12a12 12 0 0 0-12-12m0 64a12 12 0 1 0 12 12a12 12 0 0 0-12-12m0 64a12 12 0 1 0 12 12a12 12 0 0 0-12-12`})]})),ri=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M233.54 142.23a8 8 0 0 0-8-2a88.08 88.08 0 0 1-109.8-109.8a8 8 0 0 0-10-10a104.84 104.84 0 0 0-52.91 37A104 104 0 0 0 136 224a103.1 103.1 0 0 0 62.52-20.88a104.84 104.84 0 0 0 37-52.91a8 8 0 0 0-1.98-7.98m-44.64 48.11A88 88 0 0 1 65.66 67.11a89 89 0 0 1 31.4-26A106 106 0 0 0 96 56a104.11 104.11 0 0 0 104 104a106 106 0 0 0 14.92-1.06a89 89 0 0 1-26.02 31.4`})]})),ii=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M208 136H48a16 16 0 0 0-16 16v40a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16v-40a16 16 0 0 0-16-16m0 56H48v-40h160zm0-144H48a16 16 0 0 0-16 16v40a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16m0 56H48V64h160z`})]})),ai=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M216 40H40a16 16 0 0 0-16 16v144a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a16 16 0 0 0-16-16M40 56h40v144H40Zm176 144H96V56h120z`})]})),oi=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M120 40V16a8 8 0 0 1 16 0v24a8 8 0 0 1-16 0m72 88a64 64 0 1 1-64-64a64.07 64.07 0 0 1 64 64m-16 0a48 48 0 1 0-48 48a48.05 48.05 0 0 0 48-48M58.34 69.66a8 8 0 0 0 11.32-11.32l-16-16a8 8 0 0 0-11.32 11.32Zm0 116.68l-16 16a8 8 0 0 0 11.32 11.32l16-16a8 8 0 0 0-11.32-11.32M192 72a8 8 0 0 0 5.66-2.34l16-16a8 8 0 0 0-11.32-11.32l-16 16A8 8 0 0 0 192 72m5.66 114.34a8 8 0 0 0-11.32 11.32l16 16a8 8 0 0 0 11.32-11.32ZM48 128a8 8 0 0 0-8-8H16a8 8 0 0 0 0 16h24a8 8 0 0 0 8-8m80 80a8 8 0 0 0-8 8v24a8 8 0 0 0 16 0v-24a8 8 0 0 0-8-8m112-88h-24a8 8 0 0 0 0 16h24a8 8 0 0 0 0-16`})]})),si=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M32 64a8 8 0 0 1 8-8h176a8 8 0 0 1 0 16H40a8 8 0 0 1-8-8m8 48h128a8 8 0 0 0 0-16H40a8 8 0 0 0 0 16m176 24H40a8 8 0 0 0 0 16h176a8 8 0 0 0 0-16m-48 40H40a8 8 0 0 0 0 16h128a8 8 0 0 0 0-16`})]})),ci=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M160 112h48a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16h-48a16 16 0 0 0-16 16v16h-16a24 24 0 0 0-24 24v32H72v-8a16 16 0 0 0-16-16H24a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32a16 16 0 0 0 16-16v-8h32v32a24 24 0 0 0 24 24h16v16a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16h-48a16 16 0 0 0-16 16v16h-16a8 8 0 0 1-8-8V88a8 8 0 0 1 8-8h16v16a16 16 0 0 0 16 16M56 144H24v-32h32zm104 16h48v48h-48Zm0-112h48v48h-48Z`})]})),li=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M232 112a64.07 64.07 0 0 1-64 64H51.31l34.35 34.34a8 8 0 0 1-11.32 11.32l-48-48a8 8 0 0 1 0-11.32l48-48a8 8 0 0 1 11.32 11.32L51.31 160H168a48 48 0 0 0 0-96H80a8 8 0 0 1 0-16h88a64.07 64.07 0 0 1 64 64`})]})),ui=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M205.66 138.34a8 8 0 0 1-11.32 11.32L136 91.31V224a8 8 0 0 1-16 0V91.31l-58.34 58.35a8 8 0 0 1-11.32-11.32l72-72a8 8 0 0 1 11.32 0ZM216 32H40a8 8 0 0 0 0 16h176a8 8 0 0 0 0-16`})]})),di=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M224 48H32a16 16 0 0 0-16 16v128a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16m0 144H32V64h192zm-16-64a8 8 0 0 1-8 8H56a8 8 0 0 1 0-16h144a8 8 0 0 1 8 8m0-32a8 8 0 0 1-8 8H56a8 8 0 0 1 0-16h144a8 8 0 0 1 8 8M72 160a8 8 0 0 1-8 8h-8a8 8 0 0 1 0-16h8a8 8 0 0 1 8 8m96 0a8 8 0 0 1-8 8H96a8 8 0 0 1 0-16h64a8 8 0 0 1 8 8m40 0a8 8 0 0 1-8 8h-8a8 8 0 0 1 0-16h8a8 8 0 0 1 8 8`})]})),fi=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M224 128a8 8 0 0 1-8 8H40a8 8 0 0 1 0-16h176a8 8 0 0 1 8 8m-101.66-26.34a8 8 0 0 0 11.32 0l32-32a8 8 0 0 0-11.32-11.32L136 76.69V16a8 8 0 0 0-16 0v60.69l-18.34-18.35a8 8 0 0 0-11.32 11.32Zm11.32 52.68a8 8 0 0 0-11.32 0l-32 32a8 8 0 0 0 11.32 11.32L120 179.31V240a8 8 0 0 0 16 0v-60.69l18.34 18.35a8 8 0 0 0 11.32-11.32Z`})]})),pi={wrap:`_wrap_18f2t_1`,trigger:`_trigger_18f2t_5`,small:`_small_18f2t_22`,menu:`_menu_18f2t_26`,item:`_item_18f2t_41`};function mi({actions:e}){let[t,n]=(0,O.useState)(!1),r=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,M.jsxs)(`div`,{className:pi.wrap,ref:r,children:[(0,M.jsxs)(`button`,{type:`button`,className:pi.trigger,onClick:()=>n(e=>!e),"aria-haspopup":`menu`,"aria-expanded":t,title:`Expand or collapse files`,children:[(0,M.jsx)(fi,{"aria-hidden":!0}),(0,M.jsx)(ze,{"aria-hidden":!0,className:pi.small})]}),t&&(0,M.jsx)(`div`,{className:pi.menu,role:`menu`,children:e.map(e=>(0,M.jsx)(`button`,{type:`button`,role:`menuitem`,className:pi.item,onClick:()=>{e.run(),n(!1)},children:e.label},e.label))})]})}var q={strip:`_strip_1qqee_1`,stage:`_stage_1qqee_12`,slices:`_slices_1qqee_17`,bar:`_bar_1qqee_25`,fill:`_fill_1qqee_34`,failed:`_failed_1qqee_41`,active:`_active_1qqee_45`,message:`_message_1qqee_46`,cost:`_cost_1qqee_62`},hi={resolving_target:`Resolving target`,checking_registry:`Checking registry`,building_map:`Building repo map`,grouping:`Grouping files`,reviewing:`Reviewing`,coordinating:`Merging findings`,walkthrough:`Writing walkthrough`,verifying:`Verifying`,writing:`Writing results`};function gi({progress:e}){let t=e,n=t?t.slicesDone+t.slicesFailed:0,r=t&&t.slicesTotal>0?Math.round(n/t.slicesTotal*100):null;return(0,M.jsxs)(`div`,{className:q.strip,role:`status`,"aria-live":`polite`,children:[(0,M.jsxs)(`span`,{className:q.stage,children:[t?.stage?hi[t.stage]:`Starting`,`…`]}),t&&t.slicesTotal>0&&(0,M.jsxs)(`span`,{className:q.slices,children:[(0,M.jsx)(`span`,{className:q.bar,children:(0,M.jsx)(`span`,{className:q.fill,style:{width:`${r}%`}})}),n,`/`,t.slicesTotal,` slices`,t.slicesFailed>0&&(0,M.jsxs)(`span`,{className:q.failed,children:[` (`,t.slicesFailed,` failed)`]})]}),t&&t.activeSlices.length>0&&(0,M.jsx)(`span`,{className:q.active,title:t.activeSlices.join(`
|
|
14
|
+
`),children:t.activeSlices.join(`, `)}),t?.lastMessage&&(0,M.jsx)(`span`,{className:q.message,title:t.lastMessage,children:t.lastMessage}),t&&t.costUsd>0&&(0,M.jsx)(`span`,{className:q.cost,children:Ue(t.costUsd)})]})}var _i=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,M.jsx)(`path`,{d:`M173.66 98.34a8 8 0 0 1 0 11.32l-56 56a8 8 0 0 1-11.32 0l-24-24a8 8 0 0 1 11.32-11.32L112 148.69l50.34-50.35a8 8 0 0 1 11.32 0M232 128A104 104 0 1 1 128 24a104.11 104.11 0 0 1 104 104m-16 0a88 88 0 1 0-88 88a88.1 88.1 0 0 0 88-88`})]})]})),vi=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M232 128a104 104 0 0 1-208 0c0-41 23.81-78.36 60.66-95.27a8 8 0 0 1 6.68 14.54C60.15 61.59 40 93.27 40 128a88 88 0 0 0 176 0c0-34.73-20.15-66.41-51.34-80.73a8 8 0 0 1 6.68-14.54C208.19 49.64 232 87 232 128`})]})),yi=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,M.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m88 104a87.56 87.56 0 0 1-20.41 56.28L71.72 60.4A88 88 0 0 1 216 128m-176 0a87.56 87.56 0 0 1 20.41-56.28L184.28 195.6A88 88 0 0 1 40 128`})]})]})),bi=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsxs)(`g`,{fill:`currentColor`,children:[(0,M.jsx)(`path`,{d:`M224 128a96 96 0 1 1-96-96a96 96 0 0 1 96 96`,opacity:.2}),(0,M.jsx)(`path`,{d:`M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m0 192a88 88 0 1 1 88-88a88.1 88.1 0 0 1-88 88m-8-80V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0m20 36a12 12 0 1 1-12-12a12 12 0 0 1 12 12`})]})]})),xi={badge:`_badge_19nmu_1`,icon:`_icon_19nmu_23`,spin:`_spin_19nmu_1`},Si={running:vi,complete:_i,failed:bi,cancelled:yi};function Ci({status:e,compact:t=!1}){let n=Si[e];return(0,M.jsxs)(`span`,{className:xi.badge,"data-status":e,title:e,children:[(0,M.jsx)(n,{className:xi.icon,"aria-hidden":!0}),!t&&(0,M.jsx)(`span`,{children:e})]})}var J={header:`_header_hages_1`,inner:`_inner_hages_22`,row:`_row_hages_30`,home:`_home_hages_36`,title:`_title_hages_49`,controls:`_controls_hages_67`,toggle:`_toggle_hages_74`,meta:`_meta_hages_94`,author:`_author_hages_103`,refs:`_refs_hages_108`,ref:`_ref_hages_108`,right:`_right_hages_128`,action:`_action_hages_134`,actionError:`_actionError_hages_150`,error:`_error_hages_154`,tabs:`_tabs_hages_163`,tab:`_tab_hages_163`,tabLabel:`_tabLabel_hages_196`},wi={system:`light`,light:`dark`,dark:`system`},Ti={system:ei,light:oi,dark:ri};function Ei(e){let t=(0,O.useRef)(null),[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(0);return(0,O.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(()=>s(e.offsetHeight));return n.observe(e),()=>n.disconnect()},[]),(0,O.useEffect)(()=>{document.documentElement.style.setProperty(`--header-height`,`${n?0:o}px`)},[o,n]),(0,O.useEffect)(()=>()=>{document.documentElement.style.removeProperty(`--header-height`)},[]),(0,O.useEffect)(()=>{let t=window.scrollY,n=t,i=()=>{let i=window.scrollY;i<t&&(n=i),t=i,a(i>20),r(!e&&i-n>300)};return i(),window.addEventListener(`scroll`,i,{passive:!0}),()=>window.removeEventListener(`scroll`,i)},[e]),{ref:t,hidden:n,scrolled:i}}function Di({title:e,pressed:t,onClick:n,children:r}){return(0,M.jsx)(`button`,{type:`button`,className:J.toggle,title:e,"aria-pressed":t,onClick:n,children:r})}function Oi({collapseActions:e,wide:t}){let n=k(),r=A(be),i=A(xe),a=A(Se),o=A(Ce),s=A(we),c=Ti[a],l=L();return(0,M.jsxs)(`div`,{className:J.controls,children:[(0,M.jsx)(Di,{title:`Back to the summary (t)`,onClick:()=>l.goToTop(),children:(0,M.jsx)(ui,{"aria-hidden":!0})}),(0,M.jsx)(mi,{actions:e}),(0,M.jsx)(Di,{title:r===`split`?`Split view (switch to unified)`:`Unified view (switch to split)`,onClick:()=>n(ue(r===`split`?`unified`:`split`)),children:r===`split`?(0,M.jsx)($r,{"aria-hidden":!0}):(0,M.jsx)(ii,{"aria-hidden":!0})}),(0,M.jsx)(Di,{title:i?`Wrap long lines: on`:`Wrap long lines: off`,pressed:i,onClick:()=>n(de()),children:i?(0,M.jsx)(li,{"aria-hidden":!0}):(0,M.jsx)(si,{"aria-hidden":!0})}),(0,M.jsx)(Di,{title:o===`tree`?`File tree (switch to list)`:`File list (switch to tree)`,onClick:()=>n(pe(o===`tree`?`list`:`tree`)),children:o===`tree`?(0,M.jsx)(ci,{"aria-hidden":!0}):(0,M.jsx)(ni,{"aria-hidden":!0})}),t&&(0,M.jsx)(Di,{title:s?`Hide sidebar (show group tabs)`:`Show sidebar`,pressed:s,onClick:()=>n(me()),children:(0,M.jsx)(ai,{"aria-hidden":!0})}),(0,M.jsx)(Di,{title:`Theme: ${a}`,onClick:()=>n(fe(wi[a])),children:(0,M.jsx)(c,{"aria-hidden":!0})}),(0,M.jsx)(Di,{title:`Keyboard shortcuts (?)`,onClick:()=>n(er(!0)),children:(0,M.jsx)(di,{"aria-hidden":!0})})]})}function ki({tree:e,visible:t}){let n=e.ordered.find(e=>t.has(e.id))?.id,r=(0,O.useRef)(null);return(0,O.useEffect)(()=>{n&&r.current?.querySelector(`[data-group-id="${CSS.escape(n)}"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n]),(0,M.jsx)(`div`,{className:J.tabs,ref:r,children:e.ordered.map(t=>{let r=e.stats.get(t.id);return(0,M.jsxs)(`button`,{type:`button`,className:J.tab,"data-group-id":t.id,"data-active":t.id===n,"data-chapter":!t.parentId&&t.files.length===0,onClick:()=>ot(t.id),children:[(0,M.jsx)(Jr,{icon:t.icon}),(0,M.jsx)(`span`,{className:J.tabLabel,children:t.title}),r?.critical&&(0,M.jsx)(Yr,{reason:r.criticalReason}),r&&r.files>0&&(0,M.jsx)(F,{additions:r.additions,deletions:r.deletions,binary:r.binary===r.files})]},t.id)})})}function Ai({run:e}){let[t,{isLoading:n,error:r}]=pn(),i=f(),a=async()=>{let n=await t({kind:`review`,fromRun:e.id});`data`in n&&n.data&&i({to:`/runs/$runId`,params:{runId:n.data.id}})};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:J.action,disabled:n||e.status===`running`,onClick:()=>void a(),title:`Start a full review of this base and head`,children:n?`Starting review…`:`Review these changes`}),r&&(0,M.jsx)(`span`,{className:J.actionError,children:Ne(r)})]})}function ji(e){let{reviewScope:t,reviewedFiles:n,scopeReason:r}=e.meta;return t===`incremental`?n?`Only the ${P(n,`file`)} changed since the last review were reviewed again`:`No code changed since the last review`:r?`Full review: ${r}`:`Full review`}function Mi({run:e,tree:t,visible:n,collapseActions:r}){let i=xn(bn),a=A(we),{ref:o,hidden:s,scrolled:c}=Ei(i),l=e.target,u=e.files.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}),d=l.kind===`pr`?l.baseRef:Je(e.base),f=l.kind===`pr`?l.headRef:Je(e.head),p=e.status===`running`?e.progress?.costUsd??0:e.meta.costUsd,m=Mt(e)===`diff`;return(0,M.jsx)(`header`,{ref:o,"data-app-header":!0,className:J.header,"data-hidden":s,"data-scrolled":c,children:(0,M.jsxs)(`div`,{className:J.inner,children:[(0,M.jsxs)(`div`,{className:J.row,children:[(0,M.jsx)(v,{to:`/`,className:J.home,title:`All runs`,children:(0,M.jsx)(ti,{"aria-hidden":!0})}),(0,M.jsx)(Ci,{status:e.status,compact:!0}),(0,M.jsx)(`h1`,{className:J.title,children:l.kind===`pr`?(0,M.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,children:He(l)}):He(l)}),(0,M.jsx)(Oi,{collapseActions:r,wide:i})]}),(0,M.jsxs)(`div`,{className:J.meta,children:[l.kind===`pr`&&(0,M.jsx)(`span`,{className:J.author,children:l.author}),(0,M.jsxs)(`span`,{className:J.refs,children:[(0,M.jsx)(`code`,{className:J.ref,title:e.base,children:d}),(0,M.jsx)(`span`,{"aria-label":`from`,children:`←`}),(0,M.jsx)(`code`,{className:J.ref,title:e.head,children:f})]}),(0,M.jsx)(`span`,{children:P(e.files.length,`file`)}),(0,M.jsx)(F,{additions:u.additions,deletions:u.deletions}),e.round!==void 0&&e.round>1&&(0,M.jsxs)(`span`,{title:ji(e),children:[`Round `,e.round]}),(0,M.jsxs)(`span`,{className:J.right,children:[m&&!e.repo.remote&&(0,M.jsx)(Ai,{run:e}),(0,M.jsx)(`span`,{title:e.repo.root,children:e.repo.slug??e.repo.root}),(0,M.jsx)(`span`,{children:qe(e.createdAt)}),(!m||p>0)&&(0,M.jsx)(`span`,{title:`Model cost`,children:Ue(p)})]})]}),e.status===`running`&&(0,M.jsx)(gi,{progress:e.progress}),e.status===`failed`&&e.error&&(0,M.jsxs)(`p`,{className:J.error,children:[m?`Run`:`Review`,` failed: `,e.error]}),(!i||!a)&&(0,M.jsx)(ki,{tree:t,visible:n})]})})}var Ni=[[`j / k`,`Next / previous file`],[`n / p`,`Next / previous finding`],[`] / [`,`Next / previous walkthrough stop`],[`x`,`Collapse or expand the current file`],[`r`,`Mark the current file viewed (or not)`],[`t`,`Back to the summary (Back returns here)`],[`?`,`Show this list`]];function Pi(){let e=A(cr),t=k(),n=(0,O.useRef)(null);return(0,O.useEffect)(()=>{let t=n.current;t&&(e&&!t.open&&t.showModal(),!e&&t.open&&t.close())},[e]),(0,M.jsxs)(`dialog`,{ref:n,className:N.dialog,"aria-labelledby":`keyboard-help-title`,onClose:()=>t(er(!1)),onClick:e=>{e.target===e.currentTarget&&n.current?.close()},children:[(0,M.jsx)(`header`,{className:N.header,children:(0,M.jsx)(`h2`,{id:`keyboard-help-title`,className:N.title,children:`Keyboard shortcuts`})}),(0,M.jsx)(`dl`,{className:N.keys,children:Ni.map(([e,t])=>(0,M.jsxs)(`div`,{className:N.key,children:[(0,M.jsx)(`dt`,{children:e.split(` / `).map((e,t)=>(0,M.jsxs)(`span`,{children:[t>0&&` / `,(0,M.jsx)(`kbd`,{children:e})]},e))}),(0,M.jsx)(`dd`,{children:t})]},e))}),(0,M.jsx)(`div`,{className:N.actions,children:(0,M.jsx)(`button`,{type:`button`,className:N.button,onClick:()=>n.current?.close(),children:`Close`})})]})}var Y={files:`_files_133vo_1`,findings:`_findings_133vo_2`,empty:`_empty_133vo_18`,file:`_file_133vo_1`,finding:`_finding_133vo_2`,title:`_title_133vo_63`,tag:`_tag_133vo_79`,dot:`_dot_133vo_97`,line:`_line_133vo_114`};function Fi(e){let t=[];for(let n of e){let e=t.at(-1);e?.file===n.anchor.file?e.findings.push(n):t.push({file:n.anchor.file,findings:[n]})}return t}function Ii(e){let t=e.anchor,n=t.kind===`line`?t.line:t.cited.line;return n?`L${n}`:`file`}function Li(e){return e.slice(e.lastIndexOf(`/`)+1)}function Ri({findings:e,overCap:t,dismissed:n}){let r=L(),i=A(nr),a=(0,O.useRef)(null);return(0,O.useEffect)(()=>{let e=a.current,t=e?.closest(`nav`)?.parentElement?.parentElement,n=e?.querySelector(`[aria-current="true"]`);t&&n&&st(t,n)},[i]),e.length===0?(0,M.jsx)(`p`,{className:Y.empty,children:n.size>0?`Every finding has been dismissed.`:`No findings in the changed files.`}):(0,M.jsx)(`ol`,{ref:a,className:Y.files,children:Fi(e).map((e,a)=>(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`button`,{type:`button`,className:Y.file,title:e.file,onClick:()=>r.goToFile(e.file),children:Li(e.file)}),(0,M.jsx)(`ol`,{className:Y.findings,children:e.findings.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,className:Y.finding,"data-severity":e.severity,"data-over-cap":t.has(e.id),"data-preexisting":e.preexisting??!1,"data-dismissed":n.has(e.id),"aria-current":e.id===i?`true`:void 0,title:`${Ve[e.severity]}${e.preexisting?` (pre-existing)`:``}${n.has(e.id)?` (dismissed)`:``}: ${e.title}`,onClick:()=>r.goToFinding(e.id),children:[(0,M.jsx)(`span`,{className:Y.dot,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:Y.title,children:e.title}),e.preexisting&&(0,M.jsx)(`span`,{className:Y.tag,children:`pre-existing`}),(0,M.jsx)(`span`,{className:Y.line,children:Ii(e)})]})},e.id))})]},`${e.file}-${a}`))})}var zi={chapters:`_chapters_12sy8_1`,stops:`_stops_12sy8_2`,chapter:`_chapter_12sy8_1`,stop:`_stop_12sy8_2`,number:`_number_12sy8_49`,title:`_title_12sy8_62`};function Bi(e,t){let n=new Map(e.filter(e=>!e.parentId).map(e=>[e.id,e.title])),r=[],i=new Map;for(let e of t){let t=n.has(e.chapterId)?e.chapterId:``,a=i.get(t);a||(a={id:t,title:n.get(t)??`Walkthrough`,stops:[]},i.set(t,a),r.push(a)),a.stops.push(e)}return r}function Vi({groups:e,stops:t}){let n=L(),r=A(rr),i=(0,O.useRef)(null),a=Bi(e,t),o=0;return(0,O.useEffect)(()=>{let e=i.current,t=e?.closest(`nav`)?.parentElement?.parentElement,n=e?.querySelector(`[aria-current="step"]`);t&&n&&st(t,n)},[r]),(0,M.jsx)(`ol`,{ref:i,className:zi.chapters,children:a.map(e=>(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`h3`,{className:zi.chapter,children:e.title}),(0,M.jsx)(`ol`,{className:zi.stops,children:e.stops.map(e=>(o+=1,(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,className:zi.stop,"data-importance":e.importance,"aria-current":e.id===r?`step`:void 0,onClick:()=>n.goToStop(e.id),children:[(0,M.jsx)(`span`,{className:zi.number,children:o}),(0,M.jsx)(`span`,{className:zi.title,children:e.title})]})},e.id)))})]},e.id||`loose`))})}var X={sidebar:`_sidebar_1dwkw_1`,modes:`_modes_1dwkw_7`,mode:`_mode_1dwkw_7`,modeCount:`_modeCount_1dwkw_32`,nav:`_nav_1dwkw_38`,list:`_list_1dwkw_42`,row:`_row_1dwkw_51`,caret:`_caret_1dwkw_69`,caretSpace:`_caretSpace_1dwkw_70`,link:`_link_1dwkw_87`,label:`_label_1dwkw_101`,icon:`_icon_1dwkw_108`,title:`_title_1dwkw_116`,sub:`_sub_1dwkw_127`};function Hi({group:e,stats:t,depth:n,visible:r,fold:i}){return(0,M.jsxs)(`li`,{className:X.row,"data-visible":r,"data-depth":n,children:[i?(0,M.jsx)(`button`,{type:`button`,className:X.caret,onClick:i.onToggle,title:i.folded?`Show units`:`Hide units`,"aria-expanded":!i.folded,children:i.folded?(0,M.jsx)(Be,{"aria-hidden":!0}):(0,M.jsx)(ze,{"aria-hidden":!0})}):(0,M.jsx)(`span`,{className:X.caretSpace}),(0,M.jsxs)(`button`,{type:`button`,className:X.link,onClick:()=>ot(e.id),children:[(0,M.jsxs)(`span`,{className:X.label,children:[(0,M.jsx)(Jr,{icon:e.icon,className:X.icon}),(0,M.jsx)(`span`,{className:X.title,children:e.title}),t?.critical&&(0,M.jsx)(Yr,{reason:t.criticalReason})]}),t&&t.files>0&&(0,M.jsxs)(`span`,{className:X.sub,children:[(0,M.jsx)(F,{additions:t.additions,deletions:t.deletions,binary:t.binary===t.files}),(0,M.jsxs)(`span`,{children:[`・`,P(t.files,`file`)]})]}),t?.files===0&&e.stopIds.length>0&&(0,M.jsx)(`span`,{className:X.sub,children:`Walkthrough only`})]})]})}var Ui={groups:`Groups`,findings:`Findings`,guide:`Guide`};function Wi({run:e,tree:t,visible:n,folded:r,onToggleFold:i,findings:a,overCap:o,dismissed:s}){let c=k(),l=A(ar),u=[`groups`];e.findings.length+e.overCapFindings.length>0&&u.push(`findings`),e.stops.length>0&&u.push(`guide`);let d=u.includes(l)?l:`groups`;return(0,M.jsxs)(`div`,{className:X.sidebar,children:[u.length>1&&(0,M.jsx)(`div`,{className:X.modes,role:`group`,"aria-label":`Sidebar view`,children:u.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:X.mode,"aria-pressed":d===e,onClick:()=>c(Zn(e)),children:[Ui[e],e===`findings`&&(0,M.jsx)(`span`,{className:X.modeCount,children:a.length})]},e))}),d===`guide`&&(0,M.jsx)(`nav`,{className:X.nav,"aria-label":`Walkthrough`,children:(0,M.jsx)(Vi,{groups:e.groups,stops:e.stops})}),d===`findings`&&(0,M.jsx)(`nav`,{className:X.nav,"aria-label":`Findings`,children:(0,M.jsx)(Ri,{findings:a,overCap:o,dismissed:s})}),d===`groups`&&(0,M.jsx)(Gi,{tree:t,visible:n,folded:r,onToggleFold:i})]})}function Gi({tree:e,visible:t,folded:n,onToggleFold:r}){let i=(0,O.useRef)(null),a=e.ordered.find(e=>t.has(e.id))?.id;return(0,O.useEffect)(()=>{let e=i.current,t=e?.parentElement?.parentElement,n=e?.querySelector(`[data-visible="true"]`);t&&n&&st(t,n)},[a]),(0,M.jsx)(`nav`,{ref:i,className:X.nav,"aria-label":`Groups`,children:(0,M.jsx)(`ul`,{className:X.list,children:e.chapters.flatMap(({chapter:i,units:a})=>{let o=[];if(i){let s=n.has(i.id);if(o.push((0,M.jsx)(Hi,{group:i,stats:e.stats.get(i.id),depth:0,visible:t.has(i.id),fold:a.length>0?{folded:s,onToggle:()=>r(i.id)}:void 0},i.id)),s)return o}for(let n of a)o.push((0,M.jsx)(Hi,{group:n,stats:e.stats.get(n.id),depth:+!!i,visible:t.has(n.id)},n.id));return o})})})}var Ki={product:0,deploy:1,tooling:2},qi=[`product`,`deploy`,`tooling`],Ji={product:`Prod risk`,deploy:`Deploy risk`,tooling:`Main findings — tooling`},Yi=e=>e.severity===`blocker`||e.severity===`should-fix`;function Xi(e){let t=e.filter(e=>!e.preexisting),n=t.filter(e=>e.severity===`blocker`).length,r=t.filter(e=>e.severity===`should-fix`).length;return n?{level:`high`,label:`Merge risk: high`,detail:`${n} ${n===1?`blocker`:`blockers`} open.`}:r?{level:`moderate`,label:`Merge risk: moderate`,detail:`${r} should-fix ${r===1?`finding`:`findings`} open.`}:{level:`low`,label:`Merge risk: low`,detail:`nothing found that should block this.`}}function Zi(e){let t=e.filter(e=>e.surface===`product`&&!e.preexisting),n=t.filter(Yi).length;return t.length===0?{level:`low`,label:`Prod risk: none`,detail:`everything found is in tooling, deploy or test code.`}:n?{level:`high`,label:`Prod risk: ${n}`,detail:`${n===1?`finding`:`findings`} in production code worth acting on.`}:{level:`moderate`,label:`Prod risk: low`,detail:`${t.length} in production code, none above a question.`}}function Qi(e){let t=new Set(e);return qi.find(e=>t.has(e))??`product`}function $i(e,t){return Ki[e]<=Ki[t]}var ea=[`high`,`medium`,`low`];function ta(e){let t=new Map;for(let n of e){let e=t.get(n.file);e?e.push(n):t.set(n.file,[n])}return[...t].map(([e,t])=>({file:e,findings:t}))}function na(e){let t=[...e.findings].sort((e,t)=>z.indexOf(e.severity)-z.indexOf(t.severity)||ea.indexOf(e.confidence)-ea.indexOf(t.confidence)),n=t.filter(e=>e.repeatOf===void 0&&!e.preexisting),r=t.filter(e=>e.repeatOf===void 0&&e.preexisting),i=t.filter(e=>e.repeatOf!==void 0),a=z.map(e=>[e,n.filter(t=>t.severity===e).length]).filter(([,e])=>e>0),o=n.flatMap(e=>e.surface?[{finding:e,severity:e.severity,surface:e.surface}]:[]),s=o.length===n.length,c=e.files.flatMap(e=>e.surface?[e.surface]:[]),l=s?Qi(c.length?c:o.map(e=>e.surface)):null,u=l?o.filter(e=>$i(e.surface,l)).map(e=>e.finding):n,d=l?o.filter(e=>!$i(e.surface,l)).map(e=>e.finding):[];return{merge:Xi(n),...s?{prod:Zi(o)}:{},counts:a,title:l?Ji[l]:`Findings`,main:ta(u),other:ta(d),preexisting:ta(r),echoed:i}}var ra=new Set([`range`,`branch`,`commit`]);function ia(e){if(e.target.kind===`pr`)return`the description`;let t=ra.has(e.target.kind);return e.intent.stated?t?`the stated intent and commit messages`:`the stated intent`:t?`the commit messages`:void 0}var Z={summary:`_summary_19fm7_1`,verdicts:`_verdicts_19fm7_22`,dot:`_dot_19fm7_28`,sep:`_sep_19fm7_64`,section:`_section_19fm7_68`,sectionHeader:`_sectionHeader_19fm7_74`,heading:`_heading_19fm7_81`,subheading:`_subheading_19fm7_87`,findings:`_findings_19fm7_94`,fileFindings:`_fileFindings_19fm7_95`,list:`_list_19fm7_96`,finding:`_finding_19fm7_94`,outside:`_outside_19fm7_113`,lineLink:`_lineLink_19fm7_120`,fileLink:`_fileLink_19fm7_121`,path:`_path_19fm7_133`,details:`_details_19fm7_141`,overCap:`_overCap_19fm7_150`,labelled:`_labelled_19fm7_157`,inline:`_inline_19fm7_161`,alignment:`_alignment_19fm7_169`,why:`_why_19fm7_185`,note:`_note_19fm7_190`,files:`_files_19fm7_194`,footer:`_footer_19fm7_203`},aa=`summary`,oa={aligned:e=>`Matches ${e}`,partial:e=>`Partly matches ${e}`,misaligned:e=>`Does not match ${e}`},sa=[[`matches`,()=>`Holds up on`],[`mismatches`,()=>`Does not hold up on`],[`unstated`,e=>`In the diff but not in ${e}`],[`missing`,()=>`Stated but not accomplished`]];function ca(e){let t=e.replace(/^the /,``);return t.charAt(0).toUpperCase()+t.slice(1)}var la=[[`overCap`,`More code files than the reviewers could read; these were left out.`],[`failed`,`The reviewer for these files failed.`],[`budget`,`The cost limit stopped the review before these files.`]];function ua({path:e,known:t}){let n=L();return t?(0,M.jsx)(`button`,{type:`button`,className:Z.fileLink,onClick:()=>n.goToFile(e),children:(0,M.jsx)(`code`,{className:Z.path,children:e})}):(0,M.jsx)(`code`,{className:Z.path,children:e})}function da({verdict:e}){return(0,M.jsxs)(`p`,{className:Z.verdict,children:[(0,M.jsx)(`span`,{className:Z.dot,"data-level":e.level,"aria-hidden":!0}),(0,M.jsx)(`strong`,{children:e.label}),` — `,e.detail]})}function fa(e){let t=e.anchor,n=t.kind===`line`?t.line:t.cited.line,r=t.kind===`line`?t.endLine:t.cited.endLine;return n?r&&r!==n?`L${n}-${r}`:`L${n}`:`whole file`}function pa({groups:e,files:t}){let n=L();return(0,M.jsx)(`ul`,{className:Z.findings,children:e.map(({file:e,findings:r})=>{let i=t.has(e);return(0,M.jsxs)(`li`,{children:[(0,M.jsx)(ua,{path:e,known:i}),!i&&(0,M.jsx)(`span`,{className:Z.outside,children:`outside the diff`}),(0,M.jsx)(`ul`,{className:Z.fileFindings,children:r.map(e=>(0,M.jsxs)(`li`,{className:Z.finding,children:[(0,M.jsx)(`span`,{className:Z.dot,"data-severity":e.severity,"aria-hidden":!0}),(0,M.jsx)(`strong`,{children:Ve[e.severity]}),` `,e.title,` —`,` `,i?(0,M.jsx)(`button`,{type:`button`,className:Z.lineLink,onClick:()=>n.goToFinding(e.id),children:fa(e)}):(0,M.jsx)(`span`,{children:fa(e)})]},e.id))})]},e)})})}function ma({label:e,children:t}){return(0,M.jsxs)(`div`,{className:Z.labelled,children:[(0,M.jsx)(`strong`,{children:e}),` `,t]})}function ha({run:e}){let t=k(),n=A(or),r=A(sr),i=gn(e.id),a=_n(e.id),o=Object.values(i.findingStatus).filter(e=>e===`accepted`).length,s=e.files.filter(e=>e.path in i.reviewedFiles).length,c=e=>r||!a.has(e.id),l=new Set(e.files.map(e=>e.path)),u=na({files:e.files,findings:e.findings.filter(e=>!a.has(e.id))}),d=r?na({files:e.files,findings:e.findings.filter(c)}):u,{intent:f,overview:p,meta:m}=e,h=u.main.length+u.other.length,g=e.findings.some(e=>a.has(e.id)&&!e.preexisting&&e.repeatOf===void 0),_=d.main.reduce((e,t)=>e+t.findings.length,0),y=d.other.reduce((e,t)=>e+t.findings.length,0),b=d.preexisting.reduce((e,t)=>e+t.findings.length,0),x=e.overCapFindings.filter(c),S=ia(e),C=S?f.alignment:void 0,w=S?sa.filter(([e])=>(f[e]?.length??0)>0):[],ee=la.filter(([t])=>(e.unreviewed[t]?.length??0)>0),te=S?f.mismatches?.[0]:void 0,ne=Mt(e)===`diff`,T=e.groups.filter(e=>e.files.length>0).length;return(0,M.jsxs)(`section`,{id:aa,tabIndex:-1,className:Z.summary,"aria-label":ne?`Diff summary`:`Review summary`,children:[ne?(0,M.jsxs)(`p`,{children:[P(e.files.length,`changed file`),` in `,P(T,`group`),e.status===`complete`&&e.stops.length===0&&!p.focus&&(0,M.jsxs)(`span`,{className:Z.note,children:[` · no walkthrough (add one with `,(0,M.jsx)(`code`,{children:`diffloupe diff --walkthrough`}),`)`]})]}):h===0?(0,M.jsx)(`p`,{children:e.status===`running`?`Reviewing the changed files. Findings appear here when the review finishes.`:e.status===`complete`?g?`Every finding has been dismissed.`:`No new issues found in the changed files.`:`The review ${e.status===`failed`?`failed`:`was cancelled`} before reporting any findings.`}):(0,M.jsxs)(`div`,{className:Z.verdicts,children:[(0,M.jsx)(da,{verdict:u.merge}),u.prod&&(0,M.jsx)(da,{verdict:u.prod}),(0,M.jsx)(`p`,{className:Z.counts,children:u.counts.map(([e,t],n)=>(0,M.jsxs)(`span`,{children:[n>0&&(0,M.jsx)(`span`,{className:Z.sep,children:` · `}),(0,M.jsx)(`span`,{className:Z.dot,"data-severity":e,"aria-hidden":!0}),(0,M.jsx)(`strong`,{children:Ve[e]}),`: `,t]},e))})]}),_>0&&(0,M.jsxs)(`section`,{className:Z.section,children:[(0,M.jsxs)(`div`,{className:Z.sectionHeader,children:[(0,M.jsxs)(`h3`,{className:Z.heading,children:[d.title,` (`,_,`)`]}),(0,M.jsx)(fr,{text:()=>Rn(e,{includeOverCap:n,state:i,includeDismissed:r}),label:`Copy all`,title:`Copy all findings as markdown`})]}),(0,M.jsx)(pa,{groups:d.main,files:l})]}),y>0&&(0,M.jsxs)(`details`,{className:Z.details,children:[(0,M.jsxs)(`summary`,{children:[`Everything else (`,y,`) — lower-risk surfaces`]}),(0,M.jsx)(pa,{groups:d.other,files:l})]}),b>0&&(0,M.jsxs)(`details`,{className:Z.details,children:[(0,M.jsxs)(`summary`,{children:[`Pre-existing (`,b,`) — not introduced by this change`]}),(0,M.jsx)(pa,{groups:d.preexisting,files:l})]}),x.length>0&&(0,M.jsxs)(`div`,{className:Z.section,children:[(0,M.jsxs)(`label`,{className:Z.overCap,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>t(Qn())}),P(x.length,`more finding`),` past the posting cap. Show them here and in the diff.`]}),n&&(0,M.jsx)(pa,{groups:ta(x),files:l})]}),(a.size>0||o>0||s>0)&&(0,M.jsxs)(`div`,{className:Z.section,children:[(0,M.jsx)(`p`,{className:Z.note,children:[o>0?`${o} accepted`:``,a.size>0?`${a.size} dismissed`:``,`${s} of ${P(e.files.length,`file`)} reviewed`].filter(Boolean).join(` · `)}),a.size>0&&(0,M.jsxs)(`label`,{className:Z.overCap,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>t($n())}),`Show dismissed findings here and in the diff.`]})]}),d.echoed.length>0&&(0,M.jsxs)(`details`,{className:Z.details,children:[(0,M.jsxs)(`summary`,{children:[`Agreeing with `,P(d.echoed.length,`existing review comment`)]}),(0,M.jsx)(pa,{groups:ta(d.echoed),files:l})]}),(C||f.inferred||f.stated||w.length>0)&&(0,M.jsxs)(`div`,{className:Z.section,children:[S&&(C||te)&&(0,M.jsxs)(ma,{label:`Intent:`,children:[C&&(0,M.jsx)(`span`,{className:Z.alignment,"data-alignment":C,children:oa[C](S)}),te&&(0,M.jsxs)(M.Fragment,{children:[` — `,te]})]}),f.inferred&&(0,M.jsx)(ma,{label:`What it does:`,children:f.inferred}),S&&(f.stated||w.length>0)&&(0,M.jsxs)(`details`,{className:Z.details,children:[(0,M.jsxs)(`summary`,{children:[ca(S),` compared with the code`]}),f.stated&&(0,M.jsx)(ma,{label:`Stated:`,children:f.stated}),w.map(([e,t])=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h4`,{className:Z.subheading,children:t(S)}),(0,M.jsx)(`ul`,{className:Z.list,children:(f[e]??[]).map(e=>(0,M.jsx)(`li`,{children:e},e))})]},e))]})]}),p.focus&&(0,M.jsxs)(`div`,{className:Z.labelled,children:[(0,M.jsx)(`strong`,{children:`What to focus on:`}),` `,(0,M.jsx)(B,{source:p.focus,className:Z.inline})]}),p.startHere.length>0&&(0,M.jsxs)(`section`,{className:Z.section,children:[(0,M.jsx)(`h3`,{className:Z.heading,children:`Start here`}),(0,M.jsx)(`ol`,{className:Z.list,children:p.startHere.map(e=>(0,M.jsxs)(`li`,{children:[(0,M.jsx)(ua,{path:e.file,known:l.has(e.file)}),` — `,e.why]},e.file))})]}),e.resolved.length>0&&(0,M.jsxs)(`section`,{className:Z.section,children:[(0,M.jsx)(`h3`,{className:Z.heading,children:`Fixed since the last run`}),(0,M.jsx)(`ul`,{className:Z.list,children:e.resolved.map(t=>(0,M.jsxs)(`li`,{children:[e.priorRunId?(0,M.jsx)(v,{to:`/runs/$runId`,params:{runId:e.priorRunId},search:{finding:t.id},children:t.title??t.id}):t.title??t.id,t.file&&(0,M.jsxs)(`code`,{className:Z.path,children:[` `,t.file]}),t.note&&(0,M.jsx)(`span`,{className:Z.why,children:t.note})]},t.id))})]}),ee.length>0&&(0,M.jsxs)(`section`,{className:Z.section,children:[(0,M.jsx)(`h3`,{className:Z.heading,children:`Not reviewed`}),ee.map(([t,n])=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:Z.note,children:n}),(0,M.jsx)(`ul`,{className:Z.files,children:(e.unreviewed[t]??[]).map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(ua,{path:e,known:l.has(e)})},e))})]},t))]}),(0,M.jsxs)(`footer`,{className:Z.footer,children:[p.changeType&&(0,M.jsx)(`span`,{children:p.changeType}),m.costUsd>0||e.status===`running`&&!ne?(0,M.jsx)(`span`,{children:Ue(m.costUsd)}):!ne&&(0,M.jsx)(`span`,{children:`cost not reported`}),m.wallMs>0&&(0,M.jsx)(`span`,{children:We(m.wallMs)}),m.model&&(0,M.jsx)(`span`,{children:m.effort?`${m.model} (${m.effort})`:m.model}),(0,M.jsx)(`span`,{children:e.status})]})]})}function ga(e,t){let n=new Map;for(let t of e){let e=n.get(t.groupId);e?e.push(t):n.set(t.groupId,[t])}return t.ordered.flatMap(e=>n.get(e.id)??[])}function _a(e,t,n={}){let r=ga(e.files,t),i=new Map(r.map((e,t)=>[e.path,t])),a=n.showOverCap?[...e.findings,...e.overCapFindings]:e.findings,o=e=>e.anchor.kind===`file`?0:e.anchor.line;return{files:r,findings:a.filter(e=>i.has(e.anchor.file)&&!n.hidden?.has(e.id)).map((e,t)=>({f:e,i:t})).sort((e,t)=>i.get(e.f.anchor.file)-i.get(t.f.anchor.file)||o(e.f)-o(t.f)||z.indexOf(e.f.severity)-z.indexOf(t.f.severity)||e.i-t.i).map(({f:e})=>e),stops:[...e.stops]}}function va(e,t,n){if(!e.length)return;let r=t===void 0?-1:e.indexOf(t);return r===-1?e[0]:e[r+n]}var ya={j:`nextFile`,k:`prevFile`,n:`nextFinding`,p:`prevFinding`,"]":`nextStop`,"[":`prevStop`,x:`toggleFile`,r:`toggleReviewed`,t:`top`,"?":`help`},ba=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`]);function xa(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.tagName===`INPUT`?!ba.has(t.type??`text`):t.isContentEditable===!0||t.tagName===`TEXTAREA`||t.tagName===`SELECT`}function Sa(e){return e.ctrlKey||e.metaKey||e.altKey||xa(e.target)?null:ya[e.key]??null}function Ca(e,t,n,r,i){let a=e.map(e=>e.id);return t&&a.includes(t)?va(a,t,n):i===void 0?n===1?a[0]:void 0:n===1?e.find(e=>r(e)>=i)?.id:e.filter(e=>r(e)<i).at(-1)?.id}function wa(e,t,n){let r=ae(),i=(0,O.useRef)({lists:e,nav:t});i.current={lists:e,nav:t},(0,O.useEffect)(()=>{function e(e){let t=Sa(e),{lists:a,nav:o}=i.current;if(!t||!a||document.querySelector(`dialog[open]`))return;e.preventDefault();let s=r.getState(),c=ft(),l=a.files.map(e=>e.path),u=c?l.indexOf(c.path):void 0,d=e=>l.indexOf(e),f=t.startsWith(`next`)?1:-1;switch(t){case`nextFile`:case`prevFile`:{let e=c?va(l,c.path,f):f===1?l[0]:void 0;e&&o.goToFile(e);return}case`nextFinding`:case`prevFinding`:{let e=Ca(a.findings,s.focus.finding,f,e=>d(e.anchor.file),u);e&&o.goToFinding(e);return}case`nextStop`:case`prevStop`:{let e=Ca(a.stops,s.focus.stop,f,()=>0,void 0);e&&o.goToStop(e);return}case`toggleFile`:{let e=c?.path??s.focus.file;if(!e)return;let t=Te(s,n)?.includes(e)??!1;r.dispatch(ge({runId:n,path:e}));let i=c?.groupId??a.files.find(t=>t.path===e)?.groupId;!t&&i&<(i,e,{focus:!0});return}case`toggleReviewed`:{let e=c?.path??s.focus.file;if(!e)return;let t=I.endpoints.getRunState.select(n)(s).data?.reviewedFiles??{};o.setReviewed(e,!(e in t));return}case`top`:o.goToTop();return;case`help`:r.dispatch(er(!0));return}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r,n])}async function Ta(e){if(typeof window>`u`||!window.isSecureContext||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Ea(e,t,n={findings:[],stops:[]}){let r=new Map(e.map(e=>[e.id,e])),i=new Map(t.map(e=>[e.path,e])),a=[],o=new Map;for(let t of e){let n=t.parentId===void 0?void 0:r.get(t.parentId);if(n){let e=o.get(n.id);e||(e={chapter:n,units:[]},o.set(n.id,e),a.push(e)),e.units.push(t)}else if(Aa(t,e)){if(!o.has(t.id)){let e={chapter:t,units:[]};o.set(t.id,e),a.push(e)}}else{let e=a.at(-1);e&&e.chapter===null?e.units.push(t):a.push({chapter:null,units:[t]})}}let s=new Map,c=e=>{let t={files:0,additions:0,deletions:0,binary:0,critical:e.critical};for(let n of e.files){let e=i.get(n);t.files+=1,t.additions+=e?.additions??0,t.deletions+=e?.deletions??0,e?.isBinary&&(t.binary+=1)}return t};for(let{chapter:e,units:t}of a){let n=e?c(e):{files:0,additions:0,deletions:0,binary:0,critical:!1};for(let e of t){let t=c(e);s.set(e.id,t),n.files+=t.files,n.additions+=t.additions,n.deletions+=t.deletions,n.binary+=t.binary,n.critical||=t.critical}e&&s.set(e.id,n)}let l=ka(n);for(let{chapter:e,units:t}of a){for(let e of t)Da(s.get(e.id),l([e]));e&&Da(s.get(e.id),l([e,...t]))}return{chapters:a,stats:s,byId:r,ordered:a.flatMap(({chapter:e,units:t})=>e?[e,...t]:t)}}function Da(e,t){e?.critical&&t&&(e.criticalReason=t)}var Oa=[`blocker`,`should-fix`];function ka({findings:e,stops:t}){let n=new Map(e.map(e=>[e.id,e.severity])),r=new Set(t.filter(e=>e.importance===`critical`).map(e=>e.id));return e=>{let t=new Set(e.flatMap(e=>e.findingIds)),i=new Set(e.flatMap(e=>e.stopIds)),a=Oa.map(e=>({sev:e,n:[...t].filter(t=>n.get(t)===e).length})).filter(e=>e.n>0),o=[];if(a.length){let e=a.reduce((e,t)=>e+t.n,0);o.push(`${a.map(e=>`${e.n} ${e.sev}`).join(`, `)} ${e===1?`finding`:`findings`}`)}let s=[...i].filter(e=>r.has(e)).length;return s&&o.push(P(s,`critical walkthrough stop`)),o.length?o.join(`; `):void 0}}function Aa(e,t){return e.parentId===void 0?e.files.length===0||t.some(t=>t.parentId===e.id):!1}var ja=new Map;function Ma(){let e=history.state;if(e&&typeof e==`object`&&`__TSR_key`in e&&typeof e.__TSR_key==`string`)return e.__TSR_key}function Na(){let e=Ma();return e!==void 0&&ja.has(e)}function Pa(){(0,O.useEffect)(()=>{let e=()=>{let e=Ma();e&&ja.set(e,window.scrollY)},t=()=>{let e=Ma(),t=e?ja.get(e):void 0;if(t===void 0)return;let n=0,r=()=>{window.scrollTo({top:t,behavior:`instant`}),++n<4&&requestAnimationFrame(r)};requestAnimationFrame(r)};return window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`popstate`,t)}},[])}var Q={page:`_page_iew0b_1`,body:`_body_iew0b_5`,aside:`_aside_iew0b_10`,asideInner:`_asideInner_iew0b_16`,main:`_main_iew0b_24`,chapter:`_chapter_iew0b_34`,end:`_end_iew0b_40`,skeleton:`_skeleton_iew0b_49`,skeletonHeader:`_skeletonHeader_iew0b_55`,skeletonBody:`_skeletonBody_iew0b_60`,skeletonAside:`_skeletonAside_iew0b_65`,skeletonMain:`_skeletonMain_iew0b_70`,pulse:`_pulse_iew0b_1`},Fa=g(`/runs/$runId`),Ia=[];function La(e,t){let{finding:n,stop:r,file:i,...a}=e;return{...a,...t}}function Ra(){let[e,t]=(0,O.useState)(null);return(0,O.useEffect)(()=>{let e=new i;return e.setup(document),t(e),()=>{e.cleanUp(),t(null)}},[]),e}function za(){let{runId:e}=Fa.useParams(),{file:t,finding:n,stop:r}=Fa.useSearch(),i=Fa.useNavigate(),a=Fa.useLoaderData(),o=k(),{data:s}=ln(e),{data:l}=un(e),u=l===void 0?a.files:Le(e,l),d=Ra(),f=xn(bn),p=A(we),m=A(t=>Te(t,e))??Ia,h=A(t=>Ee(t,e))??Ia,g=(0,O.useMemo)(()=>new Set(m),[m]),_=(0,O.useMemo)(()=>new Set(h),[h]),v=A(or),y=A(sr),b=_n(e),x=y?Va:b,S=vn(e),C=A(nr),w=A(rr),ee=A(ir),[te,ne]=(0,O.useState)(null);(0,O.useEffect)(()=>{o(qn(e))},[o,e]);let T=(0,O.useMemo)(()=>s?Ea(s.groups,s.files,s):null,[s]),re=(0,O.useMemo)(()=>{let e=new Map;for(let t of s?.files??[]){let n=e.get(t.groupId);n?n.push(t):e.set(t.groupId,[t])}return e},[s]),E=(0,O.useMemo)(()=>{let e=[...s?.findings??[],...s?.overCapFindings??[]];return{files:new Map((s?.files??[]).map(e=>[e.path,e])),findings:new Map(e.map(e=>[e.id,e])),overCap:new Set((s?.overCapFindings??[]).map(e=>e.id)),stops:new Map((s?.stops??[]).map(e=>[e.id,e]))}},[s]),D=(0,O.useMemo)(()=>s?Vn(s,{showOverCap:v,hidden:x}):new Map,[s,v,x]),ie=(0,O.useMemo)(()=>s&&T?_a(s,T,{showOverCap:v,hidden:x}):null,[s,T,v,x]),ae=(0,O.useMemo)(()=>ie&&{...ie,findings:ie.findings.filter(e=>!b.has(e.id))},[ie,b]),oe=it(d!==null,T),se=(0,O.useMemo)(()=>new Set(oe.groups),[oe.groups]),ce=(0,O.useRef)({folded:_,showOverCap:v,showDismissed:y,dismissed:b,collapsedList:m});ce.current={folded:_,showOverCap:v,showDismissed:y,dismissed:b,collapsedList:m};let le=(0,O.useCallback)((t,n)=>{let r=E.files.get(t);if(!r)return;o(_e({runId:e,path:t}));let i=T?.byId.get(r.groupId)?.parentId;i&&ce.current.folded.has(i)&&o(ve({runId:e,groupId:i})),n?dt(r.groupId,t,n):lt(r.groupId,t,{focus:!0})},[o,E,e,T]),j=(0,O.useMemo)(()=>{let t=(e,t)=>{t?.fromUrl||i({search:t=>La(t,e),replace:t?.scroll===!1,resetScroll:!1})};return{runId:e,stops:s?.stops??[],goToTop(){o(Yn({id:null})),o(Xn({id:null})),i({search:e=>La(e,null)}).then(()=>document.getElementById(aa)?.focus({preventScroll:!0}))},goToFile(e){o(Jn(e)),le(e,null)},goToFinding(e,n){let r=E.findings.get(e);r&&(E.overCap.has(e)&&!ce.current.showOverCap&&o(Qn()),ce.current.dismissed.has(e)&&!ce.current.showDismissed&&o($n()),o(Yn({id:e,file:r.anchor.file})),t({finding:e},n),n?.scroll!==!1&&le(r.anchor.file,`finding-${e}`))},goToStop(e,n=0,r){let i=E.stops.get(e);if(!i)return;let a=i.locations[n];o(Xn({id:e,location:n,...a?{file:a.file}:{}})),t({stop:e},n>0?{...r,scroll:!1}:r),a&&r?.scroll!==!1&&le(a.file,`stop-${e}-${n}`)},async copy(e){let t=await Ta(e);return t||ne(e),t},setReviewed(t,n){let r=E.files.get(t);if(!r||s?.status===`running`)return;if(S({op:`reviewed`,paths:[t],value:n}),!n){o(_e({runId:e,path:t}));return}let i=ce.current.collapsedList.filter(e=>e!==t);o(he({runId:e,paths:[...i,t]})),lt(r.groupId,t,{focus:!0})}}},[S,o,E,i,le,s?.status,s?.stops,e]);(0,O.useEffect)(()=>{if(!t||!s||!d)return;let n=s.files.find(e=>e.path===t);n&&(o(_e({runId:e,path:n.path})),lt(n.groupId,n.path))},[t,s,d,o,e]);let ue=s!==void 0&&d!==null;Pa();let de=()=>({fromUrl:!0,scroll:!Na()});(0,O.useEffect)(()=>{ue&&(n&&n!==C?j.goToFinding(n,de()):!n&&C&&o(Yn({id:null})))},[ue,n]),(0,O.useEffect)(()=>{ue&&(r&&r!==w?j.goToStop(r,0,de()):!r&&w&&o(Xn({id:null})))},[ue,r]),wa(ae,j,e);let fe=(0,O.useMemo)(()=>{if(C){let e=E.findings.get(C);return e?{path:e.anchor.file,range:Hn(e.anchor)}:null}let e=w?E.stops.get(w)?.locations[ee]:void 0;return e?{path:e.file,range:Hn(e)}:null},[C,w,E,ee]),pe=fe?E.files.get(fe.path)?.groupId:void 0,me=e=>pe===e?fe:null,ge=(0,O.useMemo)(()=>{let t=s?.files.map(e=>e.path)??[],n=t=>()=>o(he({runId:e,paths:t}));return[{label:`Expand all files`,run:n([])},{label:`Collapse all files`,run:n(t)},{label:`Collapse skipped files`,run:n(s?.files.filter(e=>e.classification===`skip`).map(e=>e.path)??[])}]},[o,s,e]),ye=(0,O.useCallback)(t=>o(ve({runId:e,groupId:t})),[o,e]);if(!s||!T)return(0,M.jsx)(Ua,{});let be=f&&p;return(0,M.jsx)(Sn.Provider,{value:j,children:(0,M.jsxs)(`div`,{className:Q.page,children:[(0,M.jsx)(Mi,{run:s,tree:T,visible:se,collapseActions:ge}),(0,M.jsxs)(`div`,{className:Q.body,children:[be&&(0,M.jsx)(`aside`,{className:Q.aside,children:(0,M.jsx)(`div`,{className:Q.asideInner,children:(0,M.jsx)(Wi,{run:s,tree:T,visible:se,folded:_,onToggleFold:ye,findings:ie?.findings??Ha,overCap:E.overCap,dismissed:b})})}),(0,M.jsxs)(`main`,{className:Q.main,children:[(0,M.jsx)(ha,{run:s}),d&&(0,M.jsx)(c.Provider,{value:d,children:T.chapters.map(({chapter:t,units:n},r)=>{let i=t!==null&&_.has(t.id),a=t?re.get(t.id)??[]:[];return(0,M.jsxs)(`div`,{className:Q.chapter,children:[t&&(a.length>0?(0,M.jsx)(Qr,{runId:e,group:t,parent:void 0,stats:T.stats.get(t.id),files:a,diffs:u,collapsed:g,activePath:oe.files[t.id],annotations:D,selection:me(t.id)}):(0,M.jsx)(Zr,{chapter:t,stats:T.stats.get(t.id),unitCount:n.length,folded:i,onToggleFold:()=>ye(t.id)})),!i&&n.map(n=>(0,M.jsx)(Qr,{runId:e,group:n,parent:t??void 0,stats:T.stats.get(n.id),files:re.get(n.id)??Ba,diffs:u,collapsed:g,activePath:oe.files[n.id],annotations:D,selection:me(n.id)},n.id))]},t?.id??`loose-${r}`)})}),(0,M.jsx)(`p`,{className:Q.end,children:`End of diff`})]})]}),(0,M.jsx)(Pi,{}),te!==null&&(0,M.jsx)(Re,{text:te,onClose:()=>ne(null)})]})})}var Ba=[],Va=new Set,Ha=[];function Ua(){return(0,M.jsxs)(`div`,{className:Q.skeleton,"aria-busy":`true`,children:[(0,M.jsx)(`div`,{className:Q.skeletonHeader}),(0,M.jsxs)(`div`,{className:Q.skeletonBody,children:[(0,M.jsx)(`div`,{className:Q.skeletonAside}),(0,M.jsxs)(`div`,{className:Q.skeletonMain,children:[(0,M.jsx)(`div`,{}),(0,M.jsx)(`div`,{}),(0,M.jsx)(`div`,{})]})]})]})}var Wa=D({"file?":`string`,"finding?":`string`,"stop?":`string`}),Ga=e=>typeof e==`object`&&!!e&&`status`in e&&e.status===404,Ka=d({getParentRoute:()=>Pe,path:`/runs/$runId`,validateSearch:Wa,loader:async({context:{store:e},params:{runId:t}})=>{let n=e.dispatch(I.endpoints.getRun.initiate(t)),r=e.dispatch(I.endpoints.getRunPatch.initiate(t));try{let[i,a]=await Promise.all([n.unwrap(),r.unwrap()]);if(Te(e.getState(),t)===void 0){let n=i.files.filter(e=>e.classification===`skip`).map(e=>e.path);e.dispatch(he({runId:t,paths:n}))}return{files:Le(t,a)}}catch(e){throw Ga(e)?b():e}finally{n.unsubscribe(),r.unsubscribe()}},pendingComponent:Ua,errorComponent:Me,component:za}),qa=(0,O.forwardRef)(({title:e,titleId:t,...n},r)=>(0,M.jsxs)(`svg`,{viewBox:`0 0 256 256`,width:`1.2em`,height:`1.2em`,ref:r,"aria-labelledby":t,...n,children:[e?(0,M.jsx)(`title`,{id:t,children:e}):null,(0,M.jsx)(`path`,{fill:`currentColor`,d:`M216 48h-40v-8a24 24 0 0 0-24-24h-48a24 24 0 0 0-24 24v8H40a8 8 0 0 0 0 16h8v144a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16V64h8a8 8 0 0 0 0-16M96 40a8 8 0 0 1 8-8h48a8 8 0 0 1 8 8v8H96Zm96 168H64V64h128Zm-80-104v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0m48 0v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0`})]})),$={page:`_page_oa1c1_1`,header:`_header_oa1c1_10`,muted:`_muted_oa1c1_21`,error:`_error_oa1c1_27`,table:`_table_oa1c1_31`,row:`_row_oa1c1_52`,target:`_target_oa1c1_56`,link:`_link_oa1c1_62`,repo:`_repo_oa1c1_72`,invalid:`_invalid_oa1c1_78`,count:`_count_oa1c1_86`,kind:`_kind_oa1c1_111`,filters:`_filters_oa1c1_123`,filter:`_filter_oa1c1_123`,delete:`_delete_oa1c1_146`},Ja=[{key:`blocker`,label:`Blockers`},{key:`should-fix`,label:`Should fix`},{key:`nice-to-have`,label:`Nice to have`},{key:`question`,label:`Questions`}],Ya=[{key:`all`,label:`All`},{key:`review`,label:`Reviews`},{key:`diff`,label:`Diffs`}];function Xa({run:e}){let[t,{isLoading:n}]=mn(),r=He(e.target),i=e.kind??`review`;return(0,M.jsxs)(`tr`,{className:$.row,children:[(0,M.jsx)(`td`,{children:(0,M.jsx)(Ci,{status:e.status})}),(0,M.jsx)(`td`,{children:(0,M.jsx)(`span`,{className:$.kind,"data-kind":i,children:i===`diff`?`Diff`:`Review`})}),(0,M.jsx)(`td`,{children:(0,M.jsxs)(`div`,{className:$.target,children:[e.invalid?(0,M.jsxs)(`span`,{title:e.invalid,children:[r,` `,(0,M.jsx)(`span`,{className:$.invalid,children:`invalid`})]}):(0,M.jsx)(v,{to:`/runs/$runId`,params:{runId:e.id},className:$.link,children:r}),(0,M.jsx)(`span`,{className:$.repo,children:e.repo.slug??e.repo.root})]})}),(0,M.jsx)(`td`,{title:Ke(e.createdAt),className:$.muted,children:qe(e.createdAt)}),Ja.map(({key:t})=>i===`diff`?(0,M.jsx)(`td`,{className:$.count,"data-zero":!0},t):(0,M.jsx)(`td`,{className:$.count,"data-severity":t,"data-zero":e.findingCounts[t]===0,children:e.findingCounts[t]},t)),(0,M.jsx)(`td`,{className:$.count,children:i===`diff`&&e.costUsd===0?``:Ue(e.costUsd)}),(0,M.jsx)(`td`,{children:e.status!==`running`&&(0,M.jsx)(`button`,{type:`button`,className:$.delete,onClick:()=>{window.confirm(`Delete run ${e.id}?`)&&t(e.id)},disabled:n,title:`Delete run`,children:(0,M.jsx)(qa,{"aria-label":`Delete run`})})})]})}function Za(){let{data:e,error:t,isFetching:n}=cn(),[r,i]=(0,O.useState)(`all`),a=r===`all`?e:e?.filter(e=>(e.kind??`review`)===r),o=e?.some(e=>e.kind===`diff`)??!1;return(0,M.jsxs)(`main`,{className:$.page,children:[(0,M.jsxs)(`header`,{className:$.header,children:[(0,M.jsx)(`h1`,{children:`DiffLoupe`}),(0,M.jsx)(`span`,{className:$.muted,children:n?`Refreshing…`:a?`${a.length} runs`:``}),o&&(0,M.jsx)(`div`,{className:$.filters,role:`group`,"aria-label":`Show`,children:Ya.map(({key:e,label:t})=>(0,M.jsx)(`button`,{type:`button`,className:$.filter,"aria-pressed":r===e,onClick:()=>i(e),children:t},e))})]}),t?(0,M.jsx)(`p`,{className:$.error,children:Ne(t)}):e&&e.length===0?(0,M.jsxs)(`p`,{className:$.muted,children:[`No runs yet. Start one with `,(0,M.jsx)(`code`,{children:`diffloupe diff`}),` or `,(0,M.jsx)(`code`,{children:`diffloupe review`}),`.`]}):(0,M.jsxs)(`table`,{className:$.table,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:`Status`}),(0,M.jsx)(`th`,{children:`Kind`}),(0,M.jsx)(`th`,{children:`Target`}),(0,M.jsx)(`th`,{children:`Created`}),Ja.map(({key:e,label:t})=>(0,M.jsx)(`th`,{className:$.count,"data-severity":e,children:t},e)),(0,M.jsx)(`th`,{className:$.count,children:`Cost`}),(0,M.jsx)(`th`,{"aria-label":`Actions`})]})}),(0,M.jsx)(`tbody`,{children:a?.map(e=>(0,M.jsx)(Xa,{run:e},e.id))})]})]})}var Qa=d({getParentRoute:()=>Pe,path:`/`,loader:async({context:{store:e}})=>{let t=e.dispatch(I.endpoints.listRuns.initiate());try{await t.unwrap()}finally{t.unsubscribe()}},component:Za}),$a=Pe.addChildren([Qa,Ka]);function eo(e){return h({routeTree:$a,context:{store:e},defaultPreload:`intent`,defaultPreloadStaleTime:0,scrollRestoration:!0})}var to=C();function no(){return ne({reducer:{[I.reducerPath]:I.reducer,[j.reducerPath]:j.reducer,[Kn.reducerPath]:Kn.reducer},middleware:e=>e().prepend(to.middleware).concat(I.middleware)})}to.startListening.withTypes()({matcher:te(ue,de,fe,pe,me),effect:(e,{getState:t})=>{localStorage.setItem(oe,JSON.stringify(ye(t())))}});var ro=document.getElementById(`root`);if(!ro)throw Error(`Root element not found`);var io=no(),ao=eo(io),oo={workerFactory:()=>new u,poolSize:Math.min(4,Math.max(1,navigator.hardwareConcurrency-1))};(0,ie.createRoot)(ro).render((0,M.jsx)(O.StrictMode,{children:(0,M.jsx)(l,{poolOptions:oo,highlighterOptions:{},children:(0,M.jsx)(T,{store:io,children:(0,M.jsx)(y,{router:ao})})})}));
|
package/dist/web/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
if (theme === "light" || theme === "dark") document.documentElement.dataset.theme = theme;
|
|
11
11
|
} catch {}
|
|
12
12
|
</script>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-DY3NZSRS.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/react-jlQz0HNM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/shiki-CbbI7yl6.js">
|