opencode-rag-plugin 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/api.js +2 -0
  2. package/dist/chunker/factory.js +48 -18
  3. package/dist/chunker/image.js +6 -0
  4. package/dist/cli/commands/clear.js +21 -1
  5. package/dist/cli/commands/query.js +6 -0
  6. package/dist/cli/commands/status.js +4 -0
  7. package/dist/core/bootstrap.d.ts +3 -1
  8. package/dist/core/bootstrap.js +5 -0
  9. package/dist/core/config.d.ts +69 -1
  10. package/dist/core/config.js +63 -1
  11. package/dist/core/interfaces.d.ts +34 -0
  12. package/dist/describer/describer.js +9 -1
  13. package/dist/embedder/factory.d.ts +5 -1
  14. package/dist/embedder/factory.js +76 -6
  15. package/dist/embedder/health.d.ts +1 -1
  16. package/dist/embedder/health.js +43 -0
  17. package/dist/eval/rerank-eval.d.ts +45 -0
  18. package/dist/eval/rerank-eval.js +581 -0
  19. package/dist/indexer/pipeline.d.ts +17 -0
  20. package/dist/indexer/pipeline.js +123 -3
  21. package/dist/indexer/stats.d.ts +7 -0
  22. package/dist/mcp/handlers.js +3 -0
  23. package/dist/opencode/create-read-tool.js +5 -2
  24. package/dist/plugin.js +67 -6
  25. package/dist/quirks/quirk-store.d.ts +1 -0
  26. package/dist/quirks/quirk-store.js +1 -1
  27. package/dist/quirks/tool-error-recall.d.ts +112 -0
  28. package/dist/quirks/tool-error-recall.js +144 -0
  29. package/dist/reranker/base.d.ts +47 -0
  30. package/dist/reranker/base.js +73 -0
  31. package/dist/reranker/factory.d.ts +16 -0
  32. package/dist/reranker/factory.js +47 -0
  33. package/dist/reranker/llama-server.d.ts +33 -0
  34. package/dist/reranker/llama-server.js +101 -0
  35. package/dist/retriever/keyword-index.d.ts +1 -0
  36. package/dist/retriever/keyword-index.js +1 -1
  37. package/dist/retriever/retriever.d.ts +24 -1
  38. package/dist/retriever/retriever.js +69 -5
  39. package/dist/types/opencode-plugin.d.ts +2 -2
  40. package/dist/v2/v2-adapter.d.ts +6 -1
  41. package/dist/v2/v2-adapter.js +52 -8
  42. package/dist/vectorstore/lancedb.d.ts +1 -1
  43. package/dist/vectorstore/lancedb.js +43 -7
  44. package/dist/web/api.js +5 -0
  45. package/dist/web/ui/assets/index-C0QXKA-b.js +4 -0
  46. package/dist/web/ui/assets/index-Dp009QCQ.css +1 -0
  47. package/dist/web/ui/index.html +2 -2
  48. package/package.json +1 -1
  49. package/dist/web/ui/assets/index-Cgv1RsGv.js +0 -4
  50. package/dist/web/ui/assets/index-DjJHIo9R.css +0 -1
@@ -27,6 +27,40 @@
27
27
  * - The read-tool override keeps its V1 execute contract (args + sessionID).
28
28
  */
29
29
  import { ragPlugin } from "../plugin.js";
30
+ /**
31
+ * Extract a human-readable error string from a V2 `execute.after` error event.
32
+ * The exact error payload differs across OpenCode versions; probe the known
33
+ * shapes and fall back to a JSON dump or a generic message.
34
+ */
35
+ function extractToolErrorText(event) {
36
+ const result = event.result;
37
+ const candidates = [
38
+ event.error,
39
+ event.message,
40
+ result?.error,
41
+ result?.message,
42
+ typeof result?.content === "string" ? result.content : undefined,
43
+ result?.output,
44
+ ];
45
+ for (const candidate of candidates) {
46
+ if (typeof candidate === "string" && candidate.trim().length > 0)
47
+ return candidate;
48
+ if (candidate !== null && typeof candidate === "object") {
49
+ const message = candidate.message;
50
+ if (typeof message === "string" && message.trim().length > 0)
51
+ return message;
52
+ }
53
+ }
54
+ if (result !== undefined) {
55
+ try {
56
+ return JSON.stringify(result);
57
+ }
58
+ catch {
59
+ // circular payload — fall through to the generic message
60
+ }
61
+ }
62
+ return "unknown tool error";
63
+ }
30
64
  // ────────────────────────────────────────────────────────────────────────────
31
65
  // V1 tool (`@opencode-ai/plugin/tool`, zod-backed) → V2 Tool.Info converter
32
66
  // ────────────────────────────────────────────────────────────────────────────
@@ -169,19 +203,29 @@ export async function registerRagPluginV2(ctx) {
169
203
  registrations.push(registration);
170
204
  }
171
205
  // ── tool.execute.after ───────────────────────────────────────────────────
206
+ // Forwards BOTH branches: completed calls keep the existing contract, error
207
+ // calls additionally carry `input.status = "error"` and `output.error`, so
208
+ // the V1-side handler (tool-error quirk injection, auto-capture) can see
209
+ // failed tool calls. Previously the error branch was silently dropped.
172
210
  const toolAfterHook = hooks["tool.execute.after"];
