@neuralnomads/codenomad-dev 0.14.0-dev-20260421-68551f67 → 0.14.0-dev-20260422-e708c565

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -28,11 +28,12 @@ import { SideCarManager } from "./sidecars/manager";
28
28
  import { ClientConnectionManager } from "./clients/connection-manager";
29
29
  import { PluginChannelManager } from "./plugins/channel";
30
30
  import { VoiceModeManager } from "./plugins/voice-mode";
31
+ import { readServerPackageVersion, resolveServerPublicDir } from "./runtime-paths";
31
32
  const require = createRequire(import.meta.url);
32
- const packageJson = require("../package.json");
33
+ const packageJson = { version: readServerPackageVersion(import.meta.url) };
33
34
  const __filename = fileURLToPath(import.meta.url);
34
35
  const __dirname = path.dirname(__filename);
35
- const DEFAULT_UI_STATIC_DIR = path.resolve(__dirname, "../public");
36
+ const DEFAULT_UI_STATIC_DIR = resolveServerPublicDir(import.meta.url);
36
37
  const DEFAULT_HOST = "127.0.0.1";
37
38
  const DEFAULT_CONFIG_PATH = "~/.config/codenomad/config.json";
38
39
  const DEFAULT_HTTPS_PORT = 9898;
@@ -4,6 +4,6 @@
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@opencode-ai/plugin": "1.3.7"
7
+ "@opencode-ai/plugin": "1.14.19"
8
8
  }
9
- }
9
+ }
@@ -1,20 +1,9 @@
1
1
  import { existsSync } from "fs";
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
2
  import { createLogger } from "./logger";
