review-workspace 1.12.0 → 1.13.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 CHANGED
@@ -32,6 +32,8 @@ npx review-workspace serve .bundles/<name> --port 4317
32
32
 
33
33
  Opens the UI at `http://127.0.0.1:4317` (prints a write token too — needed only to raise/answer Questions, not to view). The token is saved in the bundle as `.write-token` and stays the same after a restart. Use `serve --rotate-token` to make a new one. One process, no separate dev server.
34
34
 
35
+ `serve` and `publish` also make a copy of the bundle in `~/.claude/review-workspace-backups/<bundle-name>-<hash>/`. Only the latest copy is kept. `.write-token` and `watcher.json` are left out. If the bundle folder is deleted, the UI shows the backup path. Copy that folder back to restore the bundle. Set `REVIEW_WORKSPACE_BACKUP_ROOT` to use another folder.
36
+
35
37
  ## Addressing review feedback in the target repo
36
38
 
37
39
  When a bundle has open change-request Comments, publishing it exports a self-describing hand-off file (`.review-feedback/<mr-number>-round<N>.md`) into the *target* repo's own working tree. A second skill, `skills/address-review-feedback/`, reads that file there, implements or explicitly skips each change-request against the target repo's own conventions, runs the target repo's own verification, writes a structured response file next to the hand-off file, and commits and pushes — then asks whether to spawn a background `review-workspace` agent for the next round.
@@ -0,0 +1,55 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { cpSync, existsSync, mkdirSync, realpathSync, renameSync, rmSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { basename, join, resolve } from 'node:path';
5
+ export const DEFAULT_BACKUP_ROOT = process.env.REVIEW_WORKSPACE_BACKUP_ROOT ?? join(homedir(), '.claude', 'review-workspace-backups');
6
+ const SKIPPED_FILES = ['.write-token', 'watcher.json'];
7
+ export function backupPathFor(bundlePath, root = DEFAULT_BACKUP_ROOT) {
8
+ const absolute = resolve(bundlePath);
9
+ const hash = createHash('sha1').update(absolute).digest('hex').slice(0, 8);
10
+ return join(root, `${basename(absolute)}-${hash}`);
11
+ }
12
+ export function backupBundle(bundlePath, root = DEFAULT_BACKUP_ROOT) {
13
+ const absolute = resolve(bundlePath);
14
+ const destination = backupPathFor(absolute, root);
15
+ const staging = `${destination}.tmp`;
16
+ const previous = `${destination}.old`;
17
+ try {
18
+ const source = realpathSync(absolute);
19
+ mkdirSync(root, { recursive: true });
20
+ rmSync(staging, { recursive: true, force: true });
21
+ if (existsSync(previous)) {
22
+ if (existsSync(destination))
23
+ rmSync(previous, { recursive: true, force: true });
24
+ else
25
+ renameSync(previous, destination);
26
+ }
27
+ if (!existsSync(join(source, 'review.json'))) {
28
+ return { ok: false, message: 'review.json is missing, so the last backup was kept' };
29
+ }
30
+ const skipped = SKIPPED_FILES.map((name) => join(source, name));
31
+ cpSync(source, staging, { recursive: true, dereference: true, filter: (path) => !skipped.includes(path) });
32
+ const hadBackup = existsSync(destination);
33
+ if (hadBackup)
34
+ renameSync(destination, previous);
35
+ try {
36
+ renameSync(staging, destination);
37
+ }
38
+ catch (err) {
39
+ if (hadBackup)
40
+ renameSync(previous, destination);
41
+ throw err;
42
+ }
43
+ rmSync(previous, { recursive: true, force: true });
44
+ return { ok: true, path: destination };
45
+ }
46
+ catch (err) {
47
+ rmSync(staging, { recursive: true, force: true });
48
+ return { ok: false, message: err instanceof Error ? err.message : String(err) };
49
+ }
50
+ }
51
+ export function backupOrWarn(bundlePath, root) {
52
+ const result = backupBundle(bundlePath, root);
53
+ if (!result.ok)
54
+ process.stderr.write(`Backup failed for ${bundlePath}: ${result.message}\n`);
55
+ }
@@ -13,7 +13,7 @@ import { readChain } from "./carry-forward.js";
13
13
  * hand-off export itself.
14
14
  */
15
15
  export async function publishBundleAndExportHandoff(bundlePath, options) {
16
- const result = publishBundle(bundlePath, options.limits ?? DEFAULT_LIMITS);
16
+ const result = publishBundle(bundlePath, options.limits ?? DEFAULT_LIMITS, options.backupRoot);
17
17
  if (!result.ok)
18
18
  return result;
19
19
  const document = JSON.parse(readFileSync(join(bundlePath, 'review.json'), 'utf-8'));
@@ -1,13 +1,14 @@
1
1
  import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { validateBundle } from "./validate-bundle.js";
4
+ import { backupOrWarn } from "./backup.js";
4
5
  import { DEFAULT_LIMITS } from "../security/limits.js";
5
6
  /**
6
7
  * Validates a staged `review.next.json` and, only on success, atomically
7
8
  * replaces `review.json` with it. On any failure `review.json` is left
8
9
  * byte-for-byte untouched.
9
10
  */
10
- export function publishBundle(bundlePath, limits = DEFAULT_LIMITS) {
11
+ export function publishBundle(bundlePath, limits = DEFAULT_LIMITS, backupRoot) {
11
12
  const nextPath = join(bundlePath, 'review.next.json');
12
13
  if (!existsSync(nextPath)) {
13
14
  return { ok: false, blockingReason: 'missing-next', message: 'review.next.json not found' };
@@ -20,5 +21,6 @@ export function publishBundle(bundlePath, limits = DEFAULT_LIMITS) {
20
21
  const tmpPath = join(bundlePath, `.review.json.tmp-${process.pid}-${Date.now()}`);
21
22
  writeFileSync(tmpPath, readFileSync(nextPath, 'utf-8'));
22
23
  renameSync(tmpPath, reviewPath);
24
+ backupOrWarn(bundlePath, backupRoot);
23
25
  return { ok: true, diagnostics: result.diagnostics };
24
26
  }
@@ -14,7 +14,9 @@ import { render } from "../renderer/render.js";
14
14
  import { buildReport } from "../export/report.js";
15
15
  import { resolveAssetPath } from "../security/asset-path.js";
16
16
  import { readRepoFileTop } from "../security/repo-file.js";
17
+ import { backupOrWarn, backupPathFor } from "../bundle/backup.js";
17
18
  import { loadWriteToken } from "./write-token.js";
19
+ const FILE_EXTENSION = /\.[a-zA-Z0-9]+$/;
18
20
  const WRITE_TOKEN_HEADER = 'x-write-token';
19
21
  const WITHDRAW_PATH = /^\/questions\/([^/]+)\/withdraw$/;
20
22
  const RESOLVE_PATH = /^\/questions\/([^/]+)\/resolve$/;
@@ -39,12 +41,17 @@ const UI_CONTENT_TYPES = {
39
41
  '.json': 'application/json',
40
42
  ...ASSET_CONTENT_TYPES,
41
43
  };
44
+ function isStaticUiRequest(method, pathname) {
45
+ if (method !== 'GET' || pathname.startsWith('/assets/'))
46
+ return false;
47
+ return pathname === '/' || FILE_EXTENSION.test(pathname);
48
+ }
42
49
  function serveUiStatic(pathname, res) {
43
50
  if (!existsSync(UI_DIST_DIR))
44
51
  return false;
45
52
  // SPA fallback: any path without a recognized static-file extension is a client-side
46
53
  // route (e.g. a deep link) — serve index.html and let the app's own router take over.
47
- const hasExtension = /\.[a-zA-Z0-9]+$/.test(pathname);
54
+ const hasExtension = FILE_EXTENSION.test(pathname);
48
55
  const candidate = join(UI_DIST_DIR, hasExtension ? pathname : 'index.html');
49
56
  const resolved = hasExtension && existsSync(candidate) && statSync(candidate).isFile() ? candidate : join(UI_DIST_DIR, 'index.html');
50
57
  if (!existsSync(resolved))
@@ -82,10 +89,30 @@ export function startReviewServer(bundlePath, opts = {}) {
82
89
  // this is what makes file watching load-bearing rather than a no-op wrapper
83
90
  // around a stateless re-read-per-request design.
84
91
  let latest = validateBundle(bundlePath);
85
- const watcher = watchBundle(bundlePath);
86
- watcher.emitter.on('change', () => {
92
+ backupOrWarn(bundlePath, opts.backupRoot);
93
+ const backupCopyPath = backupPathFor(bundlePath, opts.backupRoot);
94
+ const lastBackup = () => (existsSync(backupCopyPath) ? backupCopyPath : null);
95
+ const reload = () => {
87
96
  carryForwardChain(bundlePath);
88
97
  latest = validateBundle(bundlePath);
98
+ };
99
+ let folderGone = false;
100
+ const folderIsPresent = () => {
101
+ if (existsSync(bundlePath)) {
102
+ folderGone = false;
103
+ return true;
104
+ }
105
+ if (!folderGone) {
106
+ folderGone = true;
107
+ const last = lastBackup();
108
+ process.stderr.write(`Bundle folder is gone: ${bundlePath}. ${last ? `Last backup: ${last}` : 'No backup found.'}\n`);
109
+ }
110
+ return false;
111
+ };
112
+ const watcher = watchBundle(bundlePath);
113
+ watcher.emitter.on('change', () => {
114
+ if (folderIsPresent())
115
+ reload();
89
116
  });
90
117
  const server = createServer((req, res) => {
91
118
  const url = new URL(req.url ?? '/', 'http://localhost');
@@ -98,6 +125,22 @@ export function startReviewServer(bundlePath, opts = {}) {
98
125
  res.writeHead(status, { 'content-type': 'application/json' });
99
126
  res.end(JSON.stringify(body));
100
127
  };
128
+ const isApiRequest = req.url?.startsWith('/api/') || !isStaticUiRequest(req.method, url.pathname);
129
+ if (isApiRequest) {
130
+ const wasGone = folderGone;
131
+ if (!folderIsPresent()) {
132
+ respond(503, { error: 'bundle folder is gone', backupPath: lastBackup() });
133
+ return;
134
+ }
135
+ if (wasGone)
136
+ reload();
137
+ }
138
+ if (req.method !== 'GET' && url.pathname !== '/publish') {
139
+ res.on('finish', () => {
140
+ if (res.statusCode < 300)
141
+ backupOrWarn(bundlePath, opts.backupRoot);
142
+ });
143
+ }
101
144
  if (req.method === 'GET' && url.pathname === '/document') {
102
145
  respond(200, latest);
103
146
  return;
@@ -172,7 +215,7 @@ export function startReviewServer(bundlePath, opts = {}) {
172
215
  }
173
216
  }
174
217
  if (req.method === 'POST' && url.pathname === '/publish') {
175
- publishBundleAndExportHandoff(bundlePath, { repoPath: opts.repoPath })
218
+ publishBundleAndExportHandoff(bundlePath, { repoPath: opts.repoPath, backupRoot: opts.backupRoot })
176
219
  .then((result) => respond(result.ok ? 200 : 422, result))
177
220
  .catch((err) => respond(500, { error: err instanceof Error ? err.message : 'publish failed' }));
178
221
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "review-workspace",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "A local, offline decision surface for reviewing a code Comparison — evidence-linked map of intent, behavior, risk, and observable effects.",
5
5
  "license": "MIT",
6
6
  "author": "Salih Sayer",
@@ -115,5 +115,5 @@ ${e}</tr>
115
115
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${$n(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=Hp(e);if(s===null)return r;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+$n(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=Hp(e);if(s===null)return $n(n);e=s;let o=`<img src="${e}" alt="${$n(n)}"`;return t&&(o+=` title="${$n(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:$n(e.text)}},dd=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},xn=class Gu{constructor(t){Fe(this,"options");Fe(this,"renderer");Fe(this,"textRenderer");this.options=t||fs,this.options.renderer=this.options.renderer||new ca,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new dd}static parse(t,n){return new Gu(n).parse(t)}static parseInline(t,n){return new Gu(n).parseInline(t)}parse(t){var r,s;this.renderer.parser=this;let n="";for(let o=0;o<t.length;o++){let i=t[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[i.type]){let l=i,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=u||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){var s,o;this.renderer.parser=this;let r="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Oi,go=(Oi=class{constructor(e){Fe(this,"options");Fe(this,"block");this.options=e||fs}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?bn.lex:bn.lexInline}provideParser(e=this.block){return e?xn.parse:xn.parseInline}},Fe(Oi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Fe(Oi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Oi),dy=class{constructor(...e){Fe(this,"defaults",rd());Fe(this,"options",this.setOptions);Fe(this,"parse",this.parseMarkdown(!0));Fe(this,"parseInline",this.parseMarkdown(!1));Fe(this,"Parser",xn);Fe(this,"Renderer",ca);Fe(this,"TextRenderer",dd);Fe(this,"Lexer",bn);Fe(this,"Tokenizer",ua);Fe(this,"Hooks",go);this.use(...e)}walkTokens(e,t){var r,s;let n=[];for(let o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{let i=o;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let i=o;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=o;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let l=i[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=t.renderers[s.name];o?t.renderers[s.name]=function(...i){let a=s.renderer.apply(this,i);return a===!1&&(a=o.apply(this,i)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new ca(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=n.renderer[i],l=s[i];s[i]=(...u)=>{let c=a.apply(s,u);return c===!1&&(c=l.apply(s,u)),c||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new ua(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=n.tokenizer[i],l=s[i];s[i]=(...u)=>{let c=a.apply(s,u);return c===!1&&(c=l.apply(s,u)),c}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new go;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=n.hooks[i],l=s[i];go.passThroughHooks.has(o)?s[i]=u=>{if(this.defaults.async&&go.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await a.call(s,u);return l.call(s,f)})();let c=a.call(s,u);return l.call(s,c)}:s[i]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(s,u);return f===!1&&(f=await l.apply(s,u)),f})();let c=a.apply(s,u);return c===!1&&(c=l.apply(s,u)),c}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(i){let a=[];return a.push(o.call(this,i)),s&&(a=a.concat(s.call(this,i))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return bn.lex(e,t??this.defaults)}parser(e,t){return xn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let i=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer(e):e?bn.lex:bn.lexInline)(i,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser(e):e?xn.parse:xn.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(o);try{s.hooks&&(t=s.hooks.preprocess(t));let i=(s.hooks?s.hooks.provideLexer(e):e?bn.lex:bn.lexInline)(t,s);s.hooks&&(i=s.hooks.processAllTokens(i)),s.walkTokens&&this.walkTokens(i,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(e):e?xn.parse:xn.parseInline)(i,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(i){return o(i)}}}onError(e,t){return n=>{if(n.message+=`
116
116
  Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+$n(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},os=new dy;function Xe(e,t){return os.parse(e,t)}Xe.options=Xe.setOptions=function(e){return os.setOptions(e),Xe.defaults=os.defaults,ty(Xe.defaults),Xe};Xe.getDefaults=rd;Xe.defaults=fs;Xe.use=function(...e){return os.use(...e),Xe.defaults=os.defaults,ty(Xe.defaults),Xe};Xe.walkTokens=function(e,t){return os.walkTokens(e,t)};Xe.parseInline=os.parseInline;Xe.Parser=xn;Xe.parser=xn.parse;Xe.Renderer=ca;Xe.TextRenderer=dd;Xe.Lexer=bn;Xe.lexer=bn.lex;Xe.Tokenizer=ua;Xe.Hooks=go;Xe.parse=Xe;Xe.options;Xe.setOptions;Xe.use;Xe.walkTokens;Xe.parseInline;xn.parse;bn.lex;/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */function Gp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function CP(e){if(Array.isArray(e))return e}function SP(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,s=c}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw s}}return a}}function TP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
117
117
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AP(e,t){return CP(e)||SP(e,t)||EP(e,t)||TP()}function EP(e,t){if(e){if(typeof e=="string")return Gp(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gp(e,t):void 0}}const fy=Object.entries,Kp=Object.setPrototypeOf,OP=Object.isFrozen,PP=Object.getPrototypeOf,RP=Object.getOwnPropertyDescriptor;let Pt=Object.freeze,Rt=Object.seal,Ts=Object.create,py=typeof Reflect<"u"&&Reflect,Ku=py.apply,Yu=py.construct;Pt||(Pt=function(t){return t});Rt||(Rt=function(t){return t});Ku||(Ku=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o];return t.apply(n,s)});Yu||(Yu=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new t(...r)});const ws=mt(Array.prototype.forEach),IP=mt(Array.prototype.lastIndexOf),Yp=mt(Array.prototype.pop),ks=mt(Array.prototype.push),$P=mt(Array.prototype.splice),Er=Array.isArray,mo=mt(String.prototype.toLowerCase),Kl=mt(String.prototype.toString),Qp=mt(String.prototype.match),uo=mt(String.prototype.replace),Xp=mt(String.prototype.indexOf),qP=mt(String.prototype.trim),MP=mt(Number.prototype.toString),DP=mt(Boolean.prototype.toString),Zp=typeof BigInt>"u"?null:mt(BigInt.prototype.toString),Jp=typeof Symbol>"u"?null:mt(Symbol.prototype.toString),St=mt(Object.prototype.hasOwnProperty),co=mt(Object.prototype.toString),Ct=mt(RegExp.prototype.test),Fr=LP(TypeError);function mt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return Ku(e,t,r)}}function LP(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Yu(e,n)}}function Ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mo;if(Kp&&Kp(e,null),!Er(t))return e;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const o=n(s);o!==s&&(OP(t)||(t[r]=o),s=o)}e[s]=!0}return e}function NP(e){for(let t=0;t<e.length;t++)St(e,t)||(e[t]=null);return e}function Ut(e){const t=Ts(null);for(const r of fy(e)){var n=AP(r,2);const s=n[0],o=n[1];St(e,s)&&(Er(o)?t[s]=NP(o):o&&typeof o=="object"&&o.constructor===Object?t[s]=Ut(o):t[s]=o)}return t}function BP(e){switch(typeof e){case"string":return e;case"number":return MP(e);case"boolean":return DP(e);case"bigint":return Zp?Zp(e):"0";case"symbol":return Jp?Jp(e):"Symbol()";case"undefined":return co(e);case"function":case"object":{if(e===null)return co(e);const t=e,n=qn(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:co(r)}return co(e)}default:return co(e)}}function qn(e,t){for(;e!==null;){const r=RP(e,t);if(r){if(r.get)return mt(r.get);if(typeof r.value=="function")return mt(r.value)}e=PP(e)}function n(){return null}return n}function zP(e){try{return Ct(e,""),!0}catch{return!1}}const eh=Pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Yl=Pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ql=Pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),FP=Pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Xl=Pt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jP=Pt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),th=Pt(["#text"]),nh=Pt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Zl=Pt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rh=Pt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ai=Pt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),HP=Rt(/{{[\w\W]*|^[\w\W]*}}/g),VP=Rt(/<%[\w\W]*|^[\w\W]*%>/g),UP=Rt(/\${[\w\W]*/g),WP=Rt(/^data-[\-\w.\u00B7-\uFFFF]+$/),GP=Rt(/^aria-[\-\w]+$/),sh=Rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),KP=Rt(/^(?:\w+script|data):/i),YP=Rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),QP=Rt(/^html$/i),XP=Rt(/^[a-z][.\w]*(-[.\w]+)+$/i),oh=Rt(/<[/\w!]/g),ih=Rt(/<[/\w]/g),ZP=Rt(/<\/no(script|embed|frames)/i),JP=Rt(/\/>/i),sn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},eR=function(){return typeof window>"u"?null:window},tR=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ah=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_r=function(t,n,r,s){return St(t,n)&&Er(t[n])?Ne(s.base?Ut(s.base):{},t[n],s.transform):r};function hy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eR();const t=ae=>hy(ae);if(t.version="3.4.12",t.removed=[],!e||!e.document||e.document.nodeType!==sn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,s=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,i=e.Node,a=e.Element,l=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const c=e.DOMParser,f=e.trustedTypes,p=a.prototype,h=qn(p,"cloneNode"),g=qn(p,"remove"),m=qn(p,"nextSibling"),v=qn(p,"childNodes"),x=qn(p,"parentNode"),b=qn(p,"shadowRoot"),w=qn(p,"attributes"),k=i&&i.prototype?qn(i.prototype,"nodeType"):null,O=i&&i.prototype?qn(i.prototype,"nodeName"):null;if(typeof o=="function"){const ae=n.createElement("template");ae.content&&ae.content.ownerDocument&&(n=ae.content.ownerDocument)}let P,I="",M,j=!1,H=0;const le=function(){if(H>0)throw Fr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},K=function(_){le(),H++;try{return P.createHTML(_)}finally{H--}},X=function(_){le(),H++;try{return P.createScriptURL(_)}finally{H--}},J=function(){return j||(M=tR(f,s),j=!0),M},fe=n,F=fe.implementation,de=fe.createNodeIterator,ee=fe.createDocumentFragment,_e=fe.getElementsByTagName,ie=r.importNode;let Se=ah();t.isSupported=typeof fy=="function"&&typeof x=="function"&&F&&F.createHTMLDocument!==void 0;const Le=HP,rt=VP,lt=UP,Ye=WP,ze=GP,W=KP,ge=YP,re=XP;let ke=sh,be=null;const S=Ne({},[...eh,...Yl,...Ql,...Xl,...th]);let A=null;const D=Ne({},[...nh,...Zl,...rh,...Ai]);let z=Object.seal(Ts(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Q=null,V=null;const ue=Object.seal(Ts(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ce=!0,oe=!0,Z=!1,Te=!0,he=!1,xe=!0,Ce=!1,De=!1,Ve=null,He=null,st=!1,ot=!1,zt=!1,Ft=!1,yr=!0,Qs=!1;const $t="user-content-";let Jt=!0,ps=!1,Xn={},En=null;const il=Ne({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Sd=null;const Td=Ne({},["audio","video","img","source","image","track"]);let al=null;const Ad=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ni="http://www.w3.org/1998/Math/MathML",ri="http://www.w3.org/2000/svg",On="http://www.w3.org/1999/xhtml";let hs=On,ll=!1,ul=null;const jy=Ne({},[ni,ri,On],Kl),Ed=Pt(["mi","mo","mn","ms","mtext"]);let cl=Ne({},Ed);const Od=Pt(["annotation-xml"]);let dl=Ne({},Od);const Hy=Ne({},["title","style","font","a","script"]);let Xs=null;const Vy=["application/xhtml+xml","text/html"],Uy="text/html";let ut=null,gs=null;const Wy=n.createElement("form"),Pd=function(_){return _ instanceof RegExp||_ instanceof Function},fl=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(gs&&gs===_)return;(!_||typeof _!="object")&&(_={}),_=Ut(_),Xs=Vy.indexOf(_.PARSER_MEDIA_TYPE)===-1?Uy:_.PARSER_MEDIA_TYPE,ut=Xs==="application/xhtml+xml"?Kl:mo,be=_r(_,"ALLOWED_TAGS",S,{transform:ut}),A=_r(_,"ALLOWED_ATTR",D,{transform:ut}),ul=_r(_,"ALLOWED_NAMESPACES",jy,{transform:Kl}),al=_r(_,"ADD_URI_SAFE_ATTR",Ad,{transform:ut,base:Ad}),Sd=_r(_,"ADD_DATA_URI_TAGS",Td,{transform:ut,base:Td}),En=_r(_,"FORBID_CONTENTS",il,{transform:ut}),Q=_r(_,"FORBID_TAGS",Ut({}),{transform:ut}),V=_r(_,"FORBID_ATTR",Ut({}),{transform:ut}),Xn=St(_,"USE_PROFILES")?_.USE_PROFILES&&typeof _.USE_PROFILES=="object"?Ut(_.USE_PROFILES):_.USE_PROFILES:!1,ce=_.ALLOW_ARIA_ATTR!==!1,oe=_.ALLOW_DATA_ATTR!==!1,Z=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Te=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,he=_.SAFE_FOR_TEMPLATES||!1,xe=_.SAFE_FOR_XML!==!1,Ce=_.WHOLE_DOCUMENT||!1,ot=_.RETURN_DOM||!1,zt=_.RETURN_DOM_FRAGMENT||!1,Ft=_.RETURN_TRUSTED_TYPE||!1,st=_.FORCE_BODY||!1,yr=_.SANITIZE_DOM!==!1,Qs=_.SANITIZE_NAMED_PROPS||!1,Jt=_.KEEP_CONTENT!==!1,ps=_.IN_PLACE||!1,ke=zP(_.ALLOWED_URI_REGEXP)?_.ALLOWED_URI_REGEXP:sh,hs=typeof _.NAMESPACE=="string"?_.NAMESPACE:On,cl=St(_,"MATHML_TEXT_INTEGRATION_POINTS")&&_.MATHML_TEXT_INTEGRATION_POINTS&&typeof _.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ut(_.MATHML_TEXT_INTEGRATION_POINTS):Ne({},Ed),dl=St(_,"HTML_INTEGRATION_POINTS")&&_.HTML_INTEGRATION_POINTS&&typeof _.HTML_INTEGRATION_POINTS=="object"?Ut(_.HTML_INTEGRATION_POINTS):Ne({},Od);const N=St(_,"CUSTOM_ELEMENT_HANDLING")&&_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING=="object"?Ut(_.CUSTOM_ELEMENT_HANDLING):Ts(null);if(z=Ts(null),St(N,"tagNameCheck")&&Pd(N.tagNameCheck)&&(z.tagNameCheck=N.tagNameCheck),St(N,"attributeNameCheck")&&Pd(N.attributeNameCheck)&&(z.attributeNameCheck=N.attributeNameCheck),St(N,"allowCustomizedBuiltInElements")&&typeof N.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=N.allowCustomizedBuiltInElements),Rt(z),he&&(oe=!1),zt&&(ot=!0),Xn&&(be=Ne({},th),A=Ts(null),Xn.html===!0&&(Ne(be,eh),Ne(A,nh)),Xn.svg===!0&&(Ne(be,Yl),Ne(A,Zl),Ne(A,Ai)),Xn.svgFilters===!0&&(Ne(be,Ql),Ne(A,Zl),Ne(A,Ai)),Xn.mathMl===!0&&(Ne(be,Xl),Ne(A,rh),Ne(A,Ai))),ue.tagCheck=null,ue.attributeCheck=null,St(_,"ADD_TAGS")&&(typeof _.ADD_TAGS=="function"?ue.tagCheck=_.ADD_TAGS:Er(_.ADD_TAGS)&&(be===S&&(be=Ut(be)),Ne(be,_.ADD_TAGS,ut))),St(_,"ADD_ATTR")&&(typeof _.ADD_ATTR=="function"?ue.attributeCheck=_.ADD_ATTR:Er(_.ADD_ATTR)&&(A===D&&(A=Ut(A)),Ne(A,_.ADD_ATTR,ut))),St(_,"ADD_URI_SAFE_ATTR")&&Er(_.ADD_URI_SAFE_ATTR)&&Ne(al,_.ADD_URI_SAFE_ATTR,ut),St(_,"FORBID_CONTENTS")&&Er(_.FORBID_CONTENTS)&&(En===il&&(En=Ut(En)),Ne(En,_.FORBID_CONTENTS,ut)),St(_,"ADD_FORBID_CONTENTS")&&Er(_.ADD_FORBID_CONTENTS)&&(En===il&&(En=Ut(En)),Ne(En,_.ADD_FORBID_CONTENTS,ut)),Jt&&(be["#text"]=!0),Ce&&Ne(be,["html","head","body"]),be.table&&(Ne(be,["tbody"]),delete Q.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const te=P;P=_.TRUSTED_TYPES_POLICY;try{I=K("")}catch(we){throw P=te,we}}else _.TRUSTED_TYPES_POLICY===null?(P=void 0,I=""):(P===void 0&&(P=J()),P&&typeof I=="string"&&(I=K("")));Pt&&Pt(_),gs=_},Rd=Ne({},[...Yl,...Ql,...FP]),Id=Ne({},[...Xl,...jP]),Gy=function(_,N,te){return N.namespaceURI===On?_==="svg":N.namespaceURI===ni?_==="svg"&&(te==="annotation-xml"||cl[te]):!!Rd[_]},Ky=function(_,N,te){return N.namespaceURI===On?_==="math":N.namespaceURI===ri?_==="math"&&dl[te]:!!Id[_]},Yy=function(_,N,te){return N.namespaceURI===ri&&!dl[te]||N.namespaceURI===ni&&!cl[te]?!1:!Id[_]&&(Hy[_]||!Rd[_])},Qy=function(_){let N=x(_);(!N||!N.tagName)&&(N={namespaceURI:hs,tagName:"template"});const te=mo(_.tagName),we=mo(N.tagName);return ul[_.namespaceURI]?_.namespaceURI===ri?Gy(te,N,we):_.namespaceURI===ni?Ky(te,N,we):_.namespaceURI===On?Yy(te,N,we):!!(Xs==="application/xhtml+xml"&&ul[_.namespaceURI]):!1},br=function(_){ks(t.removed,{element:_});try{x(_).removeChild(_)}catch{if(g(_),!x(_))throw Fr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},si=function(_){pl(_);const N=v(_);if(N){const we=[];ws(N,Oe=>{ks(we,Oe)}),ws(we,Oe=>{try{g(Oe)}catch{}})}const te=w(_);if(te)for(let we=te.length-1;we>=0;--we){const Oe=te[we],Ie=Oe&&Oe.name;if(typeof Ie=="string")try{_.removeAttribute(Ie)}catch{}}},Dr=function(_,N){try{ks(t.removed,{attribute:N.getAttributeNode(_),from:N})}catch{ks(t.removed,{attribute:null,from:N})}if(N.removeAttribute(_),_==="is")if(ot||zt)try{br(N)}catch{}else try{N.setAttribute(_,"")}catch{}},Xy=function(_){const N=w(_);if(N)for(let te=N.length-1;te>=0;--te){const we=N[te],Oe=we&&we.name;if(!(typeof Oe!="string"||A[ut(Oe)]))try{_.removeAttribute(Oe)}catch{}}},pl=function(_){const N=[_];for(;N.length>0;){const te=N.pop();(k?k(te):te.nodeType)===sn.element&&Xy(te);const Oe=v(te);if(Oe)for(let Ie=Oe.length-1;Ie>=0;--Ie)N.push(Oe[Ie])}},Zy=function(_){if(!xe)return;const N=[_];for(;N.length>0;){const te=N.pop(),we=k?k(te):te.nodeType;if(we===sn.processingInstruction||we===sn.comment&&Ct(ih,te.data)){try{g(te)}catch{}continue}if(we===sn.element){const Ie=te,ft=ut(O?O(te):te.nodeName);try{Ie.hasAttribute&&Ie.hasAttribute("patchsrc")&&Ie.removeAttribute("patchsrc"),Ie.hasAttribute&&Ie.hasAttribute("for")&&ft!=="label"&&ft!=="output"&&Ie.removeAttribute("for")}catch{}}const Oe=v(te);if(Oe)for(let Ie=Oe.length-1;Ie>=0;--Ie)N.push(Oe[Ie])}},$d=function(_){let N=null,te=null;if(st)_="<remove></remove>"+_;else{const Ie=Qp(_,/^[\r\n\t ]+/);te=Ie&&Ie[0]}Xs==="application/xhtml+xml"&&hs===On&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const we=P?K(_):_;if(hs===On)try{N=new c().parseFromString(we,Xs)}catch{}if(!N||!N.documentElement){N=F.createDocument(hs,"template",null);try{N.documentElement.innerHTML=ll?I:we}catch{}}const Oe=N.body||N.documentElement;return _&&te&&Oe.insertBefore(n.createTextNode(te),Oe.childNodes[0]||null),hs===On?_e.call(N,Ce?"html":"body")[0]:Ce?N.documentElement:Oe},qd=function(_){return de.call(_.ownerDocument||_,_,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},oi=function(_){return _=uo(_,Le," "),_=uo(_,rt," "),_=uo(_,lt," "),_},hl=function(_){var N;_.normalize();const te=de.call(_.ownerDocument||_,_,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let we=te.nextNode();for(;we;)we.data=oi(we.data),we=te.nextNode();const Oe=(N=_.querySelectorAll)===null||N===void 0?void 0:N.call(_,"template");Oe&&ws(Oe,Ie=>{ms(Ie.content)&&hl(Ie.content)})},ii=function(_){const N=O?O(_):null;return typeof N!="string"||ut(N)!=="form"?!1:typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||_.attributes!==w(_)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function"||_.nodeType!==k(_)||_.childNodes!==v(_)},ms=function(_){if(!k||typeof _!="object"||_===null)return!1;try{return k(_)===sn.documentFragment}catch{return!1}},Zs=function(_){if(!k||typeof _!="object"||_===null)return!1;try{return typeof k(_)=="number"}catch{return!1}};function Pn(ae,_,N){ae.length!==0&&ws(ae,te=>{te.call(t,_,N,gs)})}const Jy=function(_,N){return!!(xe&&_.hasChildNodes()&&!Zs(_.firstElementChild)&&Ct(oh,_.textContent)&&Ct(oh,_.innerHTML)||xe&&_.namespaceURI===On&&N==="style"&&Zs(_.firstElementChild)||_.nodeType===sn.processingInstruction||xe&&_.nodeType===sn.comment&&Ct(ih,_.data))},eb=function(_,N){if(!Q[N]&&Ld(N)&&(z.tagNameCheck instanceof RegExp&&Ct(z.tagNameCheck,N)||z.tagNameCheck instanceof Function&&z.tagNameCheck(N)))return!1;if(Jt&&!En[N]){const te=x(_),we=v(_);if(we&&te){const Oe=we.length;for(let Ie=Oe-1;Ie>=0;--Ie){const ft=ps?we[Ie]:h(we[Ie],!0);te.insertBefore(ft,m(_))}}}return br(_),!0},Md=function(_,N){if(Pn(Se.beforeSanitizeElements,_,null),_!==N&&x(_)===null)return!0;if(ii(_))return br(_),!0;const te=ut(O?O(_):_.nodeName);if(Pn(Se.uponSanitizeElement,_,{tagName:te,allowedTags:be}),_!==N&&x(_)===null)return!0;if(Jy(_,te))return br(_),!0;if(Q[te]||!(ue.tagCheck instanceof Function&&ue.tagCheck(te))&&!be[te]){const Oe=eb(_,te);return Oe===!1&&Pn(Se.afterSanitizeElements,_,null),Oe}if((k?k(_):_.nodeType)===sn.element&&!Qy(_)||(te==="noscript"||te==="noembed"||te==="noframes")&&Ct(ZP,_.innerHTML))return br(_),!0;if(he&&_.nodeType===sn.text){const Oe=oi(_.textContent);_.textContent!==Oe&&(ks(t.removed,{element:_.cloneNode()}),_.textContent=Oe)}return Pn(Se.afterSanitizeElements,_,null),!1},Dd=function(_,N,te){if(V[N]||xe&&N==="patchsrc"||xe&&N==="for"&&_!=="label"&&_!=="output"||yr&&(N==="id"||N==="name")&&(te in n||te in Wy))return!1;const we=A[N]||ue.attributeCheck instanceof Function&&ue.attributeCheck(N,_);if(!(oe&&Ct(Ye,N))){if(!(ce&&Ct(ze,N))){if(we){if(!al[N]){if(!Ct(ke,uo(te,ge,""))){if(!((N==="src"||N==="xlink:href"||N==="href")&&_!=="script"&&Xp(te,"data:")===0&&Sd[_])){if(!(Z&&!Ct(W,uo(te,ge,"")))){if(te)return!1}}}}}else if(!(Ld(_)&&(z.tagNameCheck instanceof RegExp&&Ct(z.tagNameCheck,_)||z.tagNameCheck instanceof Function&&z.tagNameCheck(_))&&(z.attributeNameCheck instanceof RegExp&&Ct(z.attributeNameCheck,N)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(N,_))||N==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Ct(z.tagNameCheck,te)||z.tagNameCheck instanceof Function&&z.tagNameCheck(te))))return!1}}return!0},tb=Ne({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ld=function(_){return!tb[mo(_)]&&Ct(re,_)},nb=function(_,N,te,we){if(P&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!te)switch(f.getAttributeType(_,N)){case"TrustedHTML":return K(we);case"TrustedScriptURL":return X(we)}return we},rb=function(_,N,te,we){try{te?_.setAttributeNS(te,N,we):_.setAttribute(N,we),ii(_)?br(_):Yp(t.removed)}catch{Dr(N,_)}},Nd=function(_){Pn(Se.beforeSanitizeAttributes,_,null);const N=_.attributes;if(!N||ii(_))return;const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let we=N.length;const Oe=ut(_.nodeName);for(;we--;){const Ie=N[we],ft=Ie.name,qt=Ie.namespaceURI,vn=Ie.value,en=ut(ft),yn=vn;let jt=ft==="value"?yn:qP(yn);if(te.attrName=en,te.attrValue=jt,te.keepAttr=!0,te.forceKeepAttr=void 0,Pn(Se.uponSanitizeAttribute,_,te),jt=te.attrValue,Qs&&(en==="id"||en==="name")&&Xp(jt,$t)!==0&&(Dr(ft,_),jt=$t+jt),xe&&Ct(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,jt)){Dr(ft,_);continue}if(en==="attributename"&&Qp(jt,"href")){Dr(ft,_);continue}if(!te.forceKeepAttr){if(!te.keepAttr){Dr(ft,_);continue}if(!Te&&Ct(JP,jt)){Dr(ft,_);continue}if(he&&(jt=oi(jt)),!Dd(Oe,en,jt)){Dr(ft,_);continue}jt=nb(Oe,en,qt,jt),jt!==yn&&rb(_,ft,qt,jt)}}Pn(Se.afterSanitizeAttributes,_,null)},ai=function(_){let N=null;const te=qd(_);for(Pn(Se.beforeSanitizeShadowDOM,_,null);N=te.nextNode();)if(Pn(Se.uponSanitizeShadowNode,N,null),Md(N,_),Nd(N),ms(N.content)&&ai(N.content),(k?k(N):N.nodeType)===sn.element){const Oe=b(N);ms(Oe)&&(gl(Oe),ai(Oe))}Pn(Se.afterSanitizeShadowDOM,_,null)},gl=function(_){const N=[{node:_,shadow:null}];for(;N.length>0;){const te=N.pop();if(te.shadow){ai(te.shadow);continue}const we=te.node,Ie=(k?k(we):we.nodeType)===sn.element,ft=v(we);if(ft)for(let qt=ft.length-1;qt>=0;--qt)N.push({node:ft[qt],shadow:null});if(Ie){const qt=O?O(we):null;if(typeof qt=="string"&&ut(qt)==="template"){const vn=we.content;ms(vn)&&N.push({node:vn,shadow:null})}}if(Ie){const qt=b(we);ms(qt)&&N.push({node:null,shadow:qt},{node:qt,shadow:null})}}};return t.sanitize=function(ae){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},N=null,te=null,we=null,Oe=null;if(ll=!ae,ll&&(ae="<!-->"),typeof ae!="string"&&!Zs(ae)&&(ae=BP(ae),typeof ae!="string"))throw Fr("dirty is not a string, aborting");if(!t.isSupported)return ae;De?(be=Ve,A=He):fl(_),(Se.uponSanitizeElement.length>0||Se.uponSanitizeAttribute.length>0)&&(be=Ut(be)),Se.uponSanitizeAttribute.length>0&&(A=Ut(A)),t.removed=[];const Ie=ps&&typeof ae!="string"&&Zs(ae);if(Ie){Zy(ae);const en=O?O(ae):ae.nodeName;if(typeof en=="string"){const yn=ut(en);if(!be[yn]||Q[yn])throw si(ae),Fr("root node is forbidden and cannot be sanitized in-place")}if(ii(ae))throw si(ae),Fr("root node is clobbered and cannot be sanitized in-place");try{gl(ae)}catch(yn){throw si(ae),yn}}else if(Zs(ae))N=$d("<!---->"),te=N.ownerDocument.importNode(ae,!0),te.nodeType===sn.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?N=te:N.appendChild(te),gl(te);else{if(!ot&&!he&&!Ce&&ae.indexOf("<")===-1)return P&&Ft?K(ae):ae;if(N=$d(ae),!N)return ot?null:Ft?I:""}N&&st&&br(N.firstChild);const ft=Ie?ae:N,qt=qd(ft);try{for(;we=qt.nextNode();)Md(we,ft),Nd(we),ms(we.content)&&ai(we.content)}catch(en){throw Ie&&(si(ae),ws(t.removed,yn=>{yn.element&&pl(yn.element)})),en}if(Ie)return ws(t.removed,en=>{en.element&&pl(en.element)}),he&&hl(ae),ae;if(ot){if(he&&hl(N),zt)for(Oe=ee.call(N.ownerDocument);N.firstChild;)Oe.appendChild(N.firstChild);else Oe=N;return(A.shadowroot||A.shadowrootmode)&&(Oe=ie.call(r,Oe,!0)),Oe}let vn=Ce?N.outerHTML:N.innerHTML;return Ce&&be["!doctype"]&&N.ownerDocument&&N.ownerDocument.doctype&&N.ownerDocument.doctype.name&&Ct(QP,N.ownerDocument.doctype.name)&&(vn="<!DOCTYPE "+N.ownerDocument.doctype.name+`>
118
- `+vn),he&&(vn=oi(vn)),P&&Ft?K(vn):vn},t.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fl(ae),De=!0,Ve=be,He=A},t.clearConfig=function(){gs=null,De=!1,Ve=null,He=null,P=M,I=""},t.isValidAttribute=function(ae,_,N){gs||fl({});const te=ut(ae),we=ut(_);return Dd(te,we,N)},t.addHook=function(ae,_){typeof _=="function"&&St(Se,ae)&&ks(Se[ae],_)},t.removeHook=function(ae,_){if(St(Se,ae)){if(_!==void 0){const N=IP(Se[ae],_);return N===-1?void 0:$P(Se[ae],N,1)[0]}return Yp(Se[ae])}},t.removeHooks=function(ae){St(Se,ae)&&(Se[ae]=[])},t.removeAllHooks=function(){Se=ah()},t}var nR=hy();function ur(e){return`/api/assets/${e.split("/").map(encodeURIComponent).join("/")}`}async function rR(){const e=await fetch("/api/view");if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(`GET /view failed (${e.status}): ${t.error??e.statusText}`)}return e.json()}async function gy(e){const t=await fetch(e);if(!t.ok)throw new Error(`GET ${e} failed (${t.status})`);return t.json()}function sR(){return gy("/api/live-head")}function oR(){return gy("/api/watcher")}async function iR(e,t){const n=await fetch(`/api/repo-file?path=${encodeURIComponent(e)}&lines=${t}`);return n.ok?n.json():null}const fn=gn([]),aR=12,lR=/^[\w@.\-/+~]+$/,uR=/\.[A-Za-z][A-Za-z0-9]{0,7}$/;function my(e){return e.startsWith("./")?e.slice(2):e}function cR(e){const t=my(e);return t===""||!lR.test(t)||t.startsWith("/")||t.split("/").includes("..")?!1:t.includes("/")||uR.test(t)}function fd(e,t){const n=my(e);if(t.includes(n))return{kind:"diff",path:n};const r=t.filter(s=>s.endsWith(`/${n}`));return r.length===1?{kind:"diff",path:r[0]}:r.length>1?{kind:"ambiguous"}:{kind:"outside",path:n}}function dR(e){return e.binary?[]:e.hunks.flatMap(t=>t.lines).slice(0,aR)}function fR(e){return e.button===0&&(e.ctrlKey||e.metaKey)}function pR(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}const hR=new dy({renderer:{codespan({text:e}){const t=e.replace(/&#39;/g,"'");if(!cR(t))return!1;const n=fd(t,fn.value.map(r=>r.path));return n.kind==="ambiguous"?!1:`<code class="file-ref file-ref-${n.kind}" data-file-ref="${pR(t)}" tabindex="0">${e}</code>`}}});function gR(e,t){if(e=e.replace(/(<img[^>]+src=")\/uploads\//g,`$1${ur("uploads/")}`),!t)return e;let n;try{n=new URL(t).origin}catch{return e}return e.replace(/(<img[^>]+src=")\/(?!\/)/g,`$1${n}/`)}function $r(e,t){const n=hR.parse(e,{async:!1,breaks:!0});return nR.sanitize(gR(n,t))}const mR=new Set(["as","async","await","break","case","catch","class","const","continue","default","delete","do","else","export","extends","false","finally","for","from","function","if","implements","import","in","interface","keyof","let","new","null","of","readonly","return","switch","throw","true","try","type","typeof","undefined","var","while"]),vR={comment:"italic text-[var(--syntax-comment)]",keyword:"font-semibold text-[var(--syntax-keyword)]",string:"text-[var(--syntax-string)]",number:"text-[var(--syntax-number)]",function:"text-[var(--syntax-function)]",type:"text-[var(--syntax-type)]",property:"text-[var(--syntax-property)]",operator:"text-[var(--syntax-operator)]"},yR=/(\/\/.*|\/\*.*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\b\d+(?:\.\d+)?\b|[A-Za-z_$][\w$]*|\s+|.)/g,bR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function xR(e){return e.replace(/[&<>"']/g,t=>bR[t])}function Us(e){const t=String(e);let n="";for(const r of t.matchAll(yR)){const s=r[0],o=r.index??0,i=t.slice(0,o).trimEnd().at(-1),a=t.slice(o+s.length).trimStart().at(0);let l="";s.startsWith("//")||s.startsWith("/*")?l="comment":/^["'`]/.test(s)?l="string":/^\d/.test(s)?l="number":mR.has(s)?l="keyword":/^[A-Z][A-Za-z0-9_$]*$/.test(s)?l="type":/^[A-Za-z_$]/.test(s)&&a==="("?l="function":/^[A-Za-z_$]/.test(s)&&(i==="."||a===":")?l="property":/^[{}[\]().,:;?=><!&|+\-*/]+$/.test(s)&&(l="operator");const u=xR(s);n+=l?`<span class="${vR[l]}">${u}</span>`:u}return n}const lh=3;function No(e,t){const n=e.find(r=>r.path===t.path);if(!n)return null;if(t.type==="hunk"){const r=n.hunks[t.hunkIndex];return r?{path:t.path,lines:r.lines}:null}if(t.type==="line"){for(const r of n.hunks){const s=r.lines.findIndex(a=>t.side==="base"?a.oldLine===t.line:a.newLine===t.line);if(s===-1)continue;const o=Math.max(0,s-lh),i=Math.min(r.lines.length,s+lh+1);return{path:t.path,lines:r.lines.slice(o,i)}}return null}return null}const wR={class:"max-w-full overflow-x-auto rounded border border-default bg-default p-1.5 font-mono text-[10px]"},kR={class:"mr-1.5 select-none text-dimmed"},_R=["innerHTML"],Bo=Y({__name:"DiffLinesPreview",props:{lines:{}},setup(e){return(t,n)=>(y(),T("div",wR,[(y(!0),T(ne,null,Ee(e.lines,r=>(y(),T("div",{key:r.id,class:se(["whitespace-pre",{"bg-success/10":r.kind==="add","bg-error/10":r.kind==="remove"}])},[C("span",kR,q(r.kind==="add"?"+":r.kind==="remove"?"−":" "),1),C("code",{innerHTML:d(Us)(r.text)},null,8,_R)],2))),128))]))}}),CR={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute start-0 flex items-start",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute end-0 flex items-start",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2 inset-y-1",trailing:"pe-2 inset-y-1",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"},autoresize:{true:{base:"resize-none"}}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},SR=["id","value","name","rows","placeholder","disabled","required"],tl=Object.assign({inheritAttrs:!1},{__name:"Textarea",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},autoresize:{type:Boolean,required:!1},autoresizeDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},rows:{type:Number,required:!1,default:3},maxrows:{type:Number,required:!1,default:0},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Kn(),i=Nt("textarea",r),a=Un(i,"modelValue",s,{defaultValue:i.defaultValue}),l=ht(),{emitFormFocus:u,emitFormBlur:c,emitFormInput:f,emitFormChange:p,size:h,color:g,id:m,name:v,highlight:x,disabled:b,ariaAttrs:w}=Jc(r,{deferInputValidation:!0}),{isLeading:k,isTrailing:O,leadingIconName:P,trailingIconName:I}=Ya(i),M=E(()=>{var F;return Bt({extend:CR,...((F=l.ui)==null?void 0:F.textarea)||{}})({color:g.value??i.color,variant:i.variant,size:(h==null?void 0:h.value)??i.size,loading:i.loading,highlight:x.value??i.highlight,fixed:i.fixed,autoresize:i.autoresize,leading:k.value||!!i.avatar||!!o.leading,trailing:O.value||!!o.trailing})}),j=Or("textareaRef");function H(F){var de,ee,_e,ie,Se;(de=i.modelModifiers)!=null&&de.trim&&(typeof F=="string"||F===null||F===void 0)&&(F=(F==null?void 0:F.trim())??null),(ee=i.modelModifiers)!=null&&ee.number&&(F=Lm(F)),(_e=i.modelModifiers)!=null&&_e.nullable&&(F||(F=null)),(ie=i.modelModifiers)!=null&&ie.optional&&!((Se=i.modelModifiers)!=null&&Se.nullable)&&F!==null&&(F||(F=void 0)),a.value=F,f()}function le(F){var de;fe(),(de=i.modelModifiers)!=null&&de.lazy||H(F.target.value)}function K(F){var ee,_e;const de=F.target.value;(ee=i.modelModifiers)!=null&&ee.lazy&&H(de),(_e=i.modelModifiers)!=null&&_e.trim&&(F.target.value=de.trim()),p(),s("change",F)}function X(F){c(),s("blur",F)}function J(){var F;i.autofocus&&((F=j.value)==null||F.focus())}function fe(){if(i.autoresize&&j.value){j.value.rows=i.rows;const F=j.value.style.overflow;j.value.style.overflow="hidden";const de=window.getComputedStyle(j.value),ee=Number.parseInt(de.paddingTop),_e=Number.parseInt(de.paddingBottom),ie=ee+_e,Se=Number.parseInt(de.lineHeight),{scrollHeight:Le}=j.value,rt=(Le-ie)/Se;rt>i.rows&&(j.value.rows=i.maxrows?Math.min(rt,i.maxrows):rt),j.value.style.overflow=F}}return Me(a,()=>{tt(fe)}),dt(()=>{setTimeout(()=>{J()},i.autofocusDelay),setTimeout(async()=>{await tt(),fe()},i.autoresizeDelay)}),t({textareaRef:j,autoResize:fe}),(F,de)=>{var ee;return y(),$(d($e),{as:d(i).as,"data-slot":F.$attrs["data-slot"]??"root",class:se(M.value.root({class:[(ee=d(i).ui)==null?void 0:ee.root,d(i).class]}))},{default:R(()=>{var _e,ie,Se;return[C("textarea",pe({id:d(m),ref_key:"textareaRef",ref:j,value:d(a),name:d(v),rows:d(i).rows,placeholder:d(i).placeholder,class:M.value.base({class:(_e=d(i).ui)==null?void 0:_e.base}),disabled:d(b),required:d(i).required},{...F.$attrs,...d(w)},{"data-slot":"base",onInput:le,onBlur:X,onChange:K,onFocus:de[0]||(de[0]=(...Le)=>d(u)&&d(u)(...Le))}),null,16,SR),U(F.$slots,"default",{ui:M.value}),d(k)||d(i).avatar||o.leading?(y(),T("span",{key:0,"data-slot":"leading",class:se(M.value.leading({class:(ie=d(i).ui)==null?void 0:ie.leading}))},[U(F.$slots,"leading",{ui:M.value},()=>{var Le,rt,lt;return[d(k)&&d(P)?(y(),$(rn,{key:0,name:d(P),"data-slot":"leadingIcon",class:se(M.value.leadingIcon({class:(Le=d(i).ui)==null?void 0:Le.leadingIcon}))},null,8,["name","class"])):d(i).avatar?(y(),$(Xo,pe({key:1,size:((rt=d(i).ui)==null?void 0:rt.leadingAvatarSize)||M.value.leadingAvatarSize()},d(i).avatar,{"data-slot":"leadingAvatar",class:M.value.leadingAvatar({class:(lt=d(i).ui)==null?void 0:lt.leadingAvatar})}),null,16,["size","class"])):L("",!0)]})],2)):L("",!0),d(O)||o.trailing?(y(),T("span",{key:1,"data-slot":"trailing",class:se(M.value.trailing({class:(Se=d(i).ui)==null?void 0:Se.trailing}))},[U(F.$slots,"trailing",{ui:M.value},()=>{var Le;return[d(I)?(y(),$(rn,{key:0,name:d(I),"data-slot":"trailingIcon",class:se(M.value.trailingIcon({class:(Le=d(i).ui)==null?void 0:Le.trailingIcon}))},null,8,["name","class"])):L("",!0)]})],2)):L("",!0)]}),_:3},8,["as","data-slot","class"])}}});function pd(e,t){const n=Xa(),r=(t==null?void 0:t.draft)??G(""),s=(t==null?void 0:t.kind)??G("question"),o=G(!1),i=G(null),a=G(null),l=G("");async function u(g){if(r.value.trim()){o.value=!0,i.value=null;try{await fO(r.value.trim(),e(),s.value),r.value="",s.value="question",g()}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}}function c(g){a.value=g,l.value=""}async function f(g,m){if(l.value.trim()){o.value=!0,i.value=null;try{await pO(g,l.value.trim(),e()),a.value=null,l.value="",m()}catch(v){i.value=v instanceof Error?v.message:String(v)}finally{o.value=!1}}}async function p(g){o.value=!0,i.value=null;try{await hO(g)}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}async function h(g){o.value=!0,i.value=null;try{await gO(g)}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}return{store:n,draft:r,draftKind:s,busy:o,localError:i,editingId:a,editDraft:l,submitNewQuestion:u,startEdit:c,submitEdit:f,remove:p,resolve:h}}const Qu={type:"general"},TR=()=>({open:!1,threadId:null,anchorTarget:Qu,composerTarget:Qu,draft:"",kind:"question"}),Qe=gt(TR());function nl(e){Qe.open=!0,Qe.threadId=e.id,Qe.anchorTarget=e.target??Qu,Qe.composerTarget=Qe.anchorTarget}function vy(e){Qe.open=!0,Qe.threadId=null,Qe.anchorTarget=e.target,Qe.composerTarget=e.target,Qe.draft=e.draft??"",Qe.kind=e.kind??"question"}function AR(e){Qe.composerTarget=e}function ER(){Qe.open=!Qe.open}function OR(){Qe.open=!1}function zo(e){const t=e.indexOf(". "),n=e.indexOf(" — "),r=[t,n].filter(i=>i>=0);if(!r.length)return{headline:e,body:""};const s=Math.min(...r),o=s===n;return{headline:e.slice(0,s+(o?0:1)).trim(),body:e.slice(s+(o?3:2)).trim()}}function hd(e){var n;const t=new Map;for(const r of e)for(const s of r.verification)t.has(s.id)||t.set(s.id,{verification:s,annotationId:(n=r.annotations.find(o=>o.verification.some(i=>i.id===s.id)))==null?void 0:n.id,path:r.path});return[...t.values()]}function yy(e){const t=new Map;for(const r of e)for(const s of r.verification)t.set(s.id,s);const n={verified:0,unverified:0,gap:0};for(const r of t.values())n[r.status]++;return n}const uh={high:0,medium:1,low:2};function gd(e){const t=new Map(e.flatMap(n=>n.filePaths.map(r=>[r,n.risk])));return n=>t.get(n)}function md(e,t){return e.filter(n=>n.verification.status!=="verified").sort((n,r)=>(uh[t(n.path)??"low"]??3)-(uh[t(r.path)??"low"]??3))}function PR(e){return e.suggestion??""}function by(e){return e==="change-request"?6:3}function RR(e,t){return e.type==="general"&&t?`About "${t}": `:""}const IR={key:0,class:"flex flex-wrap gap-2"},$R={key:0,class:"mt-1 text-error"},qR={key:1,class:"mt-1 text-warning"},MR={class:"mt-1 flex gap-2"},ti=Y({__name:"AskQuestionForm",props:{target:{},annotation:{}},setup(e){const t=e,n=G(!1),{draft:r,draftKind:s,busy:o,localError:i,submitNewQuestion:a,store:l}=pd(()=>t.target),u=E(()=>l.writeToken.length>0);function c(){n.value=!1}function f(){const h=t.annotation&&zo(t.annotation.summary).headline;vy({target:t.target,draft:RR(t.target,h)})}function p(){s.value="change-request",r.value=t.annotation?PR(t.annotation):"",n.value=!0}return(h,g)=>{const m=kt,v=tl;return y(),T("div",null,[n.value?(y(),T(ne,{key:1},[B(v,{modelValue:d(r),"onUpdate:modelValue":g[0]||(g[0]=x=>Ze(r)?r.value=x:null),size:"sm",class:"w-full",rows:d(by)("change-request"),placeholder:"What needs to change?"},null,8,["modelValue","rows"]),d(i)?(y(),T("p",$R,q(d(i)),1)):L("",!0),u.value?L("",!0):(y(),T("p",qR,"Set your write token first (top right).")),C("div",MR,[B(m,{size:"xs",disabled:d(o)||!u.value,onClick:g[1]||(g[1]=x=>d(a)(c))},{default:R(()=>[...g[4]||(g[4]=[me("Raise change request",-1)])]),_:1},8,["disabled"]),B(m,{size:"xs",variant:"ghost",onClick:c},{default:R(()=>[...g[5]||(g[5]=[me("Cancel",-1)])]),_:1})])],64)):(y(),T("span",IR,[B(m,{size:"xs",variant:"outline",color:"neutral",onClick:f},{default:R(()=>[...g[2]||(g[2]=[me("Ask a question",-1)])]),_:1}),e.annotation?(y(),$(m,{key:0,size:"xs",variant:"outline",color:"error",onClick:p},{default:R(()=>[...g[3]||(g[3]=[me(" Raise as change-request ",-1)])]),_:1})):L("",!0)]))])}}}),DR={key:0,"data-testid":"note-suggestion",class:"mt-2 rounded border border-primary/40 bg-primary/5 p-2"},LR={class:"text-default"},rl=Y({__name:"NoteSuggestion",props:{suggestion:{}},setup(e){return(t,n)=>e.suggestion?(y(),T("div",DR,[n[0]||(n[0]=C("p",{class:"mb-0.5 text-[10px] font-bold uppercase tracking-wide text-primary"},"Suggestion",-1)),C("p",LR,q(e.suggestion),1)])):L("",!0)}}),NR={intended:"Intended",missing:"Missing",wrong:"Wrong",extra:"Extra",unclear:"Unclear"},BR={intended:"success",missing:"warning",wrong:"error",extra:"info",unclear:"neutral"},zR={low:"neutral",medium:"warning",high:"error"},FR={issue:"the issue","mr-text":"the MR text","repo-rule":"a repo rule",nobody:"nobody"};function vd(e){return NR[e]}function yd(e){return BR[e]}function jR(e){return`${e} severity`}function HR(e){return zR[e]}function VR(e){return`asked by: ${FR[e]}`}function ch(e){return e.type==="line"?`line ${e.line}`:null}const UR={class:"inline-flex shrink-0 items-center gap-1.5"},WR={key:2,"data-testid":"note-source",class:"text-[10px] text-dimmed"},sl=Y({__name:"NoteVerdict",props:{annotation:{}},setup(e){return(t,n)=>{const r=mn;return y(),T("span",UR,[e.annotation.verdict?(y(),$(r,{key:0,"data-testid":"note-verdict",size:"sm",variant:"subtle",color:d(yd)(e.annotation.verdict)},{default:R(()=>[me(q(d(vd)(e.annotation.verdict)),1)]),_:1},8,["color"])):L("",!0),e.annotation.severity?(y(),$(r,{key:1,"data-testid":"note-severity",size:"sm",variant:"outline",color:d(HR)(e.annotation.severity)},{default:R(()=>[me(q(d(jR)(e.annotation.severity)),1)]),_:1},8,["color"])):L("",!0),e.annotation.source?(y(),T("span",WR,q(d(VR)(e.annotation.source)),1)):L("",!0)])}}}),GR=["aria-label"],KR={class:"w-80 max-h-96 overflow-y-auto p-3 text-left font-sans text-xs whitespace-normal break-words normal-case select-text"},YR={class:"mb-1.5 flex items-center gap-2"},QR={class:"mb-1 truncate font-mono text-[10px] text-dimmed"},XR=["innerHTML"],ZR={key:1,class:"mt-2 space-y-1 border-t border-default pt-2"},JR=["onMouseenter"],eI=["onClick"],tI={class:"text-muted"},nI={key:0,class:"mt-1 max-w-full overflow-x-auto rounded border border-default bg-elevated p-1.5 font-mono text-[10px] normal-case"},rI={class:"mr-1.5 select-none text-dimmed"},sI=["innerHTML"],oI={class:"mt-2 border-t border-default pt-2"},xy=Y({__name:"AnnotationBadge",props:{annotation:{},number:{}},setup(e){const t=e,n=E(()=>td(t.annotation.id));function r(a){var l;(l=document.getElementById(Qn(a)))==null||l.scrollIntoView({behavior:"smooth",block:"start"})}const s=E(()=>No(fn.value,t.annotation.target)),o=G(null);function i(a){var u;const l=(u=t.annotation.relatedTargets)==null?void 0:u[a];return l?No(fn.value,l.target):null}return(a,l)=>{const u=mn,c=Qa,f=Za;return y(),$(f,{class:"ml-1 inline-grid align-middle"},{content:R(()=>{var p;return[C("div",KR,[C("span",YR,[B(u,{size:"sm",variant:"subtle",color:"primary"},{default:R(()=>[me(q(e.annotation.kind??"note"),1)]),_:1}),B(c,{class:"ml-auto","model-value":n.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":l[0]||(l[0]=h=>d(nd)(e.annotation.id))},null,8,["model-value"])]),B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("p",QR,q(e.annotation.target.path),1),s.value?(y(),$(Bo,{key:0,class:"mb-2",lines:s.value.lines},null,8,["lines"])):L("",!0),C("div",{class:"markdown-body text-muted",innerHTML:d($r)(e.annotation.summary)},null,8,XR),B(rl,{suggestion:e.annotation.suggestion},null,8,["suggestion"]),(p=e.annotation.relatedTargets)!=null&&p.length?(y(),T("ul",ZR,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(h,g)=>(y(),T("li",{key:g,class:"leading-relaxed",onMouseenter:m=>o.value=g,onMouseleave:l[1]||(l[1]=m=>o.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:m=>r(h.target.path)}," → "+q(h.target.path),9,eI),C("span",tI," — "+q(h.reason),1),o.value===g&&i(g)?(y(),T("div",nI,[(y(!0),T(ne,null,Ee(i(g).lines,m=>(y(),T("div",{key:m.id,class:se(["whitespace-pre",{"bg-success/10":m.kind==="add","bg-error/10":m.kind==="remove"}])},[C("span",rI,q(m.kind==="add"?"+":m.kind==="remove"?"−":" "),1),C("code",{innerHTML:d(Us)(m.text)},null,8,sI)],2))),128))])):L("",!0)],40,JR))),128))])):L("",!0),C("div",oI,[B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])])]}),default:R(()=>[C("button",{type:"button",class:se(["grid h-[18px] w-[18px] place-items-center rounded-full border text-[10px] font-bold transition hover:scale-110 focus-visible:scale-110 focus-visible:outline-none",n.value?"border-success/60 bg-success/15 text-success hover:bg-success hover:text-inverted focus-visible:bg-success focus-visible:text-inverted":"border-warning/60 bg-warning/15 text-warning hover:bg-warning hover:text-inverted focus-visible:bg-warning focus-visible:text-inverted"]),"aria-label":`Note ${e.number}${n.value?" (resolved)":""}: ${e.annotation.summary}`},q(e.number),11,GR)]),_:1})}}}),wy=50;function ky(e,t,n=wy){return e||t.length<=n?t:t.slice(0,n)}function _y(e,t,n=wy){return e?0:Math.max(0,t.length-n)}const Wr=gt({open:!1,x:0,y:0,symbol:"",occurrences:[]});function iI(){return Wr}function aI(e,t,n,r){Wr.x=e,Wr.y=t,Wr.symbol=n,Wr.occurrences=r,Wr.open=!0}function dh(){Wr.open=!1}const Ei=/[\w$]/;function lI(e,t){if(!Ei.test(e[t]??"")&&!Ei.test(e[t-1]??""))return null;let n=t;for(;n>0&&Ei.test(e[n-1]);)n--;let r=t;for(;r<e.length&&Ei.test(e[r]);)r++;const s=e.slice(n,r);return/^[A-Za-z_$]/.test(s)?s:null}function uI(e,t){var s;const n=(s=document.caretRangeFromPoint)==null?void 0:s.call(document,e,t),r=n==null?void 0:n.startContainer;return!r||r.nodeType!==Node.TEXT_NODE?null:lI(r.textContent??"",n.startOffset)}function Es(e){if(!e.metaKey&&!e.ctrlKey)return;const t=uI(e.clientX,e.clientY);if(!t)return;const n=cI(fn.value,t);n.length<=1||aI(e.clientX,e.clientY,t,n)}function cI(e,t){const n=new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`),r=[];for(const s of e)s.hunks.forEach((o,i)=>{for(const a of o.lines)n.test(a.text)&&r.push({path:s.path,hunkIndex:i,lineId:a.id,lineNumber:a.newLine??a.oldLine??0,text:a.text})});return r}const Cy=G([]),Xu=gt(new Map);function fh(e){Cy.value=e}function ph(e,t,n){n?Xu.set(e,t):Xu.delete(e)}function hh(e){if(Cy.value.includes(e))return!0;for(const t of Xu.values())if(t.includes(e))return!0;return!1}function bd(e){switch(e.kind){case"stale-line-target":return`Stale annotation: ${e.detail}`;case"invalid-field":return`Invalid field (${e.instancePath}): ${e.message}`;case"unresolved-target":return`Unresolved ${e.targetType} target: ${e.detail}`;case"missing-asset":return`Missing asset: ${e.assetPath}`;case"unsafe-asset-path":return`Unsafe asset path: ${e.assetPath}`;case"disallowed-asset-type":return`Disallowed asset type: ${e.assetPath}`;case"asset-too-large":return`Asset too large (${e.bytes} bytes): ${e.assetPath}`;case"image-without-comparison":return`Changed image has no base and head asset: ${e.path}`;case"dangling-answer":return`Answer ${e.answerId} references unknown Question ${e.questionId}`;case"unanchored-verification-gap":return`Verification gap ${e.verificationId} has no concrete anchor: ${e.detail}`;case"missing-verdict":return`Note ${e.annotationId} has no verdict. Set it to intended, missing, wrong, extra or unclear.`;case"missing-suggestion":return`Note ${e.annotationId} has the verdict ${e.verdict} but no suggestion. Say what to change.`;case"invalid-proof-link":return`Proof link in evidence ${e.evidenceId} is broken: ${e.detail}`}}const dI={key:0,class:"sticky right-1 z-10 ml-1 inline-flex items-center gap-1 align-middle"},Zu=Y({__name:"DiffLineNote",props:{annotations:{},diagnostics:{},numbers:{}},setup(e){return(t,n)=>{const r=mn;return e.annotations.length||e.diagnostics.length?(y(),T("span",dI,[(y(!0),T(ne,null,Ee(e.annotations,s=>(y(),$(xy,{key:s.id,annotation:s,number:e.numbers.get(s.id)??0},null,8,["annotation","number"]))),128)),(y(!0),T(ne,null,Ee(e.diagnostics,(s,o)=>(y(),$(r,{key:o,color:"warning",variant:"subtle",size:"sm",class:"ml-1",title:d(bd)(s)},{default:R(()=>[...n[0]||(n[0]=[me(" ⚠ ",-1)])]),_:1},8,["title"]))),128))])):L("",!0)}}});function Sy(e,t){if(t.type!=="line")return[];const n=e.find(s=>s.path===t.path);if(!n)return[];const r=[];for(const s of n.hunks)for(const o of s.lines)(t.side==="base"?o.oldLine:o.newLine)===t.line&&r.push(o.id);return r}function fI(e){return e.type==="line"||e.type==="hunk"}function pI(e,t){var n,r,s;if(t.type==="line")return Sy(e,t)[0];if(t.type==="hunk")return(s=(r=(n=e.find(o=>o.path===t.path))==null?void 0:n.hunks[t.hunkIndex])==null?void 0:r.lines[0])==null?void 0:s.id}const hI=1600;function gI(e){e.classList.remove("jump-flash"),e.offsetWidth,e.classList.add("jump-flash"),setTimeout(()=>e.classList.remove("jump-flash"),hI)}async function Ty(e,t){await tt();const n=document.getElementById(e);n&&(n.scrollIntoView({behavior:"smooth",block:t}),gI(n))}async function Ay(e){Vv(e),await Ty(Qn(e),"start")}async function mI(e){const t=pI(fn.value,e);if(!t)return Ay(e.path);Vv(e.path),e.type==="hunk"?ss(e.path,e.hunkIndex):ss(e.path,Number(t.split("#").at(-2))),await Ty(Hs(t),"center")}const Ey=Y({__name:"JumpToTargetButton",props:{target:{}},setup(e){return(t,n)=>{const r=kt;return d(fI)(e.target)?(y(),$(r,{key:0,size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-corner-down-right","aria-label":"Jump to this code in the diff","data-testid":"jump-to-target",onClick:n[0]||(n[0]=s=>d(mI)(e.target))})):L("",!0)}}});function vI(e){return e!=null&&e.stale?`The MR has new commits since round ${e.round}`:null}const yI=3e4,bI=5*6e4;function xd(e,t=new Date){if((e==null?void 0:e.status)!=="ok"||!e.watcher.enabled||!e.watcher.updatedAt)return!1;const n=e.watcher.current===null?yI:bI;return t.getTime()-Date.parse(e.watcher.updatedAt)>n}function wd(e,t=new Date){return(e==null?void 0:e.status)==="ok"&&e.watcher.enabled&&e.watcher.used<e.watcher.cap&&!xd(e,t)}function xI(e,t=new Date){return xd(e,t)?"Live answers: watcher stopped":`Live answers: ${wd(e,t)?"on":"off"}`}function wI(e){return(e==null?void 0:e.status)==="ok"&&e.watcher.enabled?`Answers used: ${e.watcher.used} of ${e.watcher.cap}`:null}const Ju=G(null),is=G(null),kd=G("");async function kI(){const[e,t]=await Promise.allSettled([sR(),oR()]);e.status==="fulfilled"&&(Ju.value=e.value),t.status==="fulfilled"&&(is.value=t.value)}function ol(e=1500){const t=G(!1);let n;async function r(s){await navigator.clipboard.writeText(s),t.value=!0,clearTimeout(n),n=setTimeout(()=>t.value=!1,e)}return{copied:t,copy:r}}const _I=/on this bundle:? (.+)$/;function Oy(e){var t;return((t=_I.exec(e))==null?void 0:t[1])??e}function CI(e,t){return`Invoke the /review-workspace skill on this bundle ${Oy(e)}: the MR has new commits (live head ${t}). Start the next round.`}function Py(e){return!e||e.type==="general"?"the whole MR":e.type==="line"?`${e.path}:${e.line}`:e.path}function SI(e,t){return`Invoke the /review-workspace skill on this bundle ${Oy(e)}: answer this Question on ${Py(t.target)}: ${t.body}`}function TI(e,t){return(e==null?void 0:e.type)==="general"?`Draft this as a general MR comment, not an inline one. Post it only after I say "send" and agree to a general comment: ${t.trim()}`:`Post this comment to the MR inline: ${Py(e)} ${t.trim()}`}const AI={key:0,class:"italic text-muted"},EI={key:1,"data-testid":"waiting-for-agent",class:"flex items-center gap-2"},Ry=Y({__name:"PendingAnswer",props:{question:{}},setup(e){const{copied:t,copy:n}=ol();return(r,s)=>{const o=kt;return d(wd)(d(is))?(y(),T("p",AI,"Not answered yet.")):(y(),T("div",EI,[s[1]||(s[1]=C("span",{class:"italic text-muted"},"Waiting for the agent.",-1)),B(o,{size:"xs",variant:"soft",onClick:s[0]||(s[0]=i=>d(n)(d(SI)(d(kd),e.question)))},{default:R(()=>[me(q(d(t)?"Copied!":"Send to agent"),1)]),_:1})]))}}}),OI={class:"flex items-center"},PI={key:0,"data-testid":"note-line-label",class:"shrink-0 font-mono text-[10px] text-dimmed"},RI={class:"grid h-[18px] w-[18px] shrink-0 place-items-center rounded-full border border-warning/60 text-[10px] font-bold text-warning"},II={class:"truncate"},$I={key:2,class:"ml-auto shrink-0 text-muted"},qI={key:0,class:"border-t border-warning/30 px-3 py-2"},MI=["innerHTML"],DI={key:0,class:"mt-2 space-y-1 border-t border-default pt-2"},LI=["onMouseenter"],NI=["onClick"],BI={class:"text-muted"},zI={key:1,class:"mt-2 space-y-2 border-t border-default pt-2"},FI={class:"font-semibold"},jI=["innerHTML"],HI={class:"mt-2 flex items-center gap-3 border-t border-control pt-2"},VI=Y({__name:"InlineNote",props:{annotation:{},number:{},questions:{},answers:{}},setup(e){const t=e,n=G(!1),r=E(()=>td(t.annotation.id)),s=E(()=>zo(t.annotation.summary)),o=E(()=>RO(t.questions,t.annotation.target)),i=E(()=>Sy(fn.value,t.annotation.target));function a(){n.value=!n.value,ph(t.annotation.id,i.value,n.value)}as(()=>ph(t.annotation.id,[],!1));const l=G(null);function u(p){var g;const h=(g=t.annotation.relatedTargets)==null?void 0:g[p];return h?No(fn.value,h.target):null}function c(p){var h;(h=document.getElementById(Qn(p)))==null||h.scrollIntoView({behavior:"smooth",block:"start"})}function f(p){return t.answers.find(h=>h.questionId===p)}return(p,h)=>{var v;const g=mn,m=Qa;return y(),T("div",{"data-testid":"inline-note",class:se(["my-1 max-w-3xl whitespace-normal rounded border font-sans text-xs",r.value?"border-success/40 bg-success/5":"border-warning/40 bg-warning/5"]),onMouseenter:h[2]||(h[2]=x=>d(fh)(i.value)),onMouseleave:h[3]||(h[3]=x=>d(fh)([]))},[C("div",OI,[C("button",{type:"button",class:"flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left",onClick:a},[d(ch)(e.annotation.target)?(y(),T("span",PI,q(d(ch)(e.annotation.target)),1)):L("",!0),C("span",RI,q(e.number),1),e.annotation.verdict&&!n.value?(y(),$(g,{key:1,size:"sm",variant:"subtle",color:d(yd)(e.annotation.verdict),class:"shrink-0"},{default:R(()=>[me(q(d(vd)(e.annotation.verdict)),1)]),_:1},8,["color"])):L("",!0),C("span",II,q(s.value.headline),1),o.value.length?(y(),T("span",$I,q(o.value.length)+" in thread",1)):L("",!0),C("span",{class:se(["shrink-0 text-dimmed",{"ml-auto":!o.value.length}])},q(n.value?"▾":"▸"),3)]),B(Ey,{target:e.annotation.target,class:"mr-1 shrink-0"},null,8,["target"])]),n.value?(y(),T("div",qI,[B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("div",{class:"markdown-body text-muted",innerHTML:d($r)(e.annotation.summary)},null,8,MI),B(rl,{suggestion:e.annotation.suggestion},null,8,["suggestion"]),(v=e.annotation.relatedTargets)!=null&&v.length?(y(),T("ul",DI,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(x,b)=>(y(),T("li",{key:b,onMouseenter:w=>l.value=b,onMouseleave:h[0]||(h[0]=w=>l.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:w=>c(x.target.path)}," → "+q(x.target.path),9,NI),C("span",BI," — "+q(x.reason),1),l.value===b&&u(b)?(y(),$(Bo,{key:0,class:"mt-1",lines:u(b).lines},null,8,["lines"])):L("",!0)],40,LI))),128))])):L("",!0),o.value.length?(y(),T("ul",zI,[(y(!0),T(ne,null,Ee(o.value,x=>(y(),T("li",{key:x.id},[C("p",FI,q(x.body),1),f(x.id)?(y(),T("div",{key:0,class:"markdown-body mt-1 text-muted",innerHTML:d($r)(f(x.id).body)},null,8,jI)):x.kind==="question"?(y(),$(Ry,{key:1,class:"mt-1",question:x},null,8,["question"])):L("",!0)]))),128))])):L("",!0),C("div",HI,[B(m,{"model-value":r.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":h[1]||(h[1]=x=>d(nd)(e.annotation.id))},null,8,["model-value"]),B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])])):L("",!0)],34)}}}),UI=32;function gh(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error(`failed to load ${e}`)),r.src=e})}function mh(e){const t=document.createElement("canvas");t.width=e.naturalWidth,t.height=e.naturalHeight;const n=t.getContext("2d");return n.drawImage(e,0,0),n.getImageData(0,0,t.width,t.height)}function WI(e,t,n){const r=e.width,s=e.height;let o=0;for(let i=0;i<e.data.length;i+=4)if(Math.abs(e.data[i]-t.data[i])+Math.abs(e.data[i+1]-t.data[i+1])+Math.abs(e.data[i+2]-t.data[i+2])>UI)o++,n.data[i]=255,n.data[i+1]=0,n.data[i+2]=0,n.data[i+3]=255;else{const l=(t.data[i]+t.data[i+1]+t.data[i+2])/3;n.data[i]=l,n.data[i+1]=l,n.data[i+2]=l,n.data[i+3]=90}return{width:r,height:s,changedPercent:o/(r*s)*100}}function GI(e,t,n){if(e.naturalWidth!==t.naturalWidth||e.naturalHeight!==t.naturalHeight)return{error:`Dimensions differ: base ${e.naturalWidth}×${e.naturalHeight} vs head ${t.naturalWidth}×${t.naturalHeight} — cannot pixel-diff.`};const r=e.naturalWidth,s=e.naturalHeight,o=mh(e),i=mh(t);n.width=r,n.height=s;const a=n.getContext("2d"),l=a.createImageData(r,s),u=WI(o,i,l);return a.putImageData(l,0,0),u}const KI={single:"max-w-md",pane:"max-w-md flex-1",paneImage:"w-full",stage:"max-w-2xl",stageImage:"max-w-full",cursor:"cursor-zoom-in"},YI={single:"max-w-full",pane:"min-w-0 flex-1",paneImage:"max-h-[70vh] w-full object-contain",stage:"max-w-full",stageImage:"max-h-[70vh] max-w-full",cursor:""};function QI(e){return e?YI:KI}const XI={class:"border-t border-default p-4"},ZI={class:"mb-3 text-xs text-muted"},JI=["src","alt"],e$={key:1},t$={class:"mb-3 flex gap-2"},n$={key:0,class:"flex gap-3"},r$=["src","alt"],s$=["src","alt"],o$={class:"relative inline-block overflow-hidden rounded border border-default"},i$=["src","alt"],a$=["src","alt"],l$={class:"relative inline-block overflow-hidden rounded border border-default"},u$=["src","alt"],c$=["src","alt"],d$={class:"mt-1 text-[10px] text-muted"},f$={key:0,class:"text-xs text-muted"},p$={key:1,class:"text-xs text-warning"},h$={key:2,class:"mb-2 text-xs text-muted"},g$=["src"],Iy=Y({__name:"ImageDiff",props:{assetPath:{},baseAssetPath:{},comparisonModes:{},description:{},large:{type:Boolean}},setup(e){const t=e,n=E(()=>QI(t.large===!0)),r=G(t.comparisonModes[0]??"side-by-side"),s=G(50),o=E(()=>ur(t.assetPath)),i=E(()=>t.baseAssetPath?ur(t.baseAssetPath):null),a=Or("diffCanvas"),l=G(null),u=G(null),c=G(!1);async function f(){if(i.value&&(await tt(),!!a.value)){c.value=!0,u.value=null,l.value=null;try{const[x,b]=await Promise.all([gh(i.value),gh(o.value)]),w=GI(x,b,a.value);"error"in w?u.value=w.error:l.value=w}catch(x){u.value=x instanceof Error?x.message:String(x)}finally{c.value=!1}}}Me(r,x=>{x==="changed-pixel"&&f()}),dt(()=>{r.value==="changed-pixel"&&f()});const p={"side-by-side":"Side by side",swipe:"Swipe","onion-skin":"Onion skin","changed-pixel":"Changed pixels"},h=G(null),g=Or("lightboxDialog");function m(x){var b;t.large||(h.value=x,(b=g.value)==null||b.showModal())}function v(){var x;(x=g.value)==null||x.close(),h.value=null}return(x,b)=>{const w=kt;return y(),T("div",XI,[C("p",ZI,q(e.description),1),i.value?(y(),T("div",e$,[C("div",t$,[(y(!0),T(ne,null,Ee(e.comparisonModes,k=>(y(),$(w,{key:k,size:"xs",variant:r.value===k?"solid":"outline",onClick:O=>r.value=k},{default:R(()=>[me(q(p[k]),1)]),_:2},1032,["variant","onClick"]))),128))]),r.value==="side-by-side"?(y(),T("div",n$,[C("div",{class:se(n.value.pane)},[b[10]||(b[10]=C("div",{class:"mb-1 text-[10px] font-bold text-muted"},"Base",-1)),C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["rounded border border-default",[n.value.cursor,n.value.paneImage]]),onClick:b[1]||(b[1]=k=>m(i.value))},null,10,r$)],2),C("div",{class:se(n.value.pane)},[b[11]||(b[11]=C("div",{class:"mb-1 text-[10px] font-bold text-muted"},"Head",-1)),C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["rounded border border-default",[n.value.cursor,n.value.paneImage]]),onClick:b[2]||(b[2]=k=>m(o.value))},null,10,s$)],2)])):r.value==="swipe"?(y(),T("div",{key:1,class:se(n.value.stage)},[C("div",o$,[C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[3]||(b[3]=k=>m(i.value))},null,10,i$),C("div",{class:"absolute inset-0 overflow-hidden",style:wt({clipPath:`inset(0 ${100-s.value}% 0 0)`})},[C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[4]||(b[4]=k=>m(o.value))},null,10,a$)],4),C("div",{class:"pointer-events-none absolute inset-y-0 w-0.5 bg-primary",style:wt({left:`${s.value}%`})},null,4)]),Ds(C("input",{"onUpdate:modelValue":b[5]||(b[5]=k=>s.value=k),type:"range",min:"0",max:"100",class:"mt-2 w-full"},null,512),[[yf,s.value,void 0,{number:!0}]]),b[12]||(b[12]=C("p",{class:"mt-1 text-[10px] text-muted"},"Left of the line: head. Right of the line: base.",-1))],2)):r.value==="onion-skin"?(y(),T("div",{key:2,class:se(n.value.stage)},[C("div",l$,[C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[6]||(b[6]=k=>m(i.value))},null,10,u$),C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["absolute inset-0 block",[n.value.cursor,n.value.stageImage]]),style:wt({opacity:s.value/100}),onClick:b[7]||(b[7]=k=>m(o.value))},null,14,c$)]),Ds(C("input",{"onUpdate:modelValue":b[8]||(b[8]=k=>s.value=k),type:"range",min:"0",max:"100",class:"mt-2 w-full"},null,512),[[yf,s.value,void 0,{number:!0}]]),C("p",d$,q(s.value)+"% head opacity over base.",1)],2)):(y(),T("div",{key:3,class:se(n.value.stage)},[c.value?(y(),T("p",f$,"Computing pixel diff…")):u.value?(y(),T("p",p$,q(u.value),1)):l.value?(y(),T("p",h$,q(l.value.width)+"×"+q(l.value.height)+" — "+q(l.value.changedPercent.toFixed(2))+"% pixels changed (red = changed, threshold-based, not pixel-perfect) ",1)):L("",!0),C("canvas",{ref_key:"diffCanvas",ref:a,class:"max-w-full rounded border border-default"},null,512)],2))])):(y(),T("div",{key:0,class:se(n.value.single)},[C("img",{src:o.value,alt:e.assetPath,class:se(["rounded border border-default",[n.value.cursor,n.value.stageImage]]),onClick:b[0]||(b[0]=k=>m(o.value))},null,10,JI)],2)),C("dialog",{ref_key:"lightboxDialog",ref:g,class:"max-h-none max-w-none overflow-visible border-0 bg-transparent p-0 backdrop:bg-black/80",onClick:v,onClose:b[9]||(b[9]=k=>h.value=null)},[h.value?(y(),T("img",{key:0,src:h.value,alt:"",class:"max-h-[92vh] max-w-[92vw] cursor-zoom-out object-contain"},null,8,g$)):L("",!0)],544)])}}}),m$=["aria-label"],v$=["aria-label"],y$={class:"flex items-start justify-between gap-3 p-3 pb-0"},b$={class:"text-sm font-semibold"},$y=Y({__name:"ImageLightbox",props:{assetPath:{},baseAssetPath:{},caption:{}},setup(e){const t=["side-by-side","swipe","onion-skin","changed-pixel"],n=Or("dialog"),r=G(!1);function s(){var i;r.value=!0,(i=n.value)==null||i.showModal()}function o(i){var a;i.target===n.value&&((a=n.value)==null||a.close())}return(i,a)=>{const l=kt;return y(),T(ne,null,[C("button",{type:"button",class:"block w-full cursor-zoom-in text-left","aria-label":`Enlarge image: ${e.caption}`,"data-testid":"enlarge-image",onClick:s},[U(i.$slots,"default")],8,m$),C("dialog",{ref_key:"dialog",ref:n,"data-testid":"image-lightbox","aria-label":e.caption,class:"m-auto max-h-[94vh] w-[min(96vw,90rem)] overflow-auto rounded-lg border border-default bg-default p-0 text-default backdrop:bg-black/80",onClick:o,onClose:a[1]||(a[1]=u=>r.value=!1)},[C("div",y$,[C("p",b$,q(e.caption),1),B(l,{size:"xs",variant:"soft",color:"neutral",onClick:a[0]||(a[0]=u=>{var c;return(c=n.value)==null?void 0:c.close()})},{default:R(()=>[...a[2]||(a[2]=[me("Close",-1)])]),_:1})]),r.value?(y(),$(Iy,{key:0,large:"","asset-path":e.assetPath,"base-asset-path":e.baseAssetPath,"comparison-modes":[...t],description:"Click outside the picture or press Esc to close."},null,8,["asset-path","base-asset-path","comparison-modes"])):L("",!0)],40,v$)],64)}}}),x$={class:"max-h-96 w-80 space-y-3 overflow-y-auto p-3 text-xs","data-testid":"proof-popover"},w$={key:0,class:"grid grid-cols-2 gap-1"},k$=["src","alt"],_$=["src","alt"],C$=["src","alt"],S$={class:"mt-1 text-muted"},T$=["onClick"],_d=Y({__name:"ProofIcon",props:{proofs:{}},setup(e){function t(n){var r;(r=document.getElementById(Qn(n)))==null||r.scrollIntoView({behavior:"smooth",block:"start"})}return(n,r)=>{const s=kt,o=Za;return e.proofs.length?(y(),$(o,{key:0},{content:R(()=>[C("div",x$,[(y(!0),T(ne,null,Ee(e.proofs,i=>(y(),T("figure",{key:i.evidenceId},[B($y,{"asset-path":i.assetPath,"base-asset-path":i.baseAssetPath,caption:i.caption},{default:R(()=>[i.baseAssetPath?(y(),T("div",w$,[C("img",{src:d(ur)(i.baseAssetPath),alt:`Before: ${i.caption}`,class:"rounded border border-default"},null,8,k$),C("img",{src:d(ur)(i.assetPath),alt:`After: ${i.caption}`,class:"rounded border border-default"},null,8,_$)])):(y(),T("img",{key:1,src:d(ur)(i.assetPath),alt:i.caption,class:"rounded border border-default"},null,8,C$))]),_:2},1032,["asset-path","base-asset-path","caption"]),C("figcaption",S$,q(i.caption),1),C("button",{type:"button",class:"mt-0.5 font-mono text-primary hover:underline",onClick:a=>t(i.imagePath)}," → "+q(i.imagePath),9,T$)]))),128))])]),default:R(()=>[B(s,{"data-testid":"proof-icon",size:"xs",variant:"ghost",color:"primary",icon:"i-lucide-image","aria-label":`Proof: ${e.proofs.length} image${e.proofs.length===1?"":"s"} show this change works`},null,8,["aria-label"])]),_:1})):L("",!0)}}});function A$(e){return e.kind==="change-request"?e.resolved?"✓":"!":"?"}function E$(e){return e.status==="withdrawn"?"border-dimmed/60 bg-dimmed/10 text-dimmed line-through":e.kind==="change-request"?e.resolved?"border-success/60 bg-success/10 text-success opacity-70":"border-error/60 bg-error/15 text-error hover:bg-error hover:text-inverted":"border-info/60 bg-info/15 text-info hover:bg-info hover:text-inverted"}function qy(e){return e.kind==="change-request"?"error":"info"}function My(e){return e.kind==="change-request"?"Change request":"Question"}function Dy(e,t=!1){return e.resolved||t?"success":e.status==="open"?"warning":"neutral"}function Ly(e,t=!1){return e.resolved?"Resolved":t?"Answered":e.status==="open"?"Open":"Withdrawn"}function O$(e){return e==="target-touched"?"success":e==="target-partially-touched"?"warning":e==="target-gone"?"error":"neutral"}function P$(e){switch(e){case"target-touched":return"Touched by new commits";case"target-partially-touched":return"Partially touched by new commits";case"target-untouched":return"Not touched by new commits";case"target-gone":return"Target gone"}}const R$={class:"inline-flex items-center gap-1 align-middle"},I$=["aria-label","onClick"],da=Y({__name:"QuestionThread",props:{target:{},questions:{}},setup(e){const t=e;function n(){vy({target:t.target??{type:"general"}})}return(r,s)=>(y(),T("span",R$,[(y(!0),T(ne,null,Ee(e.questions,o=>(y(),T("button",{key:o.id,type:"button",class:se(["grid h-[18px] w-[18px] place-items-center rounded-full border text-[10px] font-bold transition hover:scale-110",d(E$)(o)]),"aria-label":`${o.kind==="change-request"?"Change request":"Question"}${o.resolved?" (resolved)":""}: ${o.body}`,onClick:i=>d(nl)(o)},q(d(A$)(o)),11,I$))),128)),C("button",{type:"button",class:"grid h-[18px] w-[18px] place-items-center rounded-full border border-dimmed/40 text-[10px] text-dimmed opacity-0 transition group-hover:opacity-100 hover:scale-110 hover:border-info hover:text-info focus-visible:opacity-100","aria-label":"Comment on this",onClick:n}," + ")]))}}),$$={class:"overflow-x-auto font-mono text-xs"},q$={class:"table w-max min-w-full border-collapse"},M$={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},D$=["id","data-highlighted"],L$={class:"table-cell select-none px-2 text-right align-baseline text-dimmed"},N$={class:"table-cell select-none px-2 text-right align-baseline text-dimmed"},B$={class:"table-cell select-none px-1 align-baseline"},z$={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},F$=["innerHTML"],j$=["onClick"],H$=Y({__name:"DiffInlineLayout",props:{file:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e;function n(i){return Qv(t.file.path,i)}function r(i){const a=t.file.hunks[i];return ky(n(i),a.lines)}function s(i){return _y(n(i),t.file.hunks[i].lines)}const o=E(()=>t.file.path);return(i,a)=>(y(),T("div",$$,[(y(!0),T(ne,null,Ee(e.file.hunks,(l,u)=>(y(),T(ne,{key:u},[C("div",q$,[C("div",M$,[me(" @@ -"+q(l.oldStart)+","+q(l.oldLines)+" +"+q(l.newStart)+","+q(l.newLines)+" @@ ",1),B(_d,{proofs:l.proofs,class:"ml-2 align-middle"},null,8,["proofs"])]),(y(!0),T(ne,null,Ee(r(u),c=>(y(),T("div",{id:d(Hs)(c.id),key:c.id,class:se(["group table-row",{"bg-success/10":c.kind==="add","bg-error/10":c.kind==="remove","line-highlighted":d(hh)(c.id)}]),"data-highlighted":d(hh)(c.id)||void 0},[C("span",L$,q(c.oldLine??""),1),C("span",N$,q(c.newLine??""),1),C("span",{class:se(["table-cell select-none text-center align-baseline",{"text-success":c.kind==="add","text-error":c.kind==="remove"}])},q(c.kind==="add"?"+":c.kind==="remove"?"−":""),3),C("span",B$,[B(da,{target:d(OO)(o.value,c.text,c.oldLine,c.newLine),questions:d(aa)(e.questions,o.value,c.newLine!==void 0?"head":"base",c.newLine??c.oldLine)},null,8,["target","questions"])]),C("span",z$,[C("code",{innerHTML:d(Us)(c.text),onClick:a[0]||(a[0]=(...f)=>d(Es)&&d(Es)(...f))},null,8,F$),B(Zu,{annotations:[],diagnostics:c.diagnostics,numbers:e.annotationNumbers},null,8,["diagnostics","numbers"]),(y(!0),T(ne,null,Ee(c.annotations,f=>(y(),$(VI,{key:f.id,annotation:f,number:e.annotationNumbers.get(f.id)??0,questions:e.questions,answers:e.answers},null,8,["annotation","number","questions","answers"]))),128))])],10,D$))),128))]),s(u)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:c=>d(ss)(e.file.path,u)}," ⋯ Show "+q(s(u))+" more lines ",9,j$)):L("",!0)],64))),128))]))}});function V$(){const e=Or("leftPane"),t=Or("rightPane");let n=!1;function r(s,o){!s||!o||n||(n=!0,o.scrollLeft=s.scrollLeft,n=!1)}return{leftPane:e,rightPane:t,syncScroll:r}}const U$={class:"font-mono text-xs"},W$={class:"grid grid-cols-2"},G$={class:"table w-max min-w-full border-collapse"},K$={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},Y$=["id"],Q$={class:"table-cell w-12 select-none px-2 text-right align-baseline text-dimmed"},X$={class:"table-cell w-4 select-none text-center align-baseline text-error"},Z$={class:"table-cell select-none px-1 align-baseline"},J$={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},eq=["innerHTML"],tq=["onClick"],nq={class:"table w-max min-w-full border-collapse"},rq={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},sq=["id"],oq={class:"table-cell w-12 select-none px-2 text-right align-baseline text-dimmed"},iq={class:"table-cell w-4 select-none text-center align-baseline text-success"},aq={class:"table-cell select-none px-1 align-baseline"},lq={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},uq=["innerHTML"],cq=["onClick"],dq=Y({__name:"DiffSideBySideLayout",props:{file:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e,{leftPane:n,rightPane:r,syncScroll:s}=V$(),o=E(()=>t.file.hunks.map(c=>aO(c.lines))),i=E(()=>t.file.path);function a(c){return Qv(t.file.path,c)}function l(c){return ky(a(c),o.value[c])}function u(c){return _y(a(c),o.value[c])}return(c,f)=>(y(),T("div",U$,[f[4]||(f[4]=C("div",{class:"grid grid-cols-2 border-b border-default bg-elevated text-[10px] font-bold text-muted"},[C("span",{class:"px-3 py-1"},"Base · before"),C("span",{class:"border-l border-default px-3 py-1"},"MR head · after")],-1)),C("div",W$,[C("div",{ref_key:"leftPane",ref:n,class:"min-w-0 overflow-x-auto",onScroll:f[1]||(f[1]=p=>d(s)(d(n),d(r)))},[(y(!0),T(ne,null,Ee(e.file.hunks,(p,h)=>(y(),T(ne,{key:h},[C("div",G$,[C("div",K$,[me(" @@ -"+q(p.oldStart)+","+q(p.oldLines)+" @@ ",1),B(_d,{proofs:p.proofs,class:"ml-2 align-middle"},null,8,["proofs"])]),(y(!0),T(ne,null,Ee(l(h),(g,m)=>{var v,x,b;return y(),T("div",{id:g.left&&g.left!==g.right?d(Hs)(g.left.id):void 0,key:m,class:se(["group table-row",{"bg-error/10":((v=g.left)==null?void 0:v.kind)==="remove"}])},[C("span",Q$,q(((x=g.left)==null?void 0:x.oldLine)??""),1),C("span",X$,q(((b=g.left)==null?void 0:b.kind)==="remove"?"−":""),1),C("span",Z$,[g.left?(y(),$(da,{key:0,target:{type:"line",path:i.value,side:"base",line:g.left.oldLine,expectedText:g.left.text},questions:d(aa)(e.questions,i.value,"base",g.left.oldLine)},null,8,["target","questions"])):L("",!0)]),C("span",J$,[g.left?(y(),T(ne,{key:0},[C("code",{innerHTML:d(Us)(g.left.text),onClick:f[0]||(f[0]=(...w)=>d(Es)&&d(Es)(...w))},null,8,eq),B(Zu,{annotations:g.left.annotations,diagnostics:g.left.diagnostics,numbers:e.annotationNumbers},null,8,["annotations","diagnostics","numbers"])],64)):L("",!0)])],10,Y$)}),128))]),u(h)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:g=>d(ss)(e.file.path,h)}," ⋯ Show "+q(u(h))+" more rows ",9,tq)):L("",!0)],64))),128))],544),C("div",{ref_key:"rightPane",ref:r,class:"min-w-0 overflow-x-auto border-l border-default",onScroll:f[3]||(f[3]=p=>d(s)(d(r),d(n)))},[(y(!0),T(ne,null,Ee(e.file.hunks,(p,h)=>(y(),T(ne,{key:h},[C("div",nq,[C("div",rq," @@ +"+q(p.newStart)+","+q(p.newLines)+" @@ ",1),(y(!0),T(ne,null,Ee(l(h),(g,m)=>{var v,x,b;return y(),T("div",{id:g.right?d(Hs)(g.right.id):void 0,key:m,class:se(["group table-row",{"bg-success/10":((v=g.right)==null?void 0:v.kind)==="add"}])},[C("span",oq,q(((x=g.right)==null?void 0:x.newLine)??""),1),C("span",iq,q(((b=g.right)==null?void 0:b.kind)==="add"?"+":""),1),C("span",aq,[g.right?(y(),$(da,{key:0,target:{type:"line",path:i.value,side:"head",line:g.right.newLine,expectedText:g.right.text},questions:d(aa)(e.questions,i.value,"head",g.right.newLine)},null,8,["target","questions"])):L("",!0)]),C("span",lq,[g.right?(y(),T(ne,{key:0},[C("code",{innerHTML:d(Us)(g.right.text),onClick:f[2]||(f[2]=(...w)=>d(Es)&&d(Es)(...w))},null,8,uq),B(Zu,{annotations:g.right.annotations,diagnostics:g.right.diagnostics,numbers:e.annotationNumbers},null,8,["annotations","diagnostics","numbers"])],64)):L("",!0)])],10,sq)}),128))]),u(h)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:g=>d(ss)(e.file.path,h)}," ⋯ Show "+q(u(h))+" more rows ",9,cq)):L("",!0)],64))),128))],544)])]))}}),fq={key:0,class:"border-b border-default bg-warning/10 px-4 py-2 text-xs"},pq={class:"mt-1 list-disc space-y-1 pl-4","data-testid":"file-diagnostics"},hq=Y({__name:"FileDiagnostics",props:{diagnostics:{}},setup(e){return(t,n)=>e.diagnostics.length?(y(),T("div",fq,[C("strong",null,q(e.diagnostics.length)+" diagnostic"+q(e.diagnostics.length===1?"":"s")+" on this file",1),C("ul",pq,[(y(!0),T(ne,null,Ee(e.diagnostics,(r,s)=>(y(),T("li",{key:s},q(d(bd)(r)),1))),128))])])):L("",!0)}}),gq={class:"border-t border-default p-4 text-sm"},mq={class:"flex flex-wrap items-center gap-2"},vq=["href"],yq={class:"mt-2 text-xs text-muted"},bq={key:0,class:"mt-2 overflow-x-auto rounded bg-elevated p-2 font-mono text-xs whitespace-pre-wrap"},xq=Y({__name:"PipelineEvidence",props:{jobName:{},status:{},url:{},logExcerpt:{},description:{}},setup(e){const t={success:"success",failed:"error",running:"info",canceled:"neutral",skipped:"neutral"},n=G(!1);return(r,s)=>{const o=mn,i=kt;return y(),T("div",gq,[C("div",mq,[B(o,{size:"sm",variant:"subtle",color:t[e.status]},{default:R(()=>[me(q(e.status),1)]),_:1},8,["color"]),C("a",{href:e.url,target:"_blank",rel:"noopener",class:"font-mono text-xs text-primary hover:underline"},q(e.jobName),9,vq),e.logExcerpt?(y(),$(i,{key:0,size:"xs",variant:"ghost",class:"ml-auto",onClick:s[0]||(s[0]=a=>n.value=!n.value)},{default:R(()=>[me(q(n.value?"Hide log":"Show log"),1)]),_:1})):L("",!0)]),C("p",yq,q(e.description),1),n.value&&e.logExcerpt?(y(),T("pre",bq,q(e.logExcerpt),1)):L("",!0)])}}});function wq(e){return e.hunkIndex===void 0?e.path:`${e.path} (change ${e.hunkIndex+1})`}const kq={key:0,"data-testid":"proof-back-links",class:"flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},_q=["onClick"],Cq=Y({__name:"ProofBackLinks",props:{links:{}},setup(e){function t(n){var r;(r=document.getElementById(Qn(n)))==null||r.scrollIntoView({behavior:"smooth",block:"start"})}return(n,r)=>e.links.length?(y(),T("div",kq,[r[0]||(r[0]=C("span",null,"This image shows that this code works:",-1)),(y(!0),T(ne,null,Ee(e.links,s=>(y(),T("button",{key:s.evidenceId+s.path,type:"button",class:"font-mono text-primary hover:underline",onClick:o=>t(s.path)}," → "+q(d(wq)(s)),9,_q))),128))])):L("",!0)}}),Sq=["id"],Tq={class:"truncate font-mono text-sm"},Aq={key:0,class:"shrink-0 text-xs text-muted"},Eq={class:"ml-auto flex items-center gap-2"},Oq={key:0,class:"px-4 py-2 text-xs text-muted"},Pq={key:0,class:"flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},Rq={key:1,class:"flex flex-wrap items-center gap-2 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},Iq=["title","onClick"],$q={class:"group flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},qq={key:0,class:"p-4 text-sm text-muted"},Mq=Y({__name:"DiffFile",props:{file:{},position:{},layout:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e,n=E(()=>wO(t.file)),r=E(()=>kO(t.file)),s=E(()=>Gv(t.file)),o=E(()=>yO(t.file.path)),i=E(()=>lO(t.file.path,_O(t.file)||o.value)),a=E(()=>CO(t.file)),l=E(()=>SO(t.file)),u=E(()=>PO(t.questions,t.file.path));return(c,f)=>{const p=mn,h=Qa,g=kt;return y(),T("article",{id:d(Qn)(e.file.path),class:se(["mb-6 overflow-clip rounded-lg border",o.value?"border-success bg-success/5":"border-default"])},[C("header",{class:se(["sticky top-0 z-10 flex items-center gap-3 border-b border-default bg-elevated px-4 py-2",{"bg-success/10":o.value}])},[f[3]||(f[3]=C("span",{class:"text-dimmed"},"◇",-1)),C("strong",Tq,q(e.file.path),1),e.position?(y(),T("span",Aq,"file "+q(e.position.index)+" of "+q(e.position.total),1)):L("",!0),C("span",Eq,[B(_d,{proofs:e.file.proofs},null,8,["proofs"]),e.file.binary?(y(),$(p,{key:0,color:"neutral",variant:"subtle",size:"sm"},{default:R(()=>[...f[2]||(f[2]=[me("binary",-1)])]),_:1})):(y(),T(ne,{key:1},[B(p,{color:"success",variant:"subtle",size:"sm"},{default:R(()=>[me("+"+q(n.value),1)]),_:1}),B(p,{color:"error",variant:"subtle",size:"sm"},{default:R(()=>[me("−"+q(r.value),1)]),_:1}),B(h,{"model-value":o.value,label:"Reviewed",size:"sm","onUpdate:modelValue":f[0]||(f[0]=m=>d(bO)(e.file.path))},null,8,["model-value"]),B(g,{icon:i.value?"i-lucide-chevron-right":"i-lucide-chevron-down",size:"xs",variant:"ghost",color:"neutral","aria-label":i.value?"Expand diff":"Collapse diff",onClick:f[1]||(f[1]=m=>d(uO)(e.file.path,i.value))},null,8,["icon","aria-label"])],64))])],2),B(hq,{diagnostics:e.file.diagnostics},null,8,["diagnostics"]),B(Cq,{links:e.file.proofFor},null,8,["links"]),i.value?(y(),T("div",Oq," Diff collapsed ("+q(s.value)+" lines) — click Expand above to view. ",1)):(y(),T(ne,{key:1},[a.value.length?(y(),T("div",Pq,[f[4]||(f[4]=C("span",null,"Notes on this file:",-1)),(y(!0),T(ne,null,Ee(a.value,m=>(y(),$(xy,{key:m.id,annotation:m,number:e.annotationNumbers.get(m.id)??0},null,8,["annotation","number"]))),128))])):L("",!0),l.value.length?(y(),T("div",Rq,[f[5]||(f[5]=C("span",null,"Agent comments in this file:",-1)),(y(!0),T(ne,null,Ee(l.value,m=>(y(),T("button",{key:m.annotation.id,type:"button",title:m.annotation.summary,class:"grid h-[18px] w-[18px] place-items-center rounded-full border border-warning/60 bg-warning/15 text-[10px] font-bold text-warning transition hover:scale-110 hover:bg-warning hover:text-inverted",onClick:v=>d(Zv)(e.file.path,m.hunkIndex,m.lineId)},q(e.annotationNumbers.get(m.annotation.id)??0),9,Iq))),128))])):L("",!0),C("div",$q,[f[6]||(f[6]=C("span",null,"Questions on this file:",-1)),B(da,{target:{type:"file",path:e.file.path},questions:u.value},null,8,["target","questions"])]),(y(!0),T(ne,null,Ee(e.file.pipelineEvidence,m=>(y(),$(xq,{key:m.id,"job-name":m.jobName,status:m.status,url:m.url,"log-excerpt":m.logExcerpt,description:m.description},null,8,["job-name","status","url","log-excerpt","description"]))),128)),e.file.binary?(y(),T(ne,{key:2},[e.file.imageEvidence.length===0?(y(),T("div",qq," Binary change — no image evidence attached to compare. ")):L("",!0),(y(!0),T(ne,null,Ee(e.file.imageEvidence,m=>(y(),$(Iy,{key:m.id,"asset-path":m.assetPath,"base-asset-path":m.baseAssetPath,"comparison-modes":m.comparisonModes,description:m.description},null,8,["asset-path","base-asset-path","comparison-modes","description"]))),128))],64)):e.layout==="inline"?(y(),$(H$,{key:3,file:e.file,"annotation-numbers":e.annotationNumbers,questions:e.questions,answers:e.answers},null,8,["file","annotation-numbers","questions","answers"])):(y(),$(dq,{key:4,file:e.file,"annotation-numbers":e.annotationNumbers,questions:e.questions,answers:e.answers},null,8,["file","annotation-numbers","questions","answers"]))],64))],10,Sq)}}});function Ny(e,t,n,r=new Date){return e.kind!=="question"||e.status!=="open"?null:t?"answered":(n==null?void 0:n.status)==="ok"&&n.watcher.current===e.id&&!xd(n,r)?"answering":"waiting"}const Dq={waiting:{label:"Waiting",icon:"i-lucide-clock",color:"neutral"},answering:{label:"Answering",icon:"i-lucide-loader-circle",color:"info"},answered:{label:"Answered",icon:"i-lucide-circle-check",color:"success"}};function By(e){return Dq[e]}function Lq(e){return[...e].sort((t,n)=>n.question.createdAt.localeCompare(t.question.createdAt))}function zy(e){if(!e)return"No target";switch(e.type){case"general":return"Whole change";case"hunk":return`${e.path} (hunk ${e.hunkIndex+1})`;case"line":return`${e.path}:${e.line}`;default:return e.path}}function Bi(e){if(!e)return"none";switch(e.type){case"general":return"general";case"hunk":return`hunk:${e.path}:${e.hunkIndex}`;case"line":return`line:${e.path}:${e.side}:${e.line}`;default:return`${e.type}:${e.path}`}}const Nq={type:"general"};function Bq(e){const t=[e,Nq];return t.filter((n,r)=>t.findIndex(s=>Bi(s)===Bi(n))===r).map(n=>({key:Bi(n),label:zy(n),target:n}))}function zq(e,t){return e>0?{text:String(e),srText:`${e} new answer${e===1?"":"s"}`,tone:"new"}:t>0?{text:String(t),srText:`${t} open`,tone:"open"}:null}const Fq={key:0,"data-testid":"general-comments",class:"mt-3 border-t border-default pt-3"},jq={class:"space-y-2"},Hq=["onClick"],Vq={class:"min-w-0 break-words"},Uq=Y({__name:"GeneralComments",props:{answers:{}},setup(e){const t=e,n=Xa(),r=E(()=>IO(Xv(n.questions)).map(s=>{const o=Ny(s,t.answers.some(i=>i.questionId===s.id),is.value);return{comment:s,badge:o?By(o):null}}));return(s,o)=>{const i=mn;return r.value.length?(y(),T("div",Fq,[o[0]||(o[0]=C("h3",{class:"mb-2 text-sm font-semibold"},"Your comments on the whole change",-1)),C("ul",jq,[(y(!0),T(ne,null,Ee(r.value,({comment:a,badge:l})=>(y(),T("li",{key:a.id,"data-testid":"general-comment"},[C("button",{type:"button",class:"flex w-full items-start gap-2 text-left",onClick:u=>d(nl)(a)},[B(i,{size:"sm",variant:"subtle",color:d(qy)(a),class:"shrink-0"},{default:R(()=>[me(q(d(My)(a)),1)]),_:2},1032,["color"]),l?(y(),$(i,{key:0,size:"sm",variant:"subtle",color:l.color,icon:l.icon,class:"shrink-0"},{default:R(()=>[me(q(l.label),1)]),_:2},1032,["color","icon"])):(y(),$(i,{key:1,size:"sm",variant:"subtle",color:d(Dy)(a),class:"shrink-0"},{default:R(()=>[me(q(d(Ly)(a)),1)]),_:2},1032,["color"])),C("span",Vq,q(a.body),1)],8,Hq)]))),128))])])):L("",!0)}}}),Wq={key:0,id:"general-findings","data-testid":"general-findings",class:"mb-4 rounded-lg border border-default bg-elevated p-4 text-sm"},Gq={class:"space-y-3"},Kq=["innerHTML"],Yq=Y({__name:"GeneralFindings",props:{findings:{},answers:{}},setup(e){return(t,n)=>e.findings.length?(y(),T("section",Wq,[n[0]||(n[0]=C("h2",{class:"mb-2 text-base font-semibold"},"Findings about the whole change",-1)),C("ul",Gq,[(y(!0),T(ne,null,Ee(e.findings,r=>(y(),T("li",{key:r.id,"data-testid":"general-finding",class:"rounded border border-default p-3"},[B(sl,{annotation:r},null,8,["annotation"]),C("div",{class:"markdown-body mt-1 text-muted",innerHTML:d($r)(r.summary)},null,8,Kq),B(rl,{suggestion:r.suggestion},null,8,["suggestion"]),B(ti,{class:"mt-2",target:r.target,annotation:r},null,8,["target","annotation"])]))),128))]),B(Uq,{answers:e.answers},null,8,["answers"])])):L("",!0)}}),vh=3;function Qq(e){const t=[...(e??[]).filter(n=>n.source==="mr-text"),...(e??[]).filter(n=>n.source!=="mr-text")];return{shown:t.slice(0,vh),more:t.slice(vh)}}const Xq={key:0,class:"grid grid-cols-2 gap-1"},Zq=["src","alt"],Jq=["src","alt"],e3=["src","alt"],t3={class:"mt-1 text-xs text-muted"},yh=Y({__name:"VisualFigure",props:{visual:{}},setup(e){return(t,n)=>(y(),T("figure",{"data-testid":"intent-visual",class:se(["max-w-full",e.visual.baseAssetPath?"w-[36rem]":"w-72"])},[B($y,{"asset-path":e.visual.assetPath,"base-asset-path":e.visual.baseAssetPath,caption:e.visual.caption},{default:R(()=>[e.visual.baseAssetPath?(y(),T("div",Xq,[C("div",null,[n[0]||(n[0]=C("p",{class:"text-[10px] font-bold text-muted"},"Before",-1)),C("img",{src:d(ur)(e.visual.baseAssetPath),alt:`Before: ${e.visual.caption}`,class:"rounded border border-default"},null,8,Zq)]),C("div",null,[n[1]||(n[1]=C("p",{class:"text-[10px] font-bold text-muted"},"After",-1)),C("img",{src:d(ur)(e.visual.assetPath),alt:`After: ${e.visual.caption}`,class:"rounded border border-default"},null,8,Jq)])])):(y(),T("img",{key:1,src:d(ur)(e.visual.assetPath),alt:e.visual.caption,class:"rounded border border-default"},null,8,e3))]),_:1},8,["asset-path","base-asset-path","caption"]),C("figcaption",t3,q(e.visual.caption),1)],2))}}),n3={key:0,"data-testid":"intent-visuals",class:"mt-3 flex flex-wrap items-start gap-3"},r3={key:0,"data-testid":"more-visuals",class:"basis-full"},s3={class:"cursor-pointer text-xs text-primary"},o3={class:"mt-2 flex flex-wrap items-start gap-3"},i3=Y({__name:"VisualsPanel",props:{visuals:{}},setup(e){const t=e,n=E(()=>Qq(t.visuals));return(r,s)=>n.value.shown.length?(y(),T("aside",n3,[(y(!0),T(ne,null,Ee(n.value.shown,o=>(y(),$(yh,{key:o.assetPath,visual:o},null,8,["visual"]))),128)),n.value.more.length?(y(),T("details",r3,[C("summary",s3,"More images ("+q(n.value.more.length)+")",1),C("div",o3,[(y(!0),T(ne,null,Ee(n.value.more,o=>(y(),$(yh,{key:o.assetPath,visual:o},null,8,["visual"]))),128))])])):L("",!0)])):L("",!0)}}),a3={"data-testid":"intent-panel",class:"mb-4 rounded-lg border border-default bg-elevated p-4 text-sm"},l3={key:0,class:"mb-3 rounded border border-warning/50 bg-warning/10 p-2 text-xs"},u3={class:"space-y-2"},c3={key:0},d3={class:"list-disc pl-5"},f3={class:"mt-3 text-xs text-muted"},p3=Y({__name:"IntentPanel",props:{intent:{}},setup(e){return(t,n)=>{var r;return y(),T("section",a3,[n[3]||(n[3]=C("h2",{class:"mb-2 text-base font-semibold"},"What this change is",-1)),e.intent.weakDescription?(y(),T("p",l3," The MR text is weak: "+q(e.intent.weakDescription),1)):L("",!0),C("dl",u3,[C("div",null,[n[0]||(n[0]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"What it does",-1)),C("dd",null,q(e.intent.does),1)]),C("div",null,[n[1]||(n[1]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"Why",-1)),C("dd",null,q(e.intent.why),1)]),(r=e.intent.doesNot)!=null&&r.length?(y(),T("div",c3,[n[2]||(n[2]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"What it does not do",-1)),C("dd",null,[C("ul",d3,[(y(!0),T(ne,null,Ee(e.intent.doesNot,s=>(y(),T("li",{key:s},q(s),1))),128))])])])):L("",!0)]),B(i3,{visuals:e.intent.visuals},null,8,["visuals"]),C("p",f3,"Sources: "+q(e.intent.sources.join(", ")),1)])}}});function h3(e){return e.filter(t=>t.verdict!=="intended")}function g3(e,t){return[...h3(e).map(n=>({kind:"general",annotation:n})),...t.map(n=>({kind:"verification",entry:n}))]}const m3={role:"region","aria-label":"Verdict",class:"mb-6 rounded-lg border border-default bg-elevated p-4"},v3={class:"mb-1 text-base font-bold text-highlighted"},y3=["innerHTML"],b3={class:"mb-4 grid grid-cols-2 gap-3 sm:grid-cols-4"},x3={class:"text-2xl font-bold text-success"},w3={class:"text-2xl font-bold text-error","data-testid":"open-gaps"},k3={class:"text-2xl font-bold text-warning"},_3={class:"text-2xl font-bold text-highlighted"},C3={key:1},S3={class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},T3={class:"space-y-1.5 text-xs"},A3={class:"w-4 shrink-0 text-right text-dimmed"},E3=["onClick"],O3={class:"hidden shrink-0 font-mono text-dimmed sm:inline"},P3={key:0,class:"mt-1.5 text-[11px] text-dimmed"},R3={key:2,class:"mt-3 flex flex-wrap gap-2 text-xs"},I3=["onClick"],bh=5,$3=Y({__name:"VerdictPanel",props:{summary:{},files:{},groups:{},generalAnnotations:{},openGaps:{}},setup(e){const t=e,n=G(!1),r=E(()=>t.summary?zo(t.summary.text):{headline:"",body:""}),s=E(()=>yy(t.files)),o=E(()=>{const p=gd(t.groups);return g3(t.generalAnnotations,md(hd(t.files),p))}),i=E(()=>o.value.slice(0,bh)),a=E(()=>Math.max(0,o.value.length-bh)),l={gap:"⚑",unverified:"○"},u={gap:"error",unverified:"warning"};function c(){var p;(p=document.getElementById("general-findings"))==null||p.scrollIntoView({behavior:"smooth",block:"start"})}function f(p){var h;(h=document.getElementById(Qn(p)))==null||h.scrollIntoView({behavior:"smooth",block:"start"})}return(p,h)=>{var m;const g=mn;return y(),T("section",m3,[e.summary?(y(),T(ne,{key:0},[C("h2",v3,q(r.value.headline),1),r.value.body?(y(),T("button",{key:0,type:"button",class:"mb-3 text-xs text-primary hover:underline",onClick:h[0]||(h[0]=v=>n.value=!n.value)},q(n.value?"▾ hide rest":"▸ read rest"),1)):L("",!0),n.value&&r.value.body?(y(),T("div",{key:1,class:"markdown-body mb-3 text-sm text-muted",innerHTML:d($r)(r.value.body)},null,8,y3)):L("",!0)],64)):L("",!0),C("div",b3,[C("div",null,[C("p",x3,q(s.value.verified),1),h[1]||(h[1]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Resolved",-1))]),C("div",null,[C("p",w3,q(e.openGaps),1),h[2]||(h[2]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Open gaps",-1))]),C("div",null,[C("p",k3,q(s.value.unverified),1),h[3]||(h[3]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Needs eyes",-1))]),C("div",null,[C("p",_3,q(e.files.length),1),h[4]||(h[4]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Files changed",-1))])]),i.value.length?(y(),T("div",C3,[C("p",S3," Start here — "+q(o.value.length)+" item"+q(o.value.length===1?"":"s")+", ordered by risk ",1),C("ol",T3,[(y(!0),T(ne,null,Ee(i.value,(v,x)=>(y(),T("li",{key:v.kind==="general"?v.annotation.id:v.entry.verification.id,class:"flex items-center gap-2"},[C("span",A3,q(x+1),1),v.kind==="general"?(y(),T(ne,{key:0},[C("button",{type:"button",class:"flex-1 truncate text-left hover:underline",onClick:c},q(d(zo)(v.annotation.summary).headline),1),v.annotation.verdict?(y(),$(g,{key:0,size:"sm",variant:"subtle",color:d(yd)(v.annotation.verdict)},{default:R(()=>[me(q(d(vd)(v.annotation.verdict)),1)]),_:2},1032,["color"])):L("",!0),h[5]||(h[5]=C("span",{class:"hidden shrink-0 text-dimmed sm:inline"},"whole change",-1))],64)):(y(),T(ne,{key:1},[C("button",{type:"button",class:"flex-1 truncate text-left hover:underline",onClick:b=>f(v.entry.path)},q(v.entry.verification.description),9,E3),B(g,{size:"sm",variant:"subtle",color:u[v.entry.verification.status]},{default:R(()=>[me(q(l[v.entry.verification.status])+" "+q(v.entry.verification.status),1)]),_:2},1032,["color"]),C("span",O3,q(v.entry.path.split("/").pop()),1)],64))]))),128))]),a.value?(y(),T("p",P3,"+"+q(a.value)+" more not shown",1)):L("",!0)])):L("",!0),(m=e.summary)!=null&&m.highlightPaths.length?(y(),T("ul",R3,[(y(!0),T(ne,null,Ee(e.summary.highlightPaths,v=>(y(),T("li",{key:v},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:x=>f(v)},"→ "+q(v),9,I3)]))),128))])):L("",!0)])}}}),q3={"aria-labelledby":"before-you-read","data-testid":"before-you-read"},M3=Y({__name:"BeforeYouReadCode",props:{viewModel:{}},setup(e){return(t,n)=>(y(),T("section",q3,[n[0]||(n[0]=C("h2",{id:"before-you-read",class:"mb-3 text-lg font-bold text-highlighted"},"Before you read the code",-1)),e.viewModel.intent?(y(),$(p3,{key:0,intent:e.viewModel.intent},null,8,["intent"])):L("",!0),B(Yq,{findings:e.viewModel.generalAnnotations,answers:e.viewModel.answers},null,8,["findings","answers"]),e.viewModel.summary||e.viewModel.generalAnnotations.length?(y(),$($3,{key:1,summary:e.viewModel.summary,files:e.viewModel.files,groups:e.viewModel.groups,"general-annotations":e.viewModel.generalAnnotations,"open-gaps":e.viewModel.openGaps},null,8,["summary","files","groups","general-annotations","open-gaps"])):L("",!0)]))}}),D3={key:0,"data-testid":"stale-banner",class:"mb-4 flex items-center gap-3 rounded border border-warning/50 bg-warning/10 p-3 text-sm"},L3={class:"font-semibold"},N3=Y({__name:"StaleBanner",setup(e){const t=E(()=>vI(Ju.value)),{copied:n,copy:r}=ol();function s(){var i,a;const o=(a=(i=Ju.value)==null?void 0:i.liveHead)==null?void 0:a.head;o&&r(CI(kd.value,o))}return(o,i)=>{const a=kt;return t.value?(y(),T("div",D3,[C("span",L3,q(t.value),1),B(a,{size:"xs",class:"ml-auto",onClick:s},{default:R(()=>[me(q(d(n)?"Copied!":"Copy next-round prompt"),1)]),_:1})])):L("",!0)}}}),B3={class:"mb-1 flex flex-wrap items-start justify-between gap-2"},z3={class:"text-sm font-semibold text-highlighted"},F3={class:"flex items-center gap-2"},j3={class:"mb-1 truncate font-mono text-[10px] text-dimmed"},H3=["innerHTML"],V3={key:3,class:"mb-3 space-y-1 text-xs"},U3={class:"text-muted"},W3={key:4,class:"mb-2 flex flex-wrap items-center gap-1.5 text-[11px]"},G3={key:5,class:"mb-2 space-y-1 border-t border-default pt-2 text-xs"},K3=["onMouseenter"],Y3=["onClick"],Q3={class:"text-muted"},X3={class:"flex items-center gap-3"},Z3={class:"mt-3 border-t border-default pt-2"},J3=Y({__name:"AnnotationCard",props:{annotation:{},defaultExpanded:{type:Boolean,default:!1},jumpToDiff:{}},setup(e){const t=e,n=E(()=>zo(t.annotation.summary)),r=G(t.defaultExpanded);Me(()=>t.annotation.id,()=>{r.value=t.defaultExpanded});const s={verified:"✓",gap:"⚑",unverified:"○"},o={verified:"success",gap:"error",unverified:"neutral"},i={observed:"observed","author-claim":"claim",inference:"inference"},a={observed:"success","author-claim":"warning",inference:"neutral"};function l(h){var g;if(t.jumpToDiff){t.jumpToDiff(h);return}(g=document.getElementById(Qn(h)))==null||g.scrollIntoView({behavior:"smooth",block:"start"})}const u=G(null);function c(h){var m;const g=(m=t.annotation.relatedTargets)==null?void 0:m[h];return g?No(fn.value,g.target):null}const f=E(()=>td(t.annotation.id)),p=E(()=>No(fn.value,t.annotation.target));return(h,g)=>{var x;const m=mn,v=Qa;return y(),T("article",{class:se(["rounded-lg border p-4",f.value?"border-success bg-success/5":"border-default bg-elevated"])},[C("div",B3,[C("h3",z3,q(n.value.headline),1),C("span",F3,[B(Ey,{target:e.annotation.target},null,8,["target"]),e.annotation.kind?(y(),$(m,{key:0,size:"sm",variant:"subtle",color:"primary"},{default:R(()=>[me(q(e.annotation.kind),1)]),_:1})):L("",!0),B(v,{"model-value":f.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":g[0]||(g[0]=b=>d(nd)(e.annotation.id))},null,8,["model-value"])])]),B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("p",j3,q(e.annotation.target.path),1),p.value?(y(),$(Bo,{key:0,class:"mb-2",lines:p.value.lines},null,8,["lines"])):L("",!0),n.value.body?(y(),T("button",{key:1,type:"button",class:"mb-2 text-xs text-primary hover:underline",onClick:g[1]||(g[1]=b=>r.value=!r.value)},q(r.value?"▾ hide detail":"▸ detail"),1)):L("",!0),r.value&&n.value.body?(y(),T("div",{key:2,class:"markdown-body mb-3 text-sm text-muted",innerHTML:d($r)(n.value.body)},null,8,H3)):L("",!0),B(rl,{class:"mb-3",suggestion:e.annotation.suggestion},null,8,["suggestion"]),e.annotation.verification.length?(y(),T("ul",V3,[(y(!0),T(ne,null,Ee(e.annotation.verification,b=>(y(),T("li",{key:b.id,class:"flex items-start gap-1.5"},[C("span",{class:se(`text-${o[b.status]}`)},q(s[b.status]),3),C("span",U3,q(b.description),1)]))),128))])):L("",!0),e.annotation.evidence.length?(y(),T("div",W3,[g[4]||(g[4]=C("span",{class:"text-dimmed uppercase tracking-wide"},"Evidence",-1)),(y(!0),T(ne,null,Ee(e.annotation.evidence,b=>(y(),$(m,{key:b.id,size:"sm",variant:"subtle",color:a[b.kind],title:b.description},{default:R(()=>{var w;return[me(q(((w=b.pipeline)==null?void 0:w.jobName)??i[b.kind])+" · "+q(i[b.kind]),1)]}),_:2},1032,["color","title"]))),128))])):L("",!0),(x=e.annotation.relatedTargets)!=null&&x.length?(y(),T("ul",G3,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(b,w)=>(y(),T("li",{key:w,onMouseenter:k=>u.value=w,onMouseleave:g[2]||(g[2]=k=>u.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:k=>l(b.target.path)}," → "+q(b.target.path),9,Y3),C("span",Q3," — "+q(b.reason),1),u.value===w&&c(w)?(y(),$(Bo,{key:0,class:"mt-1",lines:c(w).lines},null,8,["lines"])):L("",!0)],40,K3))),128))])):L("",!0),C("div",X3,[C("button",{type:"button",class:"text-xs font-medium text-primary hover:underline",onClick:g[3]||(g[3]=b=>l(e.annotation.target.path))}," → jump to diff ")]),C("div",Z3,[B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])],2)}}}),eM={key:0,class:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center"},tM={key:1,class:"flex flex-1 flex-col items-center justify-center gap-6 overflow-y-auto p-8"},nM={class:"w-full max-w-2xl"},rM={class:"mb-3 flex items-center justify-between text-xs text-dimmed"},sM={key:1,class:"rounded-lg border border-default bg-elevated p-4 text-sm text-muted"},oM={class:"mb-3"},iM={key:0,class:"border-t border-default pt-2"},aM={class:"flex items-center gap-3"},lM=["disabled"],uM=["disabled"],cM=Y({__name:"FocusMode",props:{files:{},groups:{},currentId:{}},emits:["exit","update:currentId"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>{const h=new Map;for(const g of n.files)for(const m of g.annotations)h.set(m.id,m);return h}),o=E(()=>{const h=gd(n.groups);return md(hd(n.files),h)}),i=E(()=>{const h=o.value.findIndex(g=>g.verification.id===n.currentId);return h===-1?0:h}),a=E(()=>o.value[i.value]),l=E(()=>{var h;return(h=a.value)!=null&&h.annotationId?s.value.get(a.value.annotationId):void 0});function u(h){const g=Math.min(Math.max(h,0),o.value.length-1),m=o.value[g];m&&r("update:currentId",m.verification.id)}function c(){u(i.value+1)}function f(){u(i.value-1)}function p(h){const g=h.target;g&&["INPUT","TEXTAREA"].includes(g.tagName)||g!=null&&g.isContentEditable||((h.key==="ArrowRight"||h.key==="ArrowDown"||h.key==="j")&&c(),(h.key==="ArrowLeft"||h.key==="ArrowUp"||h.key==="k")&&f(),h.key==="Escape"&&r("exit",null))}return dt(()=>window.addEventListener("keydown",p)),as(()=>window.removeEventListener("keydown",p)),(h,g)=>{var m;return o.value.length?(y(),T("div",tM,[C("div",nM,[C("div",rM,[C("span",null,q(i.value+1)+" / "+q(o.value.length)+" — ordered by risk",1),C("button",{type:"button",class:"text-primary hover:underline",onClick:g[1]||(g[1]=v=>r("exit",null))},"Esc — exit focus mode")]),l.value?(y(),$(J3,{key:0,annotation:l.value,"default-expanded":!0,"jump-to-diff":v=>r("exit",v)},null,8,["annotation","jump-to-diff"])):(y(),T("div",sM,[C("p",oM,q((m=a.value)==null?void 0:m.verification.description),1),a.value?(y(),T("div",iM,[B(ti,{target:{type:"file",path:a.value.path}},null,8,["target"])])):L("",!0)])),a.value?(y(),T("button",{key:2,type:"button",class:"mt-3 text-sm font-medium text-primary hover:underline",onClick:g[2]||(g[2]=v=>r("exit",a.value.path))}," → view diff for this item ")):L("",!0)]),C("div",aM,[C("button",{type:"button",class:"rounded-full border border-default px-4 py-1.5 text-sm hover:bg-elevated disabled:opacity-30",disabled:i.value===0,onClick:f}," ← prev ",8,lM),C("button",{type:"button",class:"rounded-full border border-default px-4 py-1.5 text-sm hover:bg-elevated disabled:opacity-30",disabled:i.value===o.value.length-1,onClick:c}," next → ",8,uM)]),g[5]||(g[5]=C("p",{class:"text-[11px] text-dimmed"},"← → or j/k to step, Esc to exit",-1))])):(y(),T("div",eM,[g[3]||(g[3]=C("p",{class:"text-lg font-semibold text-highlighted"},"Nothing needs attention",-1)),g[4]||(g[4]=C("p",{class:"text-sm text-muted"},"Every Verification item in this bundle is already marked verified.",-1)),C("button",{type:"button",class:"mt-2 text-sm text-primary hover:underline",onClick:g[0]||(g[0]=v=>r("exit",null))},"Esc — exit focus mode")]))}}}),dM={slots:{overlay:"fixed inset-0 bg-elevated/75",content:"fixed bg-default divide-y divide-default sm:ring ring-default sm:shadow-lg flex flex-col focus:outline-none",header:"flex items-center gap-1.5 p-4 sm:px-6 min-h-(--ui-header-height)",wrapper:"",body:"flex-1 overflow-y-auto p-4 sm:p-6",footer:"flex items-center gap-1.5 p-4 sm:px-6",title:"text-highlighted font-semibold",description:"mt-1 text-muted text-sm",close:"absolute top-4 end-4"},variants:{side:{top:{content:""},right:{content:"max-w-md"},bottom:{content:""},left:{content:"max-w-md"}},inset:{true:{content:"rounded-lg"}},transition:{true:{overlay:"data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"}}},compoundVariants:[{side:"top",inset:!0,class:{content:"max-h-[calc(100%-2rem)] inset-x-4 top-4"}},{side:"top",inset:!1,class:{content:"max-h-full inset-x-0 top-0"}},{side:"right",inset:!0,class:{content:"w-[calc(100%-2rem)] inset-y-4 right-4"}},{side:"right",inset:!1,class:{content:"w-full inset-y-0 right-0"}},{side:"bottom",inset:!0,class:{content:"max-h-[calc(100%-2rem)] inset-x-4 bottom-4"}},{side:"bottom",inset:!1,class:{content:"max-h-full inset-x-0 bottom-0"}},{side:"left",inset:!0,class:{content:"w-[calc(100%-2rem)] inset-y-4 left-4"}},{side:"left",inset:!1,class:{content:"w-full inset-y-0 left-0"}},{transition:!0,side:"top",class:{content:"data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-top_200ms_ease-in-out]"}},{transition:!0,side:"right",class:{content:"data-[state=open]:animate-[slide-in-from-right_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-right_200ms_ease-in-out]"}},{transition:!0,side:"bottom",class:{content:"data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-bottom_200ms_ease-in-out]"}},{transition:!0,side:"left",class:{content:"data-[state=open]:animate-[slide-in-from-left_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-left_200ms_ease-in-out]"}}]},fM={__name:"Slideover",props:{title:{type:String,required:!1},description:{type:String,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},transition:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1,default:"right"},inset:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1}},emits:["leave","after:leave","enter","after:enter","close:prevent","update:open"],setup(e,{emit:t}){const n=e,r=t,s=Kn(),o=Nt("slideover",n),{t:i}=Ma(),a=ht(),l=vr(Hn(o,"open","defaultOpen","modal","unmountOnHide"),r),u=Ga(xt(()=>o.portal)),c=xt(()=>o.content),f=E(()=>o.dismissible?{pointerDownOutside:ey}:["interactOutside","escapeKeyDown"].reduce((g,m)=>(g[m]=v=>{v.preventDefault(),r("close:prevent")},g),{})),p=E(()=>{var h;return Bt({extend:dM,...((h=a.ui)==null?void 0:h.slideover)||{}})({transition:o.transition,side:o.side,inset:o.inset})});return(h,g)=>(y(),$(d(M1),it(ct(d(l))),{default:R(({open:m,close:v})=>[s.default?(y(),$(d(gC),{key:0,"as-child":"",class:se(d(o).class)},{default:R(()=>[U(h.$slots,"default",{open:m})]),_:2},1032,["class"])):L("",!0),B(d(fC),pe(d(u),{"force-mount":d(u).disabled&&d(o).unmountOnHide===!1||void 0}),{default:R(()=>[B(d(Zc),null,{default:R(()=>{var x,b;return[d(o).overlay?(y(),$(d(uC),{key:0,"data-slot":"overlay",class:se(p.value.overlay({class:(x=d(o).ui)==null?void 0:x.overlay}))},null,8,["class"])):L("",!0),B(d(sC),pe({"data-side":d(o).side,"data-slot":"content",class:p.value.content({class:[!s.default&&d(o).class,(b=d(o).ui)==null?void 0:b.content]})},c.value,{onEnter:g[0]||(g[0]=w=>r("enter")),onAfterEnter:g[1]||(g[1]=w=>r("after:enter")),onLeave:g[2]||(g[2]=w=>r("leave")),onAfterLeave:g[3]||(g[3]=w=>r("after:leave"))},pc(f.value)),{default:R(()=>[!d(o).title&&!s.title||!d(o).description&&!s.description||s.content?(y(),$(d(Yo),{key:0},{default:R(()=>[!d(o).title&&!s.title?(y(),$(d(jl),{key:0})):s.content?(y(),$(d(jl),{key:1},{default:R(()=>[U(h.$slots,"title",{},()=>[me(q(d(o).title),1)])]),_:3})):L("",!0),!d(o).description&&!s.description?(y(),$(d(Fl),{key:2})):s.content?(y(),$(d(Fl),{key:3},{default:R(()=>[U(h.$slots,"description",{},()=>[me(q(d(o).description),1)])]),_:3})):L("",!0)]),_:3})):L("",!0),U(h.$slots,"content",{close:v},()=>{var w,k,O;return[s.header||d(o).title||s.title||d(o).description||s.description||d(o).close||s.close?(y(),T("div",{key:0,"data-slot":"header",class:se(p.value.header({class:(w=d(o).ui)==null?void 0:w.header}))},[U(h.$slots,"header",{close:v},()=>{var P,I,M;return[d(o).title||s.title||d(o).description||s.description?(y(),T("div",{key:0,"data-slot":"wrapper",class:se(p.value.wrapper({class:(P=d(o).ui)==null?void 0:P.wrapper}))},[d(o).title||s.title?(y(),$(d(jl),{key:0,"data-slot":"title",class:se(p.value.title({class:(I=d(o).ui)==null?void 0:I.title}))},{default:R(()=>[U(h.$slots,"title",{},()=>[me(q(d(o).title),1)])]),_:3},8,["class"])):L("",!0),d(o).description||s.description?(y(),$(d(Fl),{key:1,"data-slot":"description",class:se(p.value.description({class:(M=d(o).ui)==null?void 0:M.description}))},{default:R(()=>[U(h.$slots,"description",{},()=>[me(q(d(o).description),1)])]),_:3},8,["class"])):L("",!0)],2)):L("",!0),U(h.$slots,"actions"),d(o).close||s.close?(y(),$(d(L1),{key:1,"as-child":""},{default:R(()=>[U(h.$slots,"close",{ui:p.value},()=>{var j;return[d(o).close?(y(),$(kt,pe({key:0,icon:d(o).closeIcon||d(a).ui.icons.close,color:"neutral",variant:"ghost","aria-label":d(i)("slideover.close")},typeof d(o).close=="object"?d(o).close:{},{"data-slot":"close",class:p.value.close({class:(j=d(o).ui)==null?void 0:j.close})}),null,16,["icon","aria-label","class"])):L("",!0)]})]),_:2},1024)):L("",!0)]})],2)):L("",!0),C("div",{"data-slot":"body",class:se(p.value.body({class:(k=d(o).ui)==null?void 0:k.body}))},[U(h.$slots,"body",{close:v})],2),s.footer?(y(),T("div",{key:1,"data-slot":"footer",class:se(p.value.footer({class:(O=d(o).ui)==null?void 0:O.footer}))},[U(h.$slots,"footer",{close:v})],2)):L("",!0)]})]),_:2},1040,["data-side","class"])]}),_:2},1024)]),_:2},1040,["force-mount"])]),_:3},16))}},pM={class:"space-y-4 text-sm"},hM={key:0,class:"text-muted"},gM=["href"],mM={class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-muted"},vM={class:"text-default"},yM={class:"text-default font-mono"},bM={class:"text-default"},xM=["innerHTML"],wM=Y({__name:"MrDetailsSlideover",props:wg({comparison:{},descriptionHtml:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const t=Sg(e,"open");return(n,r)=>{const s=fM;return y(),$(s,{open:t.value,"onUpdate:open":r[0]||(r[0]=o=>t.value=o),title:e.comparison.title||"MR details",side:"right"},{body:R(()=>[C("div",pM,[e.comparison.number?(y(),T("div",hM,"!"+q(e.comparison.number),1)):L("",!0),e.comparison.url?(y(),T("a",{key:1,href:e.comparison.url,target:"_blank",rel:"noopener",class:"block truncate text-primary hover:underline"},q(e.comparison.url),9,gM)):L("",!0),C("dl",mM,[e.comparison.author?(y(),T(ne,{key:0},[r[1]||(r[1]=C("dt",null,"Author",-1)),C("dd",vM,q(e.comparison.author),1)],64)):L("",!0),e.comparison.sourceBranch||e.comparison.targetBranch?(y(),T(ne,{key:1},[r[2]||(r[2]=C("dt",null,"Branch",-1)),C("dd",yM,q(e.comparison.sourceBranch??"?")+" → "+q(e.comparison.targetBranch??"?"),1)],64)):L("",!0),e.comparison.repository?(y(),T(ne,{key:2},[r[3]||(r[3]=C("dt",null,"Repository",-1)),C("dd",bM,q(e.comparison.repository),1)],64)):L("",!0)]),e.descriptionHtml?(y(),T("div",{key:2,class:"markdown-body border-t border-default pt-4",innerHTML:e.descriptionHtml},null,8,xM)):L("",!0)])]),_:1},8,["open","title"])}}}),kM={base:"relative",variants:{size:{xs:"",sm:"",md:"",lg:"",xl:""},orientation:{horizontal:"inline-flex -space-x-px",vertical:"flex flex-col -space-y-px"}}},Fy={__name:"FieldGroup",props:{as:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){const n=Nt("fieldGroup",e),r=ht(),s=E(()=>{var o;return Bt({extend:kM,...((o=r.ui)==null?void 0:o.fieldGroup)||{}})});return un(Qc,E(()=>({orientation:n.orientation,size:n.size}))),(o,i)=>{var a;return y(),$(d($e),{as:d(n).as,"data-orientation":d(n).orientation,class:se(s.value({orientation:d(n).orientation,class:[(a=d(n).ui)==null?void 0:a.base,d(n).class]}))},{default:R(()=>[U(o.$slots,"default")]),_:3},8,["as","data-orientation","class"])}}},_M={class:"flex items-center gap-2"},CM=["value"],SM={key:0,class:"text-error"},TM={key:1,class:"text-warning"},AM=Y({__name:"QuestionComposer",setup(e){const{store:t,draft:n,draftKind:r,busy:s,localError:o,submitNewQuestion:i}=pd(()=>Qe.composerTarget,{draft:xt(Qe,"draft"),kind:xt(Qe,"kind")}),a=E(()=>t.writeToken.length>0),l=E(()=>Bq(Qe.anchorTarget)),u=E({get:()=>Bi(Qe.composerTarget),set:f=>{const p=l.value.find(h=>h.key===f);p&&AR(p.target)}}),c=[{value:"question",label:"Question"},{value:"change-request",label:"Change request"}];return(f,p)=>{const h=kt,g=Fy,m=tl;return y(),T("form",{"data-testid":"question-composer",class:"space-y-2 p-3 text-xs",onSubmit:p[2]||(p[2]=At(v=>d(i)(()=>{}),["prevent"]))},[C("div",_M,[p[3]||(p[3]=C("label",{for:"composer-target",class:"shrink-0 font-semibold"},"About",-1)),Ds(C("select",{id:"composer-target","onUpdate:modelValue":p[0]||(p[0]=v=>u.value=v),"data-testid":"composer-target",class:"min-w-0 flex-1 truncate rounded border border-control bg-default px-2 py-1 font-mono"},[(y(!0),T(ne,null,Ee(l.value,v=>(y(),T("option",{key:v.key,value:v.key},q(v.label),9,CM))),128))],512),[[vx,u.value]])]),B(g,{size:"xs"},{default:R(()=>[(y(),T(ne,null,Ee(c,v=>B(h,{key:v.value,variant:d(r)===v.value?"solid":"outline",color:v.value==="change-request"?"error":"neutral",onClick:x=>r.value=v.value},{default:R(()=>[me(q(v.label),1)]),_:2},1032,["variant","color","onClick"])),64))]),_:1}),B(m,{modelValue:d(n),"onUpdate:modelValue":p[1]||(p[1]=v=>Ze(n)?n.value=v:null),size:"sm",class:"w-full",rows:d(by)(d(r)),placeholder:d(r)==="change-request"?"What needs to change?":"What's the reasoning here?"},null,8,["modelValue","rows","placeholder"]),d(o)?(y(),T("p",SM,q(d(o)),1)):L("",!0),a.value?L("",!0):(y(),T("p",TM,"Set your write token first (top right).")),B(h,{type:"submit",size:"xs",disabled:d(s)||!a.value},{default:R(()=>[me(q(d(r)==="change-request"?"Raise change request":"Ask"),1)]),_:1},8,["disabled"])],32)}}});function EM(){const e=G(new Set);function t(r){return r.resolved&&!e.value.has(r.id)}function n(r){const s=new Set(e.value);s.has(r)?s.delete(r):s.add(r),e.value=s}return{isCollapsed:t,toggleExpanded:n}}const OM={class:"mt-1 flex gap-2"},PM=Y({__name:"PostToMrForm",props:{target:{},body:{}},setup(e){const t=e,n=G(!1),r=G(""),{copied:s,copy:o}=ol();function i(){r.value=t.body,n.value=!0}return(a,l)=>{const u=kt,c=tl;return y(),T("div",null,[n.value?(y(),T(ne,{key:1},[B(c,{modelValue:r.value,"onUpdate:modelValue":l[0]||(l[0]=f=>r.value=f),"data-testid":"post-to-mr-text",size:"sm",class:"w-full",rows:4},null,8,["modelValue"]),l[5]||(l[5]=C("p",{class:"mt-1 text-muted"},'Copy this prompt for the agent. The agent posts it after you say "send".',-1)),C("div",OM,[B(u,{size:"xs",disabled:!r.value.trim(),onClick:l[1]||(l[1]=f=>d(o)(d(TI)(e.target,r.value)))},{default:R(()=>[me(q(d(s)?"Copied!":"Copy prompt"),1)]),_:1},8,["disabled"]),B(u,{size:"xs",variant:"ghost",onClick:l[2]||(l[2]=f=>n.value=!1)},{default:R(()=>[...l[4]||(l[4]=[me("Cancel",-1)])]),_:1})])],64)):(y(),$(u,{key:0,"data-testid":"post-to-mr",size:"xs",variant:"ghost",onClick:i},{default:R(()=>[...l[3]||(l[3]=[me("Post to MR",-1)])]),_:1}))])}}}),RM=["id","data-state"],IM={class:"mb-1 flex flex-wrap items-center gap-2"},$M={class:"mb-1 flex items-center gap-2 text-xs text-muted"},qM={"data-testid":"thread-target",class:"min-w-0 truncate font-mono"},MM={key:0,class:"mt-1 text-muted"},DM={key:1,class:"mt-1 text-muted italic"},LM={key:2,class:"mt-2 border-t border-default pt-2 text-muted"},NM=["innerHTML"],BM={class:"mt-2"},zM={key:0,class:"mt-1 text-warning"},FM={key:0,class:"flex gap-2"},jM={class:"mt-1 flex gap-2"},HM={key:0,class:"mt-1 text-warning"},VM={key:2,class:"mt-1 text-error"},UM={key:1,class:"truncate text-muted italic"},WM=Y({__name:"QuestionThreadCard",props:{entry:{},currentRound:{},active:{type:Boolean}},emits:["open","showInCode"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>n.entry.question),o=E(()=>Ny(s.value,!!n.entry.answer,is.value)),i=E(()=>o.value?By(o.value):null),a=E(()=>o.value==="waiting"&&!wd(is.value)),{store:l,busy:u,localError:c,editingId:f,editDraft:p,startEdit:h,submitEdit:g,remove:m,resolve:v}=pd(()=>s.value.target),x=E(()=>l.writeToken.length>0),{isCollapsed:b,toggleExpanded:w}=EM();return(k,O)=>{const P=mn,I=kt,M=tl;return y(),T("article",{id:`thread-${s.value.id}`,"data-testid":"question-thread","data-state":o.value??"none",class:se(["rounded-lg border p-3 text-sm",e.active?"border-primary ring-1 ring-primary":"border-default"]),onClick:O[8]||(O[8]=j=>r("open"))},[C("div",IM,[B(P,{size:"sm",variant:"subtle",color:d(qy)(s.value)},{default:R(()=>[me(q(d(My)(s.value)),1)]),_:1},8,["color"]),i.value?(y(),$(P,{key:0,"data-testid":"thread-state",size:"md",variant:"subtle",color:i.value.color,icon:i.value.icon,ui:{leadingIcon:o.value==="answering"?"animate-spin motion-reduce:animate-none":""}},{default:R(()=>[me(q(i.value.label),1)]),_:1},8,["color","icon","ui"])):(y(),$(P,{key:1,size:"sm",variant:"subtle",color:d(Dy)(s.value)},{default:R(()=>[me(q(d(Ly)(s.value)),1)]),_:1},8,["color"])),s.value.resolution?(y(),$(P,{key:2,size:"sm",variant:"subtle",color:d(O$)(s.value.resolution.status),title:s.value.resolution.evidence},{default:R(()=>[me(q(d(P$)(s.value.resolution.status)),1)]),_:1},8,["color","title"])):L("",!0),s.value.originRound!==e.currentRound?(y(),$(P,{key:3,size:"sm",variant:"outline",color:"neutral"},{default:R(()=>[me(" Round "+q(s.value.originRound),1)]),_:1})):L("",!0),s.value.resolved?(y(),$(I,{key:4,size:"xs",variant:"ghost",class:"ml-auto",onClick:O[0]||(O[0]=At(j=>d(w)(s.value.id),["stop"]))},{default:R(()=>[me(q(d(b)(s.value)?"Show":"Hide"),1)]),_:1})):L("",!0)]),C("p",$M,[C("span",qM,q(d(zy)(s.value.target)),1),e.entry.filePath?(y(),$(I,{key:0,size:"xs",variant:"ghost",class:"shrink-0",onClick:O[1]||(O[1]=At(j=>r("showInCode"),["stop"]))},{default:R(()=>[...O[9]||(O[9]=[me(" Show in code ",-1)])]),_:1})):L("",!0)]),d(b)(s.value)?(y(),T("p",UM,q(s.value.body),1)):(y(),T(ne,{key:0},[C("p",{class:se(["break-words leading-relaxed",{"text-muted line-through":s.value.status==="withdrawn"}])},q(s.value.body),3),s.value.resolution?(y(),T("p",MM,q(s.value.resolution.evidence),1)):L("",!0),s.value.kind==="change-request"&&s.value.resolved?(y(),T("p",DM," Resolved "+q(new Date(s.value.resolvedAt).toLocaleString()),1)):L("",!0),e.entry.answer?(y(),T("div",LM,[O[10]||(O[10]=C("p",{class:"mb-0.5 text-xs font-bold"},"Answer",-1)),C("div",{class:"markdown-body break-words leading-relaxed",innerHTML:d($r)(e.entry.answer.body)},null,8,NM)])):a.value?(y(),$(Ry,{key:3,class:"mt-2",question:s.value},null,8,["question"])):L("",!0),B(PM,{class:"mt-2",target:s.value.target,body:s.value.body},null,8,["target","body"]),C("div",BM,[s.value.status==="open"&&s.value.kind==="change-request"&&!s.value.resolved?(y(),T(ne,{key:0},[B(I,{size:"xs",disabled:d(u)||!x.value,onClick:O[2]||(O[2]=At(j=>d(v)(s.value.id),["stop"]))},{default:R(()=>[...O[11]||(O[11]=[me("Mark resolved",-1)])]),_:1},8,["disabled"]),x.value?L("",!0):(y(),T("p",zM,"Set your write token first (top right)."))],64)):s.value.status==="open"&&s.value.kind==="question"?(y(),T(ne,{key:1},[d(f)!==s.value.id?(y(),T("span",FM,[B(I,{size:"xs",variant:"ghost",onClick:O[3]||(O[3]=At(j=>d(h)(s.value.id),["stop"]))},{default:R(()=>[...O[12]||(O[12]=[me("Withdraw & rephrase",-1)])]),_:1}),B(I,{size:"xs",variant:"ghost",color:"error",disabled:d(u)||!x.value,onClick:O[4]||(O[4]=At(j=>d(m)(s.value.id),["stop"]))},{default:R(()=>[...O[13]||(O[13]=[me(" Delete ",-1)])]),_:1},8,["disabled"])])):(y(),T(ne,{key:1},[B(M,{modelValue:d(p),"onUpdate:modelValue":O[5]||(O[5]=j=>Ze(p)?p.value=j:null),size:"sm",class:"mt-1 w-full",rows:2,placeholder:"Better phrased question…"},null,8,["modelValue"]),C("div",jM,[B(I,{size:"xs",disabled:d(u)||!x.value,onClick:O[6]||(O[6]=At(j=>d(g)(s.value.id,()=>{}),["stop"]))},{default:R(()=>[...O[14]||(O[14]=[me("Submit",-1)])]),_:1},8,["disabled"]),B(I,{size:"xs",variant:"ghost",onClick:O[7]||(O[7]=At(j=>f.value=null,["stop"]))},{default:R(()=>[...O[15]||(O[15]=[me("Cancel",-1)])]),_:1})]),x.value?L("",!0):(y(),T("p",HM,"Set your write token first (top right)."))],64))],64)):L("",!0),d(c)?(y(),T("p",VM,q(d(c)),1)):L("",!0)])],64))],10,RM)}}}),GM={role:"region","aria-label":"Question panel","data-testid":"question-panel",class:"flex h-full min-h-0 w-96 max-w-[90vw] shrink-0 flex-col border-l border-default bg-default"},KM={class:"flex shrink-0 items-center gap-2 border-b border-default px-3 py-2"},YM={"data-testid":"thread-list",class:"min-h-0 flex-1 space-y-3 overflow-y-auto p-3"},QM={key:0,class:"text-sm text-muted"},XM=Y({__name:"QuestionPanel",props:{entries:{},currentRound:{}},emits:["showInCode"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>Lq(n.entries));return Me(()=>Qe.threadId,async o=>{var i;o&&(await tt(),(i=document.getElementById(`thread-${o}`))==null||i.scrollIntoView({block:"nearest"}))},{immediate:!0,flush:"post"}),(o,i)=>{const a=kt;return y(),T("aside",GM,[C("header",KM,[i[0]||(i[0]=C("h2",{class:"text-sm font-semibold"},"Questions",-1)),B(a,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-x",class:"ml-auto","aria-label":"Close the Question panel",onClick:d(OR)},null,8,["onClick"])]),C("div",YM,[s.value.length?L("",!0):(y(),T("p",QM,"No comments raised on this bundle yet.")),(y(!0),T(ne,null,Ee(s.value,l=>(y(),$(WM,{key:l.question.id,entry:l,"current-round":e.currentRound,active:d(Qe).threadId===l.question.id,onOpen:u=>d(nl)(l.question),onShowInCode:u=>r("showInCode",l)},null,8,["entry","current-round","active","onOpen","onShowInCode"]))),128))]),B(AM,{class:"shrink-0 border-t border-default"})])}}});function ZM(){var n;const t=(n=ht().ui)==null?void 0:n.prefix;return r=>!t||!r?r:r.split(/\s+/).filter(Boolean).map(s=>`${t}:${s}`).join(" ")}const JM=Object.assign({inheritAttrs:!1},{__name:"ColorModeButton",props:{color:{type:null,required:!1,default:"neutral"},variant:{type:null,required:!1,default:"ghost"},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},setup(e){const n=Nt("button",e),{t:r}=Ma(),s=J_(),o=ht(),i=ZM(),a=vr(Sc(n,"icon")),l=E({get(){return s.value==="dark"},set(u){s.preference=u?"dark":"light"}});return(u,c)=>(y(),$(kt,pe({...d(a),"aria-label":l.value?d(r)("colorMode.switchToLight"):d(r)("colorMode.switchToDark"),...u.$attrs},{onClick:c[0]||(c[0]=f=>l.value=!l.value)}),{leading:R(({ui:f})=>{var p,h;return[B(rn,{class:se(f.leadingIcon({class:[(p=d(n).ui)==null?void 0:p.leadingIcon,d(i)("hidden dark:inline-block")]})),name:d(o).ui.icons.dark},null,8,["class","name"]),B(rn,{class:se(f.leadingIcon({class:[(h=d(n).ui)==null?void 0:h.leadingIcon,d(i)("dark:hidden")]})),name:d(o).ui.icons.light},null,8,["class","name"])]}),_:1},16))}}),e5={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute inset-y-0 start-0 flex items-center",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute inset-y-0 end-0 flex items-center",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2",trailing:"pe-2",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},t5=["id","type","value","name","placeholder","disabled","required","autocomplete"],n5=Object.assign({inheritAttrs:!1},{__name:"Input",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},type:{type:null,required:!1,default:"text"},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autocomplete:{type:[String,Object],required:!1,default:"off"},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Kn(),i=Nt("input",r),a=Un(i,"modelValue",s,{defaultValue:i.defaultValue}),l=ht(),{emitFormBlur:u,emitFormInput:c,emitFormChange:f,size:p,color:h,id:g,name:m,highlight:v,disabled:x,emitFormFocus:b,ariaAttrs:w}=Jc(r,{deferInputValidation:!0}),{orientation:k,size:O}=Xc(r),{isLeading:P,isTrailing:I,leadingIconName:M,trailingIconName:j}=Ya(i),H=E(()=>O.value||p.value),le=E(()=>{var ee;return Bt({extend:e5,...((ee=l.ui)==null?void 0:ee.input)||{}})({type:i.type,color:h.value??i.color,variant:i.variant,size:(H==null?void 0:H.value)??i.size,loading:i.loading,highlight:v.value??i.highlight,fixed:i.fixed,leading:P.value||!!i.avatar||!!o.leading,trailing:I.value||!!o.trailing,fieldGroup:k.value})}),K=Or("inputRef");function X(ee){var _e,ie,Se,Le,rt;(_e=i.modelModifiers)!=null&&_e.trim&&(typeof ee=="string"||ee===null||ee===void 0)&&(ee=(ee==null?void 0:ee.trim())??null),((ie=i.modelModifiers)!=null&&ie.number||i.type==="number")&&(ee=Lm(ee)),(Se=i.modelModifiers)!=null&&Se.nullable&&(ee||(ee=null)),(Le=i.modelModifiers)!=null&&Le.optional&&!((rt=i.modelModifiers)!=null&&rt.nullable)&&ee!==null&&(ee||(ee=void 0)),a.value=ee,c()}function J(ee){var _e;(_e=i.modelModifiers)!=null&&_e.lazy||X(ee.target.value)}function fe(ee){var ie,Se;const _e=ee.target.value;(ie=i.modelModifiers)!=null&&ie.lazy&&X(_e),(Se=i.modelModifiers)!=null&&Se.trim&&(ee.target.value=_e.trim()),f(),s("change",ee)}function F(ee){u(),s("blur",ee)}function de(){var ee;i.autofocus&&((ee=K.value)==null||ee.focus())}return dt(()=>{setTimeout(()=>{de()},i.autofocusDelay)}),t({inputRef:K}),(ee,_e)=>{var ie;return y(),$(d($e),{as:d(i).as,"data-slot":ee.$attrs["data-slot"]??"root",class:se(le.value.root({class:[(ie=d(i).ui)==null?void 0:ie.root,d(i).class]}))},{default:R(()=>{var Se,Le,rt;return[C("input",pe({id:d(g),ref_key:"inputRef",ref:K,type:d(i).type,value:d(a),name:d(m),placeholder:d(i).placeholder,class:le.value.base({class:(Se=d(i).ui)==null?void 0:Se.base}),disabled:d(x),required:d(i).required,autocomplete:d(i).autocomplete},{...ee.$attrs,...d(w)},{"data-slot":"base",onInput:J,onBlur:F,onChange:fe,onFocus:_e[0]||(_e[0]=(...lt)=>d(b)&&d(b)(...lt))}),null,16,t5),U(ee.$slots,"default",{ui:le.value}),d(P)||d(i).avatar||o.leading?(y(),T("span",{key:0,"data-slot":"leading",class:se(le.value.leading({class:(Le=d(i).ui)==null?void 0:Le.leading}))},[U(ee.$slots,"leading",{ui:le.value},()=>{var lt,Ye,ze;return[d(P)&&d(M)?(y(),$(rn,{key:0,name:d(M),"data-slot":"leadingIcon",class:se(le.value.leadingIcon({class:(lt=d(i).ui)==null?void 0:lt.leadingIcon}))},null,8,["name","class"])):d(i).avatar?(y(),$(Xo,pe({key:1,size:((Ye=d(i).ui)==null?void 0:Ye.leadingAvatarSize)||le.value.leadingAvatarSize()},d(i).avatar,{"data-slot":"leadingAvatar",class:le.value.leadingAvatar({class:(ze=d(i).ui)==null?void 0:ze.leadingAvatar})}),null,16,["size","class"])):L("",!0)]})],2)):L("",!0),d(I)||o.trailing?(y(),T("span",{key:1,"data-slot":"trailing",class:se(le.value.trailing({class:(rt=d(i).ui)==null?void 0:rt.trailing}))},[U(ee.$slots,"trailing",{ui:le.value},()=>{var lt;return[d(j)?(y(),$(rn,{key:0,name:d(j),"data-slot":"trailingIcon",class:se(le.value.trailingIcon({class:(lt=d(i).ui)==null?void 0:lt.trailingIcon}))},null,8,["name","class"])):L("",!0)]})],2)):L("",!0)]}),_:3},8,["as","data-slot","class"])}}}),r5={base:"inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans uppercase",variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{solid:"",outline:"",soft:"",subtle:""},size:{sm:"h-4 min-w-[16px] text-[10px]",md:"h-5 min-w-[20px] text-[11px]",lg:"h-6 min-w-[24px] text-[12px]"}},compoundVariants:[{color:"primary",variant:"solid",class:"text-inverted bg-primary"},{color:"secondary",variant:"solid",class:"text-inverted bg-secondary"},{color:"success",variant:"solid",class:"text-inverted bg-success"},{color:"info",variant:"solid",class:"text-inverted bg-info"},{color:"warning",variant:"solid",class:"text-inverted bg-warning"},{color:"error",variant:"solid",class:"text-inverted bg-error"},{color:"primary",variant:"outline",class:"ring ring-inset ring-primary/50 text-primary"},{color:"secondary",variant:"outline",class:"ring ring-inset ring-secondary/50 text-secondary"},{color:"success",variant:"outline",class:"ring ring-inset ring-success/50 text-success"},{color:"info",variant:"outline",class:"ring ring-inset ring-info/50 text-info"},{color:"warning",variant:"outline",class:"ring ring-inset ring-warning/50 text-warning"},{color:"error",variant:"outline",class:"ring ring-inset ring-error/50 text-error"},{color:"primary",variant:"soft",class:"text-primary bg-primary/10"},{color:"secondary",variant:"soft",class:"text-secondary bg-secondary/10"},{color:"success",variant:"soft",class:"text-success bg-success/10"},{color:"info",variant:"soft",class:"text-info bg-info/10"},{color:"warning",variant:"soft",class:"text-warning bg-warning/10"},{color:"error",variant:"soft",class:"text-error bg-error/10"},{color:"primary",variant:"subtle",class:"text-primary ring ring-inset ring-primary/25 bg-primary/10"},{color:"secondary",variant:"subtle",class:"text-secondary ring ring-inset ring-secondary/25 bg-secondary/10"},{color:"success",variant:"subtle",class:"text-success ring ring-inset ring-success/25 bg-success/10"},{color:"info",variant:"subtle",class:"text-info ring ring-inset ring-info/25 bg-info/10"},{color:"warning",variant:"subtle",class:"text-warning ring ring-inset ring-warning/25 bg-warning/10"},{color:"error",variant:"subtle",class:"text-error ring ring-inset ring-error/25 bg-error/10"},{color:"neutral",variant:"solid",class:"text-inverted bg-inverted"},{color:"neutral",variant:"outline",class:"ring ring-inset ring-accented text-default bg-default"},{color:"neutral",variant:"soft",class:"text-default bg-elevated"},{color:"neutral",variant:"subtle",class:"ring ring-inset ring-accented text-default bg-elevated"}],defaultVariants:{variant:"outline",color:"neutral",size:"md"}},s5={__name:"Kbd",props:{as:{type:null,required:!1,default:"kbd"},value:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){const n=Nt("kbd",e),{getKbdKey:r}=z_(),s=ht(),o=E(()=>{var i;return Bt({extend:r5,...((i=s.ui)==null?void 0:i.kbd)||{}})});return(i,a)=>{var l;return y(),$(d($e),{as:d(n).as,class:se(o.value({class:[(l=d(n).ui)==null?void 0:l.base,d(n).class],color:d(n).color,variant:d(n).variant,size:d(n).size}))},{default:R(()=>[U(i.$slots,"default",{},()=>[me(q(d(r)(d(n).value)),1)])]),_:3},8,["as","class"])}}},o5={slots:{content:"flex items-center gap-1 bg-default text-highlighted shadow-sm rounded-sm ring ring-default h-6 px-2.5 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto",arrow:"fill-bg stroke-default",text:"truncate",kbds:"hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-['·'] not-first-of-type:before:me-0.5",kbdsSize:"sm"}},i5={__name:"Tooltip",props:{text:{type:String,required:!1},kbds:{type:Array,required:!1},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},delayDuration:{type:Number,required:!1},disableHoverableContent:{type:Boolean,required:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1}},emits:["update:open"],setup(e,{emit:t}){const n=e,r=t,s=Kn(),o=Nt("tooltip",n),i=ht(),a=Qo(),l=vr(Hn(o,"defaultOpen","open","delayDuration","disableHoverableContent","disableClosingTrigger","ignoreNonKeyboardFocus"),r),u=Ga(xt(()=>o.portal)),c=xt(()=>Tn(o.content,a.content.value,{side:"bottom",sideOffset:8,collisionPadding:8})),f=xt(()=>Tn(o.arrow,{rounded:!0})),p=E(()=>{var h;return Bt({extend:o5,...((h=i.ui)==null?void 0:h.tooltip)||{}})({side:c.value.side})});return(h,g)=>{var m;return y(),$(d(yA),pe(d(l),{disabled:!(d(o).text||(m=d(o).kbds)!=null&&m.length||s.content)||d(o).disabled}),{default:R(({open:v})=>[s.default||d(o).reference?(y(),$(d(AA),pe({key:0},h.$attrs,{"as-child":"",reference:d(o).reference,class:d(o).class}),{default:R(()=>[U(h.$slots,"default",{open:v})]),_:2},1040,["reference","class"])):L("",!0),B(d(SA),it(ct(d(u))),{default:R(()=>[B(d(Zc),null,{default:R(()=>{var x;return[B(d(_A),pe(c.value,{"data-slot":"content",class:p.value.content({class:[!s.default&&d(o).class,(x=d(o).ui)==null?void 0:x.content]})}),{default:R(()=>{var b;return[U(h.$slots,"content",{ui:p.value},()=>{var w,k,O;return[d(o).text?(y(),T("span",{key:0,"data-slot":"text",class:se(p.value.text({class:(w=d(o).ui)==null?void 0:w.text}))},q(d(o).text),3)):L("",!0),(k=d(o).kbds)!=null&&k.length?(y(),T("span",{key:1,"data-slot":"kbds",class:se(p.value.kbds({class:(O=d(o).ui)==null?void 0:O.kbds}))},[(y(!0),T(ne,null,Ee(d(o).kbds,(P,I)=>{var M;return y(),$(s5,pe({key:I,size:((M=d(o).ui)==null?void 0:M.kbdsSize)||p.value.kbdsSize()},{ref_for:!0},typeof P=="string"?{value:P}:P),null,16,["size"])}),128))],2)):L("",!0)]}),d(o).arrow?(y(),$(d(fA),pe({key:0},f.value,{"data-slot":"arrow",class:p.value.arrow({class:(b=d(o).ui)==null?void 0:b.arrow})}),null,16,["class"])):L("",!0)]}),_:3},16,["class"])]}),_:3})]),_:3},16)]),_:3},16,["disabled"])}}},a5=["data-tone"],l5={"aria-hidden":"true"},u5={class:"sr-only"},c5=Y({__name:"PanelButtonBadge",props:{badge:{}},setup(e){return(t,n)=>e.badge?(y(),T("span",{key:0,"data-testid":"panel-badge","data-tone":e.badge.tone,role:"status",class:se(["pointer-events-none absolute -right-2 -top-2 grid h-6 min-w-6 place-items-center rounded-full px-1.5 text-sm font-bold leading-none",e.badge.tone==="new"?"bg-primary text-inverted":"bg-warning text-inverted"])},[C("span",l5,q(e.badge.text),1),C("span",u5,q(e.badge.srText),1)],10,a5)):L("",!0)}}),d5={class:"flex items-center gap-3 border-b border-default px-4 py-3"},f5={key:0,class:"min-w-0"},p5={class:"flex items-center gap-2"},h5={class:"truncate text-sm font-semibold"},g5={key:0,class:"mt-0.5 flex items-center gap-2 text-xs text-muted"},m5=["href"],v5={key:1,class:"shrink-0 font-mono"},y5={key:1,class:"truncate text-sm font-semibold"},b5={class:"ml-auto flex items-center gap-3"},x5={"data-testid":"live-answers",class:"text-xs text-muted"},w5={class:"relative inline-flex"},k5={class:"w-80 p-3"},_5=Y({__name:"ReviewHeader",props:{headerTitle:{},comparison:{},hasMrMetadata:{type:Boolean},navVisible:{type:Boolean},layout:{},openQuestionCount:{},newAnswerCount:{},promptCopied:{type:Boolean},hasWriteToken:{type:Boolean},writeTokenDraft:{},focusMode:{type:Boolean},focusModeCount:{},liveAnswersLabel:{},answersUsedLabel:{}},emits:["update:navVisible","update:layout","update:writeTokenDraft","update:focusMode","openQuestions","openMrDetails","copyPrompt","saveWriteToken"],setup(e,{emit:t}){const n=t;return(r,s)=>{const o=kt,i=i5,a=Fy,l=n5,u=Za,c=JM;return y(),T("header",d5,[B(i,{text:e.navVisible?"Hide file list":"Show file list"},{default:R(()=>[B(o,{size:"sm",color:"neutral",variant:e.navVisible?"subtle":"ghost",icon:"i-lucide-panel-left","aria-pressed":e.navVisible,onClick:s[0]||(s[0]=f=>n("update:navVisible",!e.navVisible))},null,8,["variant","aria-pressed"])]),_:1},8,["text"]),e.comparison?(y(),T("div",f5,[C("div",p5,[C("h1",h5,q(e.headerTitle),1),e.hasMrMetadata?(y(),$(o,{key:0,size:"xs",variant:"soft",color:"primary",icon:"i-lucide-file-text",onClick:s[1]||(s[1]=f=>n("openMrDetails"))},{default:R(()=>[...s[8]||(s[8]=[me(" Details ",-1)])]),_:1})):L("",!0)]),e.hasMrMetadata?(y(),T("div",g5,[e.comparison.url?(y(),T("a",{key:0,href:e.comparison.url,target:"_blank",rel:"noopener",class:"truncate text-primary hover:underline"},q(e.comparison.url),9,m5)):L("",!0),e.comparison.sourceBranch?(y(),T("span",v5,q(e.comparison.sourceBranch)+" → "+q(e.comparison.targetBranch??"main"),1)):L("",!0)])):L("",!0)])):(y(),T("h1",y5,q(e.headerTitle),1)),C("div",b5,[C("span",x5,[me(q(e.liveAnswersLabel),1),e.answersUsedLabel?(y(),T(ne,{key:0},[me(" · "+q(e.answersUsedLabel),1)],64)):L("",!0)]),s[12]||(s[12]=C("div",{class:"h-5 w-px bg-default"},null,-1)),e.comparison?(y(),$(i,{key:0,text:"Question panel"},{default:R(()=>[C("span",w5,[B(o,{size:"sm",variant:"ghost",color:"neutral",icon:"i-lucide-message-circle-question","aria-label":"Question panel",onClick:s[2]||(s[2]=f=>n("openQuestions"))}),B(c5,{badge:d(zq)(e.newAnswerCount,e.openQuestionCount)},null,8,["badge"])])]),_:1})):L("",!0),s[13]||(s[13]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(i,{text:e.focusMode?"Exit focus mode":`Focus mode — step through ${e.focusModeCount} item(s) needing attention`},{default:R(()=>[B(o,{size:"sm",variant:e.focusMode?"solid":"ghost",color:e.focusMode?"primary":"neutral",icon:"i-lucide-crosshair",onClick:s[3]||(s[3]=f=>n("update:focusMode",!e.focusMode))},{default:R(()=>[...s[9]||(s[9]=[me(" Focus ",-1)])]),_:1},8,["variant","color"])]),_:1},8,["text"]),s[14]||(s[14]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(a,{size:"sm"},{default:R(()=>[B(i,{text:"Inline diff"},{default:R(()=>[B(o,{icon:"i-lucide-align-justify",variant:e.layout==="inline"?"solid":"outline",color:"neutral",onClick:s[4]||(s[4]=f=>n("update:layout","inline"))},null,8,["variant"])]),_:1}),B(i,{text:"Side-by-side diff"},{default:R(()=>[B(o,{icon:"i-lucide-columns-2",variant:e.layout==="side-by-side"?"solid":"outline",color:"neutral",onClick:s[5]||(s[5]=f=>n("update:layout","side-by-side"))},null,8,["variant"])]),_:1})]),_:1}),s[15]||(s[15]=C("div",{class:"h-5 w-px bg-default"},null,-1)),e.comparison?(y(),$(i,{key:1,text:e.promptCopied?"Copied!":"Copy Generator prompt"},{default:R(()=>[B(o,{size:"sm",variant:"ghost",color:e.promptCopied?"success":"neutral",icon:e.promptCopied?"i-lucide-check":"i-lucide-clipboard-copy",onClick:s[6]||(s[6]=f=>n("copyPrompt"))},null,8,["color","icon"])]),_:1},8,["text"])):L("",!0),s[16]||(s[16]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(u,null,{content:R(({close:f})=>[C("div",k5,[s[11]||(s[11]=C("p",{class:"mb-2 text-xs text-muted"},[me(" Paste the write token printed by "),C("code",{class:"font-mono"},"review-workspace serve"),me(". Needed to raise Questions or change Review State — read-only viewing works without it. ")],-1)),B(l,{"model-value":e.writeTokenDraft,size:"sm",class:"w-full",placeholder:"write token","onUpdate:modelValue":s[7]||(s[7]=p=>n("update:writeTokenDraft",p)),onKeyup:Gg(p=>n("saveWriteToken",f),["enter"])},null,8,["model-value","onKeyup"]),B(o,{size:"sm",class:"mt-2",block:"",onClick:p=>n("saveWriteToken",f)},{default:R(()=>[...s[10]||(s[10]=[me("Save",-1)])]),_:1},8,["onClick"])])]),default:R(()=>[B(i,{text:e.hasWriteToken?"Write token set":"Set write token"},{default:R(()=>[B(o,{size:"sm",variant:"ghost",color:e.hasWriteToken?"primary":"warning",icon:"i-lucide-key"},null,8,["color"])]),_:1},8,["text"])]),_:1}),B(i,{text:"Toggle color mode"},{default:R(()=>[B(c,{size:"sm"})]),_:1})])])}}}),C5={class:"flex flex-col gap-5"},S5={class:"flex flex-col gap-4"},T5={class:"mb-1 flex items-center gap-2"},A5={key:0,class:"text-xs font-semibold text-highlighted"},E5={key:1,class:"text-xs font-semibold text-muted"},O5={class:"flex flex-col gap-1"},P5=["title","onClick"],R5={key:0},I5={class:"mb-2 flex h-1.5 overflow-hidden rounded-full bg-elevated"},$5={class:"space-y-0.5 text-xs"},q5={class:"flex justify-between"},M5={class:"flex justify-between"},D5={class:"flex justify-between"},L5=Y({__name:"Sidebar",props:{groups:{},files:{}},setup(e){const t=e;function n(l){return`file-${l.replace(/[^a-zA-Z0-9]/g,"-")}`}function r(l){return l.split("/").pop()??l}function s(l){var u;(u=document.getElementById(n(l)))==null||u.scrollIntoView({behavior:"smooth",block:"start"})}const o={high:"error",medium:"warning",low:"success"},i=E(()=>yy(t.files)),a=E(()=>i.value.verified+i.value.unverified+i.value.gap);return(l,u)=>{const c=mn;return y(),T("nav",C5,[C("div",null,[u[0]||(u[0]=C("p",{class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},"Behavioral groups",-1)),C("div",S5,[(y(!0),T(ne,null,Ee(e.groups,(f,p)=>{var h,g;return y(),T("div",{key:((h=f.group)==null?void 0:h.id)??`ungrouped-${p}`},[C("div",T5,[f.group?(y(),T("span",A5,q(f.group.title),1)):(y(),T("span",E5,"Other changes")),(g=f.group)!=null&&g.risk?(y(),$(c,{key:2,color:o[f.group.risk],variant:"subtle",size:"sm"},{default:R(()=>[me(q(f.group.risk),1)]),_:2},1032,["color"])):L("",!0)]),C("div",O5,[(y(!0),T(ne,null,Ee(f.filePaths,m=>(y(),T("button",{key:m,type:"button",class:"truncate rounded px-2 py-1 text-left font-mono text-xs text-muted hover:bg-elevated hover:text-highlighted",title:m,onClick:v=>s(m)},q(r(m)),9,P5))),128))])])}),128))])]),a.value?(y(),T("div",R5,[u[4]||(u[4]=C("p",{class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},"Verification",-1)),C("div",I5,[C("div",{class:"bg-success",style:wt({width:`${100*i.value.verified/a.value}%`})},null,4),C("div",{class:"bg-warning",style:wt({width:`${100*i.value.unverified/a.value}%`})},null,4),C("div",{class:"bg-error",style:wt({width:`${100*i.value.gap/a.value}%`})},null,4)]),C("ul",$5,[C("li",q5,[u[1]||(u[1]=C("span",{class:"text-success"},"verified",-1)),C("span",null,q(i.value.verified),1)]),C("li",M5,[u[2]||(u[2]=C("span",{class:"text-warning"},"unverified",-1)),C("span",null,q(i.value.unverified),1)]),C("li",D5,[u[3]||(u[3]=C("span",{class:"text-error"},"gap",-1)),C("span",null,q(i.value.gap),1)])])])):L("",!0)])}}}),N5={class:"max-h-72 w-80 overflow-y-auto p-2 font-mono text-xs"},B5={class:"mb-1 px-1 font-sans text-[10px] text-muted"},z5=["onClick"],F5={class:"text-primary"},j5={class:"text-dimmed"},H5={class:"text-muted"},V5=Y({__name:"SymbolOccurrencesPopover",setup(e){const t=iI();async function n(s,o,i){dh(),await Zv(s,o,i)}function r(s){s||dh()}return(s,o)=>{const i=Za;return y(),$(i,{open:d(t).open,"onUpdate:open":r},{content:R(()=>[C("div",N5,[C("div",B5,q(d(t).occurrences.length)+" occurrence"+q(d(t).occurrences.length===1?"":"s")+" of “"+q(d(t).symbol)+"” ",1),(y(!0),T(ne,null,Ee(d(t).occurrences,a=>(y(),T("button",{key:a.lineId,type:"button",class:"block w-full truncate rounded px-1.5 py-1 text-left hover:bg-elevated",onClick:l=>n(a.path,a.hunkIndex,a.lineId)},[C("span",F5,q(a.path),1),C("span",j5,":"+q(a.lineNumber),1),C("span",H5," — "+q(a.text.trim()),1)],8,z5))),128))])]),default:R(()=>[C("span",{class:"pointer-events-none fixed h-0 w-0",style:wt({left:`${d(t).x}px`,top:`${d(t).y}px`})},null,4)]),_:1},8,["open"])}}}),xh=8,wh=6,U5=260;function W5(e,t,n){const r=Math.max(xh,Math.min(e.left,t.width-n-xh)),s=t.height-e.bottom;return s>=U5||s>=e.top?{left:r,top:e.bottom+wh}:{left:r,bottom:t.height-e.top+wh}}const G5=40,on=gt({body:null,anchor:null}),kh=new Map;let ec=0;function K5(e){let t=kh.get(e);return t||(t=iR(e,G5).then(n=>n?{lines:n.content.split(`
119
- `),truncated:n.truncated}:null).catch(()=>null),kh.set(e,t)),t}function Kr(){ec++,on.body=null,on.anchor=null}async function Y5(e,t){const n=++ec,r=fd(e,fn.value.map(o=>o.path));if(r.kind==="ambiguous")return Kr();if(r.kind==="diff"){const o=fn.value.find(i=>i.path===r.path);if(!o)return Kr();on.body={kind:"diff",path:r.path,lines:dR(o)},on.anchor=t;return}const s=await K5(r.path);if(n===ec){if(!s)return Kr();on.body={kind:"repo",path:r.path,...s},on.anchor=t}}const Q5=250,X5=200,Z5="[data-file-preview]",J5="[data-file-ref]";function eD(){let e;const t=g=>g instanceof Element?g.closest(J5):null,n=g=>g instanceof Element&&g.closest(Z5)!==null;function r(g,m){clearTimeout(e),e=setTimeout(()=>{const v=g.getBoundingClientRect();Y5(g.dataset.fileRef??"",{left:v.left,top:v.top,bottom:v.bottom})},m)}function s(){clearTimeout(e),e=setTimeout(Kr,X5)}function o(){clearTimeout(e)}function i(g){const m=t(g.target);m?r(m,Q5):n(g.target)&&o()}function a(g){(t(g.target)||n(g.target))&&s()}function l(g){const m=t(g.target);m&&r(m,0)}function u(g){t(g.target)&&s()}function c(g){if(g.key==="Escape"){clearTimeout(e),Kr();return}const m=t(g.target);m&&g.key==="Enter"&&g.ctrlKey&&p(m)}function f(g){const m=t(g.target);m&&fR(g)&&(g.preventDefault(),p(m))}function p(g){const m=fd(g.dataset.fileRef??"",fn.value.map(v=>v.path));m.kind==="diff"&&(Kr(),Ay(m.path))}const h=()=>Kr();dt(()=>{document.addEventListener("mouseover",i),document.addEventListener("mouseout",a),document.addEventListener("focusin",l),document.addEventListener("focusout",u),document.addEventListener("keydown",c),document.addEventListener("click",f,!0),document.addEventListener("scroll",h,!0)}),as(()=>{clearTimeout(e),document.removeEventListener("mouseover",i),document.removeEventListener("mouseout",a),document.removeEventListener("focusin",l),document.removeEventListener("focusout",u),document.removeEventListener("keydown",c),document.removeEventListener("click",f,!0),document.removeEventListener("scroll",h,!0)})}const tD={class:"mb-1 truncate font-mono text-xs font-semibold text-highlighted"},nD={class:"max-w-full overflow-x-auto rounded border border-default bg-default p-1.5 font-mono text-[10px]","data-testid":"file-preview-code"},rD=["innerHTML"],sD={class:"mt-1 text-[11px] text-muted"},oD=520,iD=Y({__name:"FilePreviewPopover",setup(e){eD();const t=E(()=>{const n=on.anchor;if(!n)return{};const r=W5(n,{width:window.innerWidth,height:window.innerHeight},oD);return{left:`${r.left}px`,top:r.top===void 0?void 0:`${r.top}px`,bottom:r.bottom===void 0?void 0:`${r.bottom}px`}});return(n,r)=>d(on).body?(y(),T("div",{key:0,id:"file-preview",role:"tooltip","data-file-preview":"","data-testid":"file-preview",class:"fixed z-50 max-h-80 w-[520px] max-w-[calc(100vw-1rem)] overflow-y-auto rounded-lg border border-default bg-default p-2 shadow-lg",style:wt(t.value)},[C("p",tD,q(d(on).body.path),1),d(on).body.kind==="diff"?(y(),T(ne,{key:0},[B(Bo,{lines:d(on).body.lines},null,8,["lines"]),r[0]||(r[0]=C("p",{class:"mt-1 text-[11px] text-muted"},"First lines of the change. Ctrl+click to open",-1))],64)):(y(),T(ne,{key:1},[C("div",nD,[(y(!0),T(ne,null,Ee(d(on).body.lines,(s,o)=>(y(),T("div",{key:o,class:"whitespace-pre"},[C("code",{innerHTML:d(Us)(s)},null,8,rD)]))),128))]),C("p",sD," Top of the file"+q(d(on).body.truncated?" (first lines only)":"")+". Not in the diff, so Ctrl+click does nothing ",1)],64))],4)):L("",!0)}});function aD(){const e=gt({loaded:!1,known:new Set,seen:new Set,answers:[]});function t(s){const o=e.loaded?s.filter(i=>!e.known.has(i.id)):[];for(const i of s)e.known.add(i.id);if(!e.loaded)for(const i of s)e.seen.add(i.id);return e.loaded=!0,e.answers=[...s],o}function n(s){for(const o of e.answers)o.questionId===s&&e.seen.add(o.id)}const r=E(()=>e.answers.filter(s=>!e.seen.has(s.id)).length);return{sync:t,markSeenForQuestion:n,unseenCount:r}}const Jl=aD(),lD=1e4;function uD(e){const t=hv(),n=Xa();function r(o){const i=n.questions.find(a=>a.id===o.questionId);t.add({title:"New answer",description:(i==null?void 0:i.body)??"The agent answered a Question.",icon:"i-lucide-message-circle-reply",duration:lD,actions:i?[{label:"Open",color:"neutral",variant:"outline",onClick:()=>nl(i)}]:[]})}function s(){Qe.open&&Qe.threadId&&Jl.markSeenForQuestion(Qe.threadId)}return Me(e,o=>{o&&(Jl.sync(o).forEach(r),s())},{immediate:!0}),Me(()=>[Qe.open,Qe.threadId],s),{unseenCount:Jl.unseenCount}}const cD=4e3;function dD(){const e=G(null),t=G(null);let n;async function r(){try{e.value=await rR(),fn.value=e.value.files,kd.value=e.value.generatorPrompt,t.value=null}catch(s){t.value=s instanceof Error?s.message:String(s)}await Jo(),await kI()}return dt(async()=>{await mO(),await r(),n=setInterval(r,cD)}),as(()=>clearInterval(n)),{viewModel:e,error:t,refresh:r}}function fD(e){const t=new Map;let n=1;for(const r of e)for(const s of r.files){for(const o of s.annotations)o.target.type!=="line"&&t.set(o.id,n++);for(const o of s.hunks)for(const i of o.lines)for(const a of i.annotations)t.set(a.id,n++)}return t}function pD(e){return!!e&&!!(e.title||e.url||e.author||e.sourceBranch||e.description)}function hD(e){return e?e.title?e.number?`!${e.number} ${e.title}`:e.title:`${e.base} → ${e.head}`:"Review Workspace"}function gD(e){return e!=null&&e.description?$r(e.description,e.url):""}function mD(e,t){const n=new Set,r=t.map(o=>{const i=o.filePaths.map(a=>e.find(l=>l.path===a)).filter(a=>!!a);return i.forEach(a=>n.add(a.path)),{group:o,filePaths:i.map(a=>a.path),files:i}}),s=e.filter(o=>!n.has(o.path));return s.length&&r.push({group:null,filePaths:s.map(o=>o.path),files:s}),r}function vD(e){const t=e.flatMap(n=>n.filePaths);return new Map(t.map((n,r)=>[n,{index:r+1,total:t.length}]))}const yD={class:"flex h-screen flex-col bg-default text-default"},bD={class:"flex min-h-0 flex-1"},xD={class:"flex min-w-0 flex-1 flex-col"},wD={key:0,class:"p-4 text-error"},kD={key:1,class:"p-4 text-muted"},_D={key:3,class:"flex flex-1 overflow-hidden"},CD={key:0,class:"w-64 shrink-0 overflow-y-auto border-r border-default p-3"},SD={class:"flex-1 overflow-y-auto p-4"},TD={key:0,class:"mb-4 rounded border border-warning/50 bg-warning/10 p-3 text-xs"},AD={class:"mt-2 list-disc space-y-1 pl-4","data-testid":"bundle-diagnostics"},ED={class:"mb-3 flex items-center gap-2"},OD={key:0,class:"text-base font-semibold"},PD={key:1,class:"text-base font-semibold text-muted"},RD=Y({__name:"DiffReviewView",setup(e){const{viewModel:t,error:n}=dD(),r=Xa(),{copied:s,copy:o}=ol(),{unseenCount:i}=uD(()=>{var K;return(K=t.value)==null?void 0:K.answers}),a=G("inline"),l=G(!0),u=G(!1),c=G(!1),f=G(),p=G(r.writeToken),h=E(()=>{const K=t.value;return K?mD(K.files,K.groups):[]}),g=E(()=>Xv(r.questions)),m=E(()=>vD(h.value)),v=E(()=>{const K=t.value;return K?md(hd(K.files),gd(K.groups)).length:0});function x(K){c.value=!1,K&&requestAnimationFrame(()=>{var X;return(X=document.getElementById(Qn(K)))==null?void 0:X.scrollIntoView({behavior:"smooth",block:"start"})})}const b=E(()=>fD(h.value)),w=E(()=>{var K;return((K=t.value)==null?void 0:K.comparison)??null}),k=E(()=>hD(w.value??void 0)),O=E(()=>pD(w.value??void 0)),P=E(()=>gD(w.value??void 0)),I=E(()=>{const K=t.value;return K?TO(K.files,K.answers,g.value):[]}),M=E(()=>AO(I.value));function j(K){cO(p.value.trim()),K()}async function H(){t.value&&await o(t.value.generatorPrompt)}async function le(K){await EO(K)}return(K,X)=>{var fe;const J=mn;return y(),T("div",yD,[B(_5,{"header-title":k.value,comparison:w.value,"has-mr-metadata":O.value,"nav-visible":l.value,layout:a.value,"open-question-count":M.value,"new-answer-count":d(i),"prompt-copied":d(s),"has-write-token":d(r).writeToken.length>0,"write-token-draft":p.value,"focus-mode":c.value,"focus-mode-count":v.value,"live-answers-label":d(xI)(d(is)),"answers-used-label":d(wI)(d(is)),"onUpdate:navVisible":X[0]||(X[0]=F=>l.value=F),"onUpdate:layout":X[1]||(X[1]=F=>a.value=F),"onUpdate:writeTokenDraft":X[2]||(X[2]=F=>p.value=F),"onUpdate:focusMode":X[3]||(X[3]=F=>c.value=F),onOpenQuestions:d(ER),onOpenMrDetails:X[4]||(X[4]=F=>u.value=!0),onCopyPrompt:H,onSaveWriteToken:j},null,8,["header-title","comparison","has-mr-metadata","nav-visible","layout","open-question-count","new-answer-count","prompt-copied","has-write-token","write-token-draft","focus-mode","focus-mode-count","live-answers-label","answers-used-label","onOpenQuestions"]),B(V5),B(iD),w.value?(y(),$(wM,{key:0,open:u.value,"onUpdate:open":X[5]||(X[5]=F=>u.value=F),comparison:w.value,"description-html":P.value},null,8,["open","comparison","description-html"])):L("",!0),C("div",bD,[C("div",xD,[d(n)?(y(),T("div",wD,"Failed to load bundle: "+q(d(n)),1)):d(t)?c.value?(y(),$(cM,{key:2,files:d(t).files,groups:d(t).groups,"current-id":f.value,"onUpdate:currentId":X[6]||(X[6]=F=>f.value=F),onExit:x},null,8,["files","groups","current-id"])):(y(),T("div",_D,[l.value?(y(),T("aside",CD,[B(L5,{groups:h.value,files:d(t).files},null,8,["groups","files"])])):L("",!0),C("main",SD,[B(N3),d(t).diagnostics.length?(y(),T("div",TD,[C("strong",null,q(d(t).diagnostics.length)+" bundle-level diagnostic(s)",1),C("ul",AD,[(y(!0),T(ne,null,Ee(d(t).diagnostics,(F,de)=>(y(),T("li",{key:de},q(d(bd)(F)),1))),128))])])):L("",!0),B(M3,{"view-model":d(t)},null,8,["view-model"]),(y(!0),T(ne,null,Ee(h.value,(F,de)=>{var ee,_e;return y(),T("section",{key:((ee=F.group)==null?void 0:ee.id)??`ungrouped-${de}`,class:"mb-8"},[C("div",ED,[F.group?(y(),T("h2",OD,q(F.group.title),1)):(y(),T("h2",PD,"Other changes")),(_e=F.group)!=null&&_e.risk?(y(),$(J,{key:2,color:{high:"error",medium:"warning",low:"success"}[F.group.risk],variant:"subtle",size:"sm"},{default:R(()=>[me(q(F.group.risk),1)]),_:2},1032,["color"])):L("",!0)]),(y(!0),T(ne,null,Ee(F.files,ie=>(y(),$(Mq,{key:ie.path,file:ie,position:m.value.get(ie.path),layout:a.value,"annotation-numbers":b.value,questions:g.value,answers:d(t).answers},null,8,["file","position","layout","annotation-numbers","questions","answers"]))),128))])}),128))])])):(y(),T("div",kD,"Loading…"))]),d(Qe).open?(y(),$(XM,{key:0,entries:I.value,"current-round":((fe=d(t))==null?void 0:fe.round)??1,onShowInCode:le},null,8,["entries","current-round"])):L("",!0)])])}}}),ID=[{path:"/",name:"diff-review",component:RD}],Cd=_x(sO),$D=Pw({routes:ID,history:uw()});Cd.use($D);Cd.use(u1);Cd.mount("#app");
118
+ `+vn),he&&(vn=oi(vn)),P&&Ft?K(vn):vn},t.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fl(ae),De=!0,Ve=be,He=A},t.clearConfig=function(){gs=null,De=!1,Ve=null,He=null,P=M,I=""},t.isValidAttribute=function(ae,_,N){gs||fl({});const te=ut(ae),we=ut(_);return Dd(te,we,N)},t.addHook=function(ae,_){typeof _=="function"&&St(Se,ae)&&ks(Se[ae],_)},t.removeHook=function(ae,_){if(St(Se,ae)){if(_!==void 0){const N=IP(Se[ae],_);return N===-1?void 0:$P(Se[ae],N,1)[0]}return Yp(Se[ae])}},t.removeHooks=function(ae){St(Se,ae)&&(Se[ae]=[])},t.removeAllHooks=function(){Se=ah()},t}var nR=hy();function ur(e){return`/api/assets/${e.split("/").map(encodeURIComponent).join("/")}`}async function rR(){const e=await fetch("/api/view");if(!e.ok){const t=await e.json().catch(()=>({})),n=t.backupPath?`. Backup: ${t.backupPath}`:"";throw new Error(`GET /view failed (${e.status}): ${t.error??e.statusText}${n}`)}return e.json()}async function gy(e){const t=await fetch(e);if(!t.ok)throw new Error(`GET ${e} failed (${t.status})`);return t.json()}function sR(){return gy("/api/live-head")}function oR(){return gy("/api/watcher")}async function iR(e,t){const n=await fetch(`/api/repo-file?path=${encodeURIComponent(e)}&lines=${t}`);return n.ok?n.json():null}const fn=gn([]),aR=12,lR=/^[\w@.\-/+~]+$/,uR=/\.[A-Za-z][A-Za-z0-9]{0,7}$/;function my(e){return e.startsWith("./")?e.slice(2):e}function cR(e){const t=my(e);return t===""||!lR.test(t)||t.startsWith("/")||t.split("/").includes("..")?!1:t.includes("/")||uR.test(t)}function fd(e,t){const n=my(e);if(t.includes(n))return{kind:"diff",path:n};const r=t.filter(s=>s.endsWith(`/${n}`));return r.length===1?{kind:"diff",path:r[0]}:r.length>1?{kind:"ambiguous"}:{kind:"outside",path:n}}function dR(e){return e.binary?[]:e.hunks.flatMap(t=>t.lines).slice(0,aR)}function fR(e){return e.button===0&&(e.ctrlKey||e.metaKey)}function pR(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}const hR=new dy({renderer:{codespan({text:e}){const t=e.replace(/&#39;/g,"'");if(!cR(t))return!1;const n=fd(t,fn.value.map(r=>r.path));return n.kind==="ambiguous"?!1:`<code class="file-ref file-ref-${n.kind}" data-file-ref="${pR(t)}" tabindex="0">${e}</code>`}}});function gR(e,t){if(e=e.replace(/(<img[^>]+src=")\/uploads\//g,`$1${ur("uploads/")}`),!t)return e;let n;try{n=new URL(t).origin}catch{return e}return e.replace(/(<img[^>]+src=")\/(?!\/)/g,`$1${n}/`)}function $r(e,t){const n=hR.parse(e,{async:!1,breaks:!0});return nR.sanitize(gR(n,t))}const mR=new Set(["as","async","await","break","case","catch","class","const","continue","default","delete","do","else","export","extends","false","finally","for","from","function","if","implements","import","in","interface","keyof","let","new","null","of","readonly","return","switch","throw","true","try","type","typeof","undefined","var","while"]),vR={comment:"italic text-[var(--syntax-comment)]",keyword:"font-semibold text-[var(--syntax-keyword)]",string:"text-[var(--syntax-string)]",number:"text-[var(--syntax-number)]",function:"text-[var(--syntax-function)]",type:"text-[var(--syntax-type)]",property:"text-[var(--syntax-property)]",operator:"text-[var(--syntax-operator)]"},yR=/(\/\/.*|\/\*.*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\b\d+(?:\.\d+)?\b|[A-Za-z_$][\w$]*|\s+|.)/g,bR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function xR(e){return e.replace(/[&<>"']/g,t=>bR[t])}function Us(e){const t=String(e);let n="";for(const r of t.matchAll(yR)){const s=r[0],o=r.index??0,i=t.slice(0,o).trimEnd().at(-1),a=t.slice(o+s.length).trimStart().at(0);let l="";s.startsWith("//")||s.startsWith("/*")?l="comment":/^["'`]/.test(s)?l="string":/^\d/.test(s)?l="number":mR.has(s)?l="keyword":/^[A-Z][A-Za-z0-9_$]*$/.test(s)?l="type":/^[A-Za-z_$]/.test(s)&&a==="("?l="function":/^[A-Za-z_$]/.test(s)&&(i==="."||a===":")?l="property":/^[{}[\]().,:;?=><!&|+\-*/]+$/.test(s)&&(l="operator");const u=xR(s);n+=l?`<span class="${vR[l]}">${u}</span>`:u}return n}const lh=3;function No(e,t){const n=e.find(r=>r.path===t.path);if(!n)return null;if(t.type==="hunk"){const r=n.hunks[t.hunkIndex];return r?{path:t.path,lines:r.lines}:null}if(t.type==="line"){for(const r of n.hunks){const s=r.lines.findIndex(a=>t.side==="base"?a.oldLine===t.line:a.newLine===t.line);if(s===-1)continue;const o=Math.max(0,s-lh),i=Math.min(r.lines.length,s+lh+1);return{path:t.path,lines:r.lines.slice(o,i)}}return null}return null}const wR={class:"max-w-full overflow-x-auto rounded border border-default bg-default p-1.5 font-mono text-[10px]"},kR={class:"mr-1.5 select-none text-dimmed"},_R=["innerHTML"],Bo=Y({__name:"DiffLinesPreview",props:{lines:{}},setup(e){return(t,n)=>(y(),T("div",wR,[(y(!0),T(ne,null,Ee(e.lines,r=>(y(),T("div",{key:r.id,class:se(["whitespace-pre",{"bg-success/10":r.kind==="add","bg-error/10":r.kind==="remove"}])},[C("span",kR,q(r.kind==="add"?"+":r.kind==="remove"?"−":" "),1),C("code",{innerHTML:d(Us)(r.text)},null,8,_R)],2))),128))]))}}),CR={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute start-0 flex items-start",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute end-0 flex items-start",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2 inset-y-1",trailing:"pe-2 inset-y-1",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"},autoresize:{true:{base:"resize-none"}}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},SR=["id","value","name","rows","placeholder","disabled","required"],tl=Object.assign({inheritAttrs:!1},{__name:"Textarea",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},autoresize:{type:Boolean,required:!1},autoresizeDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},rows:{type:Number,required:!1,default:3},maxrows:{type:Number,required:!1,default:0},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Kn(),i=Nt("textarea",r),a=Un(i,"modelValue",s,{defaultValue:i.defaultValue}),l=ht(),{emitFormFocus:u,emitFormBlur:c,emitFormInput:f,emitFormChange:p,size:h,color:g,id:m,name:v,highlight:x,disabled:b,ariaAttrs:w}=Jc(r,{deferInputValidation:!0}),{isLeading:k,isTrailing:O,leadingIconName:P,trailingIconName:I}=Ya(i),M=E(()=>{var F;return Bt({extend:CR,...((F=l.ui)==null?void 0:F.textarea)||{}})({color:g.value??i.color,variant:i.variant,size:(h==null?void 0:h.value)??i.size,loading:i.loading,highlight:x.value??i.highlight,fixed:i.fixed,autoresize:i.autoresize,leading:k.value||!!i.avatar||!!o.leading,trailing:O.value||!!o.trailing})}),j=Or("textareaRef");function H(F){var de,ee,_e,ie,Se;(de=i.modelModifiers)!=null&&de.trim&&(typeof F=="string"||F===null||F===void 0)&&(F=(F==null?void 0:F.trim())??null),(ee=i.modelModifiers)!=null&&ee.number&&(F=Lm(F)),(_e=i.modelModifiers)!=null&&_e.nullable&&(F||(F=null)),(ie=i.modelModifiers)!=null&&ie.optional&&!((Se=i.modelModifiers)!=null&&Se.nullable)&&F!==null&&(F||(F=void 0)),a.value=F,f()}function le(F){var de;fe(),(de=i.modelModifiers)!=null&&de.lazy||H(F.target.value)}function K(F){var ee,_e;const de=F.target.value;(ee=i.modelModifiers)!=null&&ee.lazy&&H(de),(_e=i.modelModifiers)!=null&&_e.trim&&(F.target.value=de.trim()),p(),s("change",F)}function X(F){c(),s("blur",F)}function J(){var F;i.autofocus&&((F=j.value)==null||F.focus())}function fe(){if(i.autoresize&&j.value){j.value.rows=i.rows;const F=j.value.style.overflow;j.value.style.overflow="hidden";const de=window.getComputedStyle(j.value),ee=Number.parseInt(de.paddingTop),_e=Number.parseInt(de.paddingBottom),ie=ee+_e,Se=Number.parseInt(de.lineHeight),{scrollHeight:Le}=j.value,rt=(Le-ie)/Se;rt>i.rows&&(j.value.rows=i.maxrows?Math.min(rt,i.maxrows):rt),j.value.style.overflow=F}}return Me(a,()=>{tt(fe)}),dt(()=>{setTimeout(()=>{J()},i.autofocusDelay),setTimeout(async()=>{await tt(),fe()},i.autoresizeDelay)}),t({textareaRef:j,autoResize:fe}),(F,de)=>{var ee;return y(),$(d($e),{as:d(i).as,"data-slot":F.$attrs["data-slot"]??"root",class:se(M.value.root({class:[(ee=d(i).ui)==null?void 0:ee.root,d(i).class]}))},{default:R(()=>{var _e,ie,Se;return[C("textarea",pe({id:d(m),ref_key:"textareaRef",ref:j,value:d(a),name:d(v),rows:d(i).rows,placeholder:d(i).placeholder,class:M.value.base({class:(_e=d(i).ui)==null?void 0:_e.base}),disabled:d(b),required:d(i).required},{...F.$attrs,...d(w)},{"data-slot":"base",onInput:le,onBlur:X,onChange:K,onFocus:de[0]||(de[0]=(...Le)=>d(u)&&d(u)(...Le))}),null,16,SR),U(F.$slots,"default",{ui:M.value}),d(k)||d(i).avatar||o.leading?(y(),T("span",{key:0,"data-slot":"leading",class:se(M.value.leading({class:(ie=d(i).ui)==null?void 0:ie.leading}))},[U(F.$slots,"leading",{ui:M.value},()=>{var Le,rt,lt;return[d(k)&&d(P)?(y(),$(rn,{key:0,name:d(P),"data-slot":"leadingIcon",class:se(M.value.leadingIcon({class:(Le=d(i).ui)==null?void 0:Le.leadingIcon}))},null,8,["name","class"])):d(i).avatar?(y(),$(Xo,pe({key:1,size:((rt=d(i).ui)==null?void 0:rt.leadingAvatarSize)||M.value.leadingAvatarSize()},d(i).avatar,{"data-slot":"leadingAvatar",class:M.value.leadingAvatar({class:(lt=d(i).ui)==null?void 0:lt.leadingAvatar})}),null,16,["size","class"])):L("",!0)]})],2)):L("",!0),d(O)||o.trailing?(y(),T("span",{key:1,"data-slot":"trailing",class:se(M.value.trailing({class:(Se=d(i).ui)==null?void 0:Se.trailing}))},[U(F.$slots,"trailing",{ui:M.value},()=>{var Le;return[d(I)?(y(),$(rn,{key:0,name:d(I),"data-slot":"trailingIcon",class:se(M.value.trailingIcon({class:(Le=d(i).ui)==null?void 0:Le.trailingIcon}))},null,8,["name","class"])):L("",!0)]})],2)):L("",!0)]}),_:3},8,["as","data-slot","class"])}}});function pd(e,t){const n=Xa(),r=(t==null?void 0:t.draft)??G(""),s=(t==null?void 0:t.kind)??G("question"),o=G(!1),i=G(null),a=G(null),l=G("");async function u(g){if(r.value.trim()){o.value=!0,i.value=null;try{await fO(r.value.trim(),e(),s.value),r.value="",s.value="question",g()}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}}function c(g){a.value=g,l.value=""}async function f(g,m){if(l.value.trim()){o.value=!0,i.value=null;try{await pO(g,l.value.trim(),e()),a.value=null,l.value="",m()}catch(v){i.value=v instanceof Error?v.message:String(v)}finally{o.value=!1}}}async function p(g){o.value=!0,i.value=null;try{await hO(g)}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}async function h(g){o.value=!0,i.value=null;try{await gO(g)}catch(m){i.value=m instanceof Error?m.message:String(m)}finally{o.value=!1}}return{store:n,draft:r,draftKind:s,busy:o,localError:i,editingId:a,editDraft:l,submitNewQuestion:u,startEdit:c,submitEdit:f,remove:p,resolve:h}}const Qu={type:"general"},TR=()=>({open:!1,threadId:null,anchorTarget:Qu,composerTarget:Qu,draft:"",kind:"question"}),Qe=gt(TR());function nl(e){Qe.open=!0,Qe.threadId=e.id,Qe.anchorTarget=e.target??Qu,Qe.composerTarget=Qe.anchorTarget}function vy(e){Qe.open=!0,Qe.threadId=null,Qe.anchorTarget=e.target,Qe.composerTarget=e.target,Qe.draft=e.draft??"",Qe.kind=e.kind??"question"}function AR(e){Qe.composerTarget=e}function ER(){Qe.open=!Qe.open}function OR(){Qe.open=!1}function zo(e){const t=e.indexOf(". "),n=e.indexOf(" — "),r=[t,n].filter(i=>i>=0);if(!r.length)return{headline:e,body:""};const s=Math.min(...r),o=s===n;return{headline:e.slice(0,s+(o?0:1)).trim(),body:e.slice(s+(o?3:2)).trim()}}function hd(e){var n;const t=new Map;for(const r of e)for(const s of r.verification)t.has(s.id)||t.set(s.id,{verification:s,annotationId:(n=r.annotations.find(o=>o.verification.some(i=>i.id===s.id)))==null?void 0:n.id,path:r.path});return[...t.values()]}function yy(e){const t=new Map;for(const r of e)for(const s of r.verification)t.set(s.id,s);const n={verified:0,unverified:0,gap:0};for(const r of t.values())n[r.status]++;return n}const uh={high:0,medium:1,low:2};function gd(e){const t=new Map(e.flatMap(n=>n.filePaths.map(r=>[r,n.risk])));return n=>t.get(n)}function md(e,t){return e.filter(n=>n.verification.status!=="verified").sort((n,r)=>(uh[t(n.path)??"low"]??3)-(uh[t(r.path)??"low"]??3))}function PR(e){return e.suggestion??""}function by(e){return e==="change-request"?6:3}function RR(e,t){return e.type==="general"&&t?`About "${t}": `:""}const IR={key:0,class:"flex flex-wrap gap-2"},$R={key:0,class:"mt-1 text-error"},qR={key:1,class:"mt-1 text-warning"},MR={class:"mt-1 flex gap-2"},ti=Y({__name:"AskQuestionForm",props:{target:{},annotation:{}},setup(e){const t=e,n=G(!1),{draft:r,draftKind:s,busy:o,localError:i,submitNewQuestion:a,store:l}=pd(()=>t.target),u=E(()=>l.writeToken.length>0);function c(){n.value=!1}function f(){const h=t.annotation&&zo(t.annotation.summary).headline;vy({target:t.target,draft:RR(t.target,h)})}function p(){s.value="change-request",r.value=t.annotation?PR(t.annotation):"",n.value=!0}return(h,g)=>{const m=kt,v=tl;return y(),T("div",null,[n.value?(y(),T(ne,{key:1},[B(v,{modelValue:d(r),"onUpdate:modelValue":g[0]||(g[0]=x=>Ze(r)?r.value=x:null),size:"sm",class:"w-full",rows:d(by)("change-request"),placeholder:"What needs to change?"},null,8,["modelValue","rows"]),d(i)?(y(),T("p",$R,q(d(i)),1)):L("",!0),u.value?L("",!0):(y(),T("p",qR,"Set your write token first (top right).")),C("div",MR,[B(m,{size:"xs",disabled:d(o)||!u.value,onClick:g[1]||(g[1]=x=>d(a)(c))},{default:R(()=>[...g[4]||(g[4]=[me("Raise change request",-1)])]),_:1},8,["disabled"]),B(m,{size:"xs",variant:"ghost",onClick:c},{default:R(()=>[...g[5]||(g[5]=[me("Cancel",-1)])]),_:1})])],64)):(y(),T("span",IR,[B(m,{size:"xs",variant:"outline",color:"neutral",onClick:f},{default:R(()=>[...g[2]||(g[2]=[me("Ask a question",-1)])]),_:1}),e.annotation?(y(),$(m,{key:0,size:"xs",variant:"outline",color:"error",onClick:p},{default:R(()=>[...g[3]||(g[3]=[me(" Raise as change-request ",-1)])]),_:1})):L("",!0)]))])}}}),DR={key:0,"data-testid":"note-suggestion",class:"mt-2 rounded border border-primary/40 bg-primary/5 p-2"},LR={class:"text-default"},rl=Y({__name:"NoteSuggestion",props:{suggestion:{}},setup(e){return(t,n)=>e.suggestion?(y(),T("div",DR,[n[0]||(n[0]=C("p",{class:"mb-0.5 text-[10px] font-bold uppercase tracking-wide text-primary"},"Suggestion",-1)),C("p",LR,q(e.suggestion),1)])):L("",!0)}}),NR={intended:"Intended",missing:"Missing",wrong:"Wrong",extra:"Extra",unclear:"Unclear"},BR={intended:"success",missing:"warning",wrong:"error",extra:"info",unclear:"neutral"},zR={low:"neutral",medium:"warning",high:"error"},FR={issue:"the issue","mr-text":"the MR text","repo-rule":"a repo rule",nobody:"nobody"};function vd(e){return NR[e]}function yd(e){return BR[e]}function jR(e){return`${e} severity`}function HR(e){return zR[e]}function VR(e){return`asked by: ${FR[e]}`}function ch(e){return e.type==="line"?`line ${e.line}`:null}const UR={class:"inline-flex shrink-0 items-center gap-1.5"},WR={key:2,"data-testid":"note-source",class:"text-[10px] text-dimmed"},sl=Y({__name:"NoteVerdict",props:{annotation:{}},setup(e){return(t,n)=>{const r=mn;return y(),T("span",UR,[e.annotation.verdict?(y(),$(r,{key:0,"data-testid":"note-verdict",size:"sm",variant:"subtle",color:d(yd)(e.annotation.verdict)},{default:R(()=>[me(q(d(vd)(e.annotation.verdict)),1)]),_:1},8,["color"])):L("",!0),e.annotation.severity?(y(),$(r,{key:1,"data-testid":"note-severity",size:"sm",variant:"outline",color:d(HR)(e.annotation.severity)},{default:R(()=>[me(q(d(jR)(e.annotation.severity)),1)]),_:1},8,["color"])):L("",!0),e.annotation.source?(y(),T("span",WR,q(d(VR)(e.annotation.source)),1)):L("",!0)])}}}),GR=["aria-label"],KR={class:"w-80 max-h-96 overflow-y-auto p-3 text-left font-sans text-xs whitespace-normal break-words normal-case select-text"},YR={class:"mb-1.5 flex items-center gap-2"},QR={class:"mb-1 truncate font-mono text-[10px] text-dimmed"},XR=["innerHTML"],ZR={key:1,class:"mt-2 space-y-1 border-t border-default pt-2"},JR=["onMouseenter"],eI=["onClick"],tI={class:"text-muted"},nI={key:0,class:"mt-1 max-w-full overflow-x-auto rounded border border-default bg-elevated p-1.5 font-mono text-[10px] normal-case"},rI={class:"mr-1.5 select-none text-dimmed"},sI=["innerHTML"],oI={class:"mt-2 border-t border-default pt-2"},xy=Y({__name:"AnnotationBadge",props:{annotation:{},number:{}},setup(e){const t=e,n=E(()=>td(t.annotation.id));function r(a){var l;(l=document.getElementById(Qn(a)))==null||l.scrollIntoView({behavior:"smooth",block:"start"})}const s=E(()=>No(fn.value,t.annotation.target)),o=G(null);function i(a){var u;const l=(u=t.annotation.relatedTargets)==null?void 0:u[a];return l?No(fn.value,l.target):null}return(a,l)=>{const u=mn,c=Qa,f=Za;return y(),$(f,{class:"ml-1 inline-grid align-middle"},{content:R(()=>{var p;return[C("div",KR,[C("span",YR,[B(u,{size:"sm",variant:"subtle",color:"primary"},{default:R(()=>[me(q(e.annotation.kind??"note"),1)]),_:1}),B(c,{class:"ml-auto","model-value":n.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":l[0]||(l[0]=h=>d(nd)(e.annotation.id))},null,8,["model-value"])]),B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("p",QR,q(e.annotation.target.path),1),s.value?(y(),$(Bo,{key:0,class:"mb-2",lines:s.value.lines},null,8,["lines"])):L("",!0),C("div",{class:"markdown-body text-muted",innerHTML:d($r)(e.annotation.summary)},null,8,XR),B(rl,{suggestion:e.annotation.suggestion},null,8,["suggestion"]),(p=e.annotation.relatedTargets)!=null&&p.length?(y(),T("ul",ZR,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(h,g)=>(y(),T("li",{key:g,class:"leading-relaxed",onMouseenter:m=>o.value=g,onMouseleave:l[1]||(l[1]=m=>o.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:m=>r(h.target.path)}," → "+q(h.target.path),9,eI),C("span",tI," — "+q(h.reason),1),o.value===g&&i(g)?(y(),T("div",nI,[(y(!0),T(ne,null,Ee(i(g).lines,m=>(y(),T("div",{key:m.id,class:se(["whitespace-pre",{"bg-success/10":m.kind==="add","bg-error/10":m.kind==="remove"}])},[C("span",rI,q(m.kind==="add"?"+":m.kind==="remove"?"−":" "),1),C("code",{innerHTML:d(Us)(m.text)},null,8,sI)],2))),128))])):L("",!0)],40,JR))),128))])):L("",!0),C("div",oI,[B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])])]}),default:R(()=>[C("button",{type:"button",class:se(["grid h-[18px] w-[18px] place-items-center rounded-full border text-[10px] font-bold transition hover:scale-110 focus-visible:scale-110 focus-visible:outline-none",n.value?"border-success/60 bg-success/15 text-success hover:bg-success hover:text-inverted focus-visible:bg-success focus-visible:text-inverted":"border-warning/60 bg-warning/15 text-warning hover:bg-warning hover:text-inverted focus-visible:bg-warning focus-visible:text-inverted"]),"aria-label":`Note ${e.number}${n.value?" (resolved)":""}: ${e.annotation.summary}`},q(e.number),11,GR)]),_:1})}}}),wy=50;function ky(e,t,n=wy){return e||t.length<=n?t:t.slice(0,n)}function _y(e,t,n=wy){return e?0:Math.max(0,t.length-n)}const Wr=gt({open:!1,x:0,y:0,symbol:"",occurrences:[]});function iI(){return Wr}function aI(e,t,n,r){Wr.x=e,Wr.y=t,Wr.symbol=n,Wr.occurrences=r,Wr.open=!0}function dh(){Wr.open=!1}const Ei=/[\w$]/;function lI(e,t){if(!Ei.test(e[t]??"")&&!Ei.test(e[t-1]??""))return null;let n=t;for(;n>0&&Ei.test(e[n-1]);)n--;let r=t;for(;r<e.length&&Ei.test(e[r]);)r++;const s=e.slice(n,r);return/^[A-Za-z_$]/.test(s)?s:null}function uI(e,t){var s;const n=(s=document.caretRangeFromPoint)==null?void 0:s.call(document,e,t),r=n==null?void 0:n.startContainer;return!r||r.nodeType!==Node.TEXT_NODE?null:lI(r.textContent??"",n.startOffset)}function Es(e){if(!e.metaKey&&!e.ctrlKey)return;const t=uI(e.clientX,e.clientY);if(!t)return;const n=cI(fn.value,t);n.length<=1||aI(e.clientX,e.clientY,t,n)}function cI(e,t){const n=new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`),r=[];for(const s of e)s.hunks.forEach((o,i)=>{for(const a of o.lines)n.test(a.text)&&r.push({path:s.path,hunkIndex:i,lineId:a.id,lineNumber:a.newLine??a.oldLine??0,text:a.text})});return r}const Cy=G([]),Xu=gt(new Map);function fh(e){Cy.value=e}function ph(e,t,n){n?Xu.set(e,t):Xu.delete(e)}function hh(e){if(Cy.value.includes(e))return!0;for(const t of Xu.values())if(t.includes(e))return!0;return!1}function bd(e){switch(e.kind){case"stale-line-target":return`Stale annotation: ${e.detail}`;case"invalid-field":return`Invalid field (${e.instancePath}): ${e.message}`;case"unresolved-target":return`Unresolved ${e.targetType} target: ${e.detail}`;case"missing-asset":return`Missing asset: ${e.assetPath}`;case"unsafe-asset-path":return`Unsafe asset path: ${e.assetPath}`;case"disallowed-asset-type":return`Disallowed asset type: ${e.assetPath}`;case"asset-too-large":return`Asset too large (${e.bytes} bytes): ${e.assetPath}`;case"image-without-comparison":return`Changed image has no base and head asset: ${e.path}`;case"dangling-answer":return`Answer ${e.answerId} references unknown Question ${e.questionId}`;case"unanchored-verification-gap":return`Verification gap ${e.verificationId} has no concrete anchor: ${e.detail}`;case"missing-verdict":return`Note ${e.annotationId} has no verdict. Set it to intended, missing, wrong, extra or unclear.`;case"missing-suggestion":return`Note ${e.annotationId} has the verdict ${e.verdict} but no suggestion. Say what to change.`;case"invalid-proof-link":return`Proof link in evidence ${e.evidenceId} is broken: ${e.detail}`}}const dI={key:0,class:"sticky right-1 z-10 ml-1 inline-flex items-center gap-1 align-middle"},Zu=Y({__name:"DiffLineNote",props:{annotations:{},diagnostics:{},numbers:{}},setup(e){return(t,n)=>{const r=mn;return e.annotations.length||e.diagnostics.length?(y(),T("span",dI,[(y(!0),T(ne,null,Ee(e.annotations,s=>(y(),$(xy,{key:s.id,annotation:s,number:e.numbers.get(s.id)??0},null,8,["annotation","number"]))),128)),(y(!0),T(ne,null,Ee(e.diagnostics,(s,o)=>(y(),$(r,{key:o,color:"warning",variant:"subtle",size:"sm",class:"ml-1",title:d(bd)(s)},{default:R(()=>[...n[0]||(n[0]=[me(" ⚠ ",-1)])]),_:1},8,["title"]))),128))])):L("",!0)}}});function Sy(e,t){if(t.type!=="line")return[];const n=e.find(s=>s.path===t.path);if(!n)return[];const r=[];for(const s of n.hunks)for(const o of s.lines)(t.side==="base"?o.oldLine:o.newLine)===t.line&&r.push(o.id);return r}function fI(e){return e.type==="line"||e.type==="hunk"}function pI(e,t){var n,r,s;if(t.type==="line")return Sy(e,t)[0];if(t.type==="hunk")return(s=(r=(n=e.find(o=>o.path===t.path))==null?void 0:n.hunks[t.hunkIndex])==null?void 0:r.lines[0])==null?void 0:s.id}const hI=1600;function gI(e){e.classList.remove("jump-flash"),e.offsetWidth,e.classList.add("jump-flash"),setTimeout(()=>e.classList.remove("jump-flash"),hI)}async function Ty(e,t){await tt();const n=document.getElementById(e);n&&(n.scrollIntoView({behavior:"smooth",block:t}),gI(n))}async function Ay(e){Vv(e),await Ty(Qn(e),"start")}async function mI(e){const t=pI(fn.value,e);if(!t)return Ay(e.path);Vv(e.path),e.type==="hunk"?ss(e.path,e.hunkIndex):ss(e.path,Number(t.split("#").at(-2))),await Ty(Hs(t),"center")}const Ey=Y({__name:"JumpToTargetButton",props:{target:{}},setup(e){return(t,n)=>{const r=kt;return d(fI)(e.target)?(y(),$(r,{key:0,size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-corner-down-right","aria-label":"Jump to this code in the diff","data-testid":"jump-to-target",onClick:n[0]||(n[0]=s=>d(mI)(e.target))})):L("",!0)}}});function vI(e){return e!=null&&e.stale?`The MR has new commits since round ${e.round}`:null}const yI=3e4,bI=5*6e4;function xd(e,t=new Date){if((e==null?void 0:e.status)!=="ok"||!e.watcher.enabled||!e.watcher.updatedAt)return!1;const n=e.watcher.current===null?yI:bI;return t.getTime()-Date.parse(e.watcher.updatedAt)>n}function wd(e,t=new Date){return(e==null?void 0:e.status)==="ok"&&e.watcher.enabled&&e.watcher.used<e.watcher.cap&&!xd(e,t)}function xI(e,t=new Date){return xd(e,t)?"Live answers: watcher stopped":`Live answers: ${wd(e,t)?"on":"off"}`}function wI(e){return(e==null?void 0:e.status)==="ok"&&e.watcher.enabled?`Answers used: ${e.watcher.used} of ${e.watcher.cap}`:null}const Ju=G(null),is=G(null),kd=G("");async function kI(){const[e,t]=await Promise.allSettled([sR(),oR()]);e.status==="fulfilled"&&(Ju.value=e.value),t.status==="fulfilled"&&(is.value=t.value)}function ol(e=1500){const t=G(!1);let n;async function r(s){await navigator.clipboard.writeText(s),t.value=!0,clearTimeout(n),n=setTimeout(()=>t.value=!1,e)}return{copied:t,copy:r}}const _I=/on this bundle:? (.+)$/;function Oy(e){var t;return((t=_I.exec(e))==null?void 0:t[1])??e}function CI(e,t){return`Invoke the /review-workspace skill on this bundle ${Oy(e)}: the MR has new commits (live head ${t}). Start the next round.`}function Py(e){return!e||e.type==="general"?"the whole MR":e.type==="line"?`${e.path}:${e.line}`:e.path}function SI(e,t){return`Invoke the /review-workspace skill on this bundle ${Oy(e)}: answer this Question on ${Py(t.target)}: ${t.body}`}function TI(e,t){return(e==null?void 0:e.type)==="general"?`Draft this as a general MR comment, not an inline one. Post it only after I say "send" and agree to a general comment: ${t.trim()}`:`Post this comment to the MR inline: ${Py(e)} ${t.trim()}`}const AI={key:0,class:"italic text-muted"},EI={key:1,"data-testid":"waiting-for-agent",class:"flex items-center gap-2"},Ry=Y({__name:"PendingAnswer",props:{question:{}},setup(e){const{copied:t,copy:n}=ol();return(r,s)=>{const o=kt;return d(wd)(d(is))?(y(),T("p",AI,"Not answered yet.")):(y(),T("div",EI,[s[1]||(s[1]=C("span",{class:"italic text-muted"},"Waiting for the agent.",-1)),B(o,{size:"xs",variant:"soft",onClick:s[0]||(s[0]=i=>d(n)(d(SI)(d(kd),e.question)))},{default:R(()=>[me(q(d(t)?"Copied!":"Send to agent"),1)]),_:1})]))}}}),OI={class:"flex items-center"},PI={key:0,"data-testid":"note-line-label",class:"shrink-0 font-mono text-[10px] text-dimmed"},RI={class:"grid h-[18px] w-[18px] shrink-0 place-items-center rounded-full border border-warning/60 text-[10px] font-bold text-warning"},II={class:"truncate"},$I={key:2,class:"ml-auto shrink-0 text-muted"},qI={key:0,class:"border-t border-warning/30 px-3 py-2"},MI=["innerHTML"],DI={key:0,class:"mt-2 space-y-1 border-t border-default pt-2"},LI=["onMouseenter"],NI=["onClick"],BI={class:"text-muted"},zI={key:1,class:"mt-2 space-y-2 border-t border-default pt-2"},FI={class:"font-semibold"},jI=["innerHTML"],HI={class:"mt-2 flex items-center gap-3 border-t border-control pt-2"},VI=Y({__name:"InlineNote",props:{annotation:{},number:{},questions:{},answers:{}},setup(e){const t=e,n=G(!1),r=E(()=>td(t.annotation.id)),s=E(()=>zo(t.annotation.summary)),o=E(()=>RO(t.questions,t.annotation.target)),i=E(()=>Sy(fn.value,t.annotation.target));function a(){n.value=!n.value,ph(t.annotation.id,i.value,n.value)}as(()=>ph(t.annotation.id,[],!1));const l=G(null);function u(p){var g;const h=(g=t.annotation.relatedTargets)==null?void 0:g[p];return h?No(fn.value,h.target):null}function c(p){var h;(h=document.getElementById(Qn(p)))==null||h.scrollIntoView({behavior:"smooth",block:"start"})}function f(p){return t.answers.find(h=>h.questionId===p)}return(p,h)=>{var v;const g=mn,m=Qa;return y(),T("div",{"data-testid":"inline-note",class:se(["my-1 max-w-3xl whitespace-normal rounded border font-sans text-xs",r.value?"border-success/40 bg-success/5":"border-warning/40 bg-warning/5"]),onMouseenter:h[2]||(h[2]=x=>d(fh)(i.value)),onMouseleave:h[3]||(h[3]=x=>d(fh)([]))},[C("div",OI,[C("button",{type:"button",class:"flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left",onClick:a},[d(ch)(e.annotation.target)?(y(),T("span",PI,q(d(ch)(e.annotation.target)),1)):L("",!0),C("span",RI,q(e.number),1),e.annotation.verdict&&!n.value?(y(),$(g,{key:1,size:"sm",variant:"subtle",color:d(yd)(e.annotation.verdict),class:"shrink-0"},{default:R(()=>[me(q(d(vd)(e.annotation.verdict)),1)]),_:1},8,["color"])):L("",!0),C("span",II,q(s.value.headline),1),o.value.length?(y(),T("span",$I,q(o.value.length)+" in thread",1)):L("",!0),C("span",{class:se(["shrink-0 text-dimmed",{"ml-auto":!o.value.length}])},q(n.value?"▾":"▸"),3)]),B(Ey,{target:e.annotation.target,class:"mr-1 shrink-0"},null,8,["target"])]),n.value?(y(),T("div",qI,[B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("div",{class:"markdown-body text-muted",innerHTML:d($r)(e.annotation.summary)},null,8,MI),B(rl,{suggestion:e.annotation.suggestion},null,8,["suggestion"]),(v=e.annotation.relatedTargets)!=null&&v.length?(y(),T("ul",DI,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(x,b)=>(y(),T("li",{key:b,onMouseenter:w=>l.value=b,onMouseleave:h[0]||(h[0]=w=>l.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:w=>c(x.target.path)}," → "+q(x.target.path),9,NI),C("span",BI," — "+q(x.reason),1),l.value===b&&u(b)?(y(),$(Bo,{key:0,class:"mt-1",lines:u(b).lines},null,8,["lines"])):L("",!0)],40,LI))),128))])):L("",!0),o.value.length?(y(),T("ul",zI,[(y(!0),T(ne,null,Ee(o.value,x=>(y(),T("li",{key:x.id},[C("p",FI,q(x.body),1),f(x.id)?(y(),T("div",{key:0,class:"markdown-body mt-1 text-muted",innerHTML:d($r)(f(x.id).body)},null,8,jI)):x.kind==="question"?(y(),$(Ry,{key:1,class:"mt-1",question:x},null,8,["question"])):L("",!0)]))),128))])):L("",!0),C("div",HI,[B(m,{"model-value":r.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":h[1]||(h[1]=x=>d(nd)(e.annotation.id))},null,8,["model-value"]),B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])])):L("",!0)],34)}}}),UI=32;function gh(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error(`failed to load ${e}`)),r.src=e})}function mh(e){const t=document.createElement("canvas");t.width=e.naturalWidth,t.height=e.naturalHeight;const n=t.getContext("2d");return n.drawImage(e,0,0),n.getImageData(0,0,t.width,t.height)}function WI(e,t,n){const r=e.width,s=e.height;let o=0;for(let i=0;i<e.data.length;i+=4)if(Math.abs(e.data[i]-t.data[i])+Math.abs(e.data[i+1]-t.data[i+1])+Math.abs(e.data[i+2]-t.data[i+2])>UI)o++,n.data[i]=255,n.data[i+1]=0,n.data[i+2]=0,n.data[i+3]=255;else{const l=(t.data[i]+t.data[i+1]+t.data[i+2])/3;n.data[i]=l,n.data[i+1]=l,n.data[i+2]=l,n.data[i+3]=90}return{width:r,height:s,changedPercent:o/(r*s)*100}}function GI(e,t,n){if(e.naturalWidth!==t.naturalWidth||e.naturalHeight!==t.naturalHeight)return{error:`Dimensions differ: base ${e.naturalWidth}×${e.naturalHeight} vs head ${t.naturalWidth}×${t.naturalHeight} — cannot pixel-diff.`};const r=e.naturalWidth,s=e.naturalHeight,o=mh(e),i=mh(t);n.width=r,n.height=s;const a=n.getContext("2d"),l=a.createImageData(r,s),u=WI(o,i,l);return a.putImageData(l,0,0),u}const KI={single:"max-w-md",pane:"max-w-md flex-1",paneImage:"w-full",stage:"max-w-2xl",stageImage:"max-w-full",cursor:"cursor-zoom-in"},YI={single:"max-w-full",pane:"min-w-0 flex-1",paneImage:"max-h-[70vh] w-full object-contain",stage:"max-w-full",stageImage:"max-h-[70vh] max-w-full",cursor:""};function QI(e){return e?YI:KI}const XI={class:"border-t border-default p-4"},ZI={class:"mb-3 text-xs text-muted"},JI=["src","alt"],e$={key:1},t$={class:"mb-3 flex gap-2"},n$={key:0,class:"flex gap-3"},r$=["src","alt"],s$=["src","alt"],o$={class:"relative inline-block overflow-hidden rounded border border-default"},i$=["src","alt"],a$=["src","alt"],l$={class:"relative inline-block overflow-hidden rounded border border-default"},u$=["src","alt"],c$=["src","alt"],d$={class:"mt-1 text-[10px] text-muted"},f$={key:0,class:"text-xs text-muted"},p$={key:1,class:"text-xs text-warning"},h$={key:2,class:"mb-2 text-xs text-muted"},g$=["src"],Iy=Y({__name:"ImageDiff",props:{assetPath:{},baseAssetPath:{},comparisonModes:{},description:{},large:{type:Boolean}},setup(e){const t=e,n=E(()=>QI(t.large===!0)),r=G(t.comparisonModes[0]??"side-by-side"),s=G(50),o=E(()=>ur(t.assetPath)),i=E(()=>t.baseAssetPath?ur(t.baseAssetPath):null),a=Or("diffCanvas"),l=G(null),u=G(null),c=G(!1);async function f(){if(i.value&&(await tt(),!!a.value)){c.value=!0,u.value=null,l.value=null;try{const[x,b]=await Promise.all([gh(i.value),gh(o.value)]),w=GI(x,b,a.value);"error"in w?u.value=w.error:l.value=w}catch(x){u.value=x instanceof Error?x.message:String(x)}finally{c.value=!1}}}Me(r,x=>{x==="changed-pixel"&&f()}),dt(()=>{r.value==="changed-pixel"&&f()});const p={"side-by-side":"Side by side",swipe:"Swipe","onion-skin":"Onion skin","changed-pixel":"Changed pixels"},h=G(null),g=Or("lightboxDialog");function m(x){var b;t.large||(h.value=x,(b=g.value)==null||b.showModal())}function v(){var x;(x=g.value)==null||x.close(),h.value=null}return(x,b)=>{const w=kt;return y(),T("div",XI,[C("p",ZI,q(e.description),1),i.value?(y(),T("div",e$,[C("div",t$,[(y(!0),T(ne,null,Ee(e.comparisonModes,k=>(y(),$(w,{key:k,size:"xs",variant:r.value===k?"solid":"outline",onClick:O=>r.value=k},{default:R(()=>[me(q(p[k]),1)]),_:2},1032,["variant","onClick"]))),128))]),r.value==="side-by-side"?(y(),T("div",n$,[C("div",{class:se(n.value.pane)},[b[10]||(b[10]=C("div",{class:"mb-1 text-[10px] font-bold text-muted"},"Base",-1)),C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["rounded border border-default",[n.value.cursor,n.value.paneImage]]),onClick:b[1]||(b[1]=k=>m(i.value))},null,10,r$)],2),C("div",{class:se(n.value.pane)},[b[11]||(b[11]=C("div",{class:"mb-1 text-[10px] font-bold text-muted"},"Head",-1)),C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["rounded border border-default",[n.value.cursor,n.value.paneImage]]),onClick:b[2]||(b[2]=k=>m(o.value))},null,10,s$)],2)])):r.value==="swipe"?(y(),T("div",{key:1,class:se(n.value.stage)},[C("div",o$,[C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[3]||(b[3]=k=>m(i.value))},null,10,i$),C("div",{class:"absolute inset-0 overflow-hidden",style:wt({clipPath:`inset(0 ${100-s.value}% 0 0)`})},[C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[4]||(b[4]=k=>m(o.value))},null,10,a$)],4),C("div",{class:"pointer-events-none absolute inset-y-0 w-0.5 bg-primary",style:wt({left:`${s.value}%`})},null,4)]),Ds(C("input",{"onUpdate:modelValue":b[5]||(b[5]=k=>s.value=k),type:"range",min:"0",max:"100",class:"mt-2 w-full"},null,512),[[yf,s.value,void 0,{number:!0}]]),b[12]||(b[12]=C("p",{class:"mt-1 text-[10px] text-muted"},"Left of the line: head. Right of the line: base.",-1))],2)):r.value==="onion-skin"?(y(),T("div",{key:2,class:se(n.value.stage)},[C("div",l$,[C("img",{src:i.value,alt:`${e.assetPath} (base)`,class:se(["block",[n.value.cursor,n.value.stageImage]]),onClick:b[6]||(b[6]=k=>m(i.value))},null,10,u$),C("img",{src:o.value,alt:`${e.assetPath} (head)`,class:se(["absolute inset-0 block",[n.value.cursor,n.value.stageImage]]),style:wt({opacity:s.value/100}),onClick:b[7]||(b[7]=k=>m(o.value))},null,14,c$)]),Ds(C("input",{"onUpdate:modelValue":b[8]||(b[8]=k=>s.value=k),type:"range",min:"0",max:"100",class:"mt-2 w-full"},null,512),[[yf,s.value,void 0,{number:!0}]]),C("p",d$,q(s.value)+"% head opacity over base.",1)],2)):(y(),T("div",{key:3,class:se(n.value.stage)},[c.value?(y(),T("p",f$,"Computing pixel diff…")):u.value?(y(),T("p",p$,q(u.value),1)):l.value?(y(),T("p",h$,q(l.value.width)+"×"+q(l.value.height)+" — "+q(l.value.changedPercent.toFixed(2))+"% pixels changed (red = changed, threshold-based, not pixel-perfect) ",1)):L("",!0),C("canvas",{ref_key:"diffCanvas",ref:a,class:"max-w-full rounded border border-default"},null,512)],2))])):(y(),T("div",{key:0,class:se(n.value.single)},[C("img",{src:o.value,alt:e.assetPath,class:se(["rounded border border-default",[n.value.cursor,n.value.stageImage]]),onClick:b[0]||(b[0]=k=>m(o.value))},null,10,JI)],2)),C("dialog",{ref_key:"lightboxDialog",ref:g,class:"max-h-none max-w-none overflow-visible border-0 bg-transparent p-0 backdrop:bg-black/80",onClick:v,onClose:b[9]||(b[9]=k=>h.value=null)},[h.value?(y(),T("img",{key:0,src:h.value,alt:"",class:"max-h-[92vh] max-w-[92vw] cursor-zoom-out object-contain"},null,8,g$)):L("",!0)],544)])}}}),m$=["aria-label"],v$=["aria-label"],y$={class:"flex items-start justify-between gap-3 p-3 pb-0"},b$={class:"text-sm font-semibold"},$y=Y({__name:"ImageLightbox",props:{assetPath:{},baseAssetPath:{},caption:{}},setup(e){const t=["side-by-side","swipe","onion-skin","changed-pixel"],n=Or("dialog"),r=G(!1);function s(){var i;r.value=!0,(i=n.value)==null||i.showModal()}function o(i){var a;i.target===n.value&&((a=n.value)==null||a.close())}return(i,a)=>{const l=kt;return y(),T(ne,null,[C("button",{type:"button",class:"block w-full cursor-zoom-in text-left","aria-label":`Enlarge image: ${e.caption}`,"data-testid":"enlarge-image",onClick:s},[U(i.$slots,"default")],8,m$),C("dialog",{ref_key:"dialog",ref:n,"data-testid":"image-lightbox","aria-label":e.caption,class:"m-auto max-h-[94vh] w-[min(96vw,90rem)] overflow-auto rounded-lg border border-default bg-default p-0 text-default backdrop:bg-black/80",onClick:o,onClose:a[1]||(a[1]=u=>r.value=!1)},[C("div",y$,[C("p",b$,q(e.caption),1),B(l,{size:"xs",variant:"soft",color:"neutral",onClick:a[0]||(a[0]=u=>{var c;return(c=n.value)==null?void 0:c.close()})},{default:R(()=>[...a[2]||(a[2]=[me("Close",-1)])]),_:1})]),r.value?(y(),$(Iy,{key:0,large:"","asset-path":e.assetPath,"base-asset-path":e.baseAssetPath,"comparison-modes":[...t],description:"Click outside the picture or press Esc to close."},null,8,["asset-path","base-asset-path","comparison-modes"])):L("",!0)],40,v$)],64)}}}),x$={class:"max-h-96 w-80 space-y-3 overflow-y-auto p-3 text-xs","data-testid":"proof-popover"},w$={key:0,class:"grid grid-cols-2 gap-1"},k$=["src","alt"],_$=["src","alt"],C$=["src","alt"],S$={class:"mt-1 text-muted"},T$=["onClick"],_d=Y({__name:"ProofIcon",props:{proofs:{}},setup(e){function t(n){var r;(r=document.getElementById(Qn(n)))==null||r.scrollIntoView({behavior:"smooth",block:"start"})}return(n,r)=>{const s=kt,o=Za;return e.proofs.length?(y(),$(o,{key:0},{content:R(()=>[C("div",x$,[(y(!0),T(ne,null,Ee(e.proofs,i=>(y(),T("figure",{key:i.evidenceId},[B($y,{"asset-path":i.assetPath,"base-asset-path":i.baseAssetPath,caption:i.caption},{default:R(()=>[i.baseAssetPath?(y(),T("div",w$,[C("img",{src:d(ur)(i.baseAssetPath),alt:`Before: ${i.caption}`,class:"rounded border border-default"},null,8,k$),C("img",{src:d(ur)(i.assetPath),alt:`After: ${i.caption}`,class:"rounded border border-default"},null,8,_$)])):(y(),T("img",{key:1,src:d(ur)(i.assetPath),alt:i.caption,class:"rounded border border-default"},null,8,C$))]),_:2},1032,["asset-path","base-asset-path","caption"]),C("figcaption",S$,q(i.caption),1),C("button",{type:"button",class:"mt-0.5 font-mono text-primary hover:underline",onClick:a=>t(i.imagePath)}," → "+q(i.imagePath),9,T$)]))),128))])]),default:R(()=>[B(s,{"data-testid":"proof-icon",size:"xs",variant:"ghost",color:"primary",icon:"i-lucide-image","aria-label":`Proof: ${e.proofs.length} image${e.proofs.length===1?"":"s"} show this change works`},null,8,["aria-label"])]),_:1})):L("",!0)}}});function A$(e){return e.kind==="change-request"?e.resolved?"✓":"!":"?"}function E$(e){return e.status==="withdrawn"?"border-dimmed/60 bg-dimmed/10 text-dimmed line-through":e.kind==="change-request"?e.resolved?"border-success/60 bg-success/10 text-success opacity-70":"border-error/60 bg-error/15 text-error hover:bg-error hover:text-inverted":"border-info/60 bg-info/15 text-info hover:bg-info hover:text-inverted"}function qy(e){return e.kind==="change-request"?"error":"info"}function My(e){return e.kind==="change-request"?"Change request":"Question"}function Dy(e,t=!1){return e.resolved||t?"success":e.status==="open"?"warning":"neutral"}function Ly(e,t=!1){return e.resolved?"Resolved":t?"Answered":e.status==="open"?"Open":"Withdrawn"}function O$(e){return e==="target-touched"?"success":e==="target-partially-touched"?"warning":e==="target-gone"?"error":"neutral"}function P$(e){switch(e){case"target-touched":return"Touched by new commits";case"target-partially-touched":return"Partially touched by new commits";case"target-untouched":return"Not touched by new commits";case"target-gone":return"Target gone"}}const R$={class:"inline-flex items-center gap-1 align-middle"},I$=["aria-label","onClick"],da=Y({__name:"QuestionThread",props:{target:{},questions:{}},setup(e){const t=e;function n(){vy({target:t.target??{type:"general"}})}return(r,s)=>(y(),T("span",R$,[(y(!0),T(ne,null,Ee(e.questions,o=>(y(),T("button",{key:o.id,type:"button",class:se(["grid h-[18px] w-[18px] place-items-center rounded-full border text-[10px] font-bold transition hover:scale-110",d(E$)(o)]),"aria-label":`${o.kind==="change-request"?"Change request":"Question"}${o.resolved?" (resolved)":""}: ${o.body}`,onClick:i=>d(nl)(o)},q(d(A$)(o)),11,I$))),128)),C("button",{type:"button",class:"grid h-[18px] w-[18px] place-items-center rounded-full border border-dimmed/40 text-[10px] text-dimmed opacity-0 transition group-hover:opacity-100 hover:scale-110 hover:border-info hover:text-info focus-visible:opacity-100","aria-label":"Comment on this",onClick:n}," + ")]))}}),$$={class:"overflow-x-auto font-mono text-xs"},q$={class:"table w-max min-w-full border-collapse"},M$={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},D$=["id","data-highlighted"],L$={class:"table-cell select-none px-2 text-right align-baseline text-dimmed"},N$={class:"table-cell select-none px-2 text-right align-baseline text-dimmed"},B$={class:"table-cell select-none px-1 align-baseline"},z$={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},F$=["innerHTML"],j$=["onClick"],H$=Y({__name:"DiffInlineLayout",props:{file:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e;function n(i){return Qv(t.file.path,i)}function r(i){const a=t.file.hunks[i];return ky(n(i),a.lines)}function s(i){return _y(n(i),t.file.hunks[i].lines)}const o=E(()=>t.file.path);return(i,a)=>(y(),T("div",$$,[(y(!0),T(ne,null,Ee(e.file.hunks,(l,u)=>(y(),T(ne,{key:u},[C("div",q$,[C("div",M$,[me(" @@ -"+q(l.oldStart)+","+q(l.oldLines)+" +"+q(l.newStart)+","+q(l.newLines)+" @@ ",1),B(_d,{proofs:l.proofs,class:"ml-2 align-middle"},null,8,["proofs"])]),(y(!0),T(ne,null,Ee(r(u),c=>(y(),T("div",{id:d(Hs)(c.id),key:c.id,class:se(["group table-row",{"bg-success/10":c.kind==="add","bg-error/10":c.kind==="remove","line-highlighted":d(hh)(c.id)}]),"data-highlighted":d(hh)(c.id)||void 0},[C("span",L$,q(c.oldLine??""),1),C("span",N$,q(c.newLine??""),1),C("span",{class:se(["table-cell select-none text-center align-baseline",{"text-success":c.kind==="add","text-error":c.kind==="remove"}])},q(c.kind==="add"?"+":c.kind==="remove"?"−":""),3),C("span",B$,[B(da,{target:d(OO)(o.value,c.text,c.oldLine,c.newLine),questions:d(aa)(e.questions,o.value,c.newLine!==void 0?"head":"base",c.newLine??c.oldLine)},null,8,["target","questions"])]),C("span",z$,[C("code",{innerHTML:d(Us)(c.text),onClick:a[0]||(a[0]=(...f)=>d(Es)&&d(Es)(...f))},null,8,F$),B(Zu,{annotations:[],diagnostics:c.diagnostics,numbers:e.annotationNumbers},null,8,["diagnostics","numbers"]),(y(!0),T(ne,null,Ee(c.annotations,f=>(y(),$(VI,{key:f.id,annotation:f,number:e.annotationNumbers.get(f.id)??0,questions:e.questions,answers:e.answers},null,8,["annotation","number","questions","answers"]))),128))])],10,D$))),128))]),s(u)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:c=>d(ss)(e.file.path,u)}," ⋯ Show "+q(s(u))+" more lines ",9,j$)):L("",!0)],64))),128))]))}});function V$(){const e=Or("leftPane"),t=Or("rightPane");let n=!1;function r(s,o){!s||!o||n||(n=!0,o.scrollLeft=s.scrollLeft,n=!1)}return{leftPane:e,rightPane:t,syncScroll:r}}const U$={class:"font-mono text-xs"},W$={class:"grid grid-cols-2"},G$={class:"table w-max min-w-full border-collapse"},K$={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},Y$=["id"],Q$={class:"table-cell w-12 select-none px-2 text-right align-baseline text-dimmed"},X$={class:"table-cell w-4 select-none text-center align-baseline text-error"},Z$={class:"table-cell select-none px-1 align-baseline"},J$={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},eq=["innerHTML"],tq=["onClick"],nq={class:"table w-max min-w-full border-collapse"},rq={class:"table-caption caption-top whitespace-nowrap bg-elevated px-3 py-1 text-primary"},sq=["id"],oq={class:"table-cell w-12 select-none px-2 text-right align-baseline text-dimmed"},iq={class:"table-cell w-4 select-none text-center align-baseline text-success"},aq={class:"table-cell select-none px-1 align-baseline"},lq={class:"table-cell whitespace-pre px-2 align-baseline text-[var(--syntax-text)]"},uq=["innerHTML"],cq=["onClick"],dq=Y({__name:"DiffSideBySideLayout",props:{file:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e,{leftPane:n,rightPane:r,syncScroll:s}=V$(),o=E(()=>t.file.hunks.map(c=>aO(c.lines))),i=E(()=>t.file.path);function a(c){return Qv(t.file.path,c)}function l(c){return ky(a(c),o.value[c])}function u(c){return _y(a(c),o.value[c])}return(c,f)=>(y(),T("div",U$,[f[4]||(f[4]=C("div",{class:"grid grid-cols-2 border-b border-default bg-elevated text-[10px] font-bold text-muted"},[C("span",{class:"px-3 py-1"},"Base · before"),C("span",{class:"border-l border-default px-3 py-1"},"MR head · after")],-1)),C("div",W$,[C("div",{ref_key:"leftPane",ref:n,class:"min-w-0 overflow-x-auto",onScroll:f[1]||(f[1]=p=>d(s)(d(n),d(r)))},[(y(!0),T(ne,null,Ee(e.file.hunks,(p,h)=>(y(),T(ne,{key:h},[C("div",G$,[C("div",K$,[me(" @@ -"+q(p.oldStart)+","+q(p.oldLines)+" @@ ",1),B(_d,{proofs:p.proofs,class:"ml-2 align-middle"},null,8,["proofs"])]),(y(!0),T(ne,null,Ee(l(h),(g,m)=>{var v,x,b;return y(),T("div",{id:g.left&&g.left!==g.right?d(Hs)(g.left.id):void 0,key:m,class:se(["group table-row",{"bg-error/10":((v=g.left)==null?void 0:v.kind)==="remove"}])},[C("span",Q$,q(((x=g.left)==null?void 0:x.oldLine)??""),1),C("span",X$,q(((b=g.left)==null?void 0:b.kind)==="remove"?"−":""),1),C("span",Z$,[g.left?(y(),$(da,{key:0,target:{type:"line",path:i.value,side:"base",line:g.left.oldLine,expectedText:g.left.text},questions:d(aa)(e.questions,i.value,"base",g.left.oldLine)},null,8,["target","questions"])):L("",!0)]),C("span",J$,[g.left?(y(),T(ne,{key:0},[C("code",{innerHTML:d(Us)(g.left.text),onClick:f[0]||(f[0]=(...w)=>d(Es)&&d(Es)(...w))},null,8,eq),B(Zu,{annotations:g.left.annotations,diagnostics:g.left.diagnostics,numbers:e.annotationNumbers},null,8,["annotations","diagnostics","numbers"])],64)):L("",!0)])],10,Y$)}),128))]),u(h)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:g=>d(ss)(e.file.path,h)}," ⋯ Show "+q(u(h))+" more rows ",9,tq)):L("",!0)],64))),128))],544),C("div",{ref_key:"rightPane",ref:r,class:"min-w-0 overflow-x-auto border-l border-default",onScroll:f[3]||(f[3]=p=>d(s)(d(r),d(n)))},[(y(!0),T(ne,null,Ee(e.file.hunks,(p,h)=>(y(),T(ne,{key:h},[C("div",nq,[C("div",rq," @@ +"+q(p.newStart)+","+q(p.newLines)+" @@ ",1),(y(!0),T(ne,null,Ee(l(h),(g,m)=>{var v,x,b;return y(),T("div",{id:g.right?d(Hs)(g.right.id):void 0,key:m,class:se(["group table-row",{"bg-success/10":((v=g.right)==null?void 0:v.kind)==="add"}])},[C("span",oq,q(((x=g.right)==null?void 0:x.newLine)??""),1),C("span",iq,q(((b=g.right)==null?void 0:b.kind)==="add"?"+":""),1),C("span",aq,[g.right?(y(),$(da,{key:0,target:{type:"line",path:i.value,side:"head",line:g.right.newLine,expectedText:g.right.text},questions:d(aa)(e.questions,i.value,"head",g.right.newLine)},null,8,["target","questions"])):L("",!0)]),C("span",lq,[g.right?(y(),T(ne,{key:0},[C("code",{innerHTML:d(Us)(g.right.text),onClick:f[2]||(f[2]=(...w)=>d(Es)&&d(Es)(...w))},null,8,uq),B(Zu,{annotations:g.right.annotations,diagnostics:g.right.diagnostics,numbers:e.annotationNumbers},null,8,["annotations","diagnostics","numbers"])],64)):L("",!0)])],10,sq)}),128))]),u(h)?(y(),T("button",{key:0,type:"button",class:"w-full border-b border-default bg-elevated/50 px-3 py-1.5 text-left text-[10px] text-muted hover:text-default",onClick:g=>d(ss)(e.file.path,h)}," ⋯ Show "+q(u(h))+" more rows ",9,cq)):L("",!0)],64))),128))],544)])]))}}),fq={key:0,class:"border-b border-default bg-warning/10 px-4 py-2 text-xs"},pq={class:"mt-1 list-disc space-y-1 pl-4","data-testid":"file-diagnostics"},hq=Y({__name:"FileDiagnostics",props:{diagnostics:{}},setup(e){return(t,n)=>e.diagnostics.length?(y(),T("div",fq,[C("strong",null,q(e.diagnostics.length)+" diagnostic"+q(e.diagnostics.length===1?"":"s")+" on this file",1),C("ul",pq,[(y(!0),T(ne,null,Ee(e.diagnostics,(r,s)=>(y(),T("li",{key:s},q(d(bd)(r)),1))),128))])])):L("",!0)}}),gq={class:"border-t border-default p-4 text-sm"},mq={class:"flex flex-wrap items-center gap-2"},vq=["href"],yq={class:"mt-2 text-xs text-muted"},bq={key:0,class:"mt-2 overflow-x-auto rounded bg-elevated p-2 font-mono text-xs whitespace-pre-wrap"},xq=Y({__name:"PipelineEvidence",props:{jobName:{},status:{},url:{},logExcerpt:{},description:{}},setup(e){const t={success:"success",failed:"error",running:"info",canceled:"neutral",skipped:"neutral"},n=G(!1);return(r,s)=>{const o=mn,i=kt;return y(),T("div",gq,[C("div",mq,[B(o,{size:"sm",variant:"subtle",color:t[e.status]},{default:R(()=>[me(q(e.status),1)]),_:1},8,["color"]),C("a",{href:e.url,target:"_blank",rel:"noopener",class:"font-mono text-xs text-primary hover:underline"},q(e.jobName),9,vq),e.logExcerpt?(y(),$(i,{key:0,size:"xs",variant:"ghost",class:"ml-auto",onClick:s[0]||(s[0]=a=>n.value=!n.value)},{default:R(()=>[me(q(n.value?"Hide log":"Show log"),1)]),_:1})):L("",!0)]),C("p",yq,q(e.description),1),n.value&&e.logExcerpt?(y(),T("pre",bq,q(e.logExcerpt),1)):L("",!0)])}}});function wq(e){return e.hunkIndex===void 0?e.path:`${e.path} (change ${e.hunkIndex+1})`}const kq={key:0,"data-testid":"proof-back-links",class:"flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},_q=["onClick"],Cq=Y({__name:"ProofBackLinks",props:{links:{}},setup(e){function t(n){var r;(r=document.getElementById(Qn(n)))==null||r.scrollIntoView({behavior:"smooth",block:"start"})}return(n,r)=>e.links.length?(y(),T("div",kq,[r[0]||(r[0]=C("span",null,"This image shows that this code works:",-1)),(y(!0),T(ne,null,Ee(e.links,s=>(y(),T("button",{key:s.evidenceId+s.path,type:"button",class:"font-mono text-primary hover:underline",onClick:o=>t(s.path)}," → "+q(d(wq)(s)),9,_q))),128))])):L("",!0)}}),Sq=["id"],Tq={class:"truncate font-mono text-sm"},Aq={key:0,class:"shrink-0 text-xs text-muted"},Eq={class:"ml-auto flex items-center gap-2"},Oq={key:0,class:"px-4 py-2 text-xs text-muted"},Pq={key:0,class:"flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},Rq={key:1,class:"flex flex-wrap items-center gap-2 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},Iq=["title","onClick"],$q={class:"group flex flex-wrap items-center gap-3 border-b border-default bg-elevated/50 px-4 py-2 text-xs text-muted"},qq={key:0,class:"p-4 text-sm text-muted"},Mq=Y({__name:"DiffFile",props:{file:{},position:{},layout:{},annotationNumbers:{},questions:{},answers:{}},setup(e){const t=e,n=E(()=>wO(t.file)),r=E(()=>kO(t.file)),s=E(()=>Gv(t.file)),o=E(()=>yO(t.file.path)),i=E(()=>lO(t.file.path,_O(t.file)||o.value)),a=E(()=>CO(t.file)),l=E(()=>SO(t.file)),u=E(()=>PO(t.questions,t.file.path));return(c,f)=>{const p=mn,h=Qa,g=kt;return y(),T("article",{id:d(Qn)(e.file.path),class:se(["mb-6 overflow-clip rounded-lg border",o.value?"border-success bg-success/5":"border-default"])},[C("header",{class:se(["sticky top-0 z-10 flex items-center gap-3 border-b border-default bg-elevated px-4 py-2",{"bg-success/10":o.value}])},[f[3]||(f[3]=C("span",{class:"text-dimmed"},"◇",-1)),C("strong",Tq,q(e.file.path),1),e.position?(y(),T("span",Aq,"file "+q(e.position.index)+" of "+q(e.position.total),1)):L("",!0),C("span",Eq,[B(_d,{proofs:e.file.proofs},null,8,["proofs"]),e.file.binary?(y(),$(p,{key:0,color:"neutral",variant:"subtle",size:"sm"},{default:R(()=>[...f[2]||(f[2]=[me("binary",-1)])]),_:1})):(y(),T(ne,{key:1},[B(p,{color:"success",variant:"subtle",size:"sm"},{default:R(()=>[me("+"+q(n.value),1)]),_:1}),B(p,{color:"error",variant:"subtle",size:"sm"},{default:R(()=>[me("−"+q(r.value),1)]),_:1}),B(h,{"model-value":o.value,label:"Reviewed",size:"sm","onUpdate:modelValue":f[0]||(f[0]=m=>d(bO)(e.file.path))},null,8,["model-value"]),B(g,{icon:i.value?"i-lucide-chevron-right":"i-lucide-chevron-down",size:"xs",variant:"ghost",color:"neutral","aria-label":i.value?"Expand diff":"Collapse diff",onClick:f[1]||(f[1]=m=>d(uO)(e.file.path,i.value))},null,8,["icon","aria-label"])],64))])],2),B(hq,{diagnostics:e.file.diagnostics},null,8,["diagnostics"]),B(Cq,{links:e.file.proofFor},null,8,["links"]),i.value?(y(),T("div",Oq," Diff collapsed ("+q(s.value)+" lines) — click Expand above to view. ",1)):(y(),T(ne,{key:1},[a.value.length?(y(),T("div",Pq,[f[4]||(f[4]=C("span",null,"Notes on this file:",-1)),(y(!0),T(ne,null,Ee(a.value,m=>(y(),$(xy,{key:m.id,annotation:m,number:e.annotationNumbers.get(m.id)??0},null,8,["annotation","number"]))),128))])):L("",!0),l.value.length?(y(),T("div",Rq,[f[5]||(f[5]=C("span",null,"Agent comments in this file:",-1)),(y(!0),T(ne,null,Ee(l.value,m=>(y(),T("button",{key:m.annotation.id,type:"button",title:m.annotation.summary,class:"grid h-[18px] w-[18px] place-items-center rounded-full border border-warning/60 bg-warning/15 text-[10px] font-bold text-warning transition hover:scale-110 hover:bg-warning hover:text-inverted",onClick:v=>d(Zv)(e.file.path,m.hunkIndex,m.lineId)},q(e.annotationNumbers.get(m.annotation.id)??0),9,Iq))),128))])):L("",!0),C("div",$q,[f[6]||(f[6]=C("span",null,"Questions on this file:",-1)),B(da,{target:{type:"file",path:e.file.path},questions:u.value},null,8,["target","questions"])]),(y(!0),T(ne,null,Ee(e.file.pipelineEvidence,m=>(y(),$(xq,{key:m.id,"job-name":m.jobName,status:m.status,url:m.url,"log-excerpt":m.logExcerpt,description:m.description},null,8,["job-name","status","url","log-excerpt","description"]))),128)),e.file.binary?(y(),T(ne,{key:2},[e.file.imageEvidence.length===0?(y(),T("div",qq," Binary change — no image evidence attached to compare. ")):L("",!0),(y(!0),T(ne,null,Ee(e.file.imageEvidence,m=>(y(),$(Iy,{key:m.id,"asset-path":m.assetPath,"base-asset-path":m.baseAssetPath,"comparison-modes":m.comparisonModes,description:m.description},null,8,["asset-path","base-asset-path","comparison-modes","description"]))),128))],64)):e.layout==="inline"?(y(),$(H$,{key:3,file:e.file,"annotation-numbers":e.annotationNumbers,questions:e.questions,answers:e.answers},null,8,["file","annotation-numbers","questions","answers"])):(y(),$(dq,{key:4,file:e.file,"annotation-numbers":e.annotationNumbers,questions:e.questions,answers:e.answers},null,8,["file","annotation-numbers","questions","answers"]))],64))],10,Sq)}}});function Ny(e,t,n,r=new Date){return e.kind!=="question"||e.status!=="open"?null:t?"answered":(n==null?void 0:n.status)==="ok"&&n.watcher.current===e.id&&!xd(n,r)?"answering":"waiting"}const Dq={waiting:{label:"Waiting",icon:"i-lucide-clock",color:"neutral"},answering:{label:"Answering",icon:"i-lucide-loader-circle",color:"info"},answered:{label:"Answered",icon:"i-lucide-circle-check",color:"success"}};function By(e){return Dq[e]}function Lq(e){return[...e].sort((t,n)=>n.question.createdAt.localeCompare(t.question.createdAt))}function zy(e){if(!e)return"No target";switch(e.type){case"general":return"Whole change";case"hunk":return`${e.path} (hunk ${e.hunkIndex+1})`;case"line":return`${e.path}:${e.line}`;default:return e.path}}function Bi(e){if(!e)return"none";switch(e.type){case"general":return"general";case"hunk":return`hunk:${e.path}:${e.hunkIndex}`;case"line":return`line:${e.path}:${e.side}:${e.line}`;default:return`${e.type}:${e.path}`}}const Nq={type:"general"};function Bq(e){const t=[e,Nq];return t.filter((n,r)=>t.findIndex(s=>Bi(s)===Bi(n))===r).map(n=>({key:Bi(n),label:zy(n),target:n}))}function zq(e,t){return e>0?{text:String(e),srText:`${e} new answer${e===1?"":"s"}`,tone:"new"}:t>0?{text:String(t),srText:`${t} open`,tone:"open"}:null}const Fq={key:0,"data-testid":"general-comments",class:"mt-3 border-t border-default pt-3"},jq={class:"space-y-2"},Hq=["onClick"],Vq={class:"min-w-0 break-words"},Uq=Y({__name:"GeneralComments",props:{answers:{}},setup(e){const t=e,n=Xa(),r=E(()=>IO(Xv(n.questions)).map(s=>{const o=Ny(s,t.answers.some(i=>i.questionId===s.id),is.value);return{comment:s,badge:o?By(o):null}}));return(s,o)=>{const i=mn;return r.value.length?(y(),T("div",Fq,[o[0]||(o[0]=C("h3",{class:"mb-2 text-sm font-semibold"},"Your comments on the whole change",-1)),C("ul",jq,[(y(!0),T(ne,null,Ee(r.value,({comment:a,badge:l})=>(y(),T("li",{key:a.id,"data-testid":"general-comment"},[C("button",{type:"button",class:"flex w-full items-start gap-2 text-left",onClick:u=>d(nl)(a)},[B(i,{size:"sm",variant:"subtle",color:d(qy)(a),class:"shrink-0"},{default:R(()=>[me(q(d(My)(a)),1)]),_:2},1032,["color"]),l?(y(),$(i,{key:0,size:"sm",variant:"subtle",color:l.color,icon:l.icon,class:"shrink-0"},{default:R(()=>[me(q(l.label),1)]),_:2},1032,["color","icon"])):(y(),$(i,{key:1,size:"sm",variant:"subtle",color:d(Dy)(a),class:"shrink-0"},{default:R(()=>[me(q(d(Ly)(a)),1)]),_:2},1032,["color"])),C("span",Vq,q(a.body),1)],8,Hq)]))),128))])])):L("",!0)}}}),Wq={key:0,id:"general-findings","data-testid":"general-findings",class:"mb-4 rounded-lg border border-default bg-elevated p-4 text-sm"},Gq={class:"space-y-3"},Kq=["innerHTML"],Yq=Y({__name:"GeneralFindings",props:{findings:{},answers:{}},setup(e){return(t,n)=>e.findings.length?(y(),T("section",Wq,[n[0]||(n[0]=C("h2",{class:"mb-2 text-base font-semibold"},"Findings about the whole change",-1)),C("ul",Gq,[(y(!0),T(ne,null,Ee(e.findings,r=>(y(),T("li",{key:r.id,"data-testid":"general-finding",class:"rounded border border-default p-3"},[B(sl,{annotation:r},null,8,["annotation"]),C("div",{class:"markdown-body mt-1 text-muted",innerHTML:d($r)(r.summary)},null,8,Kq),B(rl,{suggestion:r.suggestion},null,8,["suggestion"]),B(ti,{class:"mt-2",target:r.target,annotation:r},null,8,["target","annotation"])]))),128))]),B(Uq,{answers:e.answers},null,8,["answers"])])):L("",!0)}}),vh=3;function Qq(e){const t=[...(e??[]).filter(n=>n.source==="mr-text"),...(e??[]).filter(n=>n.source!=="mr-text")];return{shown:t.slice(0,vh),more:t.slice(vh)}}const Xq={key:0,class:"grid grid-cols-2 gap-1"},Zq=["src","alt"],Jq=["src","alt"],e3=["src","alt"],t3={class:"mt-1 text-xs text-muted"},yh=Y({__name:"VisualFigure",props:{visual:{}},setup(e){return(t,n)=>(y(),T("figure",{"data-testid":"intent-visual",class:se(["max-w-full",e.visual.baseAssetPath?"w-[36rem]":"w-72"])},[B($y,{"asset-path":e.visual.assetPath,"base-asset-path":e.visual.baseAssetPath,caption:e.visual.caption},{default:R(()=>[e.visual.baseAssetPath?(y(),T("div",Xq,[C("div",null,[n[0]||(n[0]=C("p",{class:"text-[10px] font-bold text-muted"},"Before",-1)),C("img",{src:d(ur)(e.visual.baseAssetPath),alt:`Before: ${e.visual.caption}`,class:"rounded border border-default"},null,8,Zq)]),C("div",null,[n[1]||(n[1]=C("p",{class:"text-[10px] font-bold text-muted"},"After",-1)),C("img",{src:d(ur)(e.visual.assetPath),alt:`After: ${e.visual.caption}`,class:"rounded border border-default"},null,8,Jq)])])):(y(),T("img",{key:1,src:d(ur)(e.visual.assetPath),alt:e.visual.caption,class:"rounded border border-default"},null,8,e3))]),_:1},8,["asset-path","base-asset-path","caption"]),C("figcaption",t3,q(e.visual.caption),1)],2))}}),n3={key:0,"data-testid":"intent-visuals",class:"mt-3 flex flex-wrap items-start gap-3"},r3={key:0,"data-testid":"more-visuals",class:"basis-full"},s3={class:"cursor-pointer text-xs text-primary"},o3={class:"mt-2 flex flex-wrap items-start gap-3"},i3=Y({__name:"VisualsPanel",props:{visuals:{}},setup(e){const t=e,n=E(()=>Qq(t.visuals));return(r,s)=>n.value.shown.length?(y(),T("aside",n3,[(y(!0),T(ne,null,Ee(n.value.shown,o=>(y(),$(yh,{key:o.assetPath,visual:o},null,8,["visual"]))),128)),n.value.more.length?(y(),T("details",r3,[C("summary",s3,"More images ("+q(n.value.more.length)+")",1),C("div",o3,[(y(!0),T(ne,null,Ee(n.value.more,o=>(y(),$(yh,{key:o.assetPath,visual:o},null,8,["visual"]))),128))])])):L("",!0)])):L("",!0)}}),a3={"data-testid":"intent-panel",class:"mb-4 rounded-lg border border-default bg-elevated p-4 text-sm"},l3={key:0,class:"mb-3 rounded border border-warning/50 bg-warning/10 p-2 text-xs"},u3={class:"space-y-2"},c3={key:0},d3={class:"list-disc pl-5"},f3={class:"mt-3 text-xs text-muted"},p3=Y({__name:"IntentPanel",props:{intent:{}},setup(e){return(t,n)=>{var r;return y(),T("section",a3,[n[3]||(n[3]=C("h2",{class:"mb-2 text-base font-semibold"},"What this change is",-1)),e.intent.weakDescription?(y(),T("p",l3," The MR text is weak: "+q(e.intent.weakDescription),1)):L("",!0),C("dl",u3,[C("div",null,[n[0]||(n[0]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"What it does",-1)),C("dd",null,q(e.intent.does),1)]),C("div",null,[n[1]||(n[1]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"Why",-1)),C("dd",null,q(e.intent.why),1)]),(r=e.intent.doesNot)!=null&&r.length?(y(),T("div",c3,[n[2]||(n[2]=C("dt",{class:"text-xs font-semibold uppercase tracking-wide text-muted"},"What it does not do",-1)),C("dd",null,[C("ul",d3,[(y(!0),T(ne,null,Ee(e.intent.doesNot,s=>(y(),T("li",{key:s},q(s),1))),128))])])])):L("",!0)]),B(i3,{visuals:e.intent.visuals},null,8,["visuals"]),C("p",f3,"Sources: "+q(e.intent.sources.join(", ")),1)])}}});function h3(e){return e.filter(t=>t.verdict!=="intended")}function g3(e,t){return[...h3(e).map(n=>({kind:"general",annotation:n})),...t.map(n=>({kind:"verification",entry:n}))]}const m3={role:"region","aria-label":"Verdict",class:"mb-6 rounded-lg border border-default bg-elevated p-4"},v3={class:"mb-1 text-base font-bold text-highlighted"},y3=["innerHTML"],b3={class:"mb-4 grid grid-cols-2 gap-3 sm:grid-cols-4"},x3={class:"text-2xl font-bold text-success"},w3={class:"text-2xl font-bold text-error","data-testid":"open-gaps"},k3={class:"text-2xl font-bold text-warning"},_3={class:"text-2xl font-bold text-highlighted"},C3={key:1},S3={class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},T3={class:"space-y-1.5 text-xs"},A3={class:"w-4 shrink-0 text-right text-dimmed"},E3=["onClick"],O3={class:"hidden shrink-0 font-mono text-dimmed sm:inline"},P3={key:0,class:"mt-1.5 text-[11px] text-dimmed"},R3={key:2,class:"mt-3 flex flex-wrap gap-2 text-xs"},I3=["onClick"],bh=5,$3=Y({__name:"VerdictPanel",props:{summary:{},files:{},groups:{},generalAnnotations:{},openGaps:{}},setup(e){const t=e,n=G(!1),r=E(()=>t.summary?zo(t.summary.text):{headline:"",body:""}),s=E(()=>yy(t.files)),o=E(()=>{const p=gd(t.groups);return g3(t.generalAnnotations,md(hd(t.files),p))}),i=E(()=>o.value.slice(0,bh)),a=E(()=>Math.max(0,o.value.length-bh)),l={gap:"⚑",unverified:"○"},u={gap:"error",unverified:"warning"};function c(){var p;(p=document.getElementById("general-findings"))==null||p.scrollIntoView({behavior:"smooth",block:"start"})}function f(p){var h;(h=document.getElementById(Qn(p)))==null||h.scrollIntoView({behavior:"smooth",block:"start"})}return(p,h)=>{var m;const g=mn;return y(),T("section",m3,[e.summary?(y(),T(ne,{key:0},[C("h2",v3,q(r.value.headline),1),r.value.body?(y(),T("button",{key:0,type:"button",class:"mb-3 text-xs text-primary hover:underline",onClick:h[0]||(h[0]=v=>n.value=!n.value)},q(n.value?"▾ hide rest":"▸ read rest"),1)):L("",!0),n.value&&r.value.body?(y(),T("div",{key:1,class:"markdown-body mb-3 text-sm text-muted",innerHTML:d($r)(r.value.body)},null,8,y3)):L("",!0)],64)):L("",!0),C("div",b3,[C("div",null,[C("p",x3,q(s.value.verified),1),h[1]||(h[1]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Resolved",-1))]),C("div",null,[C("p",w3,q(e.openGaps),1),h[2]||(h[2]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Open gaps",-1))]),C("div",null,[C("p",k3,q(s.value.unverified),1),h[3]||(h[3]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Needs eyes",-1))]),C("div",null,[C("p",_3,q(e.files.length),1),h[4]||(h[4]=C("p",{class:"text-[11px] tracking-wide text-dimmed uppercase"},"Files changed",-1))])]),i.value.length?(y(),T("div",C3,[C("p",S3," Start here — "+q(o.value.length)+" item"+q(o.value.length===1?"":"s")+", ordered by risk ",1),C("ol",T3,[(y(!0),T(ne,null,Ee(i.value,(v,x)=>(y(),T("li",{key:v.kind==="general"?v.annotation.id:v.entry.verification.id,class:"flex items-center gap-2"},[C("span",A3,q(x+1),1),v.kind==="general"?(y(),T(ne,{key:0},[C("button",{type:"button",class:"flex-1 truncate text-left hover:underline",onClick:c},q(d(zo)(v.annotation.summary).headline),1),v.annotation.verdict?(y(),$(g,{key:0,size:"sm",variant:"subtle",color:d(yd)(v.annotation.verdict)},{default:R(()=>[me(q(d(vd)(v.annotation.verdict)),1)]),_:2},1032,["color"])):L("",!0),h[5]||(h[5]=C("span",{class:"hidden shrink-0 text-dimmed sm:inline"},"whole change",-1))],64)):(y(),T(ne,{key:1},[C("button",{type:"button",class:"flex-1 truncate text-left hover:underline",onClick:b=>f(v.entry.path)},q(v.entry.verification.description),9,E3),B(g,{size:"sm",variant:"subtle",color:u[v.entry.verification.status]},{default:R(()=>[me(q(l[v.entry.verification.status])+" "+q(v.entry.verification.status),1)]),_:2},1032,["color"]),C("span",O3,q(v.entry.path.split("/").pop()),1)],64))]))),128))]),a.value?(y(),T("p",P3,"+"+q(a.value)+" more not shown",1)):L("",!0)])):L("",!0),(m=e.summary)!=null&&m.highlightPaths.length?(y(),T("ul",R3,[(y(!0),T(ne,null,Ee(e.summary.highlightPaths,v=>(y(),T("li",{key:v},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:x=>f(v)},"→ "+q(v),9,I3)]))),128))])):L("",!0)])}}}),q3={"aria-labelledby":"before-you-read","data-testid":"before-you-read"},M3=Y({__name:"BeforeYouReadCode",props:{viewModel:{}},setup(e){return(t,n)=>(y(),T("section",q3,[n[0]||(n[0]=C("h2",{id:"before-you-read",class:"mb-3 text-lg font-bold text-highlighted"},"Before you read the code",-1)),e.viewModel.intent?(y(),$(p3,{key:0,intent:e.viewModel.intent},null,8,["intent"])):L("",!0),B(Yq,{findings:e.viewModel.generalAnnotations,answers:e.viewModel.answers},null,8,["findings","answers"]),e.viewModel.summary||e.viewModel.generalAnnotations.length?(y(),$($3,{key:1,summary:e.viewModel.summary,files:e.viewModel.files,groups:e.viewModel.groups,"general-annotations":e.viewModel.generalAnnotations,"open-gaps":e.viewModel.openGaps},null,8,["summary","files","groups","general-annotations","open-gaps"])):L("",!0)]))}}),D3={key:0,"data-testid":"stale-banner",class:"mb-4 flex items-center gap-3 rounded border border-warning/50 bg-warning/10 p-3 text-sm"},L3={class:"font-semibold"},N3=Y({__name:"StaleBanner",setup(e){const t=E(()=>vI(Ju.value)),{copied:n,copy:r}=ol();function s(){var i,a;const o=(a=(i=Ju.value)==null?void 0:i.liveHead)==null?void 0:a.head;o&&r(CI(kd.value,o))}return(o,i)=>{const a=kt;return t.value?(y(),T("div",D3,[C("span",L3,q(t.value),1),B(a,{size:"xs",class:"ml-auto",onClick:s},{default:R(()=>[me(q(d(n)?"Copied!":"Copy next-round prompt"),1)]),_:1})])):L("",!0)}}}),B3={class:"mb-1 flex flex-wrap items-start justify-between gap-2"},z3={class:"text-sm font-semibold text-highlighted"},F3={class:"flex items-center gap-2"},j3={class:"mb-1 truncate font-mono text-[10px] text-dimmed"},H3=["innerHTML"],V3={key:3,class:"mb-3 space-y-1 text-xs"},U3={class:"text-muted"},W3={key:4,class:"mb-2 flex flex-wrap items-center gap-1.5 text-[11px]"},G3={key:5,class:"mb-2 space-y-1 border-t border-default pt-2 text-xs"},K3=["onMouseenter"],Y3=["onClick"],Q3={class:"text-muted"},X3={class:"flex items-center gap-3"},Z3={class:"mt-3 border-t border-default pt-2"},J3=Y({__name:"AnnotationCard",props:{annotation:{},defaultExpanded:{type:Boolean,default:!1},jumpToDiff:{}},setup(e){const t=e,n=E(()=>zo(t.annotation.summary)),r=G(t.defaultExpanded);Me(()=>t.annotation.id,()=>{r.value=t.defaultExpanded});const s={verified:"✓",gap:"⚑",unverified:"○"},o={verified:"success",gap:"error",unverified:"neutral"},i={observed:"observed","author-claim":"claim",inference:"inference"},a={observed:"success","author-claim":"warning",inference:"neutral"};function l(h){var g;if(t.jumpToDiff){t.jumpToDiff(h);return}(g=document.getElementById(Qn(h)))==null||g.scrollIntoView({behavior:"smooth",block:"start"})}const u=G(null);function c(h){var m;const g=(m=t.annotation.relatedTargets)==null?void 0:m[h];return g?No(fn.value,g.target):null}const f=E(()=>td(t.annotation.id)),p=E(()=>No(fn.value,t.annotation.target));return(h,g)=>{var x;const m=mn,v=Qa;return y(),T("article",{class:se(["rounded-lg border p-4",f.value?"border-success bg-success/5":"border-default bg-elevated"])},[C("div",B3,[C("h3",z3,q(n.value.headline),1),C("span",F3,[B(Ey,{target:e.annotation.target},null,8,["target"]),e.annotation.kind?(y(),$(m,{key:0,size:"sm",variant:"subtle",color:"primary"},{default:R(()=>[me(q(e.annotation.kind),1)]),_:1})):L("",!0),B(v,{"model-value":f.value,label:"Resolved",size:"sm",ui:{base:"ring-control"},"onUpdate:modelValue":g[0]||(g[0]=b=>d(nd)(e.annotation.id))},null,8,["model-value"])])]),B(sl,{class:"mb-1",annotation:e.annotation},null,8,["annotation"]),C("p",j3,q(e.annotation.target.path),1),p.value?(y(),$(Bo,{key:0,class:"mb-2",lines:p.value.lines},null,8,["lines"])):L("",!0),n.value.body?(y(),T("button",{key:1,type:"button",class:"mb-2 text-xs text-primary hover:underline",onClick:g[1]||(g[1]=b=>r.value=!r.value)},q(r.value?"▾ hide detail":"▸ detail"),1)):L("",!0),r.value&&n.value.body?(y(),T("div",{key:2,class:"markdown-body mb-3 text-sm text-muted",innerHTML:d($r)(n.value.body)},null,8,H3)):L("",!0),B(rl,{class:"mb-3",suggestion:e.annotation.suggestion},null,8,["suggestion"]),e.annotation.verification.length?(y(),T("ul",V3,[(y(!0),T(ne,null,Ee(e.annotation.verification,b=>(y(),T("li",{key:b.id,class:"flex items-start gap-1.5"},[C("span",{class:se(`text-${o[b.status]}`)},q(s[b.status]),3),C("span",U3,q(b.description),1)]))),128))])):L("",!0),e.annotation.evidence.length?(y(),T("div",W3,[g[4]||(g[4]=C("span",{class:"text-dimmed uppercase tracking-wide"},"Evidence",-1)),(y(!0),T(ne,null,Ee(e.annotation.evidence,b=>(y(),$(m,{key:b.id,size:"sm",variant:"subtle",color:a[b.kind],title:b.description},{default:R(()=>{var w;return[me(q(((w=b.pipeline)==null?void 0:w.jobName)??i[b.kind])+" · "+q(i[b.kind]),1)]}),_:2},1032,["color","title"]))),128))])):L("",!0),(x=e.annotation.relatedTargets)!=null&&x.length?(y(),T("ul",G3,[(y(!0),T(ne,null,Ee(e.annotation.relatedTargets,(b,w)=>(y(),T("li",{key:w,onMouseenter:k=>u.value=w,onMouseleave:g[2]||(g[2]=k=>u.value=null)},[C("button",{type:"button",class:"font-mono text-primary hover:underline",onClick:k=>l(b.target.path)}," → "+q(b.target.path),9,Y3),C("span",Q3," — "+q(b.reason),1),u.value===w&&c(w)?(y(),$(Bo,{key:0,class:"mt-1",lines:c(w).lines},null,8,["lines"])):L("",!0)],40,K3))),128))])):L("",!0),C("div",X3,[C("button",{type:"button",class:"text-xs font-medium text-primary hover:underline",onClick:g[3]||(g[3]=b=>l(e.annotation.target.path))}," → jump to diff ")]),C("div",Z3,[B(ti,{target:e.annotation.target,annotation:e.annotation},null,8,["target","annotation"])])],2)}}}),eM={key:0,class:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center"},tM={key:1,class:"flex flex-1 flex-col items-center justify-center gap-6 overflow-y-auto p-8"},nM={class:"w-full max-w-2xl"},rM={class:"mb-3 flex items-center justify-between text-xs text-dimmed"},sM={key:1,class:"rounded-lg border border-default bg-elevated p-4 text-sm text-muted"},oM={class:"mb-3"},iM={key:0,class:"border-t border-default pt-2"},aM={class:"flex items-center gap-3"},lM=["disabled"],uM=["disabled"],cM=Y({__name:"FocusMode",props:{files:{},groups:{},currentId:{}},emits:["exit","update:currentId"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>{const h=new Map;for(const g of n.files)for(const m of g.annotations)h.set(m.id,m);return h}),o=E(()=>{const h=gd(n.groups);return md(hd(n.files),h)}),i=E(()=>{const h=o.value.findIndex(g=>g.verification.id===n.currentId);return h===-1?0:h}),a=E(()=>o.value[i.value]),l=E(()=>{var h;return(h=a.value)!=null&&h.annotationId?s.value.get(a.value.annotationId):void 0});function u(h){const g=Math.min(Math.max(h,0),o.value.length-1),m=o.value[g];m&&r("update:currentId",m.verification.id)}function c(){u(i.value+1)}function f(){u(i.value-1)}function p(h){const g=h.target;g&&["INPUT","TEXTAREA"].includes(g.tagName)||g!=null&&g.isContentEditable||((h.key==="ArrowRight"||h.key==="ArrowDown"||h.key==="j")&&c(),(h.key==="ArrowLeft"||h.key==="ArrowUp"||h.key==="k")&&f(),h.key==="Escape"&&r("exit",null))}return dt(()=>window.addEventListener("keydown",p)),as(()=>window.removeEventListener("keydown",p)),(h,g)=>{var m;return o.value.length?(y(),T("div",tM,[C("div",nM,[C("div",rM,[C("span",null,q(i.value+1)+" / "+q(o.value.length)+" — ordered by risk",1),C("button",{type:"button",class:"text-primary hover:underline",onClick:g[1]||(g[1]=v=>r("exit",null))},"Esc — exit focus mode")]),l.value?(y(),$(J3,{key:0,annotation:l.value,"default-expanded":!0,"jump-to-diff":v=>r("exit",v)},null,8,["annotation","jump-to-diff"])):(y(),T("div",sM,[C("p",oM,q((m=a.value)==null?void 0:m.verification.description),1),a.value?(y(),T("div",iM,[B(ti,{target:{type:"file",path:a.value.path}},null,8,["target"])])):L("",!0)])),a.value?(y(),T("button",{key:2,type:"button",class:"mt-3 text-sm font-medium text-primary hover:underline",onClick:g[2]||(g[2]=v=>r("exit",a.value.path))}," → view diff for this item ")):L("",!0)]),C("div",aM,[C("button",{type:"button",class:"rounded-full border border-default px-4 py-1.5 text-sm hover:bg-elevated disabled:opacity-30",disabled:i.value===0,onClick:f}," ← prev ",8,lM),C("button",{type:"button",class:"rounded-full border border-default px-4 py-1.5 text-sm hover:bg-elevated disabled:opacity-30",disabled:i.value===o.value.length-1,onClick:c}," next → ",8,uM)]),g[5]||(g[5]=C("p",{class:"text-[11px] text-dimmed"},"← → or j/k to step, Esc to exit",-1))])):(y(),T("div",eM,[g[3]||(g[3]=C("p",{class:"text-lg font-semibold text-highlighted"},"Nothing needs attention",-1)),g[4]||(g[4]=C("p",{class:"text-sm text-muted"},"Every Verification item in this bundle is already marked verified.",-1)),C("button",{type:"button",class:"mt-2 text-sm text-primary hover:underline",onClick:g[0]||(g[0]=v=>r("exit",null))},"Esc — exit focus mode")]))}}}),dM={slots:{overlay:"fixed inset-0 bg-elevated/75",content:"fixed bg-default divide-y divide-default sm:ring ring-default sm:shadow-lg flex flex-col focus:outline-none",header:"flex items-center gap-1.5 p-4 sm:px-6 min-h-(--ui-header-height)",wrapper:"",body:"flex-1 overflow-y-auto p-4 sm:p-6",footer:"flex items-center gap-1.5 p-4 sm:px-6",title:"text-highlighted font-semibold",description:"mt-1 text-muted text-sm",close:"absolute top-4 end-4"},variants:{side:{top:{content:""},right:{content:"max-w-md"},bottom:{content:""},left:{content:"max-w-md"}},inset:{true:{content:"rounded-lg"}},transition:{true:{overlay:"data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"}}},compoundVariants:[{side:"top",inset:!0,class:{content:"max-h-[calc(100%-2rem)] inset-x-4 top-4"}},{side:"top",inset:!1,class:{content:"max-h-full inset-x-0 top-0"}},{side:"right",inset:!0,class:{content:"w-[calc(100%-2rem)] inset-y-4 right-4"}},{side:"right",inset:!1,class:{content:"w-full inset-y-0 right-0"}},{side:"bottom",inset:!0,class:{content:"max-h-[calc(100%-2rem)] inset-x-4 bottom-4"}},{side:"bottom",inset:!1,class:{content:"max-h-full inset-x-0 bottom-0"}},{side:"left",inset:!0,class:{content:"w-[calc(100%-2rem)] inset-y-4 left-4"}},{side:"left",inset:!1,class:{content:"w-full inset-y-0 left-0"}},{transition:!0,side:"top",class:{content:"data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-top_200ms_ease-in-out]"}},{transition:!0,side:"right",class:{content:"data-[state=open]:animate-[slide-in-from-right_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-right_200ms_ease-in-out]"}},{transition:!0,side:"bottom",class:{content:"data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-bottom_200ms_ease-in-out]"}},{transition:!0,side:"left",class:{content:"data-[state=open]:animate-[slide-in-from-left_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-left_200ms_ease-in-out]"}}]},fM={__name:"Slideover",props:{title:{type:String,required:!1},description:{type:String,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},transition:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1,default:"right"},inset:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1}},emits:["leave","after:leave","enter","after:enter","close:prevent","update:open"],setup(e,{emit:t}){const n=e,r=t,s=Kn(),o=Nt("slideover",n),{t:i}=Ma(),a=ht(),l=vr(Hn(o,"open","defaultOpen","modal","unmountOnHide"),r),u=Ga(xt(()=>o.portal)),c=xt(()=>o.content),f=E(()=>o.dismissible?{pointerDownOutside:ey}:["interactOutside","escapeKeyDown"].reduce((g,m)=>(g[m]=v=>{v.preventDefault(),r("close:prevent")},g),{})),p=E(()=>{var h;return Bt({extend:dM,...((h=a.ui)==null?void 0:h.slideover)||{}})({transition:o.transition,side:o.side,inset:o.inset})});return(h,g)=>(y(),$(d(M1),it(ct(d(l))),{default:R(({open:m,close:v})=>[s.default?(y(),$(d(gC),{key:0,"as-child":"",class:se(d(o).class)},{default:R(()=>[U(h.$slots,"default",{open:m})]),_:2},1032,["class"])):L("",!0),B(d(fC),pe(d(u),{"force-mount":d(u).disabled&&d(o).unmountOnHide===!1||void 0}),{default:R(()=>[B(d(Zc),null,{default:R(()=>{var x,b;return[d(o).overlay?(y(),$(d(uC),{key:0,"data-slot":"overlay",class:se(p.value.overlay({class:(x=d(o).ui)==null?void 0:x.overlay}))},null,8,["class"])):L("",!0),B(d(sC),pe({"data-side":d(o).side,"data-slot":"content",class:p.value.content({class:[!s.default&&d(o).class,(b=d(o).ui)==null?void 0:b.content]})},c.value,{onEnter:g[0]||(g[0]=w=>r("enter")),onAfterEnter:g[1]||(g[1]=w=>r("after:enter")),onLeave:g[2]||(g[2]=w=>r("leave")),onAfterLeave:g[3]||(g[3]=w=>r("after:leave"))},pc(f.value)),{default:R(()=>[!d(o).title&&!s.title||!d(o).description&&!s.description||s.content?(y(),$(d(Yo),{key:0},{default:R(()=>[!d(o).title&&!s.title?(y(),$(d(jl),{key:0})):s.content?(y(),$(d(jl),{key:1},{default:R(()=>[U(h.$slots,"title",{},()=>[me(q(d(o).title),1)])]),_:3})):L("",!0),!d(o).description&&!s.description?(y(),$(d(Fl),{key:2})):s.content?(y(),$(d(Fl),{key:3},{default:R(()=>[U(h.$slots,"description",{},()=>[me(q(d(o).description),1)])]),_:3})):L("",!0)]),_:3})):L("",!0),U(h.$slots,"content",{close:v},()=>{var w,k,O;return[s.header||d(o).title||s.title||d(o).description||s.description||d(o).close||s.close?(y(),T("div",{key:0,"data-slot":"header",class:se(p.value.header({class:(w=d(o).ui)==null?void 0:w.header}))},[U(h.$slots,"header",{close:v},()=>{var P,I,M;return[d(o).title||s.title||d(o).description||s.description?(y(),T("div",{key:0,"data-slot":"wrapper",class:se(p.value.wrapper({class:(P=d(o).ui)==null?void 0:P.wrapper}))},[d(o).title||s.title?(y(),$(d(jl),{key:0,"data-slot":"title",class:se(p.value.title({class:(I=d(o).ui)==null?void 0:I.title}))},{default:R(()=>[U(h.$slots,"title",{},()=>[me(q(d(o).title),1)])]),_:3},8,["class"])):L("",!0),d(o).description||s.description?(y(),$(d(Fl),{key:1,"data-slot":"description",class:se(p.value.description({class:(M=d(o).ui)==null?void 0:M.description}))},{default:R(()=>[U(h.$slots,"description",{},()=>[me(q(d(o).description),1)])]),_:3},8,["class"])):L("",!0)],2)):L("",!0),U(h.$slots,"actions"),d(o).close||s.close?(y(),$(d(L1),{key:1,"as-child":""},{default:R(()=>[U(h.$slots,"close",{ui:p.value},()=>{var j;return[d(o).close?(y(),$(kt,pe({key:0,icon:d(o).closeIcon||d(a).ui.icons.close,color:"neutral",variant:"ghost","aria-label":d(i)("slideover.close")},typeof d(o).close=="object"?d(o).close:{},{"data-slot":"close",class:p.value.close({class:(j=d(o).ui)==null?void 0:j.close})}),null,16,["icon","aria-label","class"])):L("",!0)]})]),_:2},1024)):L("",!0)]})],2)):L("",!0),C("div",{"data-slot":"body",class:se(p.value.body({class:(k=d(o).ui)==null?void 0:k.body}))},[U(h.$slots,"body",{close:v})],2),s.footer?(y(),T("div",{key:1,"data-slot":"footer",class:se(p.value.footer({class:(O=d(o).ui)==null?void 0:O.footer}))},[U(h.$slots,"footer",{close:v})],2)):L("",!0)]})]),_:2},1040,["data-side","class"])]}),_:2},1024)]),_:2},1040,["force-mount"])]),_:3},16))}},pM={class:"space-y-4 text-sm"},hM={key:0,class:"text-muted"},gM=["href"],mM={class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-muted"},vM={class:"text-default"},yM={class:"text-default font-mono"},bM={class:"text-default"},xM=["innerHTML"],wM=Y({__name:"MrDetailsSlideover",props:wg({comparison:{},descriptionHtml:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const t=Sg(e,"open");return(n,r)=>{const s=fM;return y(),$(s,{open:t.value,"onUpdate:open":r[0]||(r[0]=o=>t.value=o),title:e.comparison.title||"MR details",side:"right"},{body:R(()=>[C("div",pM,[e.comparison.number?(y(),T("div",hM,"!"+q(e.comparison.number),1)):L("",!0),e.comparison.url?(y(),T("a",{key:1,href:e.comparison.url,target:"_blank",rel:"noopener",class:"block truncate text-primary hover:underline"},q(e.comparison.url),9,gM)):L("",!0),C("dl",mM,[e.comparison.author?(y(),T(ne,{key:0},[r[1]||(r[1]=C("dt",null,"Author",-1)),C("dd",vM,q(e.comparison.author),1)],64)):L("",!0),e.comparison.sourceBranch||e.comparison.targetBranch?(y(),T(ne,{key:1},[r[2]||(r[2]=C("dt",null,"Branch",-1)),C("dd",yM,q(e.comparison.sourceBranch??"?")+" → "+q(e.comparison.targetBranch??"?"),1)],64)):L("",!0),e.comparison.repository?(y(),T(ne,{key:2},[r[3]||(r[3]=C("dt",null,"Repository",-1)),C("dd",bM,q(e.comparison.repository),1)],64)):L("",!0)]),e.descriptionHtml?(y(),T("div",{key:2,class:"markdown-body border-t border-default pt-4",innerHTML:e.descriptionHtml},null,8,xM)):L("",!0)])]),_:1},8,["open","title"])}}}),kM={base:"relative",variants:{size:{xs:"",sm:"",md:"",lg:"",xl:""},orientation:{horizontal:"inline-flex -space-x-px",vertical:"flex flex-col -space-y-px"}}},Fy={__name:"FieldGroup",props:{as:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){const n=Nt("fieldGroup",e),r=ht(),s=E(()=>{var o;return Bt({extend:kM,...((o=r.ui)==null?void 0:o.fieldGroup)||{}})});return un(Qc,E(()=>({orientation:n.orientation,size:n.size}))),(o,i)=>{var a;return y(),$(d($e),{as:d(n).as,"data-orientation":d(n).orientation,class:se(s.value({orientation:d(n).orientation,class:[(a=d(n).ui)==null?void 0:a.base,d(n).class]}))},{default:R(()=>[U(o.$slots,"default")]),_:3},8,["as","data-orientation","class"])}}},_M={class:"flex items-center gap-2"},CM=["value"],SM={key:0,class:"text-error"},TM={key:1,class:"text-warning"},AM=Y({__name:"QuestionComposer",setup(e){const{store:t,draft:n,draftKind:r,busy:s,localError:o,submitNewQuestion:i}=pd(()=>Qe.composerTarget,{draft:xt(Qe,"draft"),kind:xt(Qe,"kind")}),a=E(()=>t.writeToken.length>0),l=E(()=>Bq(Qe.anchorTarget)),u=E({get:()=>Bi(Qe.composerTarget),set:f=>{const p=l.value.find(h=>h.key===f);p&&AR(p.target)}}),c=[{value:"question",label:"Question"},{value:"change-request",label:"Change request"}];return(f,p)=>{const h=kt,g=Fy,m=tl;return y(),T("form",{"data-testid":"question-composer",class:"space-y-2 p-3 text-xs",onSubmit:p[2]||(p[2]=At(v=>d(i)(()=>{}),["prevent"]))},[C("div",_M,[p[3]||(p[3]=C("label",{for:"composer-target",class:"shrink-0 font-semibold"},"About",-1)),Ds(C("select",{id:"composer-target","onUpdate:modelValue":p[0]||(p[0]=v=>u.value=v),"data-testid":"composer-target",class:"min-w-0 flex-1 truncate rounded border border-control bg-default px-2 py-1 font-mono"},[(y(!0),T(ne,null,Ee(l.value,v=>(y(),T("option",{key:v.key,value:v.key},q(v.label),9,CM))),128))],512),[[vx,u.value]])]),B(g,{size:"xs"},{default:R(()=>[(y(),T(ne,null,Ee(c,v=>B(h,{key:v.value,variant:d(r)===v.value?"solid":"outline",color:v.value==="change-request"?"error":"neutral",onClick:x=>r.value=v.value},{default:R(()=>[me(q(v.label),1)]),_:2},1032,["variant","color","onClick"])),64))]),_:1}),B(m,{modelValue:d(n),"onUpdate:modelValue":p[1]||(p[1]=v=>Ze(n)?n.value=v:null),size:"sm",class:"w-full",rows:d(by)(d(r)),placeholder:d(r)==="change-request"?"What needs to change?":"What's the reasoning here?"},null,8,["modelValue","rows","placeholder"]),d(o)?(y(),T("p",SM,q(d(o)),1)):L("",!0),a.value?L("",!0):(y(),T("p",TM,"Set your write token first (top right).")),B(h,{type:"submit",size:"xs",disabled:d(s)||!a.value},{default:R(()=>[me(q(d(r)==="change-request"?"Raise change request":"Ask"),1)]),_:1},8,["disabled"])],32)}}});function EM(){const e=G(new Set);function t(r){return r.resolved&&!e.value.has(r.id)}function n(r){const s=new Set(e.value);s.has(r)?s.delete(r):s.add(r),e.value=s}return{isCollapsed:t,toggleExpanded:n}}const OM={class:"mt-1 flex gap-2"},PM=Y({__name:"PostToMrForm",props:{target:{},body:{}},setup(e){const t=e,n=G(!1),r=G(""),{copied:s,copy:o}=ol();function i(){r.value=t.body,n.value=!0}return(a,l)=>{const u=kt,c=tl;return y(),T("div",null,[n.value?(y(),T(ne,{key:1},[B(c,{modelValue:r.value,"onUpdate:modelValue":l[0]||(l[0]=f=>r.value=f),"data-testid":"post-to-mr-text",size:"sm",class:"w-full",rows:4},null,8,["modelValue"]),l[5]||(l[5]=C("p",{class:"mt-1 text-muted"},'Copy this prompt for the agent. The agent posts it after you say "send".',-1)),C("div",OM,[B(u,{size:"xs",disabled:!r.value.trim(),onClick:l[1]||(l[1]=f=>d(o)(d(TI)(e.target,r.value)))},{default:R(()=>[me(q(d(s)?"Copied!":"Copy prompt"),1)]),_:1},8,["disabled"]),B(u,{size:"xs",variant:"ghost",onClick:l[2]||(l[2]=f=>n.value=!1)},{default:R(()=>[...l[4]||(l[4]=[me("Cancel",-1)])]),_:1})])],64)):(y(),$(u,{key:0,"data-testid":"post-to-mr",size:"xs",variant:"ghost",onClick:i},{default:R(()=>[...l[3]||(l[3]=[me("Post to MR",-1)])]),_:1}))])}}}),RM=["id","data-state"],IM={class:"mb-1 flex flex-wrap items-center gap-2"},$M={class:"mb-1 flex items-center gap-2 text-xs text-muted"},qM={"data-testid":"thread-target",class:"min-w-0 truncate font-mono"},MM={key:0,class:"mt-1 text-muted"},DM={key:1,class:"mt-1 text-muted italic"},LM={key:2,class:"mt-2 border-t border-default pt-2 text-muted"},NM=["innerHTML"],BM={class:"mt-2"},zM={key:0,class:"mt-1 text-warning"},FM={key:0,class:"flex gap-2"},jM={class:"mt-1 flex gap-2"},HM={key:0,class:"mt-1 text-warning"},VM={key:2,class:"mt-1 text-error"},UM={key:1,class:"truncate text-muted italic"},WM=Y({__name:"QuestionThreadCard",props:{entry:{},currentRound:{},active:{type:Boolean}},emits:["open","showInCode"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>n.entry.question),o=E(()=>Ny(s.value,!!n.entry.answer,is.value)),i=E(()=>o.value?By(o.value):null),a=E(()=>o.value==="waiting"&&!wd(is.value)),{store:l,busy:u,localError:c,editingId:f,editDraft:p,startEdit:h,submitEdit:g,remove:m,resolve:v}=pd(()=>s.value.target),x=E(()=>l.writeToken.length>0),{isCollapsed:b,toggleExpanded:w}=EM();return(k,O)=>{const P=mn,I=kt,M=tl;return y(),T("article",{id:`thread-${s.value.id}`,"data-testid":"question-thread","data-state":o.value??"none",class:se(["rounded-lg border p-3 text-sm",e.active?"border-primary ring-1 ring-primary":"border-default"]),onClick:O[8]||(O[8]=j=>r("open"))},[C("div",IM,[B(P,{size:"sm",variant:"subtle",color:d(qy)(s.value)},{default:R(()=>[me(q(d(My)(s.value)),1)]),_:1},8,["color"]),i.value?(y(),$(P,{key:0,"data-testid":"thread-state",size:"md",variant:"subtle",color:i.value.color,icon:i.value.icon,ui:{leadingIcon:o.value==="answering"?"animate-spin motion-reduce:animate-none":""}},{default:R(()=>[me(q(i.value.label),1)]),_:1},8,["color","icon","ui"])):(y(),$(P,{key:1,size:"sm",variant:"subtle",color:d(Dy)(s.value)},{default:R(()=>[me(q(d(Ly)(s.value)),1)]),_:1},8,["color"])),s.value.resolution?(y(),$(P,{key:2,size:"sm",variant:"subtle",color:d(O$)(s.value.resolution.status),title:s.value.resolution.evidence},{default:R(()=>[me(q(d(P$)(s.value.resolution.status)),1)]),_:1},8,["color","title"])):L("",!0),s.value.originRound!==e.currentRound?(y(),$(P,{key:3,size:"sm",variant:"outline",color:"neutral"},{default:R(()=>[me(" Round "+q(s.value.originRound),1)]),_:1})):L("",!0),s.value.resolved?(y(),$(I,{key:4,size:"xs",variant:"ghost",class:"ml-auto",onClick:O[0]||(O[0]=At(j=>d(w)(s.value.id),["stop"]))},{default:R(()=>[me(q(d(b)(s.value)?"Show":"Hide"),1)]),_:1})):L("",!0)]),C("p",$M,[C("span",qM,q(d(zy)(s.value.target)),1),e.entry.filePath?(y(),$(I,{key:0,size:"xs",variant:"ghost",class:"shrink-0",onClick:O[1]||(O[1]=At(j=>r("showInCode"),["stop"]))},{default:R(()=>[...O[9]||(O[9]=[me(" Show in code ",-1)])]),_:1})):L("",!0)]),d(b)(s.value)?(y(),T("p",UM,q(s.value.body),1)):(y(),T(ne,{key:0},[C("p",{class:se(["break-words leading-relaxed",{"text-muted line-through":s.value.status==="withdrawn"}])},q(s.value.body),3),s.value.resolution?(y(),T("p",MM,q(s.value.resolution.evidence),1)):L("",!0),s.value.kind==="change-request"&&s.value.resolved?(y(),T("p",DM," Resolved "+q(new Date(s.value.resolvedAt).toLocaleString()),1)):L("",!0),e.entry.answer?(y(),T("div",LM,[O[10]||(O[10]=C("p",{class:"mb-0.5 text-xs font-bold"},"Answer",-1)),C("div",{class:"markdown-body break-words leading-relaxed",innerHTML:d($r)(e.entry.answer.body)},null,8,NM)])):a.value?(y(),$(Ry,{key:3,class:"mt-2",question:s.value},null,8,["question"])):L("",!0),B(PM,{class:"mt-2",target:s.value.target,body:s.value.body},null,8,["target","body"]),C("div",BM,[s.value.status==="open"&&s.value.kind==="change-request"&&!s.value.resolved?(y(),T(ne,{key:0},[B(I,{size:"xs",disabled:d(u)||!x.value,onClick:O[2]||(O[2]=At(j=>d(v)(s.value.id),["stop"]))},{default:R(()=>[...O[11]||(O[11]=[me("Mark resolved",-1)])]),_:1},8,["disabled"]),x.value?L("",!0):(y(),T("p",zM,"Set your write token first (top right)."))],64)):s.value.status==="open"&&s.value.kind==="question"?(y(),T(ne,{key:1},[d(f)!==s.value.id?(y(),T("span",FM,[B(I,{size:"xs",variant:"ghost",onClick:O[3]||(O[3]=At(j=>d(h)(s.value.id),["stop"]))},{default:R(()=>[...O[12]||(O[12]=[me("Withdraw & rephrase",-1)])]),_:1}),B(I,{size:"xs",variant:"ghost",color:"error",disabled:d(u)||!x.value,onClick:O[4]||(O[4]=At(j=>d(m)(s.value.id),["stop"]))},{default:R(()=>[...O[13]||(O[13]=[me(" Delete ",-1)])]),_:1},8,["disabled"])])):(y(),T(ne,{key:1},[B(M,{modelValue:d(p),"onUpdate:modelValue":O[5]||(O[5]=j=>Ze(p)?p.value=j:null),size:"sm",class:"mt-1 w-full",rows:2,placeholder:"Better phrased question…"},null,8,["modelValue"]),C("div",jM,[B(I,{size:"xs",disabled:d(u)||!x.value,onClick:O[6]||(O[6]=At(j=>d(g)(s.value.id,()=>{}),["stop"]))},{default:R(()=>[...O[14]||(O[14]=[me("Submit",-1)])]),_:1},8,["disabled"]),B(I,{size:"xs",variant:"ghost",onClick:O[7]||(O[7]=At(j=>f.value=null,["stop"]))},{default:R(()=>[...O[15]||(O[15]=[me("Cancel",-1)])]),_:1})]),x.value?L("",!0):(y(),T("p",HM,"Set your write token first (top right)."))],64))],64)):L("",!0),d(c)?(y(),T("p",VM,q(d(c)),1)):L("",!0)])],64))],10,RM)}}}),GM={role:"region","aria-label":"Question panel","data-testid":"question-panel",class:"flex h-full min-h-0 w-96 max-w-[90vw] shrink-0 flex-col border-l border-default bg-default"},KM={class:"flex shrink-0 items-center gap-2 border-b border-default px-3 py-2"},YM={"data-testid":"thread-list",class:"min-h-0 flex-1 space-y-3 overflow-y-auto p-3"},QM={key:0,class:"text-sm text-muted"},XM=Y({__name:"QuestionPanel",props:{entries:{},currentRound:{}},emits:["showInCode"],setup(e,{emit:t}){const n=e,r=t,s=E(()=>Lq(n.entries));return Me(()=>Qe.threadId,async o=>{var i;o&&(await tt(),(i=document.getElementById(`thread-${o}`))==null||i.scrollIntoView({block:"nearest"}))},{immediate:!0,flush:"post"}),(o,i)=>{const a=kt;return y(),T("aside",GM,[C("header",KM,[i[0]||(i[0]=C("h2",{class:"text-sm font-semibold"},"Questions",-1)),B(a,{size:"xs",variant:"ghost",color:"neutral",icon:"i-lucide-x",class:"ml-auto","aria-label":"Close the Question panel",onClick:d(OR)},null,8,["onClick"])]),C("div",YM,[s.value.length?L("",!0):(y(),T("p",QM,"No comments raised on this bundle yet.")),(y(!0),T(ne,null,Ee(s.value,l=>(y(),$(WM,{key:l.question.id,entry:l,"current-round":e.currentRound,active:d(Qe).threadId===l.question.id,onOpen:u=>d(nl)(l.question),onShowInCode:u=>r("showInCode",l)},null,8,["entry","current-round","active","onOpen","onShowInCode"]))),128))]),B(AM,{class:"shrink-0 border-t border-default"})])}}});function ZM(){var n;const t=(n=ht().ui)==null?void 0:n.prefix;return r=>!t||!r?r:r.split(/\s+/).filter(Boolean).map(s=>`${t}:${s}`).join(" ")}const JM=Object.assign({inheritAttrs:!1},{__name:"ColorModeButton",props:{color:{type:null,required:!1,default:"neutral"},variant:{type:null,required:!1,default:"ghost"},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},setup(e){const n=Nt("button",e),{t:r}=Ma(),s=J_(),o=ht(),i=ZM(),a=vr(Sc(n,"icon")),l=E({get(){return s.value==="dark"},set(u){s.preference=u?"dark":"light"}});return(u,c)=>(y(),$(kt,pe({...d(a),"aria-label":l.value?d(r)("colorMode.switchToLight"):d(r)("colorMode.switchToDark"),...u.$attrs},{onClick:c[0]||(c[0]=f=>l.value=!l.value)}),{leading:R(({ui:f})=>{var p,h;return[B(rn,{class:se(f.leadingIcon({class:[(p=d(n).ui)==null?void 0:p.leadingIcon,d(i)("hidden dark:inline-block")]})),name:d(o).ui.icons.dark},null,8,["class","name"]),B(rn,{class:se(f.leadingIcon({class:[(h=d(n).ui)==null?void 0:h.leadingIcon,d(i)("dark:hidden")]})),name:d(o).ui.icons.light},null,8,["class","name"])]}),_:1},16))}}),e5={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute inset-y-0 start-0 flex items-center",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute inset-y-0 end-0 flex items-center",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2",trailing:"pe-2",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5",trailing:"pe-2.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3",trailing:"pe-3",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},t5=["id","type","value","name","placeholder","disabled","required","autocomplete"],n5=Object.assign({inheritAttrs:!1},{__name:"Input",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},type:{type:null,required:!1,default:"text"},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autocomplete:{type:[String,Object],required:!1,default:"off"},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=Kn(),i=Nt("input",r),a=Un(i,"modelValue",s,{defaultValue:i.defaultValue}),l=ht(),{emitFormBlur:u,emitFormInput:c,emitFormChange:f,size:p,color:h,id:g,name:m,highlight:v,disabled:x,emitFormFocus:b,ariaAttrs:w}=Jc(r,{deferInputValidation:!0}),{orientation:k,size:O}=Xc(r),{isLeading:P,isTrailing:I,leadingIconName:M,trailingIconName:j}=Ya(i),H=E(()=>O.value||p.value),le=E(()=>{var ee;return Bt({extend:e5,...((ee=l.ui)==null?void 0:ee.input)||{}})({type:i.type,color:h.value??i.color,variant:i.variant,size:(H==null?void 0:H.value)??i.size,loading:i.loading,highlight:v.value??i.highlight,fixed:i.fixed,leading:P.value||!!i.avatar||!!o.leading,trailing:I.value||!!o.trailing,fieldGroup:k.value})}),K=Or("inputRef");function X(ee){var _e,ie,Se,Le,rt;(_e=i.modelModifiers)!=null&&_e.trim&&(typeof ee=="string"||ee===null||ee===void 0)&&(ee=(ee==null?void 0:ee.trim())??null),((ie=i.modelModifiers)!=null&&ie.number||i.type==="number")&&(ee=Lm(ee)),(Se=i.modelModifiers)!=null&&Se.nullable&&(ee||(ee=null)),(Le=i.modelModifiers)!=null&&Le.optional&&!((rt=i.modelModifiers)!=null&&rt.nullable)&&ee!==null&&(ee||(ee=void 0)),a.value=ee,c()}function J(ee){var _e;(_e=i.modelModifiers)!=null&&_e.lazy||X(ee.target.value)}function fe(ee){var ie,Se;const _e=ee.target.value;(ie=i.modelModifiers)!=null&&ie.lazy&&X(_e),(Se=i.modelModifiers)!=null&&Se.trim&&(ee.target.value=_e.trim()),f(),s("change",ee)}function F(ee){u(),s("blur",ee)}function de(){var ee;i.autofocus&&((ee=K.value)==null||ee.focus())}return dt(()=>{setTimeout(()=>{de()},i.autofocusDelay)}),t({inputRef:K}),(ee,_e)=>{var ie;return y(),$(d($e),{as:d(i).as,"data-slot":ee.$attrs["data-slot"]??"root",class:se(le.value.root({class:[(ie=d(i).ui)==null?void 0:ie.root,d(i).class]}))},{default:R(()=>{var Se,Le,rt;return[C("input",pe({id:d(g),ref_key:"inputRef",ref:K,type:d(i).type,value:d(a),name:d(m),placeholder:d(i).placeholder,class:le.value.base({class:(Se=d(i).ui)==null?void 0:Se.base}),disabled:d(x),required:d(i).required,autocomplete:d(i).autocomplete},{...ee.$attrs,...d(w)},{"data-slot":"base",onInput:J,onBlur:F,onChange:fe,onFocus:_e[0]||(_e[0]=(...lt)=>d(b)&&d(b)(...lt))}),null,16,t5),U(ee.$slots,"default",{ui:le.value}),d(P)||d(i).avatar||o.leading?(y(),T("span",{key:0,"data-slot":"leading",class:se(le.value.leading({class:(Le=d(i).ui)==null?void 0:Le.leading}))},[U(ee.$slots,"leading",{ui:le.value},()=>{var lt,Ye,ze;return[d(P)&&d(M)?(y(),$(rn,{key:0,name:d(M),"data-slot":"leadingIcon",class:se(le.value.leadingIcon({class:(lt=d(i).ui)==null?void 0:lt.leadingIcon}))},null,8,["name","class"])):d(i).avatar?(y(),$(Xo,pe({key:1,size:((Ye=d(i).ui)==null?void 0:Ye.leadingAvatarSize)||le.value.leadingAvatarSize()},d(i).avatar,{"data-slot":"leadingAvatar",class:le.value.leadingAvatar({class:(ze=d(i).ui)==null?void 0:ze.leadingAvatar})}),null,16,["size","class"])):L("",!0)]})],2)):L("",!0),d(I)||o.trailing?(y(),T("span",{key:1,"data-slot":"trailing",class:se(le.value.trailing({class:(rt=d(i).ui)==null?void 0:rt.trailing}))},[U(ee.$slots,"trailing",{ui:le.value},()=>{var lt;return[d(j)?(y(),$(rn,{key:0,name:d(j),"data-slot":"trailingIcon",class:se(le.value.trailingIcon({class:(lt=d(i).ui)==null?void 0:lt.trailingIcon}))},null,8,["name","class"])):L("",!0)]})],2)):L("",!0)]}),_:3},8,["as","data-slot","class"])}}}),r5={base:"inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans uppercase",variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{solid:"",outline:"",soft:"",subtle:""},size:{sm:"h-4 min-w-[16px] text-[10px]",md:"h-5 min-w-[20px] text-[11px]",lg:"h-6 min-w-[24px] text-[12px]"}},compoundVariants:[{color:"primary",variant:"solid",class:"text-inverted bg-primary"},{color:"secondary",variant:"solid",class:"text-inverted bg-secondary"},{color:"success",variant:"solid",class:"text-inverted bg-success"},{color:"info",variant:"solid",class:"text-inverted bg-info"},{color:"warning",variant:"solid",class:"text-inverted bg-warning"},{color:"error",variant:"solid",class:"text-inverted bg-error"},{color:"primary",variant:"outline",class:"ring ring-inset ring-primary/50 text-primary"},{color:"secondary",variant:"outline",class:"ring ring-inset ring-secondary/50 text-secondary"},{color:"success",variant:"outline",class:"ring ring-inset ring-success/50 text-success"},{color:"info",variant:"outline",class:"ring ring-inset ring-info/50 text-info"},{color:"warning",variant:"outline",class:"ring ring-inset ring-warning/50 text-warning"},{color:"error",variant:"outline",class:"ring ring-inset ring-error/50 text-error"},{color:"primary",variant:"soft",class:"text-primary bg-primary/10"},{color:"secondary",variant:"soft",class:"text-secondary bg-secondary/10"},{color:"success",variant:"soft",class:"text-success bg-success/10"},{color:"info",variant:"soft",class:"text-info bg-info/10"},{color:"warning",variant:"soft",class:"text-warning bg-warning/10"},{color:"error",variant:"soft",class:"text-error bg-error/10"},{color:"primary",variant:"subtle",class:"text-primary ring ring-inset ring-primary/25 bg-primary/10"},{color:"secondary",variant:"subtle",class:"text-secondary ring ring-inset ring-secondary/25 bg-secondary/10"},{color:"success",variant:"subtle",class:"text-success ring ring-inset ring-success/25 bg-success/10"},{color:"info",variant:"subtle",class:"text-info ring ring-inset ring-info/25 bg-info/10"},{color:"warning",variant:"subtle",class:"text-warning ring ring-inset ring-warning/25 bg-warning/10"},{color:"error",variant:"subtle",class:"text-error ring ring-inset ring-error/25 bg-error/10"},{color:"neutral",variant:"solid",class:"text-inverted bg-inverted"},{color:"neutral",variant:"outline",class:"ring ring-inset ring-accented text-default bg-default"},{color:"neutral",variant:"soft",class:"text-default bg-elevated"},{color:"neutral",variant:"subtle",class:"ring ring-inset ring-accented text-default bg-elevated"}],defaultVariants:{variant:"outline",color:"neutral",size:"md"}},s5={__name:"Kbd",props:{as:{type:null,required:!1,default:"kbd"},value:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){const n=Nt("kbd",e),{getKbdKey:r}=z_(),s=ht(),o=E(()=>{var i;return Bt({extend:r5,...((i=s.ui)==null?void 0:i.kbd)||{}})});return(i,a)=>{var l;return y(),$(d($e),{as:d(n).as,class:se(o.value({class:[(l=d(n).ui)==null?void 0:l.base,d(n).class],color:d(n).color,variant:d(n).variant,size:d(n).size}))},{default:R(()=>[U(i.$slots,"default",{},()=>[me(q(d(r)(d(n).value)),1)])]),_:3},8,["as","class"])}}},o5={slots:{content:"flex items-center gap-1 bg-default text-highlighted shadow-sm rounded-sm ring ring-default h-6 px-2.5 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto",arrow:"fill-bg stroke-default",text:"truncate",kbds:"hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-['·'] not-first-of-type:before:me-0.5",kbdsSize:"sm"}},i5={__name:"Tooltip",props:{text:{type:String,required:!1},kbds:{type:Array,required:!1},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},delayDuration:{type:Number,required:!1},disableHoverableContent:{type:Boolean,required:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1}},emits:["update:open"],setup(e,{emit:t}){const n=e,r=t,s=Kn(),o=Nt("tooltip",n),i=ht(),a=Qo(),l=vr(Hn(o,"defaultOpen","open","delayDuration","disableHoverableContent","disableClosingTrigger","ignoreNonKeyboardFocus"),r),u=Ga(xt(()=>o.portal)),c=xt(()=>Tn(o.content,a.content.value,{side:"bottom",sideOffset:8,collisionPadding:8})),f=xt(()=>Tn(o.arrow,{rounded:!0})),p=E(()=>{var h;return Bt({extend:o5,...((h=i.ui)==null?void 0:h.tooltip)||{}})({side:c.value.side})});return(h,g)=>{var m;return y(),$(d(yA),pe(d(l),{disabled:!(d(o).text||(m=d(o).kbds)!=null&&m.length||s.content)||d(o).disabled}),{default:R(({open:v})=>[s.default||d(o).reference?(y(),$(d(AA),pe({key:0},h.$attrs,{"as-child":"",reference:d(o).reference,class:d(o).class}),{default:R(()=>[U(h.$slots,"default",{open:v})]),_:2},1040,["reference","class"])):L("",!0),B(d(SA),it(ct(d(u))),{default:R(()=>[B(d(Zc),null,{default:R(()=>{var x;return[B(d(_A),pe(c.value,{"data-slot":"content",class:p.value.content({class:[!s.default&&d(o).class,(x=d(o).ui)==null?void 0:x.content]})}),{default:R(()=>{var b;return[U(h.$slots,"content",{ui:p.value},()=>{var w,k,O;return[d(o).text?(y(),T("span",{key:0,"data-slot":"text",class:se(p.value.text({class:(w=d(o).ui)==null?void 0:w.text}))},q(d(o).text),3)):L("",!0),(k=d(o).kbds)!=null&&k.length?(y(),T("span",{key:1,"data-slot":"kbds",class:se(p.value.kbds({class:(O=d(o).ui)==null?void 0:O.kbds}))},[(y(!0),T(ne,null,Ee(d(o).kbds,(P,I)=>{var M;return y(),$(s5,pe({key:I,size:((M=d(o).ui)==null?void 0:M.kbdsSize)||p.value.kbdsSize()},{ref_for:!0},typeof P=="string"?{value:P}:P),null,16,["size"])}),128))],2)):L("",!0)]}),d(o).arrow?(y(),$(d(fA),pe({key:0},f.value,{"data-slot":"arrow",class:p.value.arrow({class:(b=d(o).ui)==null?void 0:b.arrow})}),null,16,["class"])):L("",!0)]}),_:3},16,["class"])]}),_:3})]),_:3},16)]),_:3},16,["disabled"])}}},a5=["data-tone"],l5={"aria-hidden":"true"},u5={class:"sr-only"},c5=Y({__name:"PanelButtonBadge",props:{badge:{}},setup(e){return(t,n)=>e.badge?(y(),T("span",{key:0,"data-testid":"panel-badge","data-tone":e.badge.tone,role:"status",class:se(["pointer-events-none absolute -right-2 -top-2 grid h-6 min-w-6 place-items-center rounded-full px-1.5 text-sm font-bold leading-none",e.badge.tone==="new"?"bg-primary text-inverted":"bg-warning text-inverted"])},[C("span",l5,q(e.badge.text),1),C("span",u5,q(e.badge.srText),1)],10,a5)):L("",!0)}}),d5={class:"flex items-center gap-3 border-b border-default px-4 py-3"},f5={key:0,class:"min-w-0"},p5={class:"flex items-center gap-2"},h5={class:"truncate text-sm font-semibold"},g5={key:0,class:"mt-0.5 flex items-center gap-2 text-xs text-muted"},m5=["href"],v5={key:1,class:"shrink-0 font-mono"},y5={key:1,class:"truncate text-sm font-semibold"},b5={class:"ml-auto flex items-center gap-3"},x5={"data-testid":"live-answers",class:"text-xs text-muted"},w5={class:"relative inline-flex"},k5={class:"w-80 p-3"},_5=Y({__name:"ReviewHeader",props:{headerTitle:{},comparison:{},hasMrMetadata:{type:Boolean},navVisible:{type:Boolean},layout:{},openQuestionCount:{},newAnswerCount:{},promptCopied:{type:Boolean},hasWriteToken:{type:Boolean},writeTokenDraft:{},focusMode:{type:Boolean},focusModeCount:{},liveAnswersLabel:{},answersUsedLabel:{}},emits:["update:navVisible","update:layout","update:writeTokenDraft","update:focusMode","openQuestions","openMrDetails","copyPrompt","saveWriteToken"],setup(e,{emit:t}){const n=t;return(r,s)=>{const o=kt,i=i5,a=Fy,l=n5,u=Za,c=JM;return y(),T("header",d5,[B(i,{text:e.navVisible?"Hide file list":"Show file list"},{default:R(()=>[B(o,{size:"sm",color:"neutral",variant:e.navVisible?"subtle":"ghost",icon:"i-lucide-panel-left","aria-pressed":e.navVisible,onClick:s[0]||(s[0]=f=>n("update:navVisible",!e.navVisible))},null,8,["variant","aria-pressed"])]),_:1},8,["text"]),e.comparison?(y(),T("div",f5,[C("div",p5,[C("h1",h5,q(e.headerTitle),1),e.hasMrMetadata?(y(),$(o,{key:0,size:"xs",variant:"soft",color:"primary",icon:"i-lucide-file-text",onClick:s[1]||(s[1]=f=>n("openMrDetails"))},{default:R(()=>[...s[8]||(s[8]=[me(" Details ",-1)])]),_:1})):L("",!0)]),e.hasMrMetadata?(y(),T("div",g5,[e.comparison.url?(y(),T("a",{key:0,href:e.comparison.url,target:"_blank",rel:"noopener",class:"truncate text-primary hover:underline"},q(e.comparison.url),9,m5)):L("",!0),e.comparison.sourceBranch?(y(),T("span",v5,q(e.comparison.sourceBranch)+" → "+q(e.comparison.targetBranch??"main"),1)):L("",!0)])):L("",!0)])):(y(),T("h1",y5,q(e.headerTitle),1)),C("div",b5,[C("span",x5,[me(q(e.liveAnswersLabel),1),e.answersUsedLabel?(y(),T(ne,{key:0},[me(" · "+q(e.answersUsedLabel),1)],64)):L("",!0)]),s[12]||(s[12]=C("div",{class:"h-5 w-px bg-default"},null,-1)),e.comparison?(y(),$(i,{key:0,text:"Question panel"},{default:R(()=>[C("span",w5,[B(o,{size:"sm",variant:"ghost",color:"neutral",icon:"i-lucide-message-circle-question","aria-label":"Question panel",onClick:s[2]||(s[2]=f=>n("openQuestions"))}),B(c5,{badge:d(zq)(e.newAnswerCount,e.openQuestionCount)},null,8,["badge"])])]),_:1})):L("",!0),s[13]||(s[13]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(i,{text:e.focusMode?"Exit focus mode":`Focus mode — step through ${e.focusModeCount} item(s) needing attention`},{default:R(()=>[B(o,{size:"sm",variant:e.focusMode?"solid":"ghost",color:e.focusMode?"primary":"neutral",icon:"i-lucide-crosshair",onClick:s[3]||(s[3]=f=>n("update:focusMode",!e.focusMode))},{default:R(()=>[...s[9]||(s[9]=[me(" Focus ",-1)])]),_:1},8,["variant","color"])]),_:1},8,["text"]),s[14]||(s[14]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(a,{size:"sm"},{default:R(()=>[B(i,{text:"Inline diff"},{default:R(()=>[B(o,{icon:"i-lucide-align-justify",variant:e.layout==="inline"?"solid":"outline",color:"neutral",onClick:s[4]||(s[4]=f=>n("update:layout","inline"))},null,8,["variant"])]),_:1}),B(i,{text:"Side-by-side diff"},{default:R(()=>[B(o,{icon:"i-lucide-columns-2",variant:e.layout==="side-by-side"?"solid":"outline",color:"neutral",onClick:s[5]||(s[5]=f=>n("update:layout","side-by-side"))},null,8,["variant"])]),_:1})]),_:1}),s[15]||(s[15]=C("div",{class:"h-5 w-px bg-default"},null,-1)),e.comparison?(y(),$(i,{key:1,text:e.promptCopied?"Copied!":"Copy Generator prompt"},{default:R(()=>[B(o,{size:"sm",variant:"ghost",color:e.promptCopied?"success":"neutral",icon:e.promptCopied?"i-lucide-check":"i-lucide-clipboard-copy",onClick:s[6]||(s[6]=f=>n("copyPrompt"))},null,8,["color","icon"])]),_:1},8,["text"])):L("",!0),s[16]||(s[16]=C("div",{class:"h-5 w-px bg-default"},null,-1)),B(u,null,{content:R(({close:f})=>[C("div",k5,[s[11]||(s[11]=C("p",{class:"mb-2 text-xs text-muted"},[me(" Paste the write token printed by "),C("code",{class:"font-mono"},"review-workspace serve"),me(". Needed to raise Questions or change Review State — read-only viewing works without it. ")],-1)),B(l,{"model-value":e.writeTokenDraft,size:"sm",class:"w-full",placeholder:"write token","onUpdate:modelValue":s[7]||(s[7]=p=>n("update:writeTokenDraft",p)),onKeyup:Gg(p=>n("saveWriteToken",f),["enter"])},null,8,["model-value","onKeyup"]),B(o,{size:"sm",class:"mt-2",block:"",onClick:p=>n("saveWriteToken",f)},{default:R(()=>[...s[10]||(s[10]=[me("Save",-1)])]),_:1},8,["onClick"])])]),default:R(()=>[B(i,{text:e.hasWriteToken?"Write token set":"Set write token"},{default:R(()=>[B(o,{size:"sm",variant:"ghost",color:e.hasWriteToken?"primary":"warning",icon:"i-lucide-key"},null,8,["color"])]),_:1},8,["text"])]),_:1}),B(i,{text:"Toggle color mode"},{default:R(()=>[B(c,{size:"sm"})]),_:1})])])}}}),C5={class:"flex flex-col gap-5"},S5={class:"flex flex-col gap-4"},T5={class:"mb-1 flex items-center gap-2"},A5={key:0,class:"text-xs font-semibold text-highlighted"},E5={key:1,class:"text-xs font-semibold text-muted"},O5={class:"flex flex-col gap-1"},P5=["title","onClick"],R5={key:0},I5={class:"mb-2 flex h-1.5 overflow-hidden rounded-full bg-elevated"},$5={class:"space-y-0.5 text-xs"},q5={class:"flex justify-between"},M5={class:"flex justify-between"},D5={class:"flex justify-between"},L5=Y({__name:"Sidebar",props:{groups:{},files:{}},setup(e){const t=e;function n(l){return`file-${l.replace(/[^a-zA-Z0-9]/g,"-")}`}function r(l){return l.split("/").pop()??l}function s(l){var u;(u=document.getElementById(n(l)))==null||u.scrollIntoView({behavior:"smooth",block:"start"})}const o={high:"error",medium:"warning",low:"success"},i=E(()=>yy(t.files)),a=E(()=>i.value.verified+i.value.unverified+i.value.gap);return(l,u)=>{const c=mn;return y(),T("nav",C5,[C("div",null,[u[0]||(u[0]=C("p",{class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},"Behavioral groups",-1)),C("div",S5,[(y(!0),T(ne,null,Ee(e.groups,(f,p)=>{var h,g;return y(),T("div",{key:((h=f.group)==null?void 0:h.id)??`ungrouped-${p}`},[C("div",T5,[f.group?(y(),T("span",A5,q(f.group.title),1)):(y(),T("span",E5,"Other changes")),(g=f.group)!=null&&g.risk?(y(),$(c,{key:2,color:o[f.group.risk],variant:"subtle",size:"sm"},{default:R(()=>[me(q(f.group.risk),1)]),_:2},1032,["color"])):L("",!0)]),C("div",O5,[(y(!0),T(ne,null,Ee(f.filePaths,m=>(y(),T("button",{key:m,type:"button",class:"truncate rounded px-2 py-1 text-left font-mono text-xs text-muted hover:bg-elevated hover:text-highlighted",title:m,onClick:v=>s(m)},q(r(m)),9,P5))),128))])])}),128))])]),a.value?(y(),T("div",R5,[u[4]||(u[4]=C("p",{class:"mb-2 text-[11px] font-semibold tracking-wide text-dimmed uppercase"},"Verification",-1)),C("div",I5,[C("div",{class:"bg-success",style:wt({width:`${100*i.value.verified/a.value}%`})},null,4),C("div",{class:"bg-warning",style:wt({width:`${100*i.value.unverified/a.value}%`})},null,4),C("div",{class:"bg-error",style:wt({width:`${100*i.value.gap/a.value}%`})},null,4)]),C("ul",$5,[C("li",q5,[u[1]||(u[1]=C("span",{class:"text-success"},"verified",-1)),C("span",null,q(i.value.verified),1)]),C("li",M5,[u[2]||(u[2]=C("span",{class:"text-warning"},"unverified",-1)),C("span",null,q(i.value.unverified),1)]),C("li",D5,[u[3]||(u[3]=C("span",{class:"text-error"},"gap",-1)),C("span",null,q(i.value.gap),1)])])])):L("",!0)])}}}),N5={class:"max-h-72 w-80 overflow-y-auto p-2 font-mono text-xs"},B5={class:"mb-1 px-1 font-sans text-[10px] text-muted"},z5=["onClick"],F5={class:"text-primary"},j5={class:"text-dimmed"},H5={class:"text-muted"},V5=Y({__name:"SymbolOccurrencesPopover",setup(e){const t=iI();async function n(s,o,i){dh(),await Zv(s,o,i)}function r(s){s||dh()}return(s,o)=>{const i=Za;return y(),$(i,{open:d(t).open,"onUpdate:open":r},{content:R(()=>[C("div",N5,[C("div",B5,q(d(t).occurrences.length)+" occurrence"+q(d(t).occurrences.length===1?"":"s")+" of “"+q(d(t).symbol)+"” ",1),(y(!0),T(ne,null,Ee(d(t).occurrences,a=>(y(),T("button",{key:a.lineId,type:"button",class:"block w-full truncate rounded px-1.5 py-1 text-left hover:bg-elevated",onClick:l=>n(a.path,a.hunkIndex,a.lineId)},[C("span",F5,q(a.path),1),C("span",j5,":"+q(a.lineNumber),1),C("span",H5," — "+q(a.text.trim()),1)],8,z5))),128))])]),default:R(()=>[C("span",{class:"pointer-events-none fixed h-0 w-0",style:wt({left:`${d(t).x}px`,top:`${d(t).y}px`})},null,4)]),_:1},8,["open"])}}}),xh=8,wh=6,U5=260;function W5(e,t,n){const r=Math.max(xh,Math.min(e.left,t.width-n-xh)),s=t.height-e.bottom;return s>=U5||s>=e.top?{left:r,top:e.bottom+wh}:{left:r,bottom:t.height-e.top+wh}}const G5=40,on=gt({body:null,anchor:null}),kh=new Map;let ec=0;function K5(e){let t=kh.get(e);return t||(t=iR(e,G5).then(n=>n?{lines:n.content.split(`
119
+ `),truncated:n.truncated}:null).catch(()=>null),kh.set(e,t)),t}function Kr(){ec++,on.body=null,on.anchor=null}async function Y5(e,t){const n=++ec,r=fd(e,fn.value.map(o=>o.path));if(r.kind==="ambiguous")return Kr();if(r.kind==="diff"){const o=fn.value.find(i=>i.path===r.path);if(!o)return Kr();on.body={kind:"diff",path:r.path,lines:dR(o)},on.anchor=t;return}const s=await K5(r.path);if(n===ec){if(!s)return Kr();on.body={kind:"repo",path:r.path,...s},on.anchor=t}}const Q5=250,X5=200,Z5="[data-file-preview]",J5="[data-file-ref]";function eD(){let e;const t=g=>g instanceof Element?g.closest(J5):null,n=g=>g instanceof Element&&g.closest(Z5)!==null;function r(g,m){clearTimeout(e),e=setTimeout(()=>{const v=g.getBoundingClientRect();Y5(g.dataset.fileRef??"",{left:v.left,top:v.top,bottom:v.bottom})},m)}function s(){clearTimeout(e),e=setTimeout(Kr,X5)}function o(){clearTimeout(e)}function i(g){const m=t(g.target);m?r(m,Q5):n(g.target)&&o()}function a(g){(t(g.target)||n(g.target))&&s()}function l(g){const m=t(g.target);m&&r(m,0)}function u(g){t(g.target)&&s()}function c(g){if(g.key==="Escape"){clearTimeout(e),Kr();return}const m=t(g.target);m&&g.key==="Enter"&&g.ctrlKey&&p(m)}function f(g){const m=t(g.target);m&&fR(g)&&(g.preventDefault(),p(m))}function p(g){const m=fd(g.dataset.fileRef??"",fn.value.map(v=>v.path));m.kind==="diff"&&(Kr(),Ay(m.path))}const h=()=>Kr();dt(()=>{document.addEventListener("mouseover",i),document.addEventListener("mouseout",a),document.addEventListener("focusin",l),document.addEventListener("focusout",u),document.addEventListener("keydown",c),document.addEventListener("click",f,!0),document.addEventListener("scroll",h,!0)}),as(()=>{clearTimeout(e),document.removeEventListener("mouseover",i),document.removeEventListener("mouseout",a),document.removeEventListener("focusin",l),document.removeEventListener("focusout",u),document.removeEventListener("keydown",c),document.removeEventListener("click",f,!0),document.removeEventListener("scroll",h,!0)})}const tD={class:"mb-1 truncate font-mono text-xs font-semibold text-highlighted"},nD={class:"max-w-full overflow-x-auto rounded border border-default bg-default p-1.5 font-mono text-[10px]","data-testid":"file-preview-code"},rD=["innerHTML"],sD={class:"mt-1 text-[11px] text-muted"},oD=520,iD=Y({__name:"FilePreviewPopover",setup(e){eD();const t=E(()=>{const n=on.anchor;if(!n)return{};const r=W5(n,{width:window.innerWidth,height:window.innerHeight},oD);return{left:`${r.left}px`,top:r.top===void 0?void 0:`${r.top}px`,bottom:r.bottom===void 0?void 0:`${r.bottom}px`}});return(n,r)=>d(on).body?(y(),T("div",{key:0,id:"file-preview",role:"tooltip","data-file-preview":"","data-testid":"file-preview",class:"fixed z-50 max-h-80 w-[520px] max-w-[calc(100vw-1rem)] overflow-y-auto rounded-lg border border-default bg-default p-2 shadow-lg",style:wt(t.value)},[C("p",tD,q(d(on).body.path),1),d(on).body.kind==="diff"?(y(),T(ne,{key:0},[B(Bo,{lines:d(on).body.lines},null,8,["lines"]),r[0]||(r[0]=C("p",{class:"mt-1 text-[11px] text-muted"},"First lines of the change. Ctrl+click to open",-1))],64)):(y(),T(ne,{key:1},[C("div",nD,[(y(!0),T(ne,null,Ee(d(on).body.lines,(s,o)=>(y(),T("div",{key:o,class:"whitespace-pre"},[C("code",{innerHTML:d(Us)(s)},null,8,rD)]))),128))]),C("p",sD," Top of the file"+q(d(on).body.truncated?" (first lines only)":"")+". Not in the diff, so Ctrl+click does nothing ",1)],64))],4)):L("",!0)}});function aD(){const e=gt({loaded:!1,known:new Set,seen:new Set,answers:[]});function t(s){const o=e.loaded?s.filter(i=>!e.known.has(i.id)):[];for(const i of s)e.known.add(i.id);if(!e.loaded)for(const i of s)e.seen.add(i.id);return e.loaded=!0,e.answers=[...s],o}function n(s){for(const o of e.answers)o.questionId===s&&e.seen.add(o.id)}const r=E(()=>e.answers.filter(s=>!e.seen.has(s.id)).length);return{sync:t,markSeenForQuestion:n,unseenCount:r}}const Jl=aD(),lD=1e4;function uD(e){const t=hv(),n=Xa();function r(o){const i=n.questions.find(a=>a.id===o.questionId);t.add({title:"New answer",description:(i==null?void 0:i.body)??"The agent answered a Question.",icon:"i-lucide-message-circle-reply",duration:lD,actions:i?[{label:"Open",color:"neutral",variant:"outline",onClick:()=>nl(i)}]:[]})}function s(){Qe.open&&Qe.threadId&&Jl.markSeenForQuestion(Qe.threadId)}return Me(e,o=>{o&&(Jl.sync(o).forEach(r),s())},{immediate:!0}),Me(()=>[Qe.open,Qe.threadId],s),{unseenCount:Jl.unseenCount}}const cD=4e3;function dD(){const e=G(null),t=G(null);let n;async function r(){try{e.value=await rR(),fn.value=e.value.files,kd.value=e.value.generatorPrompt,t.value=null}catch(s){t.value=s instanceof Error?s.message:String(s)}await Jo(),await kI()}return dt(async()=>{await mO(),await r(),n=setInterval(r,cD)}),as(()=>clearInterval(n)),{viewModel:e,error:t,refresh:r}}function fD(e){const t=new Map;let n=1;for(const r of e)for(const s of r.files){for(const o of s.annotations)o.target.type!=="line"&&t.set(o.id,n++);for(const o of s.hunks)for(const i of o.lines)for(const a of i.annotations)t.set(a.id,n++)}return t}function pD(e){return!!e&&!!(e.title||e.url||e.author||e.sourceBranch||e.description)}function hD(e){return e?e.title?e.number?`!${e.number} ${e.title}`:e.title:`${e.base} → ${e.head}`:"Review Workspace"}function gD(e){return e!=null&&e.description?$r(e.description,e.url):""}function mD(e,t){const n=new Set,r=t.map(o=>{const i=o.filePaths.map(a=>e.find(l=>l.path===a)).filter(a=>!!a);return i.forEach(a=>n.add(a.path)),{group:o,filePaths:i.map(a=>a.path),files:i}}),s=e.filter(o=>!n.has(o.path));return s.length&&r.push({group:null,filePaths:s.map(o=>o.path),files:s}),r}function vD(e){const t=e.flatMap(n=>n.filePaths);return new Map(t.map((n,r)=>[n,{index:r+1,total:t.length}]))}const yD={class:"flex h-screen flex-col bg-default text-default"},bD={class:"flex min-h-0 flex-1"},xD={class:"flex min-w-0 flex-1 flex-col"},wD={key:0,"data-testid":"load-error",class:"p-4 text-error"},kD={key:1,class:"p-4 text-muted"},_D={key:3,class:"flex flex-1 overflow-hidden"},CD={key:0,class:"w-64 shrink-0 overflow-y-auto border-r border-default p-3"},SD={class:"flex-1 overflow-y-auto p-4"},TD={key:0,class:"mb-4 rounded border border-warning/50 bg-warning/10 p-3 text-xs"},AD={class:"mt-2 list-disc space-y-1 pl-4","data-testid":"bundle-diagnostics"},ED={class:"mb-3 flex items-center gap-2"},OD={key:0,class:"text-base font-semibold"},PD={key:1,class:"text-base font-semibold text-muted"},RD=Y({__name:"DiffReviewView",setup(e){const{viewModel:t,error:n}=dD(),r=Xa(),{copied:s,copy:o}=ol(),{unseenCount:i}=uD(()=>{var K;return(K=t.value)==null?void 0:K.answers}),a=G("inline"),l=G(!0),u=G(!1),c=G(!1),f=G(),p=G(r.writeToken),h=E(()=>{const K=t.value;return K?mD(K.files,K.groups):[]}),g=E(()=>Xv(r.questions)),m=E(()=>vD(h.value)),v=E(()=>{const K=t.value;return K?md(hd(K.files),gd(K.groups)).length:0});function x(K){c.value=!1,K&&requestAnimationFrame(()=>{var X;return(X=document.getElementById(Qn(K)))==null?void 0:X.scrollIntoView({behavior:"smooth",block:"start"})})}const b=E(()=>fD(h.value)),w=E(()=>{var K;return((K=t.value)==null?void 0:K.comparison)??null}),k=E(()=>hD(w.value??void 0)),O=E(()=>pD(w.value??void 0)),P=E(()=>gD(w.value??void 0)),I=E(()=>{const K=t.value;return K?TO(K.files,K.answers,g.value):[]}),M=E(()=>AO(I.value));function j(K){cO(p.value.trim()),K()}async function H(){t.value&&await o(t.value.generatorPrompt)}async function le(K){await EO(K)}return(K,X)=>{var fe;const J=mn;return y(),T("div",yD,[B(_5,{"header-title":k.value,comparison:w.value,"has-mr-metadata":O.value,"nav-visible":l.value,layout:a.value,"open-question-count":M.value,"new-answer-count":d(i),"prompt-copied":d(s),"has-write-token":d(r).writeToken.length>0,"write-token-draft":p.value,"focus-mode":c.value,"focus-mode-count":v.value,"live-answers-label":d(xI)(d(is)),"answers-used-label":d(wI)(d(is)),"onUpdate:navVisible":X[0]||(X[0]=F=>l.value=F),"onUpdate:layout":X[1]||(X[1]=F=>a.value=F),"onUpdate:writeTokenDraft":X[2]||(X[2]=F=>p.value=F),"onUpdate:focusMode":X[3]||(X[3]=F=>c.value=F),onOpenQuestions:d(ER),onOpenMrDetails:X[4]||(X[4]=F=>u.value=!0),onCopyPrompt:H,onSaveWriteToken:j},null,8,["header-title","comparison","has-mr-metadata","nav-visible","layout","open-question-count","new-answer-count","prompt-copied","has-write-token","write-token-draft","focus-mode","focus-mode-count","live-answers-label","answers-used-label","onOpenQuestions"]),B(V5),B(iD),w.value?(y(),$(wM,{key:0,open:u.value,"onUpdate:open":X[5]||(X[5]=F=>u.value=F),comparison:w.value,"description-html":P.value},null,8,["open","comparison","description-html"])):L("",!0),C("div",bD,[C("div",xD,[d(n)?(y(),T("div",wD,"Failed to load bundle: "+q(d(n)),1)):d(t)?c.value?(y(),$(cM,{key:2,files:d(t).files,groups:d(t).groups,"current-id":f.value,"onUpdate:currentId":X[6]||(X[6]=F=>f.value=F),onExit:x},null,8,["files","groups","current-id"])):(y(),T("div",_D,[l.value?(y(),T("aside",CD,[B(L5,{groups:h.value,files:d(t).files},null,8,["groups","files"])])):L("",!0),C("main",SD,[B(N3),d(t).diagnostics.length?(y(),T("div",TD,[C("strong",null,q(d(t).diagnostics.length)+" bundle-level diagnostic(s)",1),C("ul",AD,[(y(!0),T(ne,null,Ee(d(t).diagnostics,(F,de)=>(y(),T("li",{key:de},q(d(bd)(F)),1))),128))])])):L("",!0),B(M3,{"view-model":d(t)},null,8,["view-model"]),(y(!0),T(ne,null,Ee(h.value,(F,de)=>{var ee,_e;return y(),T("section",{key:((ee=F.group)==null?void 0:ee.id)??`ungrouped-${de}`,class:"mb-8"},[C("div",ED,[F.group?(y(),T("h2",OD,q(F.group.title),1)):(y(),T("h2",PD,"Other changes")),(_e=F.group)!=null&&_e.risk?(y(),$(J,{key:2,color:{high:"error",medium:"warning",low:"success"}[F.group.risk],variant:"subtle",size:"sm"},{default:R(()=>[me(q(F.group.risk),1)]),_:2},1032,["color"])):L("",!0)]),(y(!0),T(ne,null,Ee(F.files,ie=>(y(),$(Mq,{key:ie.path,file:ie,position:m.value.get(ie.path),layout:a.value,"annotation-numbers":b.value,questions:g.value,answers:d(t).answers},null,8,["file","position","layout","annotation-numbers","questions","answers"]))),128))])}),128))])])):(y(),T("div",kD,"Loading…"))]),d(Qe).open?(y(),$(XM,{key:0,entries:I.value,"current-round":((fe=d(t))==null?void 0:fe.round)??1,onShowInCode:le},null,8,["entries","current-round"])):L("",!0)])])}}}),ID=[{path:"/",name:"diff-review",component:RD}],Cd=_x(sO),$D=Pw({routes:ID,history:uw()});Cd.use($D);Cd.use(u1);Cd.mount("#app");
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Review Workspace</title>
7
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%94%8D%3C/text%3E%3C/svg%3E" />
8
- <script type="module" crossorigin src="/_app/index-BEfydsCd.js"></script>
8
+ <script type="module" crossorigin src="/_app/index-VESrDzeb.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/_app/index-D8IT_AV4.css">
10
10
  </head>
11
11
  <body>