173
211
  if (toolAfterHook) {
174
212
  const registration = await ctx.tool.hook("execute.after", async (event) => {
175
213
  try {
176
- if (event.status !== "completed")
177
- return;
214
+ const isError = event.status === "error";
178
215
  const result = event.result;
179
- const outputText = typeof result?.content === "string"
180
- ? result.content
181
- : result?.output !== undefined
182
- ? JSON.stringify(result.output)
183
- : "";
184
- await toolAfterHook({ sessionID: event.sessionID, tool: event.tool, callID: event.id }, { output: outputText });
216
+ const outputText = isError
217
+ ? extractToolErrorText(event)
218
+ : typeof result?.content === "string"
219
+ ? result.content
220
+ : result?.output !== undefined
221
+ ? JSON.stringify(result.output)
222
+ : "";
223
+ await toolAfterHook({
224
+ sessionID: event.sessionID,
225
+ tool: event.tool,
226
+ callID: event.id,
227
+ status: isError ? "error" : "completed",
228
+ }, { output: outputText, error: isError ? outputText : undefined });
185
229
  }
186
230
  catch {
187
231
  // Non-critical — must never throw
@@ -364,7 +364,7 @@ export declare class LanceDbStore implements VectorStore {
364
364
  close(): Promise<void>;
365
365
  /**
366
366
  * Back up the chunks.lance directory before a destructive operation.
367
- * Creates a timestamped copy at chunks.lance.backup-<ISO timestamp>.
367
+ * Moves it to a timestamped `chunks.lance.backup-<ISO timestamp>` directory.
368
368
  * Skips if chunks.lance doesn't exist or noBackup is set.
369
369
  * @returns The backup path, or null if nothing was backed up.
370
370
  */
@@ -1341,7 +1341,7 @@ export class LanceDbStore {
1341
1341
  }
1342
1342
  /**
1343
1343
  * Back up the chunks.lance directory before a destructive operation.
1344
- * Creates a timestamped copy at chunks.lance.backup-<ISO timestamp>.
1344
+ * Moves it to a timestamped `chunks.lance.backup-<ISO timestamp>` directory.
1345
1345
  * Skips if chunks.lance doesn't exist or noBackup is set.
1346
1346
  * @returns The backup path, or null if nothing was backed up.
1347
1347
  */
@@ -1357,8 +1357,26 @@ export class LanceDbStore {
1357
1357
  }
1358
1358
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
1359
1359
  const backupPath = `${lancePath}.backup-${timestamp}`;
1360
- await fs.cp(lancePath, backupPath, { recursive: true });
1361
- return backupPath;
1360
+ // Moving the table directory is instantaneous. Copying it first — as this
1361
+ // used to do — takes minutes on a large store and was exactly the window
1362
+ // in which users interrupted `clear`, ending up with a backup directory
1363
+ // and a completely untouched store. Copy is only the fallback for cases
1364
+ // where a rename cannot work (different volume, or locked by another
1365
+ // process on Windows).
1366
+ try {
1367
+ await fs.rename(lancePath, backupPath);
1368
+ return backupPath;
1369
+ }
1370
+ catch (renameErr) {
1371
+ try {
1372
+ await fs.cp(lancePath, backupPath, { recursive: true });
1373
+ return backupPath;
1374
+ }
1375
+ catch (cpErr) {
1376
+ throw new Error(`Could not back up ${lancePath} before clearing: ` +
1377
+ `${renameErr.message}; copy fallback: ${cpErr.message}`);
1378
+ }
1379
+ }
1362
1380
  }
1363
1381
  /**
1364
1382
  * Remove all chunks by dropping the underlying LanceDB table.
@@ -1372,18 +1390,36 @@ export class LanceDbStore {
1372
1390
  await this.table?.close();
1373
1391
  this.table = null;
1374
1392
  this.knownDimension = null;
1393
+ // The backup normally MOVES chunks.lance away, so there is no table left
1394
+ // to drop; attempting it on a moved table can throw, and the destructive
1395
+ // fallback below would then delete the whole store directory — including
1396
+ // the fresh backup, the manifest and quirks.jsonl.
1397
+ let tableDirStillThere = true;
1398
+ try {
1399
+ await fs.access(path.join(this.dbPath, "chunks.lance"));
1400
+ }
1401
+ catch {
1402
+ tableDirStillThere = false;
1403
+ }
1375
1404
  try {
1376
1405
  const db = await this.getDb();
1377
- const tableNames = await db.tableNames();
1378
- if (tableNames.includes(TABLE_NAME)) {
1379
- await db.dropTable(TABLE_NAME);
1406
+ if (tableDirStillThere) {
1407
+ const tableNames = await db.tableNames();
1408
+ if (tableNames.includes(TABLE_NAME)) {
1409
+ await db.dropTable(TABLE_NAME);
1410
+ }
1380
1411
  }
1381
1412
  await this.db?.close();
1382
1413
  this.db = null;
1383
1414
  }
1384
- catch {
1415
+ catch (err) {
1385
1416
  await this.db?.close();
1386
1417
  this.db = null;
1418
+ if (backup) {
1419
+ // The backup lives inside this directory — never run the destructive
1420
+ // fallback, it would destroy the backup together with the store.
1421
+ throw err;
1422
+ }
1387
1423
  try {
1388
1424
  await fs.rm(this.dbPath, { recursive: true, force: true });
1389
1425
  }
package/dist/web/api.js CHANGED
@@ -5,6 +5,7 @@ import { listSessions, getSession, deleteSession, compareSessions, validateSessi
5
5
  import { analyzeTokenUsage, compareTokenAnalyses, projectTokenSavings } from "../eval/token-analysis.js";
6
6
  import { listQuirks, lintQuirks, removeQuirk } from "../quirks/quirk-store.js";
7
7
  import { retrieve } from "../retriever/retriever.js";
8
+ import { getRerankerFor } from "../reranker/factory.js";
8
9
  import { updateConfigValue } from "../core/config.js";
9
10
  import { createExcludeMatcher } from "../core/exclude.js";
10
11
  import { CODE_SEARCH_FILTER } from "../core/interfaces.js";
@@ -481,6 +482,8 @@ async function handleRetrieve(store, keywordIndex, getEmbedder, cfg, params) {
481
482
  hybridEnabled: hybrid,
482
483
  queryPrefix: cfg.embedding.queryPrefix,
483
484
  explain,
485
+ reranker: getRerankerFor(cfg.reranking) ?? undefined,
486
+ reranking: cfg.reranking,
484
487
  filter: {
485
488
  pathPatterns: pathFilter ? pathFilter.split(",").map((s) => s.trim()).filter(Boolean) : undefined,
486
489
  languages: langFilter ? langFilter.split(",").map((s) => s.trim()).filter(Boolean) : undefined,
@@ -514,7 +517,9 @@ async function handleRetrieve(store, keywordIndex, getEmbedder, cfg, params) {
514
517
  keywordWeight: r.explanation.scoreBreakdown.keywordWeight,
515
518
  vectorRank: r.explanation.scoreBreakdown.vectorRank,
516
519
  keywordRank: r.explanation.scoreBreakdown.keywordRank,
520
+ rerankScore: r.explanation.scoreBreakdown.rerankScore,
517
521
  },
522
+ confidence: r.explanation.confidence,
518
523
  matchedTerms: r.explanation.matchedTerms,
519
524
  }
520
525
  : undefined,
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScatterPlot3D-CKwyh1Ec.js","assets/vendor-Dg8wMT7C.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./vendor-Dg8wMT7C.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function p(){let e=location.hash.slice(1)||`dashboard`,t=e.indexOf(`?`),n=t>=0?e.slice(0,t):e,r={};if(t>=0){let n=e.slice(t+1);for(let e of n.split(`&`)){let t=e.indexOf(`=`);if(t>=0)try{r[decodeURIComponent(e.slice(0,t))]=decodeURIComponent(e.slice(t+1))}catch{}}}return{view:n||`dashboard`,params:r}}function m(){let[e,t]=s(p);return u(()=>{let e=()=>t(p());return addEventListener(`hashchange`,e),()=>removeEventListener(`hashchange`,e)},[]),e}var h=Symbol.for(`preact-signals`);function g(){if(S>1)S--;else{var e,t=!1;for((function(){var e=T;for(T=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();x!==void 0;){var n=x;for(x=void 0,C++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&re(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(C=0,S--,t)throw e}}function _(e){if(S>0)return e();w=++ee,S++;try{return e()}finally{g()}}var v,y=void 0;function b(e){var t=y,n=v;y=void 0,v=void 0;try{return e()}finally{y=t,v=n}}var x=void 0,S=0,C=0,ee=0,w=0,T=void 0,te=0;function ne(e){if(y!==void 0){var t=e.n;if(t===void 0||t.t!==y)return t={i:0,S:e,p:y.s,n:void 0,t:y,e:void 0,x:void 0,r:t},y.s!==void 0&&(y.s.n=t),y.s=t,e.n=t,32&y.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=y.s,t.n=void 0,y.s.n=t,y.s=t),t}}function E(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}E.prototype.brand=h,E.prototype.h=function(){return!0},E.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?b(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},E.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&b(function(){var e;(e=t.Z)==null||e.call(t)}))}},E.prototype.subscribe=function(e){var t=this;return j(function(){var n=t.value;b(function(){return e(n)})},{name:`sub`})},E.prototype.valueOf=function(){return this.value},E.prototype.toString=function(){return this.value+``},E.prototype.toJSON=function(){return this.value},E.prototype.peek=function(){var e=this;return b(function(){return e.value})},Object.defineProperty(E.prototype,"value",{get:function(){var e=ne(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(C>100)throw Error(`Cycle detected`);(function(e){S!==0&&C===0&&e.l!==w&&(e.l=w,T={S:e,v:e.v,i:e.i,o:T})})(this),this.v=e,this.i++,te++,S++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{g()}}}});function D(e,t){return new E(e,t)}function re(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ie(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ae(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function O(e,t){E.call(this,void 0,t),this.x=e,this.s=void 0,this.g=te-1,this.f=4}O.prototype=new E,O.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===te))return!0;if(this.g=te,this.f|=1,this.i>0&&!re(this))return this.f&=-2,!0;var e=y;try{ie(this),y=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return y=e,ae(this),this.f&=-2,!0},O.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}E.prototype.S.call(this,e)},O.prototype.U=function(e){if(this.t!==void 0&&(E.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},O.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(O.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=ne(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function oe(e,t){return new O(e,t)}function se(e){var t=e.m;if(e.m=void 0,typeof t==`function`){S++;var n=y;y=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,ce(e),t}finally{y=n,g()}}}function ce(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,se(e)}function k(e){if(y!==this)throw Error(`Out-of-order effect`);ae(this),y=e,this.f&=-2,8&this.f&&ce(this),g()}function A(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,v&&v.push(this)}A.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},A.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,se(this),ie(this),S++;var e=y;return y=this,k.bind(this,e)},A.prototype.N=function(){2&this.f||(this.f|=2,this.u=x,x=this)},A.prototype.d=function(){this.f|=8,1&this.f||ce(this)},A.prototype.dispose=function(){this.d()};function j(e,t){var n=new A(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var M,N,le=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,ue=[],de=[];j(function(){M=this.N})();function fe(e,t){r[e]=t.bind(null,r[e]||function(){})}function pe(e){if(N){var t=N;N=void 0,t()}N=e&&e.S()}function me(t){var n=this,r=t.data,i=ge(r);i.name=`ReactiveDom`,i.value=r;var a=e(function(){for(var e=n,t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}var r=oe(function(){var e=i.value.value;return e===0?0:!0===e?``:e||``}),a=oe(function(){return!Array.isArray(r.value)&&!c(r.value)}),o=j(function(){if(this.N=Se,a.value){var t=r.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=n.__$u.d;return n.__$u.d=function(){o(),s.call(this)},[a,r]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}me.displayName=`ReactiveTextNode`,Object.defineProperties(E.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:me},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),fe(`__b`,function(e,t){if(typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof E&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),fe(`__r`,function(e,t){if(e(t),t.type!==n){pe();var r,i=t.__c;i&&(i.__$f&=-2,(r=i.__$u)===void 0&&(i.__$u=r=function(e,t){var n;return j(function(){n=this},{name:t}),n.c=e,n}(function(){var e;le&&((e=r.y)==null||e.call(r)),i.__$f|=1,i.setState({})},typeof t.type==`function`?t.type.displayName||t.type.name:``))),pe(r)}}),fe(`__e`,function(e,t,n,r){pe(),e(t,n,r)}),fe(`diffed`,function(e,t){pe();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=he(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function he(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=D(n);return{o:function(e,t){a.value=e,r=t},d:j(function(){this.N=Se;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}fe(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),fe(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),a.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function ge(t,n){return e(function(){return D(t,n)},[])}var _e=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},ve=function(e){queueMicrotask(function(){queueMicrotask(e)})};function ye(){_(function(){for(var e;e=ue.shift();)M.call(e)})}function be(){ue.push(this)===1&&(r.requestAnimationFrame||_e)(ye)}function xe(){_(function(){for(var e;e=de.shift();)M.call(e)})}function Se(){de.push(this)===1&&(r.requestAnimationFrame||ve)(xe)}function Ce(e,t){var n=i(e);n.current=e,u(function(){return j(function(){return this.N=be,n.current()},t)},[])}var we=D(`dashboard`),P=D(null),Te=D(null),Ee=D(null),De=D(0),Oe=D(50),F=D(new Set),ke=D(new Set),I=D(``),L=D({topK:10,minScore:.35,keywordWeight:.4,hybrid:!0,pathFilter:``,langFilter:``,extFilter:``}),R=D([]),Ae=D([]);D(!1),D(null),D([]),D(new Set),D(null),D(null);var z=D(typeof localStorage<`u`?localStorage.getItem(`theme`)??`dark`:`dark`),je=D(!0);function Me(e){return Math.min(560,Math.max(180,Math.round(e)))}function Ne(){if(typeof localStorage>`u`)return 256;let e=Number(localStorage.getItem(`sidebarWidth`));return Number.isFinite(e)&&e>0?Me(e):256}var B=D(Ne());function Pe(e){B.value=Me(e)}function Fe(){try{localStorage.setItem(`sidebarWidth`,String(B.value))}catch{}}var Ie=D([]),Le=0;function V(e,t,n=4e3){let r=Le++;Ie.value=[...Ie.value,{id:r,type:e,message:t,duration:n}],setTimeout(()=>{Ie.value=Ie.value.filter(e=>e.id!==r)},n)}function H(e){window.location.hash=e}function Re(){return u(()=>{document.documentElement.classList.toggle(`dark`,z.value===`dark`),localStorage.setItem(`theme`,z.value)},[z.value]),{theme:z.value,toggle:()=>{z.value=z.value===`dark`?`light`:`dark`}}}function ze(){u(()=>{let e=null,t=null,n=()=>{e&&=(clearTimeout(e),null),t&&=(window.removeEventListener(`keydown`,t),null)},r=r=>{let i=r.target,a=i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.isContentEditable;if((r.metaKey||r.ctrlKey)&&r.key===`k`){r.preventDefault(),H(`search`),setTimeout(()=>{document.querySelector(`.global-search-input`)?.focus()},0);return}if(!a&&r.key===`g`){let r={d:()=>H(`dashboard`),s:()=>H(`search`),c:()=>H(`chunks`),f:()=>H(`files`),e:()=>H(`evaluate`),q:()=>H(`quirks`)};n();let i=e=>{r[e.key]?.(),n()};t=i,window.addEventListener(`keydown`,i),e=setTimeout(n,500);return}};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),n()}},[])}function Be(){return l(`div`,{className:`fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none`,children:Ie.value.map(e=>l(`div`,{className:`pointer-events-auto px-4 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-all duration-300 animate-slide-in ${e.type===`success`?`bg-green-600 text-white`:e.type===`error`?`bg-red-600 text-white`:`bg-brand-600 text-white`}`,children:e.message},e.id))})}function Ve(){let e=z.value===`dark`;return l(`button`,{className:`p-2 rounded-lg transition-colors`,style:{color:`var(--text-muted)`},onClick:()=>{z.value=e?`light`:`dark`},"aria-label":e?`Switch to light mode`:`Switch to dark mode`,title:e?`Light mode`:`Dark mode`,children:[l(`span`,{className:`sr-only`,children:e?`Switch to light mode`:`Switch to dark mode`}),e?l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})}):l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})]})}function He(e,t){let[n,r]=s(e);return u(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Ue=`/api`,We=`opencode-rag-token`;function Ge(){let e=new URLSearchParams(window.location.search).get(`token`);if(e){sessionStorage.setItem(We,e);let t=window.location.pathname+window.location.hash;return window.history.replaceState(null,``,t),e}return sessionStorage.getItem(We)}function Ke(){let e=Ge();return e?{Authorization:`Bearer ${e}`}:{}}function qe(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.toString()}async function U(e,t){let n={...t?.headers??{},...Ke()},r=await fetch(Ue+e,{...t,headers:n}),i=await r.json();if(!r.ok)throw Error(i.error??r.statusText);return i}var W={stats:()=>U(`/stats`),files:()=>U(`/files`),chunks:e=>U(`/chunks?${qe(e)}`),chunk:e=>U(`/chunks/${encodeURIComponent(e)}`),search:(e,t=20)=>U(`/search?q=${encodeURIComponent(e)}&topK=${t}`),compare:e=>U(`/compare?ids=${e.join(`,`)}`),retrieve:e=>U(`/retrieve?${qe(e)}`),evalSessions:()=>U(`/eval/sessions`),evalSession:e=>U(`/eval/sessions/${encodeURIComponent(e)}`),evalDeleteSession:e=>U(`/eval/sessions/${encodeURIComponent(e)}`,{method:`DELETE`}),evalCompare:(e,t)=>U(`/eval/compare?a=${e}&b=${t}`),evalTokenCompare:(e,t)=>U(`/eval/token-compare?a=${e}&b=${t}`),evalAnalysis:e=>U(`/eval/sessions/${encodeURIComponent(e)}/analysis`),evalProjectSavings:e=>U(`/eval/project-savings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),quirks:()=>U(`/quirks`),quirkLint:()=>U(`/quirks/lint`),deleteQuirk:e=>U(`/quirks/${encodeURIComponent(e)}`,{method:`DELETE`}),indexStatus:()=>U(`/indexing/status`),triggerReindex:()=>U(`/indexing/reindex`,{method:`POST`}),config:()=>U(`/config`),updateConfig:e=>U(`/config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),tree:()=>U(`/tree`),embeddingProj:(e=5e3,t=2)=>U(`/embeddings/projection?maxChunks=${e}&dims=${t}`)},Je={typescript:`text-blue-400`,javascript:`text-yellow-400`,python:`text-green-400`,java:`text-red-400`,go:`text-cyan-400`,rust:`text-orange-400`,ruby:`text-pink-400`,csharp:`text-purple-400`,cpp:`text-indigo-400`,c:`text-gray-400`,markdown:`text-gray-300`,html:`text-orange-300`,css:`text-blue-300`,json:`text-yellow-300`,kotlin:`text-purple-300`,swift:`text-orange-400`,tex:`text-emerald-400`,sql:`text-cyan-300`};function Ye(e){return Je[e]??`text-slate-400`}function G(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${Ye(e)} bg-slate-800">${Xe(e)}</span>`}function Xe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function K(e){return typeof e==`string`?e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`):``}function Ze(e,t=80){let n=typeof e==`string`?e:String(e??``);return n.length>t?n.slice(0,t)+`...`:n}function Qe(){let[e,t]=s(``),[n,r]=s([]),[a,o]=s(!1),c=i(null),d=i(null),f=He(e,300);u(()=>{if(!f.trim()){r([]),o(!1);return}let e=!1;return W.search(f,10).then(t=>{e||(r(t?.results??[]),o(!0))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[f]),u(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&o(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[]);let p=e=>{e.key===`Escape`&&o(!1)},m=async e=>{o(!1),t(``),H(`chunks`)};return l(`div`,{ref:d,className:`relative`,children:[l(`input`,{ref:c,type:`text`,placeholder:`Search codebase...`,value:e,onInput:e=>t(e.target.value),onKeyDown:p,className:`global-search-input w-56 px-3 py-1.5 bg-slate-800 border border-slate-600 rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Global search`,role:`combobox`,"aria-expanded":a}),a&&n.length>0&&l(`div`,{className:`absolute top-full right-0 mt-1 w-96 bg-slate-800 border border-slate-600 rounded-lg shadow-xl z-50 max-h-80 overflow-y-auto`,role:`listbox`,children:n.map(e=>l(`div`,{className:`search-result p-2 hover:bg-slate-700 cursor-pointer border-b border-slate-700 last:border-0`,onClick:()=>m(e.chunk.id),role:`option`,children:[l(`div`,{className:`flex items-center gap-2 text-xs`,children:[l(`span`,{className:`text-yellow-400 font-mono`,children:[K(e.chunk.filePath),`:`,e.chunk.startLine,`-`,e.chunk.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:G(e.chunk.language)}}),l(`span`,{className:`ml-auto text-slate-500`,children:e.score})]}),l(`div`,{className:`text-xs text-slate-400 mt-1 truncate`,children:K(e.chunk.content??``).slice(0,80)})]},e.chunk.id))}),a&&e.trim()&&n.length===0&&l(`div`,{className:`absolute top-full right-0 mt-1 w-96 bg-slate-800 border border-slate-600 rounded-lg shadow-xl z-50 p-3 text-sm text-slate-500`,children:`No results`})]})}function q(e,t=[]){let[n,r]=s(null),[i,a]=s(!0),[o,c]=s(null),[l,d]=s(0);return u(()=>{let t=!1;return a(!0),c(null),e().then(e=>{t||(r(e),a(!1))}).catch(e=>{t||(c(e.message),a(!1))}),()=>{t=!0}},[...t,l]),{data:n,isLoading:i,error:o,refresh:()=>d(e=>e+1)}}function $e(){let{data:e}=q(()=>W.files()),t=e??[],[n,r]=s(``),i=He(n,300),a=i?t.filter(e=>e.filePath.toLowerCase().includes(i.toLowerCase())):t;return l(`div`,{className:`flex flex-col h-full`,children:[l(`div`,{className:`flex items-center justify-between mb-2 px-3 pt-3`,children:[l(`h2`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wide`,children:`Files`}),l(`span`,{className:`text-xs text-slate-500`,children:a.length})]}),l(`div`,{className:`px-3 mb-2`,children:l(`input`,{type:`text`,placeholder:`Filter files...`,value:n,onInput:e=>r(e.target.value),className:`w-full px-2 py-1 bg-slate-900 border border-slate-700 rounded text-xs focus:outline-none focus:border-brand-400 text-slate-200 placeholder-slate-500`})}),l(`div`,{className:`flex-1 overflow-y-auto px-1`,children:l(et,{files:a})})]})}function et({files:e}){let t={};for(let n of e){let e=n.filePath.split(`/`),r=t;for(let t=0;t<e.length-1;t++)r[e[t]]||(r[e[t]]={}),r=r[e[t]];r.__files||(r.__files=[]),r.__files.push(n)}return l(nt,{obj:t,depth:0,parentPath:``})}function tt(e){let t=(e.__files||[]).length;for(let[n,r]of Object.entries(e))n!==`__files`&&(t+=tt(r));return t}function nt({obj:e,depth:t,parentPath:r}){let i=Object.entries(e).filter(([e])=>e!==`__files`).sort(([e],[t])=>e.localeCompare(t)),a=e.__files||[];return l(n,{children:[i.map(([e,n])=>{let i=r?`${r}/${e}`:e,a=tt(n),o=ke.value.has(i),s=o?`▸`:`▾`;return l(`div`,{children:[l(`div`,{className:`file-item flex items-center gap-1 py-0.5 px-2 rounded cursor-pointer text-slate-400 hover:text-white`,style:{paddingLeft:`${t*12+8}px`},onClick:()=>{let e=new Set(ke.value);e.has(i)?e.delete(i):e.add(i),ke.value=e},role:`treeitem`,"aria-expanded":!o,children:[l(`span`,{className:`text-xs`,children:s}),l(`span`,{className:`text-xs`,children:`📁`}),l(`span`,{className:`text-xs`,children:K(e)}),l(`span`,{className:`text-xs text-slate-600 ml-auto`,children:a})]}),!o&&l(`div`,{className:`dir-children`,children:l(nt,{obj:n,depth:t+1,parentPath:i})})]},i)}),a.map(e=>{let n=e.filePath.split(`/`).pop()??e.filePath,r=P.value===e.filePath;return l(`div`,{className:`file-item flex items-center gap-1 py-0.5 px-2 rounded cursor-pointer ${r?`active text-white`:`text-slate-400 hover:text-white`}`,style:{paddingLeft:`${t*12+8}px`},onClick:()=>{P.value=e.filePath,H(`chunks?file=${encodeURIComponent(e.filePath)}`)},role:`treeitem`,tabIndex:0,children:[l(`span`,{className:`text-xs ${Ye(e.language)}`,children:`♦`}),l(`span`,{className:`text-xs truncate`,children:K(n)}),l(`span`,{className:`text-xs text-slate-600 ml-auto`,children:e.chunkCount})]},e.filePath)})]})}function rt(e){let t=[...e].sort(),n=[];for(let e of t)n.some(t=>e.startsWith(`${t}/`))||n.push(e);return n}function it(e,t){return t.includes(e)?`checked`:t.some(t=>t.startsWith(`${e}/`))?`partial`:`unchecked`}function at(){let e=q(()=>W.tree()),t=q(()=>W.config()),[r,i]=s(!1),[a,o]=s([]),[c,d]=s([]),[f,p]=s(!1),[m,h]=s(!1),[g,_]=s(!1),v=t.data?.body?.config??t.data?.config,y=e.data?.body?.tree??e.data?.tree;u(()=>{if(v&&!f){let e=v.indexing?.includeDirs??[];o(e),d(e),p(!0)}},[v,f]);let b=rt(a),x=rt(c).join(`|`)!==b.join(`|`),S=b.length===0;function C(e){let t=new Set(a);if(it(e,a)===`checked`)for(let n of a)(n===e||n.startsWith(`${e}/`))&&t.delete(n);else{t.add(e);for(let n of a)n.startsWith(`${e}/`)&&t.delete(n)}o([...t])}function ee(){o([])}async function w(){if(!m){h(!0);try{await W.updateConfig({indexing:{includeDirs:b}}),o(b),d(b),_(!0)}catch(e){V(`error`,`Failed to save scope: ${e.message}`)}finally{h(!1)}}}async function T(){_(!1),V(`info`,`Scope saved — starting reindex…`);try{await W.triggerReindex(),V(`success`,`Reindex started in the background.`)}catch(e){V(`error`,`Reindex failed to start: ${e.message}`)}}return l(`div`,{className:`border-b`,style:{borderColor:`var(--border)`},children:[l(`button`,{type:`button`,className:`w-full flex items-center gap-1 px-3 py-2 text-xs font-semibold text-slate-400 uppercase tracking-wide hover:text-white`,onClick:()=>i(e=>!e),"aria-expanded":r,children:[l(`span`,{className:`text-xs`,children:r?`▾`:`▸`}),l(`span`,{children:`Indexing scope`}),b.length>0&&l(`span`,{className:`ml-auto text-xs text-slate-500`,children:[b.length,` folder`,b.length===1?``:`s`]})]}),r&&l(`div`,{className:`px-2 pb-3 text-xs`,children:[e.error&&l(`p`,{className:`text-red-400 px-2 py-1`,children:[`Could not load workspace tree: `,e.error,l(`button`,{type:`button`,className:`ml-2 underline`,onClick:e.refresh,children:`Retry`})]}),!e.error&&!y&&l(`p`,{className:`px-2 py-1 text-slate-500`,children:`Loading folders…`}),y&&l(n,{children:[l(`label`,{className:`flex items-center gap-1.5 py-1 px-2 rounded cursor-pointer text-slate-300 hover:text-white`,children:[l(`input`,{type:`checkbox`,checked:S,onChange:ee}),l(`span`,{children:`Whole workspace`}),!S&&l(`span`,{className:`text-slate-500`,children:`(include all folders)`})]}),l(`p`,{className:`px-2 py-1 text-slate-600`,children:`Selecting a folder includes all of its subfolders. Files directly in the workspace root are only indexed with "Whole workspace".`}),l(`div`,{className:`max-h-48 overflow-y-auto border rounded`,style:{borderColor:`var(--border)`},children:l(ot,{dirs:y,depth:0,selection:a,onToggle:C})}),l(`button`,{type:`button`,disabled:!x||m,className:`mt-2 w-full px-3 py-1.5 rounded font-semibold disabled:opacity-40 disabled:cursor-not-allowed`,style:{background:`var(--accent)`,color:`#fff`},onClick:w,children:m?`Saving…`:x?`Save scope`:`Saved`}),l(`p`,{className:`mt-1.5 px-2 text-slate-600`,children:[`Saved to `,l(`code`,{children:`opencode-rag.json`}),`. The background watcher applies the new scope after an OpenCode restart.`]})]})]}),g&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:l(`div`,{className:`rounded-lg p-5 max-w-sm w-full shadow-xl`,style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`},children:[l(`h3`,{className:`text-base font-bold mb-2`,children:`Scope saved`}),l(`p`,{className:`text-sm mb-4`,style:{color:`var(--text-muted)`},children:`The includeDirs setting was written to opencode-rag.json. Reindex now so the index matches the new scope?`}),l(`div`,{className:`flex justify-end gap-2`,children:[l(`button`,{type:`button`,className:`px-3 py-1.5 rounded text-sm`,style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`},onClick:()=>{_(!1),V(`success`,`Scope saved — applies on the next index pass.`)},children:`Later`}),l(`button`,{type:`button`,className:`px-3 py-1.5 rounded text-sm font-semibold text-white`,style:{background:`var(--accent)`},onClick:T,children:`Reindex now`})]})]})})]})}function ot({dirs:e,depth:t,selection:r,onToggle:i}){return l(n,{children:e.map(e=>{let n=it(e.path,r);return l(`div`,{children:[l(`label`,{className:`flex items-center gap-1.5 py-0.5 px-2 rounded cursor-pointer text-slate-400 hover:text-white`,style:{paddingLeft:`${t*12+8}px`},children:[l(`input`,{type:`checkbox`,checked:n===`checked`,ref:e=>{e&&(e.indeterminate=n===`partial`)},onChange:()=>i(e.path)}),l(`span`,{className:`text-xs`,children:`📁`}),l(`span`,{className:`text-xs truncate`,children:e.name})]}),e.children.length>0&&l(ot,{dirs:e.children,depth:t+1,selection:r,onToggle:i})]},e.path)})})}function st(e){let t=i(null),[n,r]=s(!1);Ce(()=>{let t=e.current;t&&(t.style.width=`${B.value}px`)});let a=()=>{t.current=null,r(!1),document.body.style.cursor=``,document.body.style.userSelect=``},o=e=>{if(e.button===0){try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}t.current={pointerId:e.pointerId,startX:e.clientX,startWidth:B.peek()},r(!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`}},c=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&Pe(n.startWidth+(e.clientX-n.startX))},l=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&(a(),Fe())};return{dragging:n,handleProps:{onPointerDown:o,onPointerMove:c,onPointerUp:l,onPointerCancel:l,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowLeft`?-16:16;Pe(B.peek()+t),Fe()},onDblClick:()=>{Pe(256),Fe()}}}}function ct({targetRef:e}){let{dragging:t,handleProps:n}=st(e);return l(`div`,{className:`sidebar-resizer hidden lg:block ${t?`dragging`:``}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize file tree`,"aria-valuemin":180,"aria-valuemax":560,"aria-valuenow":B.value,tabIndex:0,title:`Drag to resize · double-click to reset`,...n})}var J=`bg-gradient-to-r from-slate-700 via-slate-600 to-slate-700 bg-[length:200%_100%]`;function Y({type:e=`card`}){return l(`div`,{className:`animate-pulse space-y-4`,children:[l(`div`,{className:`h-8 ${J} rounded w-48`}),e===`card`&&l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[1,2,3,4].map(e=>l(`div`,{className:`h-24 bg-slate-800 rounded-lg border border-slate-700 p-4`,children:[l(`div`,{className:`h-3 ${J} rounded w-16 mb-2`}),l(`div`,{className:`h-6 ${J} rounded w-24`})]},e))}),e===`table`&&l(`div`,{className:`space-y-2`,children:[l(`div`,{className:`h-10 ${J} rounded w-full`}),[1,2,3,4,5].map(e=>l(`div`,{className:`h-8 ${J} rounded w-full`},e))]}),e===`chart`&&l(`div`,{className:`h-64 ${J} rounded-lg`}),e===`detail`&&l(`div`,{className:`flex gap-4`,children:[l(`div`,{className:`flex-1 space-y-3`,children:[l(`div`,{className:`h-6 ${J} rounded w-48`}),l(`div`,{className:`h-4 ${J} rounded w-32`}),l(`div`,{className:`h-32 ${J} rounded-lg`})]}),l(`div`,{className:`flex-1 space-y-3`,children:[l(`div`,{className:`h-6 ${J} rounded w-48`}),l(`div`,{className:`h-4 ${J} rounded w-32`}),l(`div`,{className:`h-32 ${J} rounded-lg`})]})]})]})}function X({message:e,onRetry:t}){return l(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,role:`alert`,children:[l(`span`,{className:`text-4xl mb-3`,children:`⚠️`}),l(`p`,{className:`text-slate-400 mb-4`,children:e}),t&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors`,onClick:t,children:`Retry`})]})}function Z({icon:e,message:t,action:n}){return l(`div`,{className:`flex flex-col items-center justify-center py-16 text-center`,role:`status`,children:[l(`span`,{className:`text-5xl mb-4`,role:`img`,"aria-label":e,children:e}),l(`p`,{className:`text-slate-400 mb-4`,children:t}),n&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors`,onClick:n.onClick,children:n.label})]})}function Q({label:e,value:t,icon:n}){return l(`div`,{className:`kpi-card p-4`,children:[n&&l(`span`,{className:`text-lg mb-1 block`,children:n}),l(`div`,{className:`text-slate-400 text-xs mb-1`,children:e}),l(`div`,{className:`text-3xl font-bold text-white`,children:t})]})}function $(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`k`:String(e)}function lt(e){return e===0?`$0.00`:e<.01?`$`+e.toFixed(4):`$`+e.toFixed(2)}function ut(e){return e>=6e4?(e/6e4).toFixed(1)+`m`:e>=1e3?(e/1e3).toFixed(1)+`s`:e+`ms`}function dt(e){if(!e)return`-`;let t=new Date(e);return t.toLocaleDateString()+` `+t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function ft(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function pt(){let[e,t]=s(null),[n,r]=s(!0),[a,o]=s(!1),c=i(null),d=async()=>{try{let e=await W.indexStatus();t(e.body??e)}catch{}r(!1)};u(()=>{d()},[]),u(()=>()=>{c.current&&clearInterval(c.current)},[]);let f=async()=>{o(!0);try{await W.triggerReindex(),V(`info`,`Reindex started in background`);let n=e?.manifest?.lastIndexedAt,r=Date.now();c.current=setInterval(async()=>{if(Date.now()-r>6e5){c.current&&clearInterval(c.current),c.current=null,o(!1),V(`info`,`Reindex is still running — check back later`);return}try{let e=await W.indexStatus(),r=e.body??e;r.manifest?.lastIndexedAt!==n&&(c.current&&clearInterval(c.current),c.current=null,t(r),o(!1),V(`success`,`Reindex complete!`))}catch{}},2e3)}catch(e){let t=e.message??``;V(`error`,/already running/i.test(t)?`A reindex is already running`:`Reindex failed: ${t}`),o(!1)}};if(n)return null;let p=e?.manifest?.lastIndexedAt?ft(e.manifest.lastIndexedAt):`Never`,m=e?.staleFileCount??0,h=m===0?`text-green-400`:m<50?`text-amber-400`:`text-red-400`;return l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`div`,{className:`flex items-center justify-between mb-3`,children:l(`h2`,{className:`text-lg font-semibold`,children:`Index Status`})}),e?.manifest?l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Last Indexed`}),l(`span`,{className:`text-sm font-mono`,children:p})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Total Chunks`}),l(`span`,{className:`text-sm font-mono`,children:$(e.manifest.totalChunks)})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Total Files`}),l(`span`,{className:`text-sm font-mono`,children:$(e.manifest.totalFiles)})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Schema Version`}),l(`span`,{className:`text-sm font-mono`,children:e.manifest.schemaVersion})]}),l(`div`,{className:`col-span-2`,children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Index Freshness`}),l(`span`,{className:`text-sm font-mono ${h}`,children:m===0?`✓ Up to date`:`⚠ ${m} file${m===1?``:`s`} modified since last index`})]}),l(`div`,{className:`col-span-2 flex items-end`,children:a?l(`div`,{className:`flex items-center gap-2`,children:[l(`span`,{className:`animate-spin`,children:`⟳`}),l(`span`,{className:`text-sm text-amber-400`,children:`Reindexing...`})]}):l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-1.5 rounded text-sm transition-colors`,onClick:f,children:`Reindex Now`})})]}):l(`div`,{className:`text-sm text-slate-400`,children:[`No index found. Run `,l(`code`,{className:`text-brand-400`,children:`opencode-rag index`}),` first.`]})]})}function mt(){let{data:e,isLoading:t,error:n,refresh:r}=q(()=>W.stats()),{data:i}=q(()=>W.files());if(t)return l(Y,{type:`card`});if(n)return l(X,{message:n,onRetry:r});if(!e)return l(Z,{icon:`📊`,message:`No dashboard data available.`});let a=e,o=i?.body?.length??a.totalFiles??0,s=a.totalChunks??0,c=a.languages?.length??0,u=o>0?(s/o).toFixed(1):`0`,d=(a.languages??[]).slice(0,8),f=d[0]?.count??1;return l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-6`,children:`Dashboard`}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8`,children:[l(Q,{label:`Total Chunks`,value:s.toLocaleString(),icon:`🧩`}),l(Q,{label:`Total Files`,value:o.toLocaleString(),icon:`📄`}),l(Q,{label:`Languages`,value:c,icon:`🔤`}),l(Q,{label:`Avg Chunks/File`,value:u,icon:`📊`})]}),l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Language Distribution`}),l(`div`,{className:`space-y-2`,children:d.map(e=>l(`div`,{className:`flex items-center gap-3`,children:[l(`span`,{className:`w-24 text-xs text-right ${Ye(e.language)}`,children:e.language}),l(`div`,{className:`flex-1 bg-slate-800 rounded-full h-5 overflow-hidden`,children:l(`div`,{className:`h-full rounded-full bg-brand-500 flex items-center pl-2`,style:{width:`${Math.max(8,e.count/f*100)}%`},children:l(`span`,{className:`text-xs font-medium text-white`,children:e.count})})}),l(`span`,{className:`text-xs text-slate-500 w-12 text-right`,children:[(e.count/s*100).toFixed(0),`%`]})]},e.language))})]}),l(pt,{}),l(`div`,{className:`mt-6`,children:l(`h2`,{className:`text-lg font-semibold mb-3`,children:l(`a`,{href:`#config`,className:`hover:text-brand-400 transition-colors`,children:`Configuration`})})})]})}function ht({text:e,color:t,onDismiss:n}){return l(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-mono bg-slate-800 ${t??`text-slate-400`}`,children:[e,n&&l(`button`,{className:`ml-0.5 text-slate-500 hover:text-white`,onClick:n,"aria-label":`Dismiss ${e} filter`,children:`×`})]})}function gt(){let e=m();u(()=>{e.params.file&&(P.value=e.params.file),e.params.lang&&(Te.value=e.params.lang)},[e.params.file,e.params.lang]);let t=De.value,n=Oe.value,r=P.value,i=Te.value,{data:a,isLoading:o,error:s,refresh:c}=q(()=>W.chunks({offset:t,limit:n,lang:i??``,file:r??``}),[t,n,r,i]);if(o)return l(Y,{type:`detail`});if(s)return l(X,{message:s,onRetry:c});let d=a?.chunks??[],f=a?.total??d.length,p=Math.ceil(f/n),h=Math.floor(t/n)+1;return l(`div`,{className:`flex gap-4 h-full`,children:[l(`div`,{className:`w-1/2 flex flex-col`,children:[l(`div`,{className:`flex items-center gap-3 mb-3 flex-wrap`,children:[l(`h2`,{className:`text-lg font-semibold text-white`,children:`Chunks`}),l(`span`,{className:`text-sm text-slate-400`,children:[f,` total`]}),Te.value&&l(ht,{text:Te.value,color:Ye(Te.value),onDismiss:()=>{Te.value=null,Ee.value=null,De.value=0}}),P.value&&l(ht,{text:P.value,onDismiss:()=>{P.value=null,Ee.value=null,De.value=0}})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden flex-1`,children:l(`table`,{className:`w-full text-sm`,role:`table`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-2 py-2 w-8`,children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:d.length>0&&d.every(e=>F.value.has(e.id||`chunk-${d.indexOf(e)}`)),onChange:()=>{let e=d.map((e,t)=>e.id||`chunk-${t}`),t=e.every(e=>F.value.has(e)),n=new Set(F.value);for(let r of e)t?n.delete(r):n.add(r);F.value=n},"aria-label":`Select all chunks on this page`})}),l(`th`,{className:`px-3 py-2 text-left`,children:`File`}),l(`th`,{className:`px-3 py-2 text-left w-20`,children:`Lang`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Description`})]})}),l(`tbody`,{children:d.length===0?l(`tr`,{children:l(`td`,{colSpan:4,className:`px-3 py-8 text-center text-slate-500`,children:[l(`span`,{className:`text-2xl block mb-2`,children:`🔍`}),`No chunks found`]})}):d.map((e,t)=>{let n=e.id||`chunk-${t}`,r=Ee.value===n,i=F.value.has(n);return l(`tr`,{className:`chunk-row border-t border-slate-800 cursor-pointer ${r?`selected`:``}`,onClick:()=>{Ee.value=n},role:`row`,tabIndex:0,children:[l(`td`,{className:`px-2 py-2`,onClick:e=>e.stopPropagation(),children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:i,onChange:()=>{let e=new Set(F.value);e.has(n)?e.delete(n):e.add(n),F.value=e},"aria-label":`Select chunk ${n}`})}),l(`td`,{className:`px-3 py-2 text-yellow-400 font-mono text-xs`,children:[K(e.filePath),`:`,e.startLine,`-`,e.endLine]}),l(`td`,{className:`px-3 py-2`,dangerouslySetInnerHTML:{__html:G(e.language)}}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:K(e.description??``).slice(0,50)})]},n)})})]})}),l(`div`,{className:`flex items-center justify-between mt-3`,children:[l(`button`,{className:`px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50`,disabled:h<=1,onClick:()=>{De.value=Math.max(0,t-n)},children:`Previous`}),l(`span`,{className:`text-sm text-slate-400`,children:[`Page `,h,` of `,p||1]}),l(`button`,{className:`px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50`,disabled:h>=p,onClick:()=>{De.value+=n},children:`Next`})]}),F.value.size>=2&&F.value.size<=3&&l(`div`,{className:`fixed bottom-6 right-6 z-50`,children:l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-6 py-3 rounded-full shadow-lg font-bold transition-all transform hover:scale-105`,onClick:()=>{let e=[...F.value];F.value=new Set,H(`compare?ids=${e.join(`,`)}`)},children:[`Compare (`,F.value.size,`)`]})})]}),l(`div`,{className:`w-1/2 overflow-y-auto`,children:Ee.value?l(_t,{chunkId:Ee.value,chunks:d}):l(`div`,{className:`flex items-center justify-center h-full text-slate-500`,children:l(`div`,{className:`text-center`,children:[l(`div`,{className:`text-4xl mb-2`,children:`📄`}),l(`div`,{className:`text-sm`,children:`Select a chunk to view details`})]})})})]})}function _t({chunkId:e,chunks:t}){let[n,r]=s(null),[a,o]=s(!1),c=i(null);if(u(()=>{let n=!1,i=t.find(t=>t.id===e);return i?r(i):W.chunk(e).then(e=>{n||r(e)}).catch(()=>{n||r({id:e,content:``,filePath:`not found`,language:``,startLine:0,endLine:0,description:``})}),()=>{n=!0}},[e,t]),u(()=>()=>{c.current&&clearTimeout(c.current)},[]),!n)return l(Y,{type:`detail`});let d=n,f=d.language===`image`;return l(`div`,{children:[l(`div`,{className:`mb-3`,children:[l(`div`,{className:`flex items-center gap-3 mb-1`,children:l(`span`,{className:`text-yellow-400 font-mono text-sm`,children:K(d.filePath)})}),l(`div`,{className:`flex items-center gap-3 text-sm text-slate-400`,children:[l(`span`,{children:[`Lines `,d.startLine,`-`,d.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:G(d.language)}}),d.id&&l(`span`,{className:`text-xs text-slate-600 font-mono`,children:d.id})]})]}),d.description&&l(`div`,{className:`kpi-card p-3 mb-3`,children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Description`}),l(`p`,{className:`text-sm text-slate-300`,children:K(d.description)})]}),f&&l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden mb-3`,children:[l(`div`,{className:`px-3 py-1.5 bg-slate-800 border-b border-slate-700`,children:l(`span`,{className:`text-xs text-slate-400`,children:`Image Preview`})}),l(`div`,{className:`p-3 flex items-center justify-center bg-slate-950`,children:l(`img`,{src:`/api/file?path=${encodeURIComponent(d.filePath)}`,alt:d.filePath,className:`max-w-full max-h-[60vh] object-contain rounded`,onError:e=>{let t=e.currentTarget;t.style.display=`none`,t.parentElement.innerHTML=`<span class="text-slate-500 text-sm">Image not available</span>`}})})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden`,children:[l(`div`,{className:`px-3 py-1.5 bg-slate-800 border-b border-slate-700 flex items-center justify-between`,children:[l(`span`,{className:`text-xs text-slate-400`,children:f?`Vision Analysis`:`Source Code`}),l(`button`,{className:`text-xs text-slate-500 hover:text-white transition-colors`,onClick:()=>{navigator.clipboard.writeText(d.content).then(()=>{o(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),1500)})},children:a?`Copied!`:`Copy`})]}),l(`pre`,{className:`p-3 overflow-x-auto text-sm max-h-[calc(100vh-220px)]`,children:l(`code`,{className:`language-${f?`text`:d.language}`,children:K(d.content)})})]})]})}function vt(){let{data:e,isLoading:t,error:n,refresh:r}=q(()=>W.files());if(t)return l(Y,{type:`table`});if(n)return l(X,{message:n,onRetry:r});let i=e??[];if(i.length===0)return l(Z,{icon:`📂`,message:`No files indexed yet.`});let a=i.reduce((e,t)=>e+t.chunkCount,0);return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Files`}),l(`span`,{className:`text-sm text-slate-400`,children:[i.length,` files, `,a,` chunks`]})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden`,children:l(`table`,{className:`w-full text-sm`,role:`table`,"aria-label":`Indexed files`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-3 py-2 text-left`,children:`File`}),l(`th`,{className:`px-3 py-2 text-left w-28`,children:`Language`}),l(`th`,{className:`px-3 py-2 text-left w-20`,children:`Chunks`}),l(`th`,{className:`px-3 py-2 text-left w-24`})]})}),l(`tbody`,{children:i.map(e=>l(`tr`,{className:`border-t border-slate-800 hover:bg-slate-800 cursor-pointer`,onClick:()=>H(`chunks?file=${encodeURIComponent(e.filePath)}`),role:`row`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&H(`chunks?file=${encodeURIComponent(e.filePath)}`)},children:[l(`td`,{className:`px-3 py-2 text-yellow-400 font-mono text-xs`,children:e.filePath}),l(`td`,{className:`px-3 py-2`,dangerouslySetInnerHTML:{__html:G(e.language)}}),l(`td`,{className:`px-3 py-2 text-slate-300`,children:e.chunkCount}),l(`td`,{className:`px-3 py-2 text-slate-500 text-xs`,children:l(`span`,{className:`hover:text-white transition-colors`,children:`View chunks`})})]},e.filePath))})]})})]})}function yt({segments:e,size:t=180,innerRadius:n,centerLabel:r}){let i=t/2,a=t/2,o=t/2-10,s=n??o*.6,c=e.reduce((e,t)=>e+t.value,0);if(c===0)return l(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,children:[l(`circle`,{cx:i,cy:a,r:o,fill:`none`,stroke:`#334155`,"stroke-width":o-s}),l(`circle`,{cx:i,cy:a,r:s,fill:`#0f172a`})]});let u=0,d=e.map(e=>{let t=e.value/c*360,n=u,r=u+t;return u+=t,`<path d="${bt(i,a,o,n,r,s)}" fill="${e.color}" />`}).join(``),f=r??``;return l(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`chart-svg`,children:[l(`g`,{dangerouslySetInnerHTML:{__html:d}}),l(`text`,{x:i,y:a-6,"text-anchor":`middle`,fill:`white`,"font-size":`22`,"font-weight":`bold`,children:f}),l(`text`,{x:i,y:a+14,"text-anchor":`middle`,fill:`#64748b`,"font-size":`11`,children:`tokens`})]})}function bt(e,t,n,r,i,a){let o=i-r;if(o>=359.99)return`M${e},${t-n} A${n},${n} 0 1,1 ${e-.01},${t-n} L${e-.01},${t-a} A${a},${a} 0 1,0 ${e},${t-a} Z`;let s=e=>(e-90)*Math.PI/180,c=e+n*Math.cos(s(r)),l=t+n*Math.sin(s(r)),u=e+n*Math.cos(s(i)),d=t+n*Math.sin(s(i)),f=e+a*Math.cos(s(i)),p=t+a*Math.sin(s(i)),m=e+a*Math.cos(s(r)),h=t+a*Math.sin(s(r)),g=+(o>180);return[`M${c},${l}`,`A${n},${n} 0 ${g} 1 ${u},${d}`,`L${f},${p}`,`A${a},${a} 0 ${g} 0 ${m},${h}`,`Z`].join(` `)}function xt(){let e=m();return e.params.compare?l(wt,{ids:[e.params.a??``,e.params.b??``]}):e.params.session?l(Ct,{sessionId:e.params.session}):l(St,{})}function St(){let{data:e,isLoading:t,error:n,refresh:r}=q(()=>W.evalSessions()),[i,a]=s(new Set);if(t)return l(Y,{type:`table`});if(n)return l(X,{message:n,onRetry:r});let o=e?.sessions??[];if(o.length===0)return l(Z,{icon:`📊`,message:`No sessions recorded yet.`});let c=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Evaluate`}),l(`div`,{className:`flex gap-2`,children:[i.size===2&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-3 py-1 rounded text-sm transition-colors`,onClick:()=>{let[e,t]=[...i];H(`evaluate?compare&a=${encodeURIComponent(e)}&b=${encodeURIComponent(t)}`)},children:`Compare Selected`}),i.size>0&&l(`button`,{className:`text-xs text-slate-400 hover:text-white`,onClick:()=>a(new Set),children:[`Clear (`,i.size,`)`]})]})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-x-auto`,children:l(`table`,{className:`w-full text-sm`,role:`table`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-2 py-2 w-8`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Session`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Last Activity`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Messages`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Input Tokens`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Output Tokens`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Cost`}),l(`th`,{className:`px-3 py-2 text-right`,children:`RAG Calls`}),l(`th`,{className:`px-3 py-2 text-right`,children:`RAG Tokens`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Model`}),l(`th`,{className:`px-3 py-2 w-8`})]})}),l(`tbody`,{children:o.map(e=>l(`tr`,{className:`border-t border-slate-800 hover:bg-slate-800 cursor-pointer`,onClick:()=>H(`evaluate?session=${encodeURIComponent(e.sessionID)}`),children:[l(`td`,{className:`px-2 py-2`,onClick:e=>e.stopPropagation(),children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:i.has(e.sessionID),onChange:()=>c(e.sessionID),"aria-label":`Select session ${e.title??e.sessionID}`})}),l(`td`,{className:`px-3 py-2 text-slate-200 font-mono text-xs`,children:e.title??e.sessionID.slice(0,8)}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:dt(e.lastEventAt)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:e.messageCount}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$((e.totalTokens?.input??0)+(e.totalTokens?.cacheRead??0))}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$(e.totalTokens?.output??0)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:lt(e.totalCost??0)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:e.ragContextCount??0}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$(e.ragContextTokens??0)}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:e.models?.[0]??`-`}),l(`td`,{className:`px-3 py-2`,onClick:e=>e.stopPropagation(),children:l(`button`,{className:`text-slate-600 hover:text-red-400 text-xs`,onClick:async()=>{if(confirm(`Delete this session?`))try{await W.evalDeleteSession(e.sessionID),V(`success`,`Session deleted`),r()}catch(e){V(`error`,`Delete failed: ${e.message}`)}},"aria-label":`Delete session`,children:`🗑`})})]},e.sessionID))})]})})]})}function Ct({sessionId:e}){let{data:t,isLoading:n,error:r,refresh:i}=q(()=>W.evalSession(e));if(n)return l(Y,{type:`detail`});if(r)return l(X,{message:r,onRetry:i});let a=t?.summary??t,o=t?.events??[],s=a.toolCallCounts??{};[`search_semantic`,`get_file_skeleton`,`find_usages`,`describe_image`].reduce((e,t)=>e+(s[t]??0),0);let c=[{label:`Input`,value:(a.totalTokens?.input??0)+(a.totalTokens?.cacheRead??0),color:`#3b82f6`},{label:`Output`,value:a.totalTokens?.output??0,color:`#a855f7`},{label:`RAG`,value:a.ragContextTokens??0,color:`#06b6d4`},{label:`Reasoning`,value:a.totalTokens?.reasoning??0,color:`#f59e0b`}].filter(e=>e.value>0),u=c.reduce((e,t)=>e+t.value,0);return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`button`,{className:`text-sm text-slate-400 hover:text-white`,onClick:()=>H(`evaluate`),children:`← Back`}),l(`h1`,{className:`text-xl font-bold`,children:a.title??a.sessionID?.slice(0,12)})]}),l(`div`,{className:`grid grid-cols-3 lg:grid-cols-5 gap-3 mb-6`,children:[l(Q,{label:`Total Tokens`,value:$(u)}),l(Q,{label:`Input`,value:$((a.totalTokens?.input??0)+(a.totalTokens?.cacheRead??0))}),l(Q,{label:`Output`,value:$(a.totalTokens?.output??0)}),l(Q,{label:`Cost`,value:lt(a.totalCost??0)}),l(Q,{label:`RAG Context`,value:$(a.ragContextTokens??0)})]}),l(`div`,{className:`flex items-center gap-6 mb-6`,children:[l(yt,{segments:c,centerLabel:$(u)}),l(`div`,{className:`flex flex-wrap gap-3`,children:c.map(e=>l(`div`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`span`,{className:`inline-block w-3 h-3 rounded-sm`,style:{background:e.color}}),e.label,`: `,$(e.value),` (`,(e.value/u*100).toFixed(1),`%)`]},e.label))})]}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6`,children:[l(Q,{label:`Messages`,value:a.messageCount??0}),l(Q,{label:`Steps`,value:a.totalSteps??0}),l(Q,{label:`RAG Injections`,value:a.ragContextCount??0}),l(Q,{label:`Avg Response`,value:ut(a.avgResponseTimeMs??0)})]}),Object.keys(s).length>0&&l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Tool Calls`}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:Object.entries(s).map(([e,t])=>l(`div`,{className:`flex justify-between text-xs text-slate-400`,children:[l(`span`,{className:`font-mono`,children:e}),l(`span`,{className:`text-white`,children:String(t)})]},e))})]}),a.models&&a.models.length>0&&l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:`Models`}),l(`div`,{className:`flex flex-wrap gap-2`,children:a.models.map(e=>l(`span`,{className:`px-2 py-0.5 rounded text-xs font-mono bg-slate-800 text-slate-300`,children:e},e))})]}),o.length>0&&l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Event Timeline`}),l(`div`,{className:`space-y-1 max-h-64 overflow-y-auto`,children:o.map((e,t)=>l(`div`,{className:`flex gap-2 text-xs border-b border-slate-700/50 py-1`,children:[l(`span`,{className:`text-slate-500 shrink-0 w-16`,children:dt(e.ts)}),l(`span`,{className:`text-slate-400`,children:e.event}),e.tool&&l(`span`,{className:`text-slate-500 font-mono`,children:e.tool}),e.toolStatus&&l(`span`,{className:`text-xs ${e.toolStatus===`completed`?`text-green-400`:e.toolStatus===`running`?`text-amber-400`:`text-slate-500`}`,children:e.toolStatus})]},t))})]})]})}function wt({ids:e}){let[t,n]=e,{data:r,isLoading:i,error:a}=q(()=>Promise.all([W.evalCompare(t,n),W.evalTokenCompare(t,n)]),[t,n]);if(i)return l(Y,{type:`chart`});if(a)return l(X,{message:a});if(!r)return null;let o=r[0],s=r[1],c=s.sessionA?.savings??0,u=s.sessionB?.savings??0;return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`button`,{className:`text-sm text-slate-400 hover:text-white`,onClick:()=>H(`evaluate`),children:`← Back`}),l(`h1`,{className:`text-xl font-bold`,children:`Session Comparison`})]}),l(`div`,{className:`px-4 py-3 rounded-lg mb-4 font-semibold text-sm ${c>0&&u>0?`bg-green-900/50 text-green-300 border border-green-700`:`bg-amber-900/50 text-amber-300 border border-amber-700`}`,children:c>0&&u>0?`RAG saves tokens`:`Mixed results`}),l(`div`,{className:`grid grid-cols-2 gap-4`,children:[l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:o.sessionA?.title??`Session A`}),l(`div`,{className:`space-y-1 text-sm`,children:[l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Total Tokens`}),l(`span`,{children:$(o.sessionA?.totalTokens??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Cost`}),l(`span`,{children:lt(o.sessionA?.totalCost??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`RAG Savings`}),l(`span`,{className:c>0?`text-green-400`:`text-red-400`,children:[$(Math.abs(c)),` (`,c>0?`+`:``,c>0?`+`:``,`)`]})]})]})]}),l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:o.sessionB?.title??`Session B`}),l(`div`,{className:`space-y-1 text-sm`,children:[l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Total Tokens`}),l(`span`,{children:$(o.sessionB?.totalTokens??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Cost`}),l(`span`,{children:lt(o.sessionB?.totalCost??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`RAG Savings`}),l(`span`,{className:u>0?`text-green-400`:`text-red-400`,children:$(Math.abs(u))})]})]})]})]})]})}var Tt={gotcha:`text-amber-400 bg-amber-900/20`,preference:`text-emerald-400 bg-emerald-900/20`,decision:`text-sky-400 bg-sky-900/20`,"environment-constraint":`text-rose-400 bg-rose-900/20`};function Et(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${Tt[e]??`text-slate-400 bg-slate-800`}">${K(e||`general`)}</span>`}function Dt(){let{data:e,isLoading:t,error:n,refresh:r}=q(()=>W.quirks()),[i,a]=s(null),[o,c]=s(null),[u,d]=s(!1);if(t)return l(Y,{type:`card`});if(n)return l(X,{message:n,onRetry:r});let f=e?.quirks??[],p=[...new Set(f.map(e=>e.type||`general`))],m=i?f.filter(e=>(e.type||`general`)===i):f,h=async e=>{if(confirm(`Delete this quirk?`))try{await W.deleteQuirk(e),V(`success`,`Quirk deleted`),r()}catch(e){V(`error`,`Delete failed: ${e.message}`)}};return l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Quirks`}),l(`button`,{className:`bg-slate-700 hover:bg-slate-600 text-white px-3 py-1 rounded text-sm transition-colors`,onClick:async()=>{d(!0);try{let e=await W.quirkLint();c(e)}catch(e){c({error:e.message})}d(!1)},disabled:u,children:u?`Linting...`:`Lint`})]}),l(`div`,{className:`flex gap-2 mb-4 flex-wrap`,children:[l(`button`,{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${i===null?`bg-brand-600 text-white`:`bg-slate-700 text-slate-300 hover:bg-slate-600`}`,onClick:()=>a(null),children:`All`}),p.map(e=>l(`button`,{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${i===e?`bg-brand-600 text-white`:`bg-slate-700 text-slate-300 hover:bg-slate-600`}`,onClick:()=>a(e),children:e},e))]}),o&&l(`div`,{className:`mb-4 p-3 rounded-lg border text-sm ${o.success?`bg-green-900/30 border-green-700 text-green-300`:o.error?`bg-red-900/30 border-red-700 text-red-300`:`bg-amber-900/30 border-amber-700 text-amber-300`}`,children:l(`pre`,{className:`text-xs whitespace-pre-wrap`,children:JSON.stringify(o,null,2)})}),m.length===0?l(Z,{icon:`💡`,message:`No quirks stored yet.`}):l(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3`,children:m.map(e=>l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 p-3 flex flex-col`,children:[l(`div`,{className:`flex items-center justify-between mb-2`,children:[l(`span`,{dangerouslySetInnerHTML:{__html:Et(e.type)}}),l(`span`,{className:`text-xs font-mono ${e.confidence>.7?`text-green-400`:e.confidence>.4?`text-amber-400`:`text-red-400`}`,children:[(e.confidence*100).toFixed(0),`%`]})]}),l(`p`,{className:`text-sm text-slate-200 mb-2 flex-1`,children:K(e.content)}),e.tags&&e.tags.length>0&&l(`div`,{className:`flex gap-1 flex-wrap mb-2`,children:e.tags.map(e=>l(`span`,{className:`text-xs bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded`,children:[`#`,e]},e))}),l(`div`,{className:`flex items-center justify-between text-xs text-slate-600 mt-auto`,children:[e.sourceRef&&l(`span`,{className:`font-mono`,children:K(e.sourceRef)}),l(`span`,{className:`font-mono`,children:e.id})]}),l(`button`,{className:`self-end mt-2 text-xs text-slate-600 hover:text-red-400 transition-colors`,onClick:()=>h(e.id),"aria-label":`Delete quirk`,children:`Delete`})]},e.id))})]})}function Ot(){let[e,t]=s([]),[n,r]=s(!1),[i,a]=s(null),[o,c]=s(!1),l=He(L.value,300);return u(()=>{let e=I.value.trim();if(!e){t([]),a(null),r(!1),R.value=[];return}let n=!1;return(async()=>{r(!0),a(null);try{let i=await W.retrieve({q:e,topK:l.topK,minScore:l.minScore,keywordWeight:l.keywordWeight,hybrid:l.hybrid?`true`:`false`,path:l.pathFilter||void 0,lang:l.langFilter||void 0,ext:l.extFilter||void 0,explain:`true`});if(n)return;if(i.status===503){a(i.body?.error??`Embedding model unavailable`),r(!1);return}c(!1);let o=i.body?.results??i.results??[];t(o),R.value=o,Ae.value=[{query:e,params:{...l}},...Ae.value.filter(t=>t.query!==e).slice(0,19)]}catch(e){n||a(e.message)}finally{n||r(!1)}})(),()=>{n=!0}},[I.value,l]),{results:e,isLoading:n,isInitializing:o,error:i,setResults:t}}function kt({explanation:e}){let{vectorScore:t,keywordScore:n,rawVectorScore:r,rawKeywordScore:i,keywordWeight:a,vectorRank:o,keywordRank:s}=e.scoreBreakdown,c=Math.max(t+n,.001),u=(t/c*100).toFixed(0),d=(n/c*100).toFixed(0);return l(`div`,{className:`mb-2`,children:[l(`div`,{className:`flex items-center gap-2 text-xs mb-1`,children:[l(`span`,{className:`text-cyan-400`,title:`Vector: ${r.toFixed(3)}${o===void 0?``:`, rank #${o+1}`}`,children:[`Vector `,u,`%`]}),l(`span`,{className:`text-amber-400`,title:`Keyword: ${i.toFixed(3)}${s===void 0?``:`, rank #${s+1}`}`,children:[`Keyword `,d,`%`]}),l(`span`,{className:`text-slate-500 ml-auto`,children:[`kw=`,a.toFixed(1)]})]}),l(`div`,{className:`h-2 bg-slate-700 rounded-full overflow-hidden flex`,children:[l(`div`,{className:`h-full bg-cyan-500 transition-all duration-200`,style:{width:`${u}%`}}),l(`div`,{className:`h-full bg-amber-500 transition-all duration-200`,style:{width:`${d}%`}})]})]})}function At(){let e=m(),{results:t,isLoading:n,isInitializing:r,error:i}=Ot();return u(()=>{e.params.query&&(I.value=e.params.query,L.value={...L.value,topK:parseInt(e.params.topK??`10`,10),minScore:parseFloat(e.params.minScore??`0.35`),keywordWeight:parseFloat(e.params.keywordWeight??`0.4`),hybrid:e.params.hybrid!==`false`,pathFilter:e.params.path??``,langFilter:e.params.lang??``,extFilter:e.params.ext??``})},[]),u(()=>{if(I.value.trim()){let e=new URLSearchParams({query:I.value,topK:String(L.value.topK),minScore:String(L.value.minScore),keywordWeight:String(L.value.keywordWeight),hybrid:String(L.value.hybrid)});L.value.pathFilter&&e.set(`path`,L.value.pathFilter),L.value.langFilter&&e.set(`lang`,L.value.langFilter),L.value.extFilter&&e.set(`ext`,L.value.extFilter);let t=`search?${e.toString()}`;location.hash!==`#${t}`&&history.replaceState(null,``,`#${t}`)}},[I.value,L.value]),l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-4`,children:`Semantic Search`}),l(`div`,{className:`flex gap-3 mb-4`,children:l(`input`,{type:`text`,value:I.value,onInput:e=>{I.value=e.target.value,R.value=[]},onKeyDown:e=>{e.key===`Enter`&&I.value.trim()},placeholder:`Search your codebase semantically... (e.g., 'how does authentication work?')`,className:`flex-1 px-4 py-2 bg-slate-800 border border-slate-600 rounded-lg text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,autoFocus:!0,"aria-label":`Semantic search query`})}),l(`details`,{className:`mb-4 bg-slate-800 rounded-lg border border-slate-700`,children:[l(`summary`,{className:`px-3 py-2 text-xs text-slate-400 cursor-pointer hover:text-white font-medium`,children:`Search Parameters`}),l(`div`,{className:`px-3 pb-3 space-y-3`,children:[l(Nt,{label:`topK`,min:1,max:25,step:1,value:L.value.topK,onChange:e=>{L.value={...L.value,topK:e}}}),l(Nt,{label:`minScore`,min:0,max:1,step:.05,value:L.value.minScore,onChange:e=>{L.value={...L.value,minScore:e}}}),l(Nt,{label:`keywordWeight`,min:0,max:1,step:.1,value:L.value.keywordWeight,onChange:e=>{L.value={...L.value,keywordWeight:e}}}),l(`div`,{className:`flex items-center gap-2`,children:[l(`label`,{className:`text-xs text-slate-400 w-28`,children:`Hybrid mode`}),l(`input`,{type:`checkbox`,checked:L.value.hybrid,onChange:e=>{L.value={...L.value,hybrid:e.target.checked}},className:`accent-brand-500`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Extensions`}),l(`input`,{type:`text`,value:L.value.extFilter,onInput:e=>{L.value={...L.value,extFilter:e.target.value}},placeholder:`.ts, .py (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`File extension filter`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Languages`}),l(`input`,{type:`text`,value:L.value.langFilter,onInput:e=>{L.value={...L.value,langFilter:e.target.value}},placeholder:`typescript, python (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Language filter`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Path`}),l(`input`,{type:`text`,value:L.value.pathFilter,onInput:e=>{L.value={...L.value,pathFilter:e.target.value}},placeholder:`src/** (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Path filter`})]})]})]}),r&&l(`div`,{className:`text-center py-10 text-slate-400`,children:[l(`span`,{className:`animate-spin inline-block mr-2`,children:`⟳`}),`Initializing embedding model...`]}),i&&l(X,{message:i}),!n&&!i&&I.value.trim()&&t.length===0&&l(`div`,{className:`text-center py-16 text-slate-500`,children:[l(`div`,{className:`text-4xl mb-2`,children:`🔍`}),l(`div`,{children:[`No results found for "`,K(I.value),`"`]})]}),!n&&!i&&!I.value.trim()&&l(`div`,{className:`text-center py-16 text-slate-500`,children:[l(`div`,{className:`text-4xl mb-2`,children:`🔍`}),l(`div`,{children:`Enter a query to search your codebase`}),Ae.value.length>0&&l(`div`,{className:`mt-6`,children:[l(`p`,{className:`text-xs text-slate-600 mb-2`,children:`Recent queries:`}),l(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:Ae.value.slice(0,10).map((e,t)=>l(`button`,{className:`px-2 py-1 bg-slate-800 rounded text-xs text-slate-400 hover:text-white hover:bg-slate-700 transition-colors`,onClick:()=>{I.value=e.query},children:K(e.query)},t))})]})]}),t.length>0&&l(`div`,{className:`space-y-3`,children:[l(`div`,{className:`flex items-center justify-between text-sm text-slate-400 mb-2`,children:[l(`span`,{children:[t.length,` result`,t.length===1?``:`s`]}),n&&l(`span`,{className:`text-xs text-brand-400 animate-pulse`,children:`Searching...`})]}),t.map(e=>l(jt,{result:e},e.chunk.id))]}),n&&t.length===0&&l(`div`,{className:`text-center py-10 text-slate-400`,children:[l(`span`,{className:`animate-spin inline-block mr-2`,children:`⟳`}),`Searching...`]})]})}function jt({result:e}){let t=e.chunk,n=e.score;return l(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700 hover:border-brand-500/50 transition-colors cursor-pointer`,onClick:()=>H(`chunks?id=${encodeURIComponent(t.id)}`),children:[l(`div`,{className:`flex items-center justify-between mb-2`,children:[l(`div`,{className:`flex items-center gap-2 min-w-0`,children:[l(`span`,{className:`text-sm text-yellow-400 font-mono truncate`,children:[K(t.filePath),`:`,t.startLine,`-`,t.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:G(t.language)}})]}),l(`span`,{className:`text-lg font-bold shrink-0 ml-2`,style:{color:Mt(n)},children:n.toFixed(2)})]}),e.explanation&&l(kt,{explanation:e.explanation}),e.explanation?.matchedTerms?.length>0&&l(`div`,{className:`flex gap-1 flex-wrap mb-2`,children:e.explanation.matchedTerms.map(e=>l(`span`,{className:`text-xs bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded`,children:K(e)},e))}),t.description&&l(`p`,{className:`text-sm text-slate-400 mb-2 line-clamp-2`,children:K(t.description)}),l(`pre`,{className:`text-xs overflow-x-auto max-h-32 rounded bg-slate-900/50 p-2`,children:l(`code`,{children:K(t.content??``).slice(0,500)})})]})}function Mt(e){return e>=.8?`#22c55e`:e>=.6?`#06b6d4`:e>=.4?`#f59e0b`:`#ef4444`}function Nt({label:e,min:t,max:n,step:r,value:i,onChange:a}){return l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:e}),l(`input`,{type:`range`,min:t,max:n,step:r,value:i,onInput:e=>a(parseFloat(e.target.value)),className:`flex-1 accent-brand-500`}),l(`span`,{className:`text-xs text-slate-300 font-mono w-12 text-right`,children:i})]})}function Pt(){let e=m().params.ids?.split(`,`).filter(Boolean)??[],[t,n]=s([]),[r,i]=s(!0),[a,o]=s(null);return u(()=>{let t=!1;if(e.length<2){o(`Select 2-3 chunks to compare.`),i(!1);return}return W.compare(e).then(e=>{t||(n(e?.body?.chunks??e?.chunks??[]),i(!1))}).catch(e=>{t||(o(e.message),i(!1))}),()=>{t=!0}},[e.join(`,`)]),r?l(Y,{type:`detail`}):a?l(X,{message:a}):t.length<2?l(Z,{icon:`📋`,message:`Select 2-3 chunks from the Chunks view to compare them.`}):l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Chunk Comparison`}),l(`button`,{className:`text-sm text-slate-400 hover:text-white transition-colors`,onClick:()=>H(`chunks`),children:`← Back to Chunks`})]}),l(`div`,{className:`grid gap-4 ${t.length===2?`grid-cols-2`:`grid-cols-3`}`,children:t.map((e,n)=>l(Ft,{chunk:e,index:n,baseChunk:n>0?t[0]:void 0},e.id))})]})}function Ft({chunk:e,index:t,baseChunk:n}){let r=e.content.split(`
3
+ `),i=n?.content.split(`
4
+ `)??[];return l(`div`,{className:`bg-slate-800 rounded-lg border border-slate-700 overflow-hidden flex flex-col`,children:[l(`div`,{className:`p-3 border-b border-slate-700 bg-slate-800/80`,children:[l(`div`,{className:`flex items-center justify-between mb-1`,children:[l(`span`,{className:`text-sm font-mono text-brand-400 truncate mr-2`,children:[K(e.filePath),`:`,e.startLine,`-`,e.endLine]}),l(`span`,{className:`shrink-0`,dangerouslySetInnerHTML:{__html:G(e.language)}})]}),e.description&&l(`p`,{className:`text-xs text-slate-400 truncate`,children:K(e.description)})]}),l(`div`,{className:`overflow-x-auto flex-1 max-h-[70vh]`,children:l(`table`,{className:`w-full text-xs font-mono border-collapse`,children:l(`tbody`,{children:r.map((t,n)=>{let r=(e.startLine??1)+n,a=i[n]===void 0?`bg-green-900/30`:t===``&&i[n]!==``?`bg-red-900/30`:t===i[n]?``:`bg-amber-900/20`;return l(`tr`,{className:a,children:[l(`td`,{className:`text-right text-slate-600 select-none px-2 w-10 border-r border-slate-700 align-top`,children:r}),l(`td`,{className:`px-3 py-0 whitespace-pre-wrap break-all`,children:K(t)||`\xA0`})]},n)})})})}),l(`div`,{className:`px-3 py-1.5 bg-slate-900 border-t border-slate-700 text-xs text-slate-500`,children:[`Chunk `,t+1,t===0&&l(`span`,{className:`text-slate-600 ml-1`,children:`(reference)`})]})]})}function It(){let{data:e,isLoading:t,error:n,refresh:r}=q(()=>W.config());if(t)return l(Y,{type:`card`});if(n)return l(X,{message:n,onRetry:r});let i=e?.body?.config??e?.config;return i?l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-6`,children:`Configuration`}),l(`p`,{className:`text-sm text-slate-400 mb-4`,children:[`Effective configuration from `,l(`code`,{className:`text-brand-400`,children:`opencode-rag.json`}),`. API keys are redacted.`]}),l(`div`,{className:`space-y-4`,children:Object.entries(i).map(([e,t])=>l(`details`,{className:`bg-slate-800 rounded-lg border border-slate-700`,open:!0,children:[l(`summary`,{className:`px-4 py-2 cursor-pointer hover:bg-slate-700 font-mono text-sm font-semibold capitalize text-slate-300`,children:e.replace(/([A-Z])/g,` $1`)}),l(`div`,{className:`px-4 pb-3`,children:typeof t==`object`&&t?Object.entries(t).map(([e,t])=>l(`div`,{className:`flex justify-between py-1 border-b border-slate-700/50 text-sm`,children:[l(`span`,{className:`text-slate-400 font-mono`,children:e}),l(`span`,{className:`text-slate-200 font-mono text-xs text-right ml-4`,children:Lt(t)})]},e)):l(`div`,{className:`flex justify-between py-1 text-sm`,children:l(`span`,{className:`text-slate-200 font-mono`,children:String(t)})})})]},e))})]}):l(Z,{icon:`⚙`,message:`No configuration available.`})}function Lt(e){return e===null?`null`:e===void 0?`undefined`:typeof e==`boolean`?e?`true`:`false`:Array.isArray(e)?`[${e.join(`, `)}]`:typeof e==`object`?JSON.stringify(e).slice(0,150):String(e)}var Rt=10;function zt({points:e,width:n=800,height:r=600,onPointClick:a,renderTooltip:o}){let c=i(null),[d,f]=s({x:0,y:0,scale:1}),[p,m]=s(null),[h,g]=s(!1),_=i({x:0,y:0}),v=i(null),y=i(null),b=i(e);b.current=e;let x=t(e=>{v.current=e(v.current??d),y.current===null&&(y.current=requestAnimationFrame(()=>{y.current=null,v.current&&=(f(v.current),null)}))},[d]);u(()=>()=>{y.current!==null&&cancelAnimationFrame(y.current)},[]);let S=t((e,t)=>{let i=c.current;if(!i)return null;let a=i.getBoundingClientRect(),o=v.current??d,s=e-a.left,l=t-a.top,u=null,f=Rt;for(let e of b.current){let t=e.x*n*o.scale+o.x,i=e.y*r*o.scale+o.y,a=s-t,c=l-i,d=Math.sqrt(a*a+c*c);d<=f&&(f=d,u=e)}return u},[d,n,r]);u(()=>{let t=c.current;if(!t)return;let i=t.getContext(`2d`);if(!i)return;let a=window.devicePixelRatio||1;t.width=n*a,t.height=r*a,i.scale(a,a),i.clearRect(0,0,n,r),i.save(),i.translate(d.x,d.y),i.scale(d.scale,d.scale);for(let t of e){let e=t.x*n,a=t.y*r,o=(t.radius??3)*(t.highlighted?2:1);i.beginPath(),i.arc(e,a,o,0,Math.PI*2),i.fillStyle=t.color,i.globalAlpha=t.highlighted?1:.6,i.fill(),t.highlighted&&(i.strokeStyle=`#22d3ee`,i.lineWidth=2,i.stroke())}i.restore()},[e,d,n,r]);let C=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;x(e=>({...e,scale:Math.max(.5,Math.min(10,e.scale*t))}))},ee=e=>{g(!0),_.current={x:e.clientX-d.x,y:e.clientY-d.y}},w=e=>{if(h){x(t=>({...t,x:e.clientX-_.current.x,y:e.clientY-_.current.y}));return}let t=S(e.clientX,e.clientY);m(e=>e?.id===t?.id?e:t)},T=()=>g(!1);return l(`div`,{className:`relative overflow-hidden rounded-lg border border-slate-700 bg-slate-900`,style:{width:n,height:r},children:[l(`canvas`,{ref:c,className:`absolute inset-0 cursor-grab active:cursor-grabbing`,onMouseDown:ee,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onClick:e=>{if(h)return;let t=S(e.clientX,e.clientY);t&&a?.(t.id)},onWheel:C}),p&&o&&l(`div`,{className:`absolute bg-slate-800 border border-slate-600 rounded-lg p-3 shadow-xl text-sm z-10 pointer-events-none`,style:{left:Math.min(p.x*n*d.scale+d.x+12,n-200),top:Math.min(p.y*r*d.scale+d.y-12,r-80)},children:o(p)}),d.scale!==1&&l(`button`,{className:`absolute bottom-3 right-3 px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors z-20`,onClick:()=>{f({x:0,y:0,scale:1}),v.current=null},children:`Reset zoom`})]})}function Bt(e,t){let n=e.x-t.x,r=e.y-t.y,i=(e.z??0)-(t.z??0);return Math.sqrt(n*n+r*r+i*i)}function Vt(e,t=8,n=20){let r=e.length;if(r<=t)return e.map((e,t)=>t);let i=Array(r).fill(0),a=[];a.push(e[Math.floor(Math.random()*r)]);for(let n=1;n<t;n++){let t=e.map(e=>Math.min(...a.map(t=>Bt(e,t)))),n=t.reduce((e,t)=>e+t*t,0),i=Math.random()*n;for(let n=0;n<r;n++)if(i-=t[n]*t[n],i<=0){a.push(e[n]);break}}for(let t=0;t<n;t++){for(let t=0;t<r;t++){let n=0,r=Bt(e[t],a[0]);for(let i=1;i<a.length;i++){let o=Bt(e[t],a[i]);o<r&&(r=o,n=i)}i[t]=n}let t=a.map(()=>({x:0,y:0,z:0,count:0}));for(let n=0;n<r;n++){let r=i[n];t[r].x+=e[n].x,t[r].y+=e[n].y,t[r].z+=e[n].z??0,t[r].count++}a.forEach((e,n)=>{t[n].count>0&&(e.x=t[n].x/t[n].count,e.y=t[n].y/t[n].count,e.z!==void 0&&(e.z=t[n].z/t[n].count))})}return i}function Ht(e,t,n){let r=n.map((n,r)=>{let i=e.filter((e,n)=>t[n]===r).map(e=>Bt(e,n)),a=i.reduce((e,t)=>e+t,0)/i.length,o=i.reduce((e,t)=>e+(t-a)**2,0)/i.length;return Math.sqrt(o)}),i=new Set;for(let a=0;a<e.length;a++){let o=t[a];Bt(e[a],n[o])>2*(r[o]??0)&&i.add(a)}return i}var Ut=`modulepreload`,Wt=function(e){return`/ui/`+e},Gt={},Kt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Wt(t,n),t=s(t),t in Gt)return;Gt[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Ut,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},qt=o(()=>Kt(()=>import(`./ScatterPlot3D-CKwyh1Ec.js`).then(e=>({default:e.ScatterPlot3D})),__vite__mapDeps([0,1]))),Jt=[`#3b82f6`,`#ef4444`,`#22c55e`,`#f59e0b`,`#a855f7`,`#06b6d4`,`#ec4899`,`#84cc16`,`#f97316`,`#14b8a6`,`#8b5cf6`,`#e11d48`,`#65a30d`,`#0ea5e9`,`#d946ef`,`#ca8a04`,`#64748b`,`#4ade80`,`#fb7185`,`#38bdf8`],Yt=2,Xt=50,Zt=5,Qt=200,$t=20,en=12;function tn(){let{data:t,isLoading:r,error:a,refresh:o}=q(()=>W.embeddingProj(5e3,3)),[c,f]=s(`language`),[p,m]=s(`3d`),[h,g]=s(!1),[_,v]=s(8),[y,b]=s(20),[x,S]=s(!1),[C,ee]=s(new Set),[w,T]=s(5),[te,ne]=s(0),[E,D]=s(null),[re,ie]=s(!1),ae=i(0),[O,oe]=s(null),[se,ce]=s(new Set),k=t?.body?.points??t?.points??[],A=t?.body?.totalChunks??t?.totalChunks??0;if(u(()=>{if(c===`cluster`&&k.length>0){let e=Math.max(Yt,Math.min(_,k.length)),t=Vt(k,e,y);if(oe(t),h){let n=[];for(let r=0;r<e;r++){let e=k.filter((e,n)=>t[n]===r);if(e.length>0){let t=e[0]?.z!==void 0;n.push({x:e.reduce((e,t)=>e+t.x,0)/e.length,y:e.reduce((e,t)=>e+t.y,0)/e.length,...t?{z:e.reduce((e,t)=>e+(t.z??0),0)/e.length}:{}})}}ce(Ht(k,t,n))}}else oe(null),ce(new Set)},[c,h,_,y,k]),u(()=>{x&&R.value.length>0?ee(new Set(R.value.map(e=>e.chunk.id))):ee(new Set)},[x,R.value]),r)return l(Y,{type:`chart`});if(a)return l(X,{message:a,onRetry:o});if(k.length===0)return l(Z,{icon:`🌐`,message:`No embedding data available. Index some files first.`});let j=e(()=>an(k),[k]),M=e(()=>k.map((e,t)=>{let n;n=c===`language`?Ye(e.language)===`text-slate-400`?`#94a3b8`:on(e.language):c===`file`?j.get(e.filePath)??`#94a3b8`:Jt[(O?.[t]??0)%Jt.length];let r=se.has(t),i=C.has(e.id);return{id:e.id,x:e.x,y:e.y,z:e.z??.5,color:i?`#22d3ee`:r?`#f97316`:n,label:`${e.filePath}:${e.startLine}-${e.endLine} [${e.language}]`,radius:i?6:r?5:3,highlighted:i}}),[k,c,O,se,C,j]),N=e(()=>{if(c!==`file`)return[];let e=rn(k.map(e=>e.filePath)),t=new Map;for(let e of k)t.set(e.filePath,(t.get(e.filePath)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]).slice(0,en).map(([t,n])=>({label:t.slice(e.length)||t,count:n,color:j.get(t)??`#94a3b8`}))},[c,k,j]),le=e(()=>c===`file`?new Set(k.map(e=>e.filePath)).size-N.length:0,[c,k,N]),ue=e=>{let t=++ae.current;D(null),ie(!0),W.chunk(e).then(e=>{t===ae.current&&(D(e),ie(!1))}).catch(()=>{t===ae.current&&(D({id:e,content:``,filePath:`not found`,language:``,startLine:0,endLine:0,description:`Error loading chunk details.`}),ie(!1))})};return l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-4`,children:`Embedding Space Explorer`}),l(`div`,{className:`flex flex-wrap gap-3 mb-4 items-center`,children:[l(`div`,{className:`flex items-center gap-1 bg-slate-800 border border-slate-600 rounded-lg p-0.5`,children:[`2d`,`3d`].map(e=>l(`button`,{className:`px-2 py-0.5 rounded text-xs transition-colors ${p===e?`bg-slate-600 text-white`:`text-slate-400 hover:text-slate-200`}`,onClick:()=>m(e),children:e.toUpperCase()},e))}),l(`label`,{className:`text-xs text-slate-400`,children:`Color by:`}),l(`select`,{className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1`,value:c,onChange:e=>f(e.target.value),children:[l(`option`,{value:`language`,children:`Language`}),l(`option`,{value:`file`,children:`File`}),l(`option`,{value:`cluster`,children:`Cluster`})]}),c===`cluster`&&l(n,{children:[l(`label`,{className:`text-xs text-slate-400`,children:`K:`}),l(`input`,{type:`number`,min:Yt,max:Xt,value:_,onChange:e=>v(nn(e.target,Yt,Xt,8)),className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1 w-16`,title:`Number of clusters`}),l(`label`,{className:`text-xs text-slate-400`,children:`Iterations:`}),l(`input`,{type:`number`,min:Zt,max:Qt,value:y,onChange:e=>b(nn(e.target,Zt,Qt,20)),className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1 w-20`,title:`Maximum k-means iterations`})]}),l(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:h,onChange:e=>g(e.target.checked)}),`Outliers`]}),R.value.length>0&&l(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:x,onChange:e=>S(e.target.checked)}),`Search overlay (`,R.value.length,` results)`]}),p===`3d`&&l(n,{children:[l(`label`,{className:`text-xs text-slate-400`,children:`Point size:`}),l(`input`,{type:`range`,min:1,max:20,value:w,onChange:e=>T(Number(e.target.value)),className:`w-24 accent-brand-500`}),l(`button`,{className:`px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors`,onClick:()=>ne(e=>e+1),children:`Reset camera`})]})]}),c===`cluster`&&O&&l(`div`,{className:`flex flex-wrap gap-2 mb-3 text-xs`,children:(()=>{let e=Array.from(new Set(O)).sort((e,t)=>e-t),t=e.slice(0,$t),r=e.length-t.length;return l(n,{children:[t.map(e=>l(`span`,{className:`flex items-center gap-1 text-slate-400`,children:[l(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:Jt[e%Jt.length]}}),`Cluster `,e+1]},e)),r>0&&l(`span`,{className:`text-slate-500`,children:[`+`,r,` more`]})]})})()}),c===`file`&&N.length>0&&l(`div`,{className:`flex flex-wrap gap-2 mb-3 text-xs`,children:[N.map(({label:e,count:t,color:n})=>l(`span`,{className:`flex items-center gap-1 text-slate-400`,title:e,children:[l(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:n}}),K(Ze(e,40)),` (`,t,`)`]},e)),le>0&&l(`span`,{className:`text-slate-500`,children:[`+`,le,` more files`]})]}),p===`3d`?l(d,{fallback:l(Y,{type:`chart`}),children:l(qt,{points:M,width:900,height:600,onPointClick:ue,pointSize:w,resetKey:te,selectedId:E?.id??null})}):l(zt,{points:M,width:900,height:600,onPointClick:ue,renderTooltip:e=>{let t=k.find(t=>t.id===e.id);return l(`div`,{children:[l(`div`,{className:`text-yellow-400 font-mono text-xs`,children:K(e.label)}),t?.description&&l(`div`,{className:`text-slate-400 text-xs mt-1`,children:K(Ze(t.description,80))})]})}}),re&&l(Y,{type:`detail`}),E&&!re&&l(`div`,{className:`kpi-card p-4 mt-4`,children:[l(`div`,{className:`flex items-center gap-3 mb-1 flex-wrap`,children:[l(`span`,{className:`text-yellow-400 font-mono text-sm`,children:K(E.filePath)}),l(`span`,{className:`text-slate-400 text-xs`,children:[`Lines `,E.startLine,`-`,E.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:G(E.language)}}),E.id&&l(`span`,{className:`text-xs text-slate-600 font-mono`,children:E.id}),l(`button`,{className:`ml-auto px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors`,onClick:()=>H(`chunks?id=${encodeURIComponent(E.id)}`),children:`Open in Chunks`})]}),E.description&&l(`div`,{className:`mb-3`,children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Description`}),l(`p`,{className:`text-sm text-slate-300`,children:K(E.description)})]}),E.content&&l(`div`,{children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Content`}),l(`pre`,{className:`text-xs text-slate-300 bg-slate-900 border border-slate-700 rounded p-3 overflow-auto max-h-64 font-mono whitespace-pre`,children:K(E.content)})]})]}),l(`p`,{className:`text-xs text-slate-500 mt-2`,children:[M.length,` of `,A,` chunks displayed`,M.length<A&&` (chunks without embeddings omitted)`]})]})}function nn(e,t,n,r){let i=parseInt(e?.value??``,10);return Number.isNaN(i)?r:Math.max(t,Math.min(n,i))}function rn(e){if(e.length===0)return``;let t=e[0]??``;for(let n of e)for(;n&&t&&!n.startsWith(t);)t=t.slice(0,-1);let n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n+1):``}function an(e){let t=new Map;for(let n of e){let e=t.get(n.filePath)??{x:0,y:0,z:0,n:0};e.x+=n.x,e.y+=n.y,e.z+=n.z??0,e.n++,t.set(n.filePath,e)}let n=[];for(let[e,r]of t)n.push({file:e,x:r.x/r.n,y:r.y/r.n,z:r.z/r.n});let r=n.reduce((e,t)=>e+t.x,0)/n.length,i=n.reduce((e,t)=>e+t.y,0)/n.length,a=n.reduce((e,t)=>e+t.z,0)/n.length,o=n.reduce((e,t)=>e+(t.x-r)**2,0),s=n.reduce((e,t)=>e+(t.y-i)**2,0),c=n.reduce((e,t)=>e+(t.z-a)**2,0),l=o>=s&&o>=c?`x`:s>=c?`y`:`z`,u=[`x`,`y`,`z`].filter(e=>e!==l);n.sort((e,t)=>e[l]-t[l]||e[u[0]]-t[u[0]]||e[u[1]]-t[u[1]]);let d=new Map;for(let e=0;e<n.length;e++){let t=e*137.508%360,r=e%2==0?55:40;d.set(n[e].file,`hsl(${t.toFixed(1)}, 80%, ${r}%)`)}return d}function on(e){return{typescript:`#60a5fa`,javascript:`#facc15`,python:`#4ade80`,java:`#f87171`,go:`#22d3ee`,rust:`#fb923c`,ruby:`#f472b6`,csharp:`#a78bfa`,cpp:`#818cf8`,c:`#9ca3af`,markdown:`#d1d5db`,html:`#fdba74`,css:`#60a5fa`,json:`#fde047`,kotlin:`#c084fc`,swift:`#fb923c`,tex:`#34d399`,sql:`#67e8f9`,text:`#94a3b8`,image:`#a78bfa`,quirk:`#fbbf24`}[e]??`#94a3b8`}var sn=[{view:`dashboard`,label:`Dashboard`,icon:`📊`},{view:`search`,label:`Search`,icon:`🔍`},{view:`embeddings`,label:`Embeddings`,icon:`🌐`},{view:`chunks`,label:`Chunks`,icon:`🧩`},{view:`files`,label:`Files`,icon:`📄`},{view:`evaluate`,label:`Evaluate`,icon:`📈`},{view:`quirks`,label:`Quirks`,icon:`💡`}];function cn(){Re(),ze();let e=m(),t=i(null);we.value=e.view;let r=()=>{je.value=!je.value};return l(`div`,{className:`h-screen flex flex-col overflow-hidden`,children:[l(`header`,{className:`flex items-center gap-3 px-4 py-2 border-b shrink-0`,style:{borderColor:`var(--border)`},children:[l(`h1`,{className:`text-lg font-bold shrink-0`,style:{color:`var(--accent)`},children:`OpenCodeRAG`}),l(`nav`,{className:`flex gap-1 flex-1`,role:`navigation`,"aria-label":`Main navigation`,children:sn.map(e=>l(`button`,{id:`nav-${e.view}`,className:`nav-btn ${we.value===e.view?`active`:``}`,onClick:()=>window.location.hash=e.view,role:`tab`,"aria-selected":we.value===e.view,children:[e.icon,` `,e.label]},e.view))}),l(Qe,{}),l(Ve,{}),l(`button`,{className:`p-2 rounded-lg transition-colors hidden lg:block`,style:{color:`var(--text-muted)`},onClick:r,"aria-label":`Toggle file tree`,title:`Toggle file tree`,children:`☰`}),l(`button`,{className:`p-2 rounded-lg transition-colors lg:hidden`,style:{color:`var(--text-muted)`},onClick:r,"aria-label":`Toggle file tree`,title:`Toggle file tree`,children:`☰`})]}),l(`div`,{className:`flex flex-1 overflow-hidden`,children:[je.value&&l(n,{children:[l(`div`,{className:`fixed inset-0 z-30 lg:hidden`,style:{background:`rgba(0,0,0,0.5)`},onClick:()=>{je.value=!1}}),l(`aside`,{ref:t,className:`shrink-0 border-r z-40 fixed lg:relative inset-y-0 left-0 flex flex-col max-w-[85vw] lg:max-w-none`,style:{background:`var(--bg-secondary)`,borderColor:`var(--border)`,width:`${B.peek()}px`},children:[l(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,role:`tree`,"aria-label":`File tree`,children:[l(at,{}),l($e,{})]}),l(ct,{targetRef:t})]})]}),l(`main`,{className:`flex-1 overflow-y-auto p-6`,id:`main-content`,tabIndex:-1,children:[e.view===`dashboard`&&l(mt,{}),e.view===`search`&&l(At,{}),e.view===`embeddings`&&l(tn,{}),e.view===`compare`&&l(Pt,{}),e.view===`chunks`&&l(gt,{}),e.view===`files`&&l(vt,{}),e.view===`evaluate`&&l(xt,{}),e.view===`quirks`&&l(Dt,{}),e.view===`config`&&l(It,{})]})]}),l(Be,{})]})}f(l(cn,{}),document.getElementById(`app`));
@@ -0,0 +1 @@
1
+ *,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media (width>=640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (width>=768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (width>=1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (width>=1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (width>=1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.chunk-row.selected{background:color-mix(in srgb, var(--accent) 10%, transparent);border-left:2px solid var(--accent)}.chunk-row:hover{background:var(--bg-tertiary)}.file-item.active{background:color-mix(in srgb, var(--accent) 20%, transparent);color:var(--text-primary)}.file-item:hover{background:var(--bg-tertiary)}.sidebar-resizer{cursor:col-resize;touch-action:none;background:0 0;width:7px;transition:background-color .15s;position:absolute;top:0;bottom:0;right:-3px}.sidebar-resizer:hover,.sidebar-resizer.dragging,.sidebar-resizer:focus-visible{background:color-mix(in srgb, var(--accent) 55%, transparent)}.kpi-card{background:var(--bg-card);border:1px solid var(--border);border-radius:.75rem}.nav-btn{color:var(--text-muted);border-radius:.25rem;padding:.375rem .75rem;font-size:.875rem;transition:color .15s,background-color .15s}.nav-btn:hover{background:var(--bg-tertiary);color:var(--text-primary)}.nav-btn.active{background:color-mix(in srgb, var(--accent) 20%, transparent);color:var(--accent)}pre,code{background:var(--bg-code)}table thead{background:var(--bg-secondary)}table tbody tr{border-top:1px solid var(--border)}table tbody tr:hover{background:var(--bg-tertiary)}input,select,textarea{background:var(--bg-secondary);border-color:var(--border);color:var(--text-primary)}input::-moz-placeholder{color:var(--text-muted)}textarea::-moz-placeholder{color:var(--text-muted)}input::placeholder,textarea::placeholder{color:var(--text-muted)}.chart-svg rect{transition:opacity .15s}.chart-svg rect:hover{opacity:.85}.chart-svg circle:hover{r:5}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.bottom-3{bottom:.75rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.right-0{right:0}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[9999\]{z-index:9999}.col-span-2{grid-column:span 2/span 2}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[60vh\]{max-height:60vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[calc\(100vh-220px\)\]{max-height:calc(100vh - 220px)}.min-h-0{min-height:0}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-32{width:8rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-64{width:16rem}.w-8{width:2rem}.w-96{width:24rem}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[85vw\]{max-width:85vw}.max-w-full{max-width:100%}.max-w-sm{max-width:24rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity:1;border-color:rgb(30 41 59/var(--tw-border-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-900\/20{background-color:#78350f33}.bg-amber-900\/30{background-color:#78350f4d}.bg-amber-900\/50{background-color:#78350f80}.bg-brand-500{--tw-bg-opacity:1;background-color:rgb(6 182 212/var(--tw-bg-opacity,1))}.bg-brand-600{--tw-bg-opacity:1;background-color:rgb(8 145 178/var(--tw-bg-opacity,1))}.bg-cyan-500{--tw-bg-opacity:1;background-color:rgb(6 182 212/var(--tw-bg-opacity,1))}.bg-emerald-900\/20{background-color:#064e3b33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/30{background-color:#14532d4d}.bg-green-900\/50{background-color:#14532d80}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-900\/20{background-color:#88133733}.bg-sky-900\/20{background-color:#0c4a6e33}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-950{--tw-bg-opacity:1;background-color:rgb(2 6 23/var(--tw-bg-opacity,1))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-slate-700{--tw-gradient-from:#334155 var(--tw-gradient-from-position);--tw-gradient-to:#33415500 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.via-slate-600{--tw-gradient-to:#47556900 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), #475569 var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-slate-700{--tw-gradient-to:#334155 var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pl-2{padding-left:.5rem}.pt-3{padding-top:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tracking-wide{letter-spacing:.025em}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-blue-300{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-brand-400{--tw-text-opacity:1;color:rgb(34 211 238/var(--tw-text-opacity,1))}.text-cyan-300{--tw-text-opacity:1;color:rgb(103 232 249/var(--tw-text-opacity,1))}.text-cyan-400{--tw-text-opacity:1;color:rgb(34 211 238/var(--tw-text-opacity,1))}.text-emerald-400{--tw-text-opacity:1;color:rgb(52 211 153/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-indigo-400{--tw-text-opacity:1;color:rgb(129 140 248/var(--tw-text-opacity,1))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-pink-400{--tw-text-opacity:1;color:rgb(244 114 182/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-rose-400{--tw-text-opacity:1;color:rgb(251 113 133/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.placeholder-slate-500::placeholder{--tw-placeholder-opacity:1;color:rgb(100 116 139/var(--tw-placeholder-opacity,1))}.accent-brand-500{accent-color:#06b6d4}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}:root{--bg-primary:#fff;--bg-secondary:#f8fafc;--bg-tertiary:#f1f5f9;--bg-card:#fff;--bg-code:#f8fafc;--bg-surface:#fff;--text-primary:#0f172a;--text-secondary:#475569;--text-muted:#94a3b8;--border:#e2e8f0;--border-hover:#cbd5e1;--accent:#0891b2;--accent-hover:#0e7490;--chart-grid:#e2e8f0;--skeleton-from:#e2e8f0;--skeleton-to:#cbd5e1;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.dark{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--bg-card:#1e293b;--bg-code:#0f172a;--bg-surface:#0f172a;--text-primary:#e2e8f0;--text-secondary:#94a3b8;--text-muted:#64748b;--border:#334155;--border-hover:#475569;--accent:#06b6d4;--accent-hover:#22d3ee;--chart-grid:#334155;--skeleton-from:#334155;--skeleton-to:#475569;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{background:var(--bg-primary);color:var(--text-primary);transition:background-color .2s,color .2s}.scrollbar-thin::-webkit-scrollbar{width:6px}.scrollbar-thin::-webkit-scrollbar-track{background:0 0}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}:focus-visible,button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-shimmer{background-size:200% 100%;background-image:linear-gradient(to right, var(--skeleton-from), var(--skeleton-to), var(--skeleton-from));animation:1.5s ease-in-out infinite shimmer}@media (width<=768px){.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sidebar-overlay{z-index:40;background:#00000080;position:fixed;inset:0}}@media (width<=640px){.kpi-grid{grid-template-columns:repeat(1,minmax(0,1fr))}}.last\:border-0:last-child{border-width:0}.hover\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-brand-500\/50:hover{border-color:#06b6d480}.hover\:bg-brand-500:hover{--tw-bg-opacity:1;background-color:rgb(6 182 212/var(--tw-bg-opacity,1))}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:text-brand-400:hover{--tw-text-opacity:1;color:rgb(34 211 238/var(--tw-text-opacity,1))}.hover\:text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\:text-slate-200:hover{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:border-brand-400:focus{--tw-border-opacity:1;border-color:rgb(34 211 238/var(--tw-border-opacity,1))}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=1024px){.lg\:relative{position:relative}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:max-w-none{max-width:none}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}
@@ -5,9 +5,9 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>OpenCodeRAG</title>
7
7
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔎</text></svg>">
8
- <script type="module" crossorigin src="/ui/assets/index-Cgv1RsGv.js"></script>
8
+ <script type="module" crossorigin src="/ui/assets/index-C0QXKA-b.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/ui/assets/vendor-Dg8wMT7C.js">
10
- <link rel="stylesheet" crossorigin href="/ui/assets/index-DjJHIo9R.css">
10
+ <link rel="stylesheet" crossorigin href="/ui/assets/index-Dp009QCQ.css">
11
11
  </head>
12
12
  <body class="h-screen flex flex-col overflow-hidden bg-slate-900 text-slate-200">
13
13
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-rag-plugin",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "OpenCode plugin for local-first RAG-based semantic code search",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin-entry.js",