3
+ import { resolveOpencodeTemplateDir } from "./runtime-paths";
5
4
  const log = createLogger({ component: "opencode-config" });
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- const devTemplateDir = path.resolve(__dirname, "../../opencode-config");
9
- const resourcesPath = process.resourcesPath;
10
- const prodTemplateDirs = [
11
- resourcesPath ? path.resolve(resourcesPath, "opencode-config") : undefined,
12
- path.resolve(__dirname, "opencode-config"),
13
- ].filter((dir) => Boolean(dir));
14
- const isDevBuild = Boolean(process.env.CODENOMAD_DEV ?? process.env.CLI_UI_DEV_SERVER) || existsSync(devTemplateDir);
15
- const templateDir = isDevBuild
16
- ? devTemplateDir
17
- : prodTemplateDirs.find((dir) => existsSync(dir)) ?? prodTemplateDirs[0];
5
+ const templateDir = resolveOpencodeTemplateDir(import.meta.url);
6
+ const isDevBuild = Boolean(process.env.CODENOMAD_DEV ?? process.env.CLI_UI_DEV_SERVER);
18
7
  export function getOpencodeConfigDir() {
19
8
  if (!existsSync(templateDir)) {
20
9
  throw new Error(`CodeNomad Opencode config template missing at ${templateDir}`);
@@ -0,0 +1,67 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ function safeModuleDir(importMetaUrl) {
5
+ try {
6
+ return path.dirname(fileURLToPath(importMetaUrl));
7
+ }
8
+ catch {
9
+ return null;
10
+ }
11
+ }
12
+ function firstExistingPath(candidates, predicate) {
13
+ for (const candidate of candidates) {
14
+ if (!candidate)
15
+ continue;
16
+ if (predicate(candidate)) {
17
+ return candidate;
18
+ }
19
+ }
20
+ return null;
21
+ }
22
+ export function getPackagedDistDir() {
23
+ return path.dirname(process.execPath);
24
+ }
25
+ export function resolveServerPackageRoot(importMetaUrl) {
26
+ const moduleDir = safeModuleDir(importMetaUrl);
27
+ const configuredRoot = process.env.CODENOMAD_SERVER_ROOT?.trim();
28
+ const candidates = [
29
+ configuredRoot ? path.resolve(configuredRoot) : null,
30
+ moduleDir ? path.resolve(moduleDir, "..") : null,
31
+ path.resolve(getPackagedDistDir(), ".."),
32
+ ];
33
+ return (firstExistingPath(candidates, (value) => fs.existsSync(path.join(value, "package.json"))) ??
34
+ candidates.find((value) => Boolean(value)) ??
35
+ process.cwd());
36
+ }
37
+ export function resolveServerPublicDir(importMetaUrl) {
38
+ const moduleDir = safeModuleDir(importMetaUrl);
39
+ const candidates = [moduleDir ? path.resolve(moduleDir, "../public") : null, path.join(resolveServerPackageRoot(importMetaUrl), "public")];
40
+ return firstExistingPath(candidates, (value) => fs.existsSync(value)) ?? candidates[candidates.length - 1];
41
+ }
42
+ export function resolveAuthTemplatePath(importMetaUrl, fileName) {
43
+ const moduleDir = safeModuleDir(importMetaUrl);
44
+ const distDir = getPackagedDistDir();
45
+ const candidates = [
46
+ moduleDir ? path.join(moduleDir, "auth-pages", fileName) : null,
47
+ path.join(distDir, "auth-pages", fileName),
48
+ path.join(distDir, "server", "routes", "auth-pages", fileName),
49
+ ];
50
+ return firstExistingPath(candidates, (value) => fs.existsSync(value)) ?? candidates[0];
51
+ }
52
+ export function resolveOpencodeTemplateDir(importMetaUrl) {
53
+ const moduleDir = safeModuleDir(importMetaUrl);
54
+ const resourcesPath = process.resourcesPath;
55
+ const candidates = [
56
+ moduleDir ? path.resolve(moduleDir, "../../opencode-config") : null,
57
+ resourcesPath ? path.resolve(resourcesPath, "opencode-config") : null,
58
+ moduleDir ? path.resolve(moduleDir, "opencode-config") : null,
59
+ path.join(getPackagedDistDir(), "opencode-config"),
60
+ ];
61
+ return firstExistingPath(candidates, (value) => fs.existsSync(value)) ?? candidates[candidates.length - 1];
62
+ }
63
+ export function readServerPackageVersion(importMetaUrl) {
64
+ const packageJsonPath = path.join(resolveServerPackageRoot(importMetaUrl), "package.json");
65
+ const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
66
+ return typeof parsed.version === "string" && parsed.version.trim().length > 0 ? parsed.version : "0.0.0";
67
+ }
@@ -5,6 +5,8 @@ import replyFrom from "@fastify/reply-from";
5
5
  import fs from "fs";
6
6
  import { connect as connectTcp } from "net";
7
7
  import path from "path";
8
+ import { Readable } from "stream";
9
+ import { pipeline } from "stream/promises";
8
10
  import { connect as connectTls } from "tls";
9
11
  import { fetch } from "undici";
10
12
  import { isValidWorktreeSlug } from "../workspaces/git-worktrees";
@@ -489,47 +491,49 @@ async function proxyWorkspaceRequest(args) {
489
491
  if (logger.isLevelEnabled("trace")) {
490
492
  logger.trace({ workspaceId, targetUrl, body: request.body }, "Instance proxy payload");
491
493
  }
492
- return reply.from(targetUrl, {
493
- rewriteRequestHeaders: (_originalRequest, headers) => {
494
- if (instanceAuthHeader) {
495
- headers.authorization = instanceAuthHeader;
496
- }
497
- // OpenCode expects the *full* path; we send it via header to avoid query tampering.
498
- const isNonASCII = /[^\x00-\x7F]/.test(directory);
499
- const encodedDirectory = isNonASCII ? encodeURIComponent(directory) : directory;
500
- headers["x-opencode-directory"] = encodedDirectory;
501
- if (logger.isLevelEnabled("trace")) {
502
- const outgoing = {};
503
- for (const [key, value] of Object.entries(headers)) {
504
- outgoing[key] = value;
505
- }
506
- // Redact sensitive headers.
507
- for (const key of Object.keys(outgoing)) {
508
- const lower = key.toLowerCase();
509
- if (lower === "authorization" || lower === "cookie" || lower === "set-cookie") {
510
- outgoing[key] = "<redacted>";
511
- }
512
- }
513
- logger.trace({
514
- workspaceId,
515
- method: request.method,
516
- targetUrl,
517
- worktreeSlug,
518
- directory,
519
- contentType: request.headers["content-type"],
520
- body: bodyToJson(request.body),
521
- headers: outgoing,
522
- }, "Proxy -> OpenCode request");
523
- }
524
- return headers;
525
- },
526
- onError: (proxyReply, { error }) => {
527
- logger.error({ err: error, workspaceId, targetUrl }, "Failed to proxy workspace request");
528
- if (!proxyReply.sent) {
529
- proxyReply.code(502).send({ error: "Workspace instance proxy failed" });
530
- }
531
- },
532
- });
494
+ const headers = buildWorkspaceInstanceProxyHeaders(request.headers, instanceAuthHeader, directory);
495
+ if (logger.isLevelEnabled("trace")) {
496
+ logger.trace({
497
+ workspaceId,
498
+ method: request.method,
499
+ targetUrl,
500
+ worktreeSlug,
501
+ directory,
502
+ contentType: request.headers["content-type"],
503
+ body: bodyToJson(request.body),
504
+ headers: redactProxyHeadersForLogs(headers),
505
+ }, "Proxy -> OpenCode request");
506
+ }
507
+ const init = {
508
+ method: request.method,
509
+ headers,
510
+ redirect: "manual",
511
+ };
512
+ if (request.method !== "GET" && request.method !== "HEAD") {
513
+ const body = toProxyRequestBody(request.body);
514
+ if (body !== undefined) {
515
+ init.body = body;
516
+ init.duplex = "half";
517
+ }
518
+ }
519
+ try {
520
+ const response = await fetch(targetUrl, init);
521
+ reply.code(response.status);
522
+ applyInstanceProxyResponseHeaders(reply, response);
523
+ if (!response.body || request.method === "HEAD") {
524
+ reply.send();
525
+ return;
526
+ }
527
+ reply.hijack();
528
+ reply.raw.writeHead(reply.statusCode, toOutgoingHeaders(reply.getHeaders()));
529
+ await pipeline(Readable.fromWeb(response.body), reply.raw);
530
+ }
531
+ catch (error) {
532
+ logger.error({ err: error, workspaceId, targetUrl }, "Failed to proxy workspace request");
533
+ if (!reply.sent) {
534
+ reply.code(502).send({ error: "Workspace instance proxy failed" });
535
+ }
536
+ }
533
537
  }
534
538
  function extractOpencodeDirectoryOverride(pathSuffix) {
535
539
  if (!pathSuffix) {
@@ -692,12 +696,78 @@ function isApiRequest(rawUrl) {
692
696
  function buildProxyHeaders(headers) {
693
697
  const result = {};
694
698
  for (const [key, value] of Object.entries(headers ?? {})) {
695
- if (!value || key.toLowerCase() === "host")
699
+ const lower = key.toLowerCase();
700
+ if (!value || lower === "host" || isHopByHopHeader(lower))
696
701
  continue;
697
702
  result[key] = Array.isArray(value) ? value.join(",") : value;
698
703
  }
699
704
  return result;
700
705
  }
706
+ function toProxyRequestBody(body) {
707
+ if (body == null) {
708
+ return undefined;
709
+ }
710
+ if (typeof body.pipe === "function") {
711
+ return body;
712
+ }
713
+ if (typeof body[Symbol.asyncIterator] === "function") {
714
+ return body;
715
+ }
716
+ if (Buffer.isBuffer(body) || typeof body === "string" || body instanceof Uint8Array) {
717
+ return body;
718
+ }
719
+ return JSON.stringify(body);
720
+ }
721
+ function buildWorkspaceInstanceProxyHeaders(headers, instanceAuthHeader, directory) {
722
+ const next = buildProxyHeaders(headers);
723
+ if (instanceAuthHeader) {
724
+ next.authorization = instanceAuthHeader;
725
+ }
726
+ const isNonASCII = /[^\x00-\x7F]/.test(directory);
727
+ next["x-opencode-directory"] = isNonASCII ? encodeURIComponent(directory) : directory;
728
+ return next;
729
+ }
730
+ function redactProxyHeadersForLogs(headers) {
731
+ const outgoing = { ...headers };
732
+ for (const key of Object.keys(outgoing)) {
733
+ const lower = key.toLowerCase();
734
+ if (lower === "authorization" || lower === "cookie" || lower === "set-cookie") {
735
+ outgoing[key] = "<redacted>";
736
+ }
737
+ }
738
+ return outgoing;
739
+ }
740
+ function applyInstanceProxyResponseHeaders(reply, response) {
741
+ response.headers.forEach((value, key) => {
742
+ const lower = key.toLowerCase();
743
+ if (isHopByHopHeader(lower) || lower === "content-length" || lower === "content-encoding") {
744
+ return;
745
+ }
746
+ reply.header(key, value);
747
+ });
748
+ }
749
+ function toOutgoingHeaders(headers) {
750
+ const next = {};
751
+ for (const [key, value] of Object.entries(headers)) {
752
+ if (value === undefined) {
753
+ continue;
754
+ }
755
+ next[key] = Array.isArray(value) ? value.map(String) : String(value);
756
+ }
757
+ return next;
758
+ }
759
+ function isHopByHopHeader(name) {
760
+ return new Set([
761
+ "connection",
762
+ "keep-alive",
763
+ "proxy-authenticate",
764
+ "proxy-authorization",
765
+ "te",
766
+ "trailer",
767
+ "transfer-encoding",
768
+ "upgrade",
769
+ ]).has(name);
770
+ }
701
771
  async function proxySideCarRequest(args) {
702
772
  const sidecarId = args.request.params.id ?? "";
703
773
  const sidecar = await args.sidecarManager.get(sidecarId);
@@ -1,6 +1,7 @@
1
1
  import fs from "fs";
2
2
  import { z } from "zod";
3
3
  import { isLoopbackAddress } from "../../auth/http-auth";
4
+ import { resolveAuthTemplatePath } from "../../runtime-paths";
4
5
  const LoginSchema = z.object({
5
6
  username: z.string().min(1),
6
7
  password: z.string().min(1),
@@ -11,26 +12,26 @@ const TokenSchema = z.object({
11
12
  const PasswordSchema = z.object({
12
13
  password: z.string().min(8),
13
14
  });
14
- const LOGIN_TEMPLATE_URL = new URL("./auth-pages/login.html", import.meta.url);
15
- const TOKEN_TEMPLATE_URL = new URL("./auth-pages/token.html", import.meta.url);
15
+ const LOGIN_TEMPLATE_PATH = resolveAuthTemplatePath(import.meta.url, "login.html");
16
+ const TOKEN_TEMPLATE_PATH = resolveAuthTemplatePath(import.meta.url, "token.html");
16
17
  let cachedLoginTemplate = null;
17
18
  let cachedTokenTemplate = null;
18
- function readTemplate(url, cache) {
19
+ function readTemplate(filePath, cache) {
19
20
  if (cache)
20
21
  return cache;
21
- const content = fs.readFileSync(url, "utf-8");
22
+ const content = fs.readFileSync(filePath, "utf-8");
22
23
  return content;
23
24
  }
24
25
  function getLoginHtml(defaultUsername) {
25
26
  if (!cachedLoginTemplate) {
26
- cachedLoginTemplate = readTemplate(LOGIN_TEMPLATE_URL, null);
27
+ cachedLoginTemplate = readTemplate(LOGIN_TEMPLATE_PATH, null);
27
28
  }
28
29
  const escapedUsername = escapeHtml(defaultUsername);
29
30
  return cachedLoginTemplate.replace(/\{\{DEFAULT_USERNAME\}\}/g, escapedUsername);
30
31
  }
31
32
  function getTokenHtml() {
32
33
  if (!cachedTokenTemplate) {
33
- cachedTokenTemplate = readTemplate(TOKEN_TEMPLATE_URL, null);
34
+ cachedTokenTemplate = readTemplate(TOKEN_TEMPLATE_PATH, null);
34
35
  }
35
36
  return cachedTokenTemplate;
36
37
  }
@@ -8,6 +8,58 @@ import { WorkspaceRuntime } from "./runtime";
8
8
  import { getOpencodeConfigDir } from "../opencode-config.js";
9
9
  import { buildOpencodeBasicAuthHeader, DEFAULT_OPENCODE_USERNAME, generateOpencodeServerPassword, OPENCODE_SERVER_PASSWORD_ENV, OPENCODE_SERVER_USERNAME_ENV, } from "./opencode-auth";
10
10
  const STARTUP_STABILITY_DELAY_MS = 1500;
11
+ function defaultShellPath() {
12
+ const configured = process.env.SHELL?.trim();
13
+ if (configured) {
14
+ return configured;
15
+ }
16
+ return process.platform === "darwin" ? "/bin/zsh" : "/bin/bash";
17
+ }
18
+ function shellEscape(input) {
19
+ if (!input)
20
+ return "''";
21
+ return `'${input.replace(/'/g, `'\\''`)}'`;
22
+ }
23
+ function wrapCommandForShell(command, shellPath) {
24
+ const shellName = path.basename(shellPath).toLowerCase();
25
+ if (shellName.includes("bash")) {
26
+ return `if [ -f ~/.bashrc ]; then source ~/.bashrc >/dev/null 2>&1; fi; ${command}`;
27
+ }
28
+ if (shellName.includes("zsh")) {
29
+ return `if [ -f ~/.zshrc ]; then source ~/.zshrc >/dev/null 2>&1; fi; ${command}`;
30
+ }
31
+ return command;
32
+ }
33
+ function buildShellArgs(shellPath, command) {
34
+ const shellName = path.basename(shellPath).toLowerCase();
35
+ if (shellName.includes("zsh")) {
36
+ return ["-l", "-i", "-c", command];
37
+ }
38
+ return ["-l", "-c", command];
39
+ }
40
+ function resolveBinaryPathFromUserShell(identifier) {
41
+ if (process.platform === "win32") {
42
+ return null;
43
+ }
44
+ const shellPath = defaultShellPath();
45
+ const lookupCommand = wrapCommandForShell(`command -v ${shellEscape(identifier)}`, shellPath);
46
+ const result = spawnSync(shellPath, buildShellArgs(shellPath, lookupCommand), {
47
+ encoding: "utf8",
48
+ env: {
49
+ ...process.env,
50
+ npm_config_prefix: undefined,
51
+ NPM_CONFIG_PREFIX: undefined,
52
+ },
53
+ });
54
+ if (result.status !== 0) {
55
+ return null;
56
+ }
57
+ const resolved = String(result.stdout ?? "")
58
+ .split(/\r?\n/)
59
+ .map((line) => line.trim())
60
+ .find((line) => line.length > 0);
61
+ return resolved ?? null;
62
+ }
11
63
  export class WorkspaceManager {
12
64
  constructor(options) {
13
65
  this.options = options;
@@ -200,6 +252,11 @@ export class WorkspaceManager {
200
252
  catch (error) {
201
253
  this.options.logger.warn({ identifier, err: error }, "Failed to resolve binary path from system PATH");
202
254
  }
255
+ const shellResolved = resolveBinaryPathFromUserShell(identifier);
256
+ if (shellResolved) {
257
+ this.options.logger.debug({ identifier, resolved: shellResolved }, "Resolved binary path from user shell");
258
+ return shellResolved;
259
+ }
203
260
  return identifier;
204
261
  }
205
262
  pickBinaryCandidate(candidates) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralnomads/codenomad-dev",
3
- "version": "0.14.0-dev-20260421-68551f67",
3
+ "version": "0.14.0-dev-20260422-e708c565",
4
4
  "description": "CodeNomad Server",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "npm run build:ui && npm run prepare-ui && tsc -p tsconfig.json && node ./scripts/copy-auth-pages.mjs && npm run prepare-config",
21
+ "build:standalone": "node ./scripts/build-standalone.mjs",
21
22
  "build:ui": "npm run build --prefix ../ui",
22
23
  "prepare-ui": "node ./scripts/copy-ui-dist.mjs",
23
24
  "prepare-config": "node ./scripts/copy-opencode-config.mjs",
@@ -25,16 +26,16 @@
25
26
  "typecheck": "tsc --noEmit -p tsconfig.json"
26
27
  },
27
28
  "dependencies": {
28
- "@fastify/cors": "^8.5.0",
29
- "@fastify/reply-from": "^9.8.0",
30
- "@fastify/static": "^7.0.4",
29
+ "@fastify/cors": "^11.2.0",
30
+ "@fastify/reply-from": "^12.6.2",
31
+ "@fastify/static": "^9.1.1",
31
32
  "commander": "^12.1.0",
32
- "fastify": "^4.28.1",
33
+ "fastify": "^5.8.5",
33
34
  "fuzzysort": "^2.0.4",
34
35
  "node-forge": "^1.3.3",
35
36
  "openai": "^6.27.0",
36
37
  "pino": "^9.4.0",
37
- "undici": "^6.19.8",
38
+ "undici": "^8.1.0",
38
39
  "yaml": "^2.4.2",
39
40
  "yauzl": "^2.10.0",
40
41
  "zod": "^3.23.8"
@@ -42,6 +43,7 @@
42
43
  "devDependencies": {
43
44
  "@types/node-forge": "^1.3.14",
44
45
  "@types/yauzl": "^2.10.0",
46
+ "bun": "^1.3.13",
45
47
  "cross-env": "^7.0.3",
46
48
  "ts-node": "^10.9.2",
47
49
  "tsx": "^4.20.6",
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-DANembz4.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as K}from"./index-DE6KDkkL.js";import{m as B,t as g,i as a,d as w,a as F,f as N}from"./monaco-viewer-DANembz4.js";import{c as f,n as c,a as L,F as T,S as W,z as j,A as q}from"./git-diff-vendor-CSgooKT_.js";import{D as G}from"./DiffToolbar-C-rXHRQB.js";import{S as H}from"./SplitFilePanel-DhUmaW0S.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./main-3oghJUx8.js";import"./wrap-text-DngNWpNA.js";var J=g('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),p=g("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Q=g('<div class="p-3 text-xs text-secondary">'),E=g("<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-"),U=g("<span class=files-tab-selected-path><span class=file-path-text>"),X=g('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Y=g("<div style=margin-left:auto>");const Z=q(()=>K(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),fe=e=>{const M=f(()=>e.activeSessionId()),S=f(()=>!!(M()&&M()!=="info")),D=f(()=>S()?e.activeSessionDiffs():null),m=f(()=>{const n=D();return Array.isArray(n)?[...n].sort((i,l)=>String(i.file||"").localeCompare(String(l.file||""))):[]}),R=f(()=>m().reduce((n,i)=>(n.additions+=typeof i.additions=="number"?i.additions:0,n.deletions+=typeof i.deletions=="number"?i.deletions:0,n),{additions:0,deletions:0})),I=f(()=>{const n=m();return n.length===0?null:n.reduce((i,l)=>{const v=typeof(i==null?void 0:i.additions)=="number"?i.additions:0,y=typeof(i==null?void 0:i.deletions)=="number"?i.deletions:0,x=v+y,k=typeof(l==null?void 0:l.additions)=="number"?l.additions:0,t=typeof(l==null?void 0:l.deletions)=="number"?l.deletions:0,r=k+t;return r>x?l:r<x?i:String(l.file||"").localeCompare(String((i==null?void 0:i.file)||""))<0?l:i},n[0])}),P=f(()=>{const n=e.selectedFile(),i=m();if(n){const l=i.find(v=>v.file===n);if(l)return l}return I()}),O=f(()=>`${e.instanceId}:${S()?M():"no-session"}`),V=f(()=>{if(!S())return e.t("instanceShell.sessionChanges.noSessionSelected");const n=D();return n===void 0?e.t("instanceShell.sessionChanges.loading"):!Array.isArray(n)||n.length===0?e.t("instanceShell.sessionChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty")}),A=f(()=>{const n=P();return n!=null&&n.file?String(n.file):e.t("instanceShell.rightPanel.tabs.changes")});return B(()=>{const n=m(),i=R(),l=P(),v=()=>(()=>{var t=J(),r=t.firstChild;return a(r,c(W,{get when(){return l&&S()&&n.length>0?l:null},get fallback(){return(()=>{var d=p(),s=d.firstChild;return a(s,V),d})()},children:d=>c(j,{get fallback(){return(()=>{var s=p(),u=s.firstChild;return a(u,()=>e.t("instanceInfo.loading")),s})()},get children(){return c(Z,{get scopeKey(){return O()},get path(){return String(d().file||"")},get patch(){return String(d().patch||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()}})}})})),t})(),y=()=>(()=>{var t=Q();return a(t,V),t})();return c(H,{get header(){return[(()=>{var t=U(),r=t.firstChild;return a(r,A),L(()=>w(t,"title",A())),t})(),(()=>{var t=X(),r=t.firstChild,d=r.firstChild;d.firstChild;var s=r.nextSibling,u=s.firstChild;return u.firstChild,a(d,()=>i.additions,null),a(u,()=>i.deletions,null),t})(),(()=>{var t=Y();return a(t,c(G,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})),t})()]},list:{panel:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,e.isPhoneLayout())},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(s,"title",o.t=$),o},{e:void 0,t:void 0}),r})()})}}),overlay:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,!0)},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file,z=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(r,"title",o.t=$),z!==o.a&&w(s,"title",o.a=z),o},{e:void 0,t:void 0,a:void 0}),r})()})}})},get viewer(){return v()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.changes")}})})};N(["click"]);export{fe as default};
2
+ import{_ as K}from"./index-DE6KDkkL.js";import{m as B,t as g,i as a,d as w,a as F,f as N}from"./monaco-viewer-DANembz4.js";import{c as f,n as c,a as L,F as T,S as W,z as j,A as q}from"./git-diff-vendor-CSgooKT_.js";import{D as G}from"./DiffToolbar-BqTuTuLi.js";import{S as H}from"./SplitFilePanel-DhUmaW0S.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./main-BIaFBThA.js";import"./wrap-text-BTyaDmSX.js";var J=g('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),p=g("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Q=g('<div class="p-3 text-xs text-secondary">'),E=g("<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-"),U=g("<span class=files-tab-selected-path><span class=file-path-text>"),X=g('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Y=g("<div style=margin-left:auto>");const Z=q(()=>K(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),fe=e=>{const M=f(()=>e.activeSessionId()),S=f(()=>!!(M()&&M()!=="info")),D=f(()=>S()?e.activeSessionDiffs():null),m=f(()=>{const n=D();return Array.isArray(n)?[...n].sort((i,l)=>String(i.file||"").localeCompare(String(l.file||""))):[]}),R=f(()=>m().reduce((n,i)=>(n.additions+=typeof i.additions=="number"?i.additions:0,n.deletions+=typeof i.deletions=="number"?i.deletions:0,n),{additions:0,deletions:0})),I=f(()=>{const n=m();return n.length===0?null:n.reduce((i,l)=>{const v=typeof(i==null?void 0:i.additions)=="number"?i.additions:0,y=typeof(i==null?void 0:i.deletions)=="number"?i.deletions:0,x=v+y,k=typeof(l==null?void 0:l.additions)=="number"?l.additions:0,t=typeof(l==null?void 0:l.deletions)=="number"?l.deletions:0,r=k+t;return r>x?l:r<x?i:String(l.file||"").localeCompare(String((i==null?void 0:i.file)||""))<0?l:i},n[0])}),P=f(()=>{const n=e.selectedFile(),i=m();if(n){const l=i.find(v=>v.file===n);if(l)return l}return I()}),O=f(()=>`${e.instanceId}:${S()?M():"no-session"}`),V=f(()=>{if(!S())return e.t("instanceShell.sessionChanges.noSessionSelected");const n=D();return n===void 0?e.t("instanceShell.sessionChanges.loading"):!Array.isArray(n)||n.length===0?e.t("instanceShell.sessionChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty")}),A=f(()=>{const n=P();return n!=null&&n.file?String(n.file):e.t("instanceShell.rightPanel.tabs.changes")});return B(()=>{const n=m(),i=R(),l=P(),v=()=>(()=>{var t=J(),r=t.firstChild;return a(r,c(W,{get when(){return l&&S()&&n.length>0?l:null},get fallback(){return(()=>{var d=p(),s=d.firstChild;return a(s,V),d})()},children:d=>c(j,{get fallback(){return(()=>{var s=p(),u=s.firstChild;return a(u,()=>e.t("instanceInfo.loading")),s})()},get children(){return c(Z,{get scopeKey(){return O()},get path(){return String(d().file||"")},get patch(){return String(d().patch||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()}})}})})),t})(),y=()=>(()=>{var t=Q();return a(t,V),t})();return c(H,{get header(){return[(()=>{var t=U(),r=t.firstChild;return a(r,A),L(()=>w(t,"title",A())),t})(),(()=>{var t=X(),r=t.firstChild,d=r.firstChild;d.firstChild;var s=r.nextSibling,u=s.firstChild;return u.firstChild,a(d,()=>i.additions,null),a(u,()=>i.deletions,null),t})(),(()=>{var t=Y();return a(t,c(G,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})),t})()]},list:{panel:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,e.isPhoneLayout())},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(s,"title",o.t=$),o},{e:void 0,t:void 0}),r})()})}}),overlay:()=>c(W,{get when(){return n.length>0},get fallback(){return y()},get children(){return c(T,{each:n,children:t=>(()=>{var r=E(),d=r.firstChild,s=d.firstChild,u=s.firstChild,b=s.nextSibling,h=b.firstChild;h.firstChild;var C=h.nextSibling;return C.firstChild,r.$$click=()=>{e.onSelectFile(t.file,!0)},a(u,()=>t.file),a(h,()=>t.additions,null),a(C,()=>t.deletions,null),L(o=>{var _=`file-list-item ${(l==null?void 0:l.file)===t.file?"file-list-item-active":""}`,$=t.file,z=t.file;return _!==o.e&&F(r,o.e=_),$!==o.t&&w(r,"title",o.t=$),z!==o.a&&w(s,"title",o.a=z),o},{e:void 0,t:void 0,a:void 0}),r})()})}})},get viewer(){return v()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.changes")}})})};N(["click"]);export{fe as default};
@@ -1 +1 @@
1
- import{t as g,i as c,m as W,d as i,a as S,f as T}from"./monaco-viewer-DANembz4.js";import{u as C}from"./index-DE6KDkkL.js";import{n as o,m as $,a as V}from"./git-diff-vendor-CSgooKT_.js";import{I as U,S as A,T as I}from"./main-3oghJUx8.js";import{A as D,W as E}from"./wrap-text-DngNWpNA.js";const F=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],H=t=>o(U,$(t,{name:"UnfoldVertical",iconNode:F}));var N=g("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const z=t=>{const{t:a}=C(),r=()=>t.viewMode==="split"?"unified":"split",s=()=>t.contextMode==="collapsed"?"expanded":"collapsed",h=()=>t.wordWrapMode==="on"?"off":"on",f=()=>r()==="split"?a("instanceShell.diff.switchToSplit"):a("instanceShell.diff.switchToUnified"),v=()=>s()==="collapsed"?a("instanceShell.diff.hideUnchanged"):a("instanceShell.diff.showFull"),u=()=>h()==="on"?a("instanceShell.diff.enableWordWrap"):a("instanceShell.diff.disableWordWrap");return(()=>{var b=N(),n=b.firstChild,l=n.nextSibling,d=l.nextSibling;return n.$$click=()=>t.onViewModeChange(r()),c(n,(()=>{var e=W(()=>r()==="split");return()=>e()?o(A,{class:"h-4 w-4","aria-hidden":"true"}):o(D,{class:"h-4 w-4","aria-hidden":"true"})})()),l.$$click=()=>t.onContextModeChange(s()),c(l,(()=>{var e=W(()=>s()==="collapsed");return()=>e()?o(I,{class:"h-4 w-4","aria-hidden":"true"}):o(H,{class:"h-4 w-4","aria-hidden":"true"})})()),d.$$click=()=>t.onWordWrapModeChange(h()),c(d,o(E,{class:"h-4 w-4","aria-hidden":"true"})),V(e=>{var m=f(),w=f(),M=v(),p=v(),x=`file-viewer-toolbar-icon-button${t.wordWrapMode==="on"?" active":""}`,k=u(),y=u();return m!==e.e&&i(n,"aria-label",e.e=m),w!==e.t&&i(n,"title",e.t=w),M!==e.a&&i(l,"aria-label",e.a=M),p!==e.o&&i(l,"title",e.o=p),x!==e.i&&S(d,e.i=x),k!==e.n&&i(d,"aria-label",e.n=k),y!==e.s&&i(d,"title",e.s=y),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),b})()};T(["click"]);export{z as D};
1
+ import{t as g,i as c,m as W,d as i,a as S,f as T}from"./monaco-viewer-DANembz4.js";import{u as C}from"./index-DE6KDkkL.js";import{n as o,m as $,a as V}from"./git-diff-vendor-CSgooKT_.js";import{I as U,S as A,T as I}from"./main-BIaFBThA.js";import{A as D,W as E}from"./wrap-text-BTyaDmSX.js";const F=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],H=t=>o(U,$(t,{name:"UnfoldVertical",iconNode:F}));var N=g("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const z=t=>{const{t:a}=C(),r=()=>t.viewMode==="split"?"unified":"split",s=()=>t.contextMode==="collapsed"?"expanded":"collapsed",h=()=>t.wordWrapMode==="on"?"off":"on",f=()=>r()==="split"?a("instanceShell.diff.switchToSplit"):a("instanceShell.diff.switchToUnified"),v=()=>s()==="collapsed"?a("instanceShell.diff.hideUnchanged"):a("instanceShell.diff.showFull"),u=()=>h()==="on"?a("instanceShell.diff.enableWordWrap"):a("instanceShell.diff.disableWordWrap");return(()=>{var b=N(),n=b.firstChild,l=n.nextSibling,d=l.nextSibling;return n.$$click=()=>t.onViewModeChange(r()),c(n,(()=>{var e=W(()=>r()==="split");return()=>e()?o(A,{class:"h-4 w-4","aria-hidden":"true"}):o(D,{class:"h-4 w-4","aria-hidden":"true"})})()),l.$$click=()=>t.onContextModeChange(s()),c(l,(()=>{var e=W(()=>s()==="collapsed");return()=>e()?o(I,{class:"h-4 w-4","aria-hidden":"true"}):o(H,{class:"h-4 w-4","aria-hidden":"true"})})()),d.$$click=()=>t.onWordWrapModeChange(h()),c(d,o(E,{class:"h-4 w-4","aria-hidden":"true"})),V(e=>{var m=f(),w=f(),M=v(),p=v(),x=`file-viewer-toolbar-icon-button${t.wordWrapMode==="on"?" active":""}`,k=u(),y=u();return m!==e.e&&i(n,"aria-label",e.e=m),w!==e.t&&i(n,"title",e.t=w),M!==e.a&&i(l,"aria-label",e.a=M),p!==e.o&&i(l,"title",e.o=p),x!==e.i&&S(d,e.i=x),k!==e.n&&i(d,"aria-label",e.n=k),y!==e.s&&i(d,"title",e.s=y),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),b})()};T(["click"]);export{z as D};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-DANembz4.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as R}from"./index-DE6KDkkL.js";import{m as _,t as o,i as s,d as c,a as z,f as I}from"./monaco-viewer-DANembz4.js";import{n as i,m as D,S as d,a as v,F,z as V,A as M}from"./git-diff-vendor-CSgooKT_.js";import{S as T}from"./SplitFilePanel-DhUmaW0S.js";import{I as A,R as y}from"./main-3oghJUx8.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const O=[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]],q=e=>i(A,D(e,{name:"Save",iconNode:O}));var g=o("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),K=o('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),N=o('<div class="p-3 text-xs text-secondary">'),W=o("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),H=o('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class="text-[10px] text-secondary">'),j=o("<span>"),B=o("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),G=o("<button type=button class=files-header-icon-button style=margin-inline-start:auto>"),J=o("<button type=button class=files-header-icon-button>"),Q=o("<span class=text-error>");const U=M(()=>R(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ae),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer}))),ae=e=>{const C=()=>{const h=e.browserSelectedContent();h!=null&&e.onSave(h)};return _(()=>{const h=e.browserEntries(),P=[...h||[]].sort((t,n)=>{const r=t.type==="directory"?0:1,l=n.type==="directory"?0:1;return r!==l?r-l:String(t.name||"").localeCompare(String(n.name||""))}),L=e.parentPath(),w=()=>e.browserSelectedPath()||e.browserPath(),x=()=>e.browserLoading()&&h===null?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),k=()=>(()=>{var t=K(),n=t.firstChild;return s(n,i(d,{get when(){return e.browserSelectedLoading()},get fallback(){return i(d,{get when(){return e.browserSelectedError()},get fallback(){return i(d,{get when(){return _(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var r=g(),l=r.firstChild;return s(l,x),r})()},children:r=>i(V,{get fallback(){return(()=>{var l=g(),a=l.firstChild;return s(a,()=>e.t("instanceInfo.loading")),l})()},get children(){return i(U,{get scopeKey(){return e.scopeKey()},get path(){return r().path},get content(){return r().content},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})})},children:r=>(()=>{var l=g(),a=l.firstChild;return s(a,r),l})()})},get children(){var r=g(),l=r.firstChild;return s(l,()=>e.t("instanceInfo.loading")),r}})),t})(),m=()=>[i(d,{when:L,children:t=>(()=>{var n=W(),r=n.firstChild,l=r.firstChild;return n.$$click=()=>e.onLoadEntries(t()),v(()=>c(l,"title",t())),n})()}),i(d,{get when(){return e.browserLoading()&&h===null},get children(){var t=N();return s(t,()=>e.t("instanceInfo.loading")),t}}),i(F,{each:P,children:t=>(()=>{var n=H(),r=n.firstChild,l=r.firstChild,a=l.firstChild,f=l.nextSibling,E=f.firstChild;return n.$$click=()=>{if(t.type==="directory"){e.onLoadEntries(t.path);return}e.onRequestOpenFile(t.path)},s(a,()=>t.name),s(E,()=>t.type),v(u=>{var b=`file-list-item ${e.browserSelectedPath()===t.path?"file-list-item-active":""}`,S=t.path,$=t.path;return b!==u.e&&z(n,u.e=b),S!==u.t&&c(n,"title",u.t=S),$!==u.a&&c(l,"title",u.a=$),u},{e:void 0,t:void 0,a:void 0}),n})()})];return i(T,{get header(){return[(()=>{var t=B(),n=t.firstChild,r=n.firstChild,l=r.firstChild;return s(l,w),s(t,i(d,{get when(){return e.browserLoading()},get children(){var a=j();return s(a,()=>e.t("instanceInfo.loading")),a}}),null),s(t,i(d,{get when(){return e.browserError()},children:a=>(()=>{var f=Q();return s(f,a),f})()}),null),v(()=>c(r,"title",w())),t})(),(()=>{var t=G();return t.$$click=C,s(t,i(d,{get when(){return e.browserSelectedSaving()},get fallback(){return i(q,{class:"h-4 w-4"})},get children(){return i(y,{class:"h-4 w-4 animate-spin"})}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",l=e.t("instanceShell.rightPanel.actions.save")||"Save",a=e.browserSelectedSaving()||!e.browserSelectedDirty();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})(),(()=>{var t=J();return t.$$click=()=>e.onRefresh(),s(t,i(y,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.refresh"),l=e.t("instanceShell.rightPanel.actions.refresh"),a=e.browserLoading();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()]},list:{panel:m,overlay:m},get viewer(){return k()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};I(["click"]);export{ae as default};
2
+ import{_ as R}from"./index-DE6KDkkL.js";import{m as _,t as o,i as s,d as c,a as z,f as I}from"./monaco-viewer-DANembz4.js";import{n as i,m as D,S as d,a as v,F,z as V,A as M}from"./git-diff-vendor-CSgooKT_.js";import{S as T}from"./SplitFilePanel-DhUmaW0S.js";import{I as A,R as y}from"./main-BIaFBThA.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const O=[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]],q=e=>i(A,D(e,{name:"Save",iconNode:O}));var g=o("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),K=o('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),N=o('<div class="p-3 text-xs text-secondary">'),W=o("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),H=o('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=file-list-item-stats><span class="text-[10px] text-secondary">'),j=o("<span>"),B=o("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),G=o("<button type=button class=files-header-icon-button style=margin-inline-start:auto>"),J=o("<button type=button class=files-header-icon-button>"),Q=o("<span class=text-error>");const U=M(()=>R(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ae),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer}))),ae=e=>{const C=()=>{const h=e.browserSelectedContent();h!=null&&e.onSave(h)};return _(()=>{const h=e.browserEntries(),P=[...h||[]].sort((t,n)=>{const r=t.type==="directory"?0:1,l=n.type==="directory"?0:1;return r!==l?r-l:String(t.name||"").localeCompare(String(n.name||""))}),L=e.parentPath(),w=()=>e.browserSelectedPath()||e.browserPath(),x=()=>e.browserLoading()&&h===null?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),k=()=>(()=>{var t=K(),n=t.firstChild;return s(n,i(d,{get when(){return e.browserSelectedLoading()},get fallback(){return i(d,{get when(){return e.browserSelectedError()},get fallback(){return i(d,{get when(){return _(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var r=g(),l=r.firstChild;return s(l,x),r})()},children:r=>i(V,{get fallback(){return(()=>{var l=g(),a=l.firstChild;return s(a,()=>e.t("instanceInfo.loading")),l})()},get children(){return i(U,{get scopeKey(){return e.scopeKey()},get path(){return r().path},get content(){return r().content},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})})},children:r=>(()=>{var l=g(),a=l.firstChild;return s(a,r),l})()})},get children(){var r=g(),l=r.firstChild;return s(l,()=>e.t("instanceInfo.loading")),r}})),t})(),m=()=>[i(d,{when:L,children:t=>(()=>{var n=W(),r=n.firstChild,l=r.firstChild;return n.$$click=()=>e.onLoadEntries(t()),v(()=>c(l,"title",t())),n})()}),i(d,{get when(){return e.browserLoading()&&h===null},get children(){var t=N();return s(t,()=>e.t("instanceInfo.loading")),t}}),i(F,{each:P,children:t=>(()=>{var n=H(),r=n.firstChild,l=r.firstChild,a=l.firstChild,f=l.nextSibling,E=f.firstChild;return n.$$click=()=>{if(t.type==="directory"){e.onLoadEntries(t.path);return}e.onRequestOpenFile(t.path)},s(a,()=>t.name),s(E,()=>t.type),v(u=>{var b=`file-list-item ${e.browserSelectedPath()===t.path?"file-list-item-active":""}`,S=t.path,$=t.path;return b!==u.e&&z(n,u.e=b),S!==u.t&&c(n,"title",u.t=S),$!==u.a&&c(l,"title",u.a=$),u},{e:void 0,t:void 0,a:void 0}),n})()})];return i(T,{get header(){return[(()=>{var t=B(),n=t.firstChild,r=n.firstChild,l=r.firstChild;return s(l,w),s(t,i(d,{get when(){return e.browserLoading()},get children(){var a=j();return s(a,()=>e.t("instanceInfo.loading")),a}}),null),s(t,i(d,{get when(){return e.browserError()},children:a=>(()=>{var f=Q();return s(f,a),f})()}),null),v(()=>c(r,"title",w())),t})(),(()=>{var t=G();return t.$$click=C,s(t,i(d,{get when(){return e.browserSelectedSaving()},get fallback(){return i(q,{class:"h-4 w-4"})},get children(){return i(y,{class:"h-4 w-4 animate-spin"})}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",l=e.t("instanceShell.rightPanel.actions.save")||"Save",a=e.browserSelectedSaving()||!e.browserSelectedDirty();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})(),(()=>{var t=J();return t.$$click=()=>e.onRefresh(),s(t,i(y,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),v(n=>{var r=e.t("instanceShell.rightPanel.actions.refresh"),l=e.t("instanceShell.rightPanel.actions.refresh"),a=e.browserLoading();return r!==n.e&&c(t,"title",n.e=r),l!==n.t&&c(t,"aria-label",n.t=l),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()]},list:{panel:m,overlay:m},get viewer(){return k()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};I(["click"]);export{ae as default};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-DANembz4.js","assets/git-diff-vendor-CSgooKT_.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as se}from"./index-DE6KDkkL.js";import{m as R,t as h,i as n,d as b,h as U,a as Q,f as le}from"./monaco-viewer-DANembz4.js";import{n as r,m as re,c as m,a as L,S as w,F as j,z as ce,A as oe}from"./git-diff-vendor-CSgooKT_.js";import{D as de}from"./DiffToolbar-C-rXHRQB.js";import{S as ge}from"./SplitFilePanel-DhUmaW0S.js";import{I as he,O as ue,R as fe,P as H,Q as J}from"./main-3oghJUx8.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./wrap-text-DngNWpNA.js";const me=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],ve=e=>r(he,re(e,{name:"GitBranch",iconNode:me}));var V=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Ce=h('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),$e=h('<div class="p-3 text-xs text-secondary">'),be=h('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),_e=h('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),we=h("<div class=git-change-section-items>"),Se=h("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),ye=h('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),xe=h("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ie=h('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Me=h("<span class=files-tab-selected-path><span class=file-path-text>"),ke=h('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Le=h("<button type=button class=files-header-icon-button style=margin-left:auto>"),Ee=h("<span class=text-error>");const Pe=oe(()=>se(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),Ge=e=>{const T=m(()=>e.activeSessionId()),W=m(()=>!!(T()&&T()!=="info")),A=m(()=>W()?e.entries():null),X=m(()=>{const o=A();return Array.isArray(o)?[...o].sort((d,x)=>String(d.path||"").localeCompare(String(x.path||""))):[]}),S=m(()=>ue(X())),Y=m(()=>S().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),z=m(()=>S().filter(o=>o.section==="staged")),Z=m(()=>S().filter(o=>o.section==="unstaged")),p=m(()=>z().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),ee=m(()=>{const o=S(),d=e.selectedItemId(),x=e.mostChangedItemId(),I=o.find(E=>E.id===d)||(x?o.find(E=>E.id===x):void 0);return(I==null?void 0:I.entry)??null}),D=m(()=>W()?A()===null?e.t("instanceShell.gitChanges.loading"):S().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),te=m(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return R(()=>{const o=Y(),d=ee(),x=S(),I=z(),E=Z(),ne=()=>(()=>{var t=Ce(),l=t.firstChild;return n(l,r(w,{get when(){return e.selectedLoading()},get fallback(){return r(w,{get when(){return e.selectedError()},get fallback(){return r(w,{get when(){return R(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var i=V(),s=i.firstChild;return n(s,D),i})()},children:i=>r(ce,{get fallback(){return(()=>{var s=V(),a=s.firstChild;return n(a,()=>e.t("instanceInfo.loading")),s})()},get children(){return r(Pe,{get scopeKey(){return e.scopeKey()},get path(){return String(i().path||"")},get before(){return String(i().before||"")},get after(){return String(i().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return te()?void 0:s=>{const a=e.selectedItemId();if(!a)return;const g=S().find(u=>u.id===a);g&&e.onInsertContext(g,s)}}})}})})},children:i=>(()=>{var s=V(),a=s.firstChild;return n(a,i),s})()})},get children(){var i=V(),s=i.firstChild;return n(s,()=>e.t("instanceInfo.loading")),i}})),t})(),ie=()=>(()=>{var t=$e();return n(t,D),t})(),B=t=>{const l=m(()=>e.selectedBulkItemIds().has(t.id)),i=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var a=_e(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=u.nextSibling,$=v.firstChild,C=$.firstChild;C.firstChild;var _=C.nextSibling;_.firstChild;var P=g.nextSibling,f=P.firstChild,y=f.firstChild,k=y.firstChild;return k.firstChild,a.$$click=c=>e.onRowClick(t,c),a.$$mousedown=c=>{(c.shiftKey||c.ctrlKey||c.metaKey)&&c.preventDefault()},n(M,()=>t.path),n(C,()=>t.additions,null),n(_,()=>t.deletions,null),y.$$click=c=>{c.stopPropagation(),s()},b(y,"title",i),b(y,"aria-label",i),n(k,r(w,{get when(){return t.section!=="staged"},get children(){return be()}}),null),L(c=>{var F=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${l()?"git-change-list-item-bulk-selected":""}`,G=t.path,K=t.path,q=t.path,N=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return F!==c.e&&Q(a,c.e=F),G!==c.t&&b(a,"title",c.t=G),K!==c.a&&b(g,"title",c.a=K),q!==c.o&&b(u,"title",c.o=q),N!==c.i&&Q(k,c.i=N),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},ae=(t,l,i,s)=>(()=>{var a=Se(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=M.nextSibling,$=u.nextSibling;return U(g,"click",s,!0),n(M,i?r(H,{class:"h-3.5 w-3.5"}):r(J,{class:"h-3.5 w-3.5"})),n(v,t),n($,()=>l.length),n(a,r(w,{when:i,get children(){var C=we();return n(C,r(j,{each:l,children:_=>B(_)})),C}}),null),a})(),O=()=>r(w,{get when(){return x.length>0},get fallback(){return ie()},get children(){var t=xe(),l=t.firstChild,i=l.firstChild,s=i.firstChild,a=s.firstChild,g=a.nextSibling,u=g.firstChild,M=s.nextSibling;return U(i,"click",e.onToggleStagedOpen,!0),n(a,(()=>{var v=R(()=>!!e.stagedOpen());return()=>v()?r(H,{class:"h-3.5 w-3.5"}):r(J,{class:"h-3.5 w-3.5"})})()),n(u,()=>e.t("instanceShell.gitChanges.sections.staged")),n(g,r(w,{get when(){return e.branchLabel()},children:v=>(()=>{var $=Ie(),C=$.firstChild;return n($,r(ve,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,v),L(()=>b($,"title",`Branch: ${v()}`)),$})()}),null),n(M,()=>I.length),n(l,r(w,{get when(){return e.stagedOpen()},get children(){var v=ye(),$=v.firstChild,C=$.firstChild,_=C.firstChild,P=_.nextSibling;return _.$$input=f=>e.onCommitMessageInput(f.currentTarget.value),P.$$click=()=>e.onSubmitCommit(),n(P,(()=>{var f=R(()=>!!e.commitSubmitting());return()=>f()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n(v,r(j,{each:I,children:f=>B(f)}),null),L(f=>{var y=e.t("instanceShell.gitChanges.commit.placeholder"),k=!p();return y!==f.e&&b(_,"placeholder",f.e=y),k!==f.t&&(P.disabled=f.t=k),f},{e:void 0,t:void 0}),L(()=>_.value=e.commitMessage()),v}}),null),n(t,()=>ae(e.t("instanceShell.gitChanges.sections.unstaged"),E,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return r(ge,{get header(){return[(()=>{var t=Me(),l=t.firstChild;return n(l,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),L(()=>b(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=ke(),l=t.firstChild,i=l.firstChild;i.firstChild;var s=l.nextSibling,a=s.firstChild;return a.firstChild,n(i,()=>o.additions,null),n(a,()=>o.deletions,null),n(t,r(w,{get when(){return e.statusError()},children:g=>(()=>{var u=Ee();return n(u,g),u})()}),null),t})(),(()=>{var t=Le();return t.$$click=()=>e.onRefresh(),n(t,r(fe,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),L(l=>{var i=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),a=!W()||e.statusLoading()||A()===null;return i!==l.e&&b(t,"title",l.e=i),s!==l.t&&b(t,"aria-label",l.t=s),a!==l.a&&(t.disabled=l.a=a),l},{e:void 0,t:void 0,a:void 0}),t})(),r(de,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:O,overlay:O},get viewer(){return ne()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};le(["mousedown","click","input"]);export{Ge as default};
2
+ import{_ as se}from"./index-DE6KDkkL.js";import{m as R,t as h,i as n,d as b,h as U,a as Q,f as le}from"./monaco-viewer-DANembz4.js";import{n as r,m as re,c as m,a as L,S as w,F as j,z as ce,A as oe}from"./git-diff-vendor-CSgooKT_.js";import{D as de}from"./DiffToolbar-BqTuTuLi.js";import{S as ge}from"./SplitFilePanel-DhUmaW0S.js";import{I as he,O as ue,R as fe,P as H,Q as J}from"./main-BIaFBThA.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./wrap-text-BTyaDmSX.js";const me=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],ve=e=>r(he,re(e,{name:"GitBranch",iconNode:me}));var V=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Ce=h('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),$e=h('<div class="p-3 text-xs text-secondary">'),be=h('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),_e=h('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),we=h("<div class=git-change-section-items>"),Se=h("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),ye=h('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),xe=h("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ie=h('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Me=h("<span class=files-tab-selected-path><span class=file-path-text>"),ke=h('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),Le=h("<button type=button class=files-header-icon-button style=margin-left:auto>"),Ee=h("<span class=text-error>");const Pe=oe(()=>se(()=>import("./monaco-viewer-DANembz4.js").then(e=>e.ad),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),Ge=e=>{const T=m(()=>e.activeSessionId()),W=m(()=>!!(T()&&T()!=="info")),A=m(()=>W()?e.entries():null),X=m(()=>{const o=A();return Array.isArray(o)?[...o].sort((d,x)=>String(d.path||"").localeCompare(String(x.path||""))):[]}),S=m(()=>ue(X())),Y=m(()=>S().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),z=m(()=>S().filter(o=>o.section==="staged")),Z=m(()=>S().filter(o=>o.section==="unstaged")),p=m(()=>z().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),ee=m(()=>{const o=S(),d=e.selectedItemId(),x=e.mostChangedItemId(),I=o.find(E=>E.id===d)||(x?o.find(E=>E.id===x):void 0);return(I==null?void 0:I.entry)??null}),D=m(()=>W()?A()===null?e.t("instanceShell.gitChanges.loading"):S().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),te=m(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return R(()=>{const o=Y(),d=ee(),x=S(),I=z(),E=Z(),ne=()=>(()=>{var t=Ce(),l=t.firstChild;return n(l,r(w,{get when(){return e.selectedLoading()},get fallback(){return r(w,{get when(){return e.selectedError()},get fallback(){return r(w,{get when(){return R(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var i=V(),s=i.firstChild;return n(s,D),i})()},children:i=>r(ce,{get fallback(){return(()=>{var s=V(),a=s.firstChild;return n(a,()=>e.t("instanceInfo.loading")),s})()},get children(){return r(Pe,{get scopeKey(){return e.scopeKey()},get path(){return String(i().path||"")},get before(){return String(i().before||"")},get after(){return String(i().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return te()?void 0:s=>{const a=e.selectedItemId();if(!a)return;const g=S().find(u=>u.id===a);g&&e.onInsertContext(g,s)}}})}})})},children:i=>(()=>{var s=V(),a=s.firstChild;return n(a,i),s})()})},get children(){var i=V(),s=i.firstChild;return n(s,()=>e.t("instanceInfo.loading")),i}})),t})(),ie=()=>(()=>{var t=$e();return n(t,D),t})(),B=t=>{const l=m(()=>e.selectedBulkItemIds().has(t.id)),i=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var a=_e(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=u.nextSibling,$=v.firstChild,C=$.firstChild;C.firstChild;var _=C.nextSibling;_.firstChild;var P=g.nextSibling,f=P.firstChild,y=f.firstChild,k=y.firstChild;return k.firstChild,a.$$click=c=>e.onRowClick(t,c),a.$$mousedown=c=>{(c.shiftKey||c.ctrlKey||c.metaKey)&&c.preventDefault()},n(M,()=>t.path),n(C,()=>t.additions,null),n(_,()=>t.deletions,null),y.$$click=c=>{c.stopPropagation(),s()},b(y,"title",i),b(y,"aria-label",i),n(k,r(w,{get when(){return t.section!=="staged"},get children(){return be()}}),null),L(c=>{var F=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${l()?"git-change-list-item-bulk-selected":""}`,G=t.path,K=t.path,q=t.path,N=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return F!==c.e&&Q(a,c.e=F),G!==c.t&&b(a,"title",c.t=G),K!==c.a&&b(g,"title",c.a=K),q!==c.o&&b(u,"title",c.o=q),N!==c.i&&Q(k,c.i=N),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},ae=(t,l,i,s)=>(()=>{var a=Se(),g=a.firstChild,u=g.firstChild,M=u.firstChild,v=M.nextSibling,$=u.nextSibling;return U(g,"click",s,!0),n(M,i?r(H,{class:"h-3.5 w-3.5"}):r(J,{class:"h-3.5 w-3.5"})),n(v,t),n($,()=>l.length),n(a,r(w,{when:i,get children(){var C=we();return n(C,r(j,{each:l,children:_=>B(_)})),C}}),null),a})(),O=()=>r(w,{get when(){return x.length>0},get fallback(){return ie()},get children(){var t=xe(),l=t.firstChild,i=l.firstChild,s=i.firstChild,a=s.firstChild,g=a.nextSibling,u=g.firstChild,M=s.nextSibling;return U(i,"click",e.onToggleStagedOpen,!0),n(a,(()=>{var v=R(()=>!!e.stagedOpen());return()=>v()?r(H,{class:"h-3.5 w-3.5"}):r(J,{class:"h-3.5 w-3.5"})})()),n(u,()=>e.t("instanceShell.gitChanges.sections.staged")),n(g,r(w,{get when(){return e.branchLabel()},children:v=>(()=>{var $=Ie(),C=$.firstChild;return n($,r(ve,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,v),L(()=>b($,"title",`Branch: ${v()}`)),$})()}),null),n(M,()=>I.length),n(l,r(w,{get when(){return e.stagedOpen()},get children(){var v=ye(),$=v.firstChild,C=$.firstChild,_=C.firstChild,P=_.nextSibling;return _.$$input=f=>e.onCommitMessageInput(f.currentTarget.value),P.$$click=()=>e.onSubmitCommit(),n(P,(()=>{var f=R(()=>!!e.commitSubmitting());return()=>f()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n(v,r(j,{each:I,children:f=>B(f)}),null),L(f=>{var y=e.t("instanceShell.gitChanges.commit.placeholder"),k=!p();return y!==f.e&&b(_,"placeholder",f.e=y),k!==f.t&&(P.disabled=f.t=k),f},{e:void 0,t:void 0}),L(()=>_.value=e.commitMessage()),v}}),null),n(t,()=>ae(e.t("instanceShell.gitChanges.sections.unstaged"),E,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return r(ge,{get header(){return[(()=>{var t=Me(),l=t.firstChild;return n(l,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),L(()=>b(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=ke(),l=t.firstChild,i=l.firstChild;i.firstChild;var s=l.nextSibling,a=s.firstChild;return a.firstChild,n(i,()=>o.additions,null),n(a,()=>o.deletions,null),n(t,r(w,{get when(){return e.statusError()},children:g=>(()=>{var u=Ee();return n(u,g),u})()}),null),t})(),(()=>{var t=Le();return t.$$click=()=>e.onRefresh(),n(t,r(fe,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),L(l=>{var i=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),a=!W()||e.statusLoading()||A()===null;return i!==l.e&&b(t,"title",l.e=i),s!==l.t&&b(t,"aria-label",l.t=s),a!==l.a&&(t.disabled=l.a=a),l},{e:void 0,t:void 0,a:void 0}),t})(),r(de,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:O,overlay:O},get viewer(){return ne()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};le(["mousedown","click","input"]);export{Ge as default};