@ai-ecoverse/slicc-spectrum 1.96.0 → 1.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/slicc-ui.js CHANGED
@@ -8743,40 +8743,40 @@ function schemeOf(media2) {
8743
8743
  if (!query.startsWith("not")) return scheme;
8744
8744
  return scheme === "dark" ? "light" : "dark";
8745
8745
  }
8746
- function apply(doc, paint, color2) {
8746
+ function apply(doc, paint2, color2) {
8747
8747
  doc.documentElement.style.colorScheme = color2;
8748
8748
  const metas = [...doc.head.querySelectorAll('meta[name="theme-color"]')];
8749
- for (const meta of metas) if (!paint.tones.has(meta)) paint.tones.set(meta, meta.content);
8749
+ for (const meta of metas) if (!paint2.tones.has(meta)) paint2.tones.set(meta, meta.content);
8750
8750
  const own5 = metas.find((meta) => schemeOf(meta.media ?? "") === color2);
8751
8751
  if (!own5) return;
8752
- const tone = paint.tones.get(own5);
8752
+ const tone = paint2.tones.get(own5);
8753
8753
  for (const meta of metas) meta.content = tone;
8754
8754
  }
8755
8755
  function holdDocument(doc) {
8756
- const paint = paints.get(doc) ?? {
8756
+ const paint2 = paints.get(doc) ?? {
8757
8757
  scheme: doc.documentElement.style.colorScheme,
8758
8758
  priority: doc.documentElement.style.getPropertyPriority("color-scheme"),
8759
8759
  tones: /* @__PURE__ */ new Map(),
8760
8760
  holds: /* @__PURE__ */ new Map()
8761
8761
  };
8762
- paints.set(doc, paint);
8762
+ paints.set(doc, paint2);
8763
8763
  const key2 = {};
8764
- paint.holds.set(key2, null);
8764
+ paint2.holds.set(key2, null);
8765
8765
  return {
8766
8766
  paint(color2) {
8767
- if (!paint.holds.has(key2)) return;
8768
- paint.holds.delete(key2);
8769
- paint.holds.set(key2, color2);
8770
- apply(doc, paint, color2);
8767
+ if (!paint2.holds.has(key2)) return;
8768
+ paint2.holds.delete(key2);
8769
+ paint2.holds.set(key2, color2);
8770
+ apply(doc, paint2, color2);
8771
8771
  },
8772
8772
  release() {
8773
- if (!paint.holds.delete(key2)) return;
8774
- const left = [...paint.holds.values()].filter((color2) => color2 !== null);
8775
- if (left.length) return apply(doc, paint, left[left.length - 1]);
8776
- if (paint.holds.size) return;
8773
+ if (!paint2.holds.delete(key2)) return;
8774
+ const left = [...paint2.holds.values()].filter((color2) => color2 !== null);
8775
+ if (left.length) return apply(doc, paint2, left[left.length - 1]);
8776
+ if (paint2.holds.size) return;
8777
8777
  paints.delete(doc);
8778
- doc.documentElement.style.setProperty("color-scheme", paint.scheme, paint.priority);
8779
- for (const [meta, tone] of paint.tones) meta.content = tone;
8778
+ doc.documentElement.style.setProperty("color-scheme", paint2.scheme, paint2.priority);
8779
+ for (const [meta, tone] of paint2.tones) meta.content = tone;
8780
8780
  }
8781
8781
  };
8782
8782
  }
@@ -9766,11 +9766,11 @@ e25("swc-icon-user-following", o49);
9766
9766
 
9767
9767
  // src/app/follow.ts
9768
9768
  var lights = {
9769
- connecting: ["info", (owner) => `Connecting to ${owner}`],
9770
- connected: ["positive", (owner) => `Following ${owner}`],
9771
- reconnecting: ["notice", (owner) => `Reconnecting to ${owner}`],
9772
- unlinked: ["negative", (owner) => `Unlinked from ${owner}`],
9773
- failed: ["negative", (owner) => `Can\u2019t reach ${owner}`]
9769
+ connecting: ["info", (owner2) => `Connecting to ${owner2}`],
9770
+ connected: ["positive", (owner2) => `Following ${owner2}`],
9771
+ reconnecting: ["notice", (owner2) => `Reconnecting to ${owner2}`],
9772
+ unlinked: ["negative", (owner2) => `Unlinked from ${owner2}`],
9773
+ failed: ["negative", (owner2) => `Can\u2019t reach ${owner2}`]
9774
9774
  };
9775
9775
  function refusedNow(state2) {
9776
9776
  return !!state2?.refused && state2.link === "connected";
@@ -9782,31 +9782,31 @@ function followLight(state2) {
9782
9782
  }
9783
9783
  function followPage(state2) {
9784
9784
  if (!state2) return null;
9785
- const { owner } = state2;
9785
+ const { owner: owner2 } = state2;
9786
9786
  if (state2.link === "connecting")
9787
9787
  return {
9788
9788
  kind: "connecting",
9789
- title: `Connecting to ${owner}\u2026`,
9790
- body: `This device follows ${owner}. Its agent shows here once it\u2019s connected.`
9789
+ title: `Connecting to ${owner2}\u2026`,
9790
+ body: `This device follows ${owner2}. Its agent shows here once it\u2019s connected.`
9791
9791
  };
9792
9792
  if (state2.link === "unlinked")
9793
9793
  return {
9794
9794
  kind: "unlinked",
9795
- title: `${owner} unlinked this device`,
9796
- body: `To follow it again, open a new link from ${owner}.`
9795
+ title: `${owner2} unlinked this device`,
9796
+ body: `To follow it again, open a new link from ${owner2}.`
9797
9797
  };
9798
9798
  if (state2.link === "failed")
9799
9799
  return {
9800
9800
  kind: "failed",
9801
- title: `Can\u2019t follow ${owner}`,
9802
- body: state2.error ?? `The link to ${owner} failed.`
9801
+ title: `Can\u2019t follow ${owner2}`,
9802
+ body: state2.error ?? `The link to ${owner2} failed.`
9803
9803
  };
9804
9804
  if (state2.access.view) return null;
9805
9805
  const where2 = state2.name ? `next to ${state2.name}` : "for this device";
9806
9806
  return {
9807
9807
  kind: "waiting",
9808
- title: `Waiting for ${owner} to allow this device`,
9809
- body: `On ${owner}, choose Allow ${where2} in Network \u203A Linked devices.`
9808
+ title: `Waiting for ${owner2} to allow this device`,
9809
+ body: `On ${owner2}, choose Allow ${where2} in Network \u203A Linked devices.`
9810
9810
  };
9811
9811
  }
9812
9812
  function list(items, last) {
@@ -12303,9 +12303,9 @@ function factoryTitle(effects, ok4, nok, type, markerType, stringType) {
12303
12303
  return atBreak(code3);
12304
12304
  }
12305
12305
  effects.consume(code3);
12306
- return code3 === 92 ? escape2 : inside;
12306
+ return code3 === 92 ? escape3 : inside;
12307
12307
  }
12308
- function escape2(code3) {
12308
+ function escape3(code3) {
12309
12309
  if (code3 === marker || code3 === 92) {
12310
12310
  effects.consume(code3);
12311
12311
  return inside;
@@ -21041,8 +21041,8 @@ var PATH_STORE_NODE_FLAGS_MASK = 7;
21041
21041
  var PATH_STORE_NODE_KIND_SHIFT = 3;
21042
21042
  var PATH_STORE_NODE_KIND_MASK = 1 << PATH_STORE_NODE_KIND_SHIFT;
21043
21043
  var PATH_STORE_NODE_DEPTH_SHIFT = 4;
21044
- function createNodeDepthAndFlags(depth, flags, kind = 0) {
21045
- return depth << PATH_STORE_NODE_DEPTH_SHIFT | kind << PATH_STORE_NODE_KIND_SHIFT | flags;
21044
+ function createNodeDepthAndFlags(depth, flags2, kind = 0) {
21045
+ return depth << PATH_STORE_NODE_DEPTH_SHIFT | kind << PATH_STORE_NODE_KIND_SHIFT | flags2;
21046
21046
  }
21047
21047
  function getNodeDepth(node2) {
21048
21048
  return node2.depthAndFlags >>> PATH_STORE_NODE_DEPTH_SHIFT;
@@ -29392,6 +29392,229 @@ var FileTree = class {
29392
29392
  }
29393
29393
  };
29394
29394
 
29395
+ // src/app/ansi.ts
29396
+ var lightPalette = [
29397
+ "gray-800",
29398
+ "negative-color-900",
29399
+ "positive-color-900",
29400
+ "notice-color-1000",
29401
+ "informative-color-900",
29402
+ "purple-900",
29403
+ "cyan-1000",
29404
+ "gray-600",
29405
+ "gray-700",
29406
+ "negative-color-1000",
29407
+ "positive-color-1000",
29408
+ "notice-color-1100",
29409
+ "informative-color-1000",
29410
+ "purple-1000",
29411
+ "cyan-1100",
29412
+ "gray-800"
29413
+ ];
29414
+ var terminalPalette = r(
29415
+ lightPalette.map((token2, n37) => `--slicc-terminal-color-${n37}: var(--swc-${token2});`).join("\n")
29416
+ );
29417
+ var tints = [
29418
+ "gray-800",
29419
+ "negative-subtle-background-color-default",
29420
+ "positive-subtle-background-color-default",
29421
+ "notice-subtle-background-color-default",
29422
+ "informative-subtle-background-color-default",
29423
+ "purple-subtle-background-color-default",
29424
+ "cyan-subtle-background-color-default",
29425
+ "gray-subtle-background-color-default"
29426
+ ];
29427
+ var plain = {
29428
+ bold: false,
29429
+ dim: false,
29430
+ italic: false,
29431
+ underline: false,
29432
+ inverse: false,
29433
+ fg: null,
29434
+ bg: null
29435
+ };
29436
+ var levels = [0, 95, 135, 175, 215, 255];
29437
+ function indexed(n37) {
29438
+ if (!Number.isInteger(n37) || n37 < 0 || n37 > 255) return null;
29439
+ if (n37 < 16) return n37;
29440
+ if (n37 >= 232) {
29441
+ const grey = 8 + (n37 - 232) * 10;
29442
+ return `rgb(${grey}, ${grey}, ${grey})`;
29443
+ }
29444
+ const cube = n37 - 16;
29445
+ const [r40, g7, b13] = [Math.floor(cube / 36), Math.floor(cube / 6) % 6, cube % 6].map(
29446
+ (level) => levels[level]
29447
+ );
29448
+ return `rgb(${r40}, ${g7}, ${b13})`;
29449
+ }
29450
+ function channel(value) {
29451
+ return Number.isInteger(value) && value >= 0 && value <= 255 ? value : null;
29452
+ }
29453
+ function extended(params, at) {
29454
+ const mode2 = params[at + 1];
29455
+ if (mode2 === 5) return { color: indexed(params[at + 2]), used: 2 };
29456
+ if (mode2 === 2) {
29457
+ const rgb = params.slice(at + 2, at + 5).map(channel);
29458
+ const ok4 = rgb.length === 3 && rgb.every((value) => value !== null);
29459
+ return { color: ok4 ? `rgb(${rgb.join(", ")})` : null, used: 4 };
29460
+ }
29461
+ return { color: null, used: 0 };
29462
+ }
29463
+ function numbers(text5) {
29464
+ return text5.split(":").map((part2) => part2 === "" ? 0 : Number(part2));
29465
+ }
29466
+ var flags = {
29467
+ 0: plain,
29468
+ 1: { bold: true },
29469
+ 2: { dim: true },
29470
+ 3: { italic: true },
29471
+ 4: { underline: true },
29472
+ 7: { inverse: true },
29473
+ 22: { bold: false, dim: false },
29474
+ 23: { italic: false },
29475
+ 24: { underline: false },
29476
+ 27: { inverse: false },
29477
+ 39: { fg: null },
29478
+ 49: { bg: null }
29479
+ };
29480
+ var ranges = [
29481
+ [30, "fg", 0],
29482
+ [40, "bg", 0],
29483
+ [90, "fg", 8],
29484
+ [100, "bg", 8]
29485
+ ];
29486
+ function simple(code3) {
29487
+ const flag = flags[code3];
29488
+ if (flag) return flag;
29489
+ const range3 = ranges.find(([start2]) => code3 >= start2 && code3 < start2 + 8);
29490
+ return range3 ? { [range3[1]]: code3 - range3[0] + range3[2] } : null;
29491
+ }
29492
+ function wide(groups2, i26) {
29493
+ const group = groups2[i26];
29494
+ if (group.length === 1)
29495
+ return extended(
29496
+ groups2.slice(i26).map((entry) => entry[0]),
29497
+ 0
29498
+ );
29499
+ const spaced = group[1] === 2 && group.length > 5;
29500
+ return { color: extended(spaced ? [0, 2, ...group.slice(3)] : group, 0).color, used: 0 };
29501
+ }
29502
+ function sgr(style, body4) {
29503
+ const next = { ...style };
29504
+ const groups2 = body4 === "" ? [[0]] : body4.split(";").map(numbers);
29505
+ for (let i26 = 0; i26 < groups2.length; i26++) {
29506
+ const group = groups2[i26];
29507
+ const code3 = group[0];
29508
+ if (code3 === 38 || code3 === 48) {
29509
+ const { color: color2, used } = wide(groups2, i26);
29510
+ i26 += used;
29511
+ if (color2 !== null) next[code3 === 38 ? "fg" : "bg"] = color2;
29512
+ } else if (code3 === 4 && group.length > 1) next.underline = group[1] !== 0;
29513
+ else Object.assign(next, simple(code3));
29514
+ }
29515
+ return next;
29516
+ }
29517
+ function terminated(text5, from, streaming) {
29518
+ for (let i26 = from; i26 < text5.length; i26++) {
29519
+ if (text5[i26] === "\x07") return i26 + 1;
29520
+ if (text5[i26] === "\x1B" && text5[i26 + 1] === "\\") return i26 + 2;
29521
+ }
29522
+ if (streaming) return -1;
29523
+ const line = text5.indexOf("\n", from);
29524
+ return line === -1 ? text5.length : line;
29525
+ }
29526
+ function csi(text5, from) {
29527
+ for (let i26 = from; i26 < text5.length; i26++) {
29528
+ const code3 = text5.charCodeAt(i26);
29529
+ if (code3 >= 64 && code3 <= 126) {
29530
+ return { end: i26 + 1, body: text5.slice(from, i26), final: text5[i26] };
29531
+ }
29532
+ if (code3 < 32 || code3 > 63) return { end: i26, body: "", final: "" };
29533
+ }
29534
+ return null;
29535
+ }
29536
+ function escape(text5, at, style, streaming) {
29537
+ const kind = text5[at + 1];
29538
+ if (kind === void 0) return { end: -1, style };
29539
+ if (kind === "[") {
29540
+ const found = csi(text5, at + 2);
29541
+ if (!found) return { end: -1, style };
29542
+ const styled = found.final === "m" && /^[\d;:]*$/.test(found.body);
29543
+ return { end: found.end, style: styled ? sgr(style, found.body) : style };
29544
+ }
29545
+ if ("]PX^_".includes(kind)) return { end: terminated(text5, at + 2, streaming), style };
29546
+ let i26 = at + 1;
29547
+ while (i26 < text5.length && text5.charCodeAt(i26) >= 32 && text5.charCodeAt(i26) <= 47) i26++;
29548
+ if (i26 === text5.length) return { end: -1, style };
29549
+ const final = text5.charCodeAt(i26);
29550
+ return { end: final >= 48 && final <= 126 ? i26 + 1 : at + 1, style };
29551
+ }
29552
+ function parseAnsi(text5, streaming = false) {
29553
+ const runs2 = [];
29554
+ let style = plain;
29555
+ let start2 = 0;
29556
+ const push2 = (end) => {
29557
+ if (end <= start2) return;
29558
+ const last = runs2.at(-1);
29559
+ const piece = text5.slice(start2, end);
29560
+ if (last?.style === style) last.text += piece;
29561
+ else runs2.push({ text: piece, style });
29562
+ };
29563
+ let i26 = text5.indexOf("\x1B");
29564
+ while (i26 !== -1) {
29565
+ push2(i26);
29566
+ const found = escape(text5, i26, style, streaming);
29567
+ if (found.end === -1) return runs2;
29568
+ style = found.style;
29569
+ start2 = found.end;
29570
+ i26 = text5.indexOf("\x1B", start2);
29571
+ }
29572
+ push2(text5.length);
29573
+ return runs2;
29574
+ }
29575
+ function swatch(color2) {
29576
+ if (color2 === null) return null;
29577
+ return typeof color2 === "number" ? `var(--slicc-terminal-color-${color2}, var(--swc-${lightPalette[color2]}))` : color2;
29578
+ }
29579
+ function on(rgb) {
29580
+ const [r40, g7, b13] = rgb.match(/\d+/g).map((value) => {
29581
+ const v13 = Number(value) / 255;
29582
+ return v13 <= 0.03928 ? v13 / 12.92 : ((v13 + 0.055) / 1.055) ** 2.4;
29583
+ });
29584
+ return 0.2126 * r40 + 0.7152 * g7 + 0.0722 * b13 > 0.179 ? "var(--swc-black)" : "var(--swc-white)";
29585
+ }
29586
+ function paint(style) {
29587
+ let { fg, bg } = style;
29588
+ if (style.inverse && fg === null && bg === null) {
29589
+ return ["var(--swc-background-layer-1-color)", "var(--swc-neutral-content-color-default)"];
29590
+ }
29591
+ if (style.inverse) [fg, bg] = [bg, fg];
29592
+ if (style.dim && typeof fg === "number" && fg >= 8) fg -= 8;
29593
+ if (style.dim && fg === null && bg === null) {
29594
+ return ["var(--swc-neutral-subdued-content-color-default)", null];
29595
+ }
29596
+ if (bg === null) return [swatch(fg), null];
29597
+ if (typeof bg === "string") return [typeof fg === "string" ? fg : on(bg), bg];
29598
+ const tint = `var(--swc-${bg === 8 ? "gray-700" : tints[bg % 8]})`;
29599
+ return [bg % 8 === 0 ? "var(--swc-gray-25)" : null, tint];
29600
+ }
29601
+ function inline3(style) {
29602
+ const [fg, bg] = paint(style);
29603
+ return [
29604
+ fg ? `color: ${fg}` : "",
29605
+ bg ? `background: ${bg}` : "",
29606
+ style.bold ? "font-weight: var(--swc-bold-font-weight)" : "",
29607
+ style.italic ? "font-style: italic" : "",
29608
+ style.underline ? "text-decoration: underline" : ""
29609
+ ].filter(Boolean).join("; ");
29610
+ }
29611
+ function ansi(text5, streaming = false) {
29612
+ return parseAnsi(text5, streaming).map((run) => {
29613
+ const style = inline3(run.style);
29614
+ return style ? b`<span style=${style}>${run.text}</span>` : run.text;
29615
+ });
29616
+ }
29617
+
29395
29618
  // src/app/sign-in.ts
29396
29619
  var continuing = "Continue in the sign-in window that opened.";
29397
29620
  var closed = "Closed the sign-in window? Cancel, then Log in again.";
@@ -29711,7 +29934,7 @@ function tool(call, color2 = "light", options2 = {}) {
29711
29934
  const label = `${call.title}, ${statusLabel2(call.status)}`;
29712
29935
  const content3 = b`<div class="call">
29713
29936
  ${body(call, color2)}
29714
- ${call.output ? b`<pre class="output">${call.output}</pre>` : A}
29937
+ ${call.output ? b`<pre class="output">${ansi(call.output, call.status === "running")}</pre>` : A}
29715
29938
  ${call.notes?.length ? notes(call.notes) : A}
29716
29939
  ${call.image ? b`<img class="shot" src=${call.image} alt=${call.title} />` : A}
29717
29940
  ${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
@@ -31207,9 +31430,9 @@ function tabsLight(state2) {
31207
31430
  var stores = /* @__PURE__ */ new WeakMap();
31208
31431
  var loose = {};
31209
31432
  function slotOf(model, key2, initial) {
31210
- const owner = model ?? loose;
31211
- const slots = stores.get(owner) ?? /* @__PURE__ */ new Map();
31212
- stores.set(owner, slots);
31433
+ const owner2 = model ?? loose;
31434
+ const slots = stores.get(owner2) ?? /* @__PURE__ */ new Map();
31435
+ stores.set(owner2, slots);
31213
31436
  const found = slots.get(key2);
31214
31437
  if (found) return found;
31215
31438
  const slot = { value: initial(), listeners: /* @__PURE__ */ new Set() };
@@ -31658,6 +31881,7 @@ var SliccChat = class extends ThemedElement {
31658
31881
  model.agent.on("agents", settle2),
31659
31882
  ...model.tabs ? [model.tabs.on("tabs", () => this.requestUpdate())] : [],
31660
31883
  ...onWatch(model, settle2),
31884
+ ...model.agent.starting ? [model.agent.on("starting", () => this.requestUpdate())] : [],
31661
31885
  model.agent.on("messages", (agentId) => {
31662
31886
  if (agentId === this.#id()) this.#refresh(this.#sent(agentId));
31663
31887
  }),
@@ -32112,7 +32336,7 @@ var SliccChat = class extends ThemedElement {
32112
32336
  this.#items(messages, agent),
32113
32337
  ([key2]) => key2,
32114
32338
  ([, item2]) => item2
32115
- )}</swc-conversation-thread>` : this.model?.tabs?.state().role === "connecting" ? b`<div class="empty" data-connecting>${connecting}</div>` : b`<div class="empty" data-empty>${empty3(watch, seat, agent?.name ?? "the agent")}</div>`}
32339
+ )}</swc-conversation-thread>` : this.model?.tabs?.state().role === "connecting" ? b`<div class="empty" data-connecting>${connecting}</div>` : this.model?.agent.starting?.() ? A : b`<div class="empty" data-empty>${empty3(watch, seat, agent?.name ?? "the agent")}</div>`}
32116
32340
  </div>
32117
32341
  </div>
32118
32342
  ${this.dropping ? b`<swc-dropzone dragged size="l" aria-label="Attach files" dragged-message="Drop to attach"><p>Drop to attach</p></swc-dropzone>` : A}
@@ -32500,13 +32724,13 @@ var SliccFiles = class extends ModelElement {
32500
32724
  item2?.select();
32501
32725
  tree.reveal(path2, false);
32502
32726
  }
32503
- #busy(at, on) {
32727
+ #busy(at, on2) {
32504
32728
  if (at === void 0) {
32505
- this.mounting = on;
32729
+ this.mounting = on2;
32506
32730
  return;
32507
32731
  }
32508
32732
  const inserting = new Set(this.inserting);
32509
- if (on) inserting.add(at);
32733
+ if (on2) inserting.add(at);
32510
32734
  else inserting.delete(at);
32511
32735
  this.inserting = inserting;
32512
32736
  }
@@ -37907,18 +38131,22 @@ function openTerminal(dock, info, screen) {
37907
38131
  }
37908
38132
  return id;
37909
38133
  }
37910
- function defaultLayout(dock, screen, agent, items = surfaces2, terminals = []) {
38134
+ function openChatSlot(dock, item2, screen, agent, agentless) {
38135
+ if (agent) openChat(dock, agent, screen, false);
38136
+ else if (agentless) openSurface(dock, item2, screen, false);
38137
+ }
38138
+ function defaultLayout(dock, screen, agent, items = surfaces2, terminals = [], agentless = false) {
37911
38139
  dock.clear();
37912
38140
  const order = ["center", "left", "right"];
37913
38141
  for (const side of order) {
37914
38142
  for (const item2 of items) {
37915
38143
  if (item2.side !== side || !item2.open.includes(screen)) continue;
37916
38144
  if (item2.id === "terminal") for (const info of terminals) openTerminal(dock, info, screen);
37917
- else if (item2.id !== "chat") openSurface(dock, item2, screen);
37918
- else if (agent) openChat(dock, agent, screen, false);
38145
+ else if (item2.id === "chat") openChatSlot(dock, item2, screen, agent, agentless);
38146
+ else openSurface(dock, item2, screen);
37919
38147
  }
37920
38148
  }
37921
- const chat = chats(dock)[0];
38149
+ const chat = chats(dock)[0] ?? (dock.has("chat") ? "chat" : null);
37922
38150
  if (chat) dock.api.getPanel(chat)?.api.setActive();
37923
38151
  }
37924
38152
  function shown(dock, id) {
@@ -38645,22 +38873,7 @@ var SliccTerminalPanel = class extends ThemedElement {
38645
38873
  --slicc-terminal-font-size: var(--swc-font-size-100);
38646
38874
  }
38647
38875
  :host([color='light']) {
38648
- --slicc-terminal-color-0: var(--swc-gray-800);
38649
- --slicc-terminal-color-1: var(--swc-negative-color-900);
38650
- --slicc-terminal-color-2: var(--swc-positive-color-900);
38651
- --slicc-terminal-color-3: var(--swc-notice-color-1000);
38652
- --slicc-terminal-color-4: var(--swc-informative-color-900);
38653
- --slicc-terminal-color-5: var(--swc-purple-900);
38654
- --slicc-terminal-color-6: var(--swc-cyan-1000);
38655
- --slicc-terminal-color-7: var(--swc-gray-600);
38656
- --slicc-terminal-color-8: var(--swc-gray-700);
38657
- --slicc-terminal-color-9: var(--swc-negative-color-1000);
38658
- --slicc-terminal-color-10: var(--swc-positive-color-1000);
38659
- --slicc-terminal-color-11: var(--swc-notice-color-1100);
38660
- --slicc-terminal-color-12: var(--swc-informative-color-1000);
38661
- --slicc-terminal-color-13: var(--swc-purple-1000);
38662
- --slicc-terminal-color-14: var(--swc-cyan-1100);
38663
- --slicc-terminal-color-15: var(--swc-gray-800);
38876
+ ${terminalPalette}
38664
38877
  }
38665
38878
  `
38666
38879
  ];
@@ -42741,10 +42954,19 @@ var SliccApp = class extends ThemedElement {
42741
42954
  const saved = this.#saved();
42742
42955
  const restored = this.#offered(saved, dock.factories) && dock.restore(saved);
42743
42956
  if (!restored) {
42744
- defaultLayout(dock, this.screen, this.#active(), this.#available(), model.terminals.list());
42957
+ defaultLayout(
42958
+ dock,
42959
+ this.screen,
42960
+ this.#active(),
42961
+ this.#available(),
42962
+ model.terminals.list(),
42963
+ !!model.agent.starting?.()
42964
+ );
42745
42965
  }
42746
42966
  this.#started = this.screen;
42747
42967
  this.#prune();
42968
+ if (!(this.#active() || chats(dock).length || dock.has("chat")) && model.agent.starting?.())
42969
+ this.#open("chat", false);
42748
42970
  this.#saving = true;
42749
42971
  this.#save();
42750
42972
  }
@@ -42774,14 +42996,29 @@ var SliccApp = class extends ThemedElement {
42774
42996
  #prune() {
42775
42997
  const dock = this.renderRoot.querySelector("slicc-dock");
42776
42998
  if (!dock || !this.#started) return;
42777
- const known = new Set(this.model?.agent.list().map((agent) => agent.id));
42999
+ const known = new Set(this.model?.agent.list().map((agent2) => agent2.id));
43000
+ const agent = this.#active();
43001
+ const held = !!agent && !!dock.content("chat")?.shadowRoot?.activeElement;
42778
43002
  this.panels.quietly(() => {
42779
43003
  for (const id of chats(dock)) {
42780
43004
  if (!known.has(chatAgent(id))) dock.close(id);
42781
43005
  }
43006
+ if (agent && dock.has("chat")) {
43007
+ if (this.#offers("chat") && !dock.has(chatId(agent.id)))
43008
+ dock.open({
43009
+ id: chatId(agent.id),
43010
+ component: "chat",
43011
+ title: agent.name,
43012
+ params: { agent: agent.id },
43013
+ inactive: true,
43014
+ position: { referencePanel: "chat", direction: "within" }
43015
+ });
43016
+ dock.close("chat");
43017
+ }
42782
43018
  if (this.model && this.#offers("terminal"))
42783
43019
  this.terminalPanels.sync(dock, this.model.terminals, this.screen);
42784
43020
  });
43021
+ if (agent && held && this.#offers("chat")) openChat(dock, agent, this.screen, true);
42785
43022
  }
42786
43023
  #activated(event2) {
42787
43024
  const { id } = event2.detail;
@@ -42793,7 +43030,14 @@ var SliccApp = class extends ThemedElement {
42793
43030
  resetLayout() {
42794
43031
  const terminals = this.model?.terminals.list();
42795
43032
  this.panels.quietly(
42796
- () => defaultLayout(this.dock, this.screen, this.#active(), this.#available(), terminals)
43033
+ () => defaultLayout(
43034
+ this.dock,
43035
+ this.screen,
43036
+ this.#active(),
43037
+ this.#available(),
43038
+ terminals,
43039
+ !!this.model?.agent.starting?.()
43040
+ )
42797
43041
  );
42798
43042
  this.#save();
42799
43043
  }
@@ -43237,13 +43481,13 @@ function touched2(cwds, word, whole) {
43237
43481
  }
43238
43482
  return null;
43239
43483
  }
43240
- function ansi(command3) {
43241
- const escape2 = /\\(?:x([0-9a-fA-F]{1,2})|u([0-9a-fA-F]{1,4})|U([0-9a-fA-F]{1,8})|([0-7]{1,3})|([\s\S]))/g;
43484
+ function ansi2(command3) {
43485
+ const escape3 = /\\(?:x([0-9a-fA-F]{1,2})|u([0-9a-fA-F]{1,4})|U([0-9a-fA-F]{1,8})|([0-7]{1,3})|([\s\S]))/g;
43242
43486
  return command3.replace(
43243
43487
  /\$'((?:[^'\\]|\\[\s\S])*)'/g,
43244
- (_9, body4) => `'${body4.replace(escape2, (_match, hex, short2, long, octal, plain) => {
43488
+ (_9, body4) => `'${body4.replace(escape3, (_match, hex, short2, long, octal, plain2) => {
43245
43489
  if (octal) return String.fromCharCode(Number.parseInt(octal, 8));
43246
- if (plain) return plain;
43490
+ if (plain2) return plain2;
43247
43491
  return String.fromCodePoint(
43248
43492
  Math.min(Number.parseInt(hex ?? short2 ?? long, 16), 1114111)
43249
43493
  );
@@ -43339,10 +43583,10 @@ function reach2(command3, cwd) {
43339
43583
  const start2 = absolute("/", cwd ?? "/");
43340
43584
  if (protects(start2, false)) return start2;
43341
43585
  const cwds = /* @__PURE__ */ new Set([start2]);
43342
- const text5 = unglob(ansi(command3.replace(/\\\n/g, "")));
43343
- const plain = text5.split(separators).map((segment2) => commas(segment2.split(/[\s<>=]+/).map((word) => word.replace(/['"\\]/g, ""))));
43586
+ const text5 = unglob(ansi2(command3.replace(/\\\n/g, "")));
43587
+ const plain2 = text5.split(separators).map((segment2) => commas(segment2.split(/[\s<>=]+/).map((word) => word.replace(/['"\\]/g, ""))));
43344
43588
  const aware = shield(text5).split(separators).map((segment2) => commas(quoted(unshield(segment2))));
43345
- const segments = JSON.stringify(aware) === JSON.stringify(plain) ? plain : [...plain, ...aware];
43589
+ const segments = JSON.stringify(aware) === JSON.stringify(plain2) ? plain2 : [...plain2, ...aware];
43346
43590
  const whole = segments.some((words) => words.length > 0 && !trusted(words[0]));
43347
43591
  for (const words of segments) {
43348
43592
  const hit = scan2(words, cwds, whole);
@@ -43549,9 +43793,9 @@ var SliccApprovals = class extends ModelElement {
43549
43793
  clearTimeout(this.#arming);
43550
43794
  this.#showing = null;
43551
43795
  }
43552
- #tick(on) {
43553
- if (on && !this.#timer) this.#timer = setInterval(() => this.now = Date.now(), 1e3);
43554
- if (!on && this.#timer) {
43796
+ #tick(on2) {
43797
+ if (on2 && !this.#timer) this.#timer = setInterval(() => this.now = Date.now(), 1e3);
43798
+ if (!on2 && this.#timer) {
43555
43799
  clearInterval(this.#timer);
43556
43800
  this.#timer = null;
43557
43801
  }
@@ -44932,10 +45176,10 @@ var SliccBrowser = class extends ModelElement {
44932
45176
  }
44933
45177
  #detail(tabs, tab) {
44934
45178
  const narrow = this.#width < narrowWidth;
44935
- const wide = this.#width >= wideWidth;
45179
+ const wide2 = this.#width >= wideWidth;
44936
45180
  const copy = this.#copied === "url" ? "Copied" : this.#copied === "failed" ? "Couldn\u2019t copy" : "Copy";
44937
- return b`<div class=${`focused${wide ? " wide" : ""}${narrow ? " narrow" : ""}`}>
44938
- ${wide ? this.#list(tabs, tab) : A}
45181
+ return b`<div class=${`focused${wide2 ? " wide" : ""}${narrow ? " narrow" : ""}`}>
45182
+ ${wide2 ? this.#list(tabs, tab) : A}
44939
45183
  <section class="detail" aria-label=${tab.title}>
44940
45184
  <div class="bar">
44941
45185
  <swc-action-button size="s" quiet data-action="all-tabs" @click=${(event2) => {
@@ -44944,7 +45188,7 @@ var SliccBrowser = class extends ModelElement {
44944
45188
  () => this.focusWith({ focusVisible: event2.detail === 0 }, ".window")
44945
45189
  );
44946
45190
  }}><swc-icon-chevron-left slot="icon"></swc-icon-chevron-left>All tabs (${tabs.length})</swc-action-button>
44947
- ${wide ? A : this.#picker(tabs, tab)}
45191
+ ${wide2 ? A : this.#picker(tabs, tab)}
44948
45192
  </div>
44949
45193
  <div class="address">
44950
45194
  <span class="url" title=${tab.url}>${narrow ? place2(tab.url) : tab.url}</span>
@@ -46704,6 +46948,51 @@ var SliccVaultButton = class extends i2 {
46704
46948
 
46705
46949
  // src/app/composer.ts
46706
46950
  var limit = 25 * 1024 * 1024;
46951
+ var pages = /* @__PURE__ */ new WeakMap();
46952
+ function owner(node2) {
46953
+ let at = node2;
46954
+ while (at) {
46955
+ if (at instanceof Element && at.localName === "slicc-app") return at;
46956
+ at = at.parentNode ?? (at instanceof ShadowRoot ? at.host : null);
46957
+ }
46958
+ return node2.ownerDocument;
46959
+ }
46960
+ var PageQueue = class {
46961
+ #host;
46962
+ #owner = null;
46963
+ constructor(host4) {
46964
+ this.#host = host4;
46965
+ host4.addController(this);
46966
+ }
46967
+ #page() {
46968
+ this.#owner ??= this.#host.isConnected ? owner(this.#host) : null;
46969
+ const page = this.#owner ?? this.#host.ownerDocument;
46970
+ const found = pages.get(page) ?? { rows: [], draft: null, hosts: /* @__PURE__ */ new Set() };
46971
+ pages.set(page, found);
46972
+ return found;
46973
+ }
46974
+ get value() {
46975
+ return this.#page().rows;
46976
+ }
46977
+ set value(rows2) {
46978
+ const page = this.#page();
46979
+ page.rows = rows2;
46980
+ for (const host4 of [...page.hosts]) host4.requestUpdate();
46981
+ }
46982
+ get draft() {
46983
+ return this.#page().draft;
46984
+ }
46985
+ set draft(draft2) {
46986
+ this.#page().draft = draft2;
46987
+ }
46988
+ hostConnected() {
46989
+ this.#owner = owner(this.#host);
46990
+ this.#page().hosts.add(this.#host);
46991
+ }
46992
+ hostDisconnected() {
46993
+ this.#page().hosts.delete(this.#host);
46994
+ }
46995
+ };
46707
46996
  function available(model) {
46708
46997
  return commands2.filter((command3) => command3.available?.(model) ?? true);
46709
46998
  }
@@ -46844,6 +47133,7 @@ var SliccComposer = class extends ThemedElement {
46844
47133
  agent: {}
46845
47134
  };
46846
47135
  #drafts = /* @__PURE__ */ new Map();
47136
+ #waiting = new PageQueue(this);
46847
47137
  #history = -1;
46848
47138
  #paths = [];
46849
47139
  #agent = "";
@@ -46932,6 +47222,7 @@ var SliccComposer = class extends ThemedElement {
46932
47222
  margin: 0 0 var(--swc-spacing-100);
46933
47223
  padding: 0;
46934
47224
  display: grid;
47225
+ grid-template-columns: minmax(0, 1fr);
46935
47226
  gap: var(--swc-spacing-75);
46936
47227
  }
46937
47228
  .queued {
@@ -46976,7 +47267,8 @@ var SliccComposer = class extends ThemedElement {
46976
47267
  .hold .held {
46977
47268
  color: var(--swc-neutral-subdued-content-color-default);
46978
47269
  }
46979
- .queued swc-icon-clock {
47270
+ .queued swc-icon-clock,
47271
+ .queued > swc-icon-file {
46980
47272
  flex: none;
46981
47273
  color: var(--swc-neutral-subdued-content-color-default);
46982
47274
  }
@@ -46985,6 +47277,11 @@ var SliccComposer = class extends ThemedElement {
46985
47277
  font-size: var(--swc-font-size-75);
46986
47278
  color: var(--swc-neutral-subdued-content-color-default);
46987
47279
  }
47280
+ .queued [data-files] {
47281
+ display: inline-flex;
47282
+ align-items: center;
47283
+ gap: var(--swc-spacing-50);
47284
+ }
46988
47285
  .queued .text {
46989
47286
  flex: 1;
46990
47287
  min-width: 0;
@@ -47140,6 +47437,9 @@ var SliccComposer = class extends ThemedElement {
47140
47437
  if (changed.has("agent") && this.agent && this.model && this.agent !== this.#agent) {
47141
47438
  this.#switch(this.agent);
47142
47439
  }
47440
+ const edited = changed.has("value") || changed.has("attachments");
47441
+ if (edited && this.hasUpdated && !this.#agent && this.#starting())
47442
+ this.#waiting.draft = { value: this.value, attachments: this.attachments };
47143
47443
  }
47144
47444
  connectedCallback() {
47145
47445
  super.connectedCallback();
@@ -47156,8 +47456,9 @@ var SliccComposer = class extends ThemedElement {
47156
47456
  globalThis.removeEventListener("keyup", this.#release);
47157
47457
  globalThis.removeEventListener("blur", this.#release);
47158
47458
  clearValues(this.renderRoot);
47459
+ const kept3 = this.#waiting.draft?.attachments;
47159
47460
  const held = [
47160
- this.attachments,
47461
+ this.attachments === kept3 ? [] : this.attachments,
47161
47462
  ...[...this.#drafts.values()].map((draft2) => draft2.attachments)
47162
47463
  ];
47163
47464
  if (held.flat().some((attachment2) => attachment2.url?.startsWith("blob:")))
@@ -47190,6 +47491,7 @@ var SliccComposer = class extends ThemedElement {
47190
47491
  this.#paths = entries.filter((entry) => entry.kind === "file").map((entry) => entry.path);
47191
47492
  });
47192
47493
  const update = () => this.requestUpdate();
47494
+ queueMicrotask(() => this.#arrived());
47193
47495
  return [
47194
47496
  ...super.subscribe(model),
47195
47497
  model.agent.on("active", (id) => {
@@ -47199,7 +47501,18 @@ var SliccComposer = class extends ThemedElement {
47199
47501
  if (hold?.reason !== "locked") this.blocked = false;
47200
47502
  update();
47201
47503
  }),
47202
- model.agent.on("agents", update),
47504
+ model.agent.on("agents", () => {
47505
+ this.#arrived();
47506
+ update();
47507
+ }),
47508
+ ...model.agent.starting ? [
47509
+ model.agent.on("starting", () => {
47510
+ if (this.#starting() && this.popup?.kind !== "file" && this.popup?.kind !== "secret")
47511
+ this.popup = null;
47512
+ this.#arrived();
47513
+ update();
47514
+ })
47515
+ ] : [],
47203
47516
  model.agent.on("messages", update),
47204
47517
  model.agent.on("message", update),
47205
47518
  model.settings.on("settings", update),
@@ -47207,6 +47520,27 @@ var SliccComposer = class extends ThemedElement {
47207
47520
  ...model.vault ? [model.vault.on("availability", update), model.vault.on("status", update)] : []
47208
47521
  ];
47209
47522
  }
47523
+ #starting() {
47524
+ return this.model?.agent.starting?.() ?? null;
47525
+ }
47526
+ #arrived() {
47527
+ const model = this.model;
47528
+ const waiting3 = this.#waiting.value;
47529
+ const agents = model?.agent.list() ?? [];
47530
+ if (!(model && waiting3.length && agents.length) || this.#starting()) return;
47531
+ const active = model.agent.active();
47532
+ const id = agents.some((agent) => agent.id === active) ? active : agents[0].id;
47533
+ this.#waiting.value = [];
47534
+ const [first2, ...rest] = waiting3;
47535
+ this.#deliver(model, id, first2, "queue");
47536
+ for (const { text: text5, attachments } of rest)
47537
+ this.#post(model, id, { text: text5, attachments, mode: "queue" });
47538
+ }
47539
+ #unwait(id) {
47540
+ const waiting3 = this.#waiting.value;
47541
+ release(waiting3.find((message) => message.id === id)?.attachments ?? []);
47542
+ this.#waiting.value = waiting3.filter((message) => message.id !== id);
47543
+ }
47210
47544
  #held() {
47211
47545
  const state2 = this.model?.follow?.state();
47212
47546
  return state2?.link === "reconnecting" ? state2.owner : null;
@@ -47214,7 +47548,9 @@ var SliccComposer = class extends ThemedElement {
47214
47548
  #switch(id) {
47215
47549
  if (this.#agent)
47216
47550
  this.#drafts.set(this.#agent, { value: this.value, attachments: this.attachments });
47217
- const draft2 = this.#drafts.get(id);
47551
+ const shared2 = this.#agent || !this.isConnected ? null : this.#waiting.draft;
47552
+ if (shared2 && id && !this.#drafts.has(id)) this.#waiting.draft = null;
47553
+ const draft2 = this.#drafts.get(id) ?? shared2 ?? void 0;
47218
47554
  this.#agent = id;
47219
47555
  this.value = draft2?.value ?? "";
47220
47556
  this.attachments = draft2?.attachments ?? [];
@@ -47254,16 +47590,26 @@ var SliccComposer = class extends ThemedElement {
47254
47590
  this.attachments = [];
47255
47591
  this.popup = null;
47256
47592
  this.#history = -1;
47593
+ if (this.#starting()) {
47594
+ this.#waiting.value = [...this.#waiting.value, { id: this.#id(), text: text5, attachments }];
47595
+ return;
47596
+ }
47257
47597
  if (known) {
47258
47598
  release(attachments);
47259
47599
  known.run(model, this.#agent, (command3[2] ?? "").trim());
47260
47600
  return;
47261
47601
  }
47262
- const busy = this.#busy();
47602
+ this.#deliver(model, this.#agent, { text: text5, attachments }, mode2);
47603
+ }
47604
+ #deliver(model, id, message, mode2) {
47605
+ const busy = model.agent.busy(id);
47263
47606
  const resolved = mode2 === "queue" ? busy ? "queue" : "send" : busy || mode2 === "steer" ? "steer" : "send";
47264
- const id = this.#agent;
47607
+ this.#post(model, id, { text: message.text, attachments: message.attachments, mode: resolved });
47608
+ }
47609
+ #post(model, id, message) {
47610
+ const attachments = message.attachments ?? [];
47265
47611
  const done2 = () => retire(model.agent, id, attachments);
47266
- model.agent.send(id, { text: text5, attachments, mode: resolved }).then(done2, done2);
47612
+ model.agent.send(id, { ...message, attachments }).then(done2, done2);
47267
47613
  }
47268
47614
  #propose(model, text5) {
47269
47615
  this.value = "";
@@ -47443,6 +47789,10 @@ ${this.value}` : text5;
47443
47789
  #refresh() {
47444
47790
  const area = this.#textarea;
47445
47791
  if (!area || this.model?.seat) return;
47792
+ if (this.#starting()) {
47793
+ this.popup = null;
47794
+ return;
47795
+ }
47446
47796
  if (this.popup?.kind === "file" || this.popup?.kind === "secret") return;
47447
47797
  const found = trigger(this.value, area.selectionStart ?? this.value.length);
47448
47798
  const name = this.value.match(/^\/(\w+)/)?.[1];
@@ -47782,7 +48132,23 @@ ${this.value}` : text5;
47782
48132
  )}
47783
48133
  </ul>`;
47784
48134
  }
47785
- #waiting() {
48135
+ #starters() {
48136
+ const waiting3 = this.#waiting.value;
48137
+ if (waiting3.length === 0) return A;
48138
+ return b`<ul class="queue" aria-label="Waiting for the agent">
48139
+ ${waiting3.map(
48140
+ (message) => b`<li class="queued" data-id=${message.id} data-mode="starting">
48141
+ <swc-icon-clock size="s" aria-hidden="true"></swc-icon-clock>
48142
+ ${message.text ? A : b`<swc-icon-file size="xs" aria-hidden="true"></swc-icon-file>`}
48143
+ <span class="text"><span class="sr">Queued: </span>${message.text || message.attachments.map((attachment2) => attachment2.name).join(", ")}</span>
48144
+ ${message.text && message.attachments.length ? b`<span class="next" data-files><swc-icon-file size="xs" aria-hidden="true"></swc-icon-file><span class="sr">, </span>${message.attachments.length === 1 ? "1 file" : `${message.attachments.length} files`}</span>` : A}
48145
+ <span class="next">Sent when the agent starts</span>
48146
+ <swc-close-button size="s" data-action="unqueue" accessible-label="Remove from queue" @click=${() => this.#unwait(message.id)}></swc-close-button>
48147
+ </li>`
48148
+ )}
48149
+ </ul>`;
48150
+ }
48151
+ #review() {
47786
48152
  const queued = this.model?.agent.queue(this.#agent) ?? [];
47787
48153
  if (queued.length === 0) return A;
47788
48154
  return b`<ul class="queue" aria-label="Waiting for review">
@@ -47800,7 +48166,7 @@ ${this.value}` : text5;
47800
48166
  const cone = agent?.name ?? "the agent";
47801
48167
  return b`<div class="column">
47802
48168
  <span id="keys" class="sr" aria-hidden="true">${this.#instructions(false)}</span>
47803
- ${this.#waiting()}
48169
+ ${this.#review()}
47804
48170
  ${this.failure ? b`<p class="send-error" role="alert" data-send-error><swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle><span>${this.failure}</span></p>` : A}
47805
48171
  <swc-prompt-field
47806
48172
  label="Message"
@@ -47827,9 +48193,11 @@ ${this.value}` : text5;
47827
48193
  const pushToTalk = this.model?.settings.get().pushToTalk ?? false;
47828
48194
  const talk = !!speech();
47829
48195
  const held = this.#held();
48196
+ const starting = this.#starting();
47830
48197
  return b`<div class="column">
47831
48198
  <span id="keys" class="sr" aria-hidden="true">${this.#instructions(busy)}</span>
47832
48199
  ${this.#hold()}
48200
+ ${this.#starters()}
47833
48201
  ${this.#queue()}
47834
48202
  ${this.#popup()}
47835
48203
  <swc-prompt-field
@@ -47841,7 +48209,7 @@ ${this.value}` : text5;
47841
48209
  max-rows="10"
47842
48210
  ?generating=${busy && !canSend}
47843
48211
  ?disabled=${!!held}
47844
- placeholder=${held ? `Reconnecting to ${held}\u2026` : suggestion ? `${suggestion} (Tab)` : `Message ${agent?.name ?? ""}`}
48212
+ placeholder=${held ? `Reconnecting to ${held}\u2026` : starting ? starting : suggestion ? `${suggestion} (Tab)` : `Message ${agent?.name ?? ""}`}
47845
48213
  .value=${l(this.value)}
47846
48214
  @keydown=${this.#keys}
47847
48215
  @swc-prompt-field-input=${this.#input}
@@ -47887,7 +48255,7 @@ function load() {
47887
48255
  function pascal(name) {
47888
48256
  return name.replace(/(^|-)([a-z0-9])/g, (_9, _dash, char) => char.toUpperCase());
47889
48257
  }
47890
- var escape = (value) => String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
48258
+ var escape2 = (value) => String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
47891
48259
  function svg(name, node2) {
47892
48260
  const attributes = {
47893
48261
  xmlns: "http://www.w3.org/2000/svg",
@@ -47901,7 +48269,7 @@ function svg(name, node2) {
47901
48269
  "stroke-linejoin": "round",
47902
48270
  class: `lucide lucide-${name}`
47903
48271
  };
47904
- const attrs = (entries) => Object.entries(entries).map(([key2, value]) => ` ${key2}="${escape(value)}"`).join("");
48272
+ const attrs = (entries) => Object.entries(entries).map(([key2, value]) => ` ${key2}="${escape2(value)}"`).join("");
47905
48273
  const children = node2.map(([tag3, child]) => `<${tag3}${attrs(child)}/>`).join("");
47906
48274
  return `<svg${attrs(attributes)}>${children}</svg>`;
47907
48275
  }
@@ -48542,17 +48910,17 @@ function byName(a23, b13) {
48542
48910
  return a23.name < b13.name ? -1 : a23.name > b13.name ? 1 : 0;
48543
48911
  }
48544
48912
  function sourceLine(secret, devices) {
48545
- const on = secret.sourceDevice ? ` on ${deviceName2(secret.sourceDevice, devices)}` : "";
48913
+ const on2 = secret.sourceDevice ? ` on ${deviceName2(secret.sourceDevice, devices)}` : "";
48546
48914
  const [kind, detail = ""] = secret.source.split(/:(.*)/s);
48547
- if (kind === "settings") return `Entered in SLICC${on}`;
48548
- if (kind === "popup") return `Entered in the vault${on}`;
48549
- if (kind === "process") return `Saved by a program${on}`;
48915
+ if (kind === "settings") return `Entered in SLICC${on2}`;
48916
+ if (kind === "popup") return `Entered in the vault${on2}`;
48917
+ if (kind === "process") return `Saved by a program${on2}`;
48550
48918
  if (kind === "import") return `Imported from ${detail}`;
48551
48919
  if (kind === "oauth") {
48552
48920
  const as = secret.account ? ` as ${secret.account}` : "";
48553
48921
  return `Signed in to ${secret.provider ?? detail}${as}`;
48554
48922
  }
48555
- return `A jerk lease for ${detail.split("@")[0]}${on}`;
48923
+ return `A jerk lease for ${detail.split("@")[0]}${on2}`;
48556
48924
  }
48557
48925
  function startOfDay(now) {
48558
48926
  const date = new Date(now);
@@ -48620,9 +48988,9 @@ function auditLine(entry, devices, named2) {
48620
48988
  return b`<code>${entry.file}</code> ${entry.accepted ? "changed" : "changed and was refused"}${changes(entry, devices).map(([kind, line]) => b`<span class="change" data-change=${kind}>${line}</span>`)}${entry.warning ? b`<span class="warning" data-warning>${entry.warning}</span>` : A}${entry.accepted ? b`<span class="hint" data-hint>If you didn’t mean this, change the file back with sudo.</span>` : A}`;
48621
48989
  }
48622
48990
  }
48623
- function merged(...pages) {
48991
+ function merged(...pages2) {
48624
48992
  const bySeq = /* @__PURE__ */ new Map();
48625
- for (const page of pages) for (const entry of page) bySeq.set(entry.seq, entry);
48993
+ for (const page of pages2) for (const entry of page) bySeq.set(entry.seq, entry);
48626
48994
  return [...bySeq.values()].sort((a23, b13) => b13.seq - a23.seq);
48627
48995
  }
48628
48996
  function replaceable(secret) {
@@ -49281,9 +49649,9 @@ var SliccSecrets = class extends ThemedElement {
49281
49649
  }
49282
49650
  }
49283
49651
  #pick(name, event2) {
49284
- const on = event2.currentTarget.checked;
49652
+ const on2 = event2.currentTarget.checked;
49285
49653
  this.picked = new Set(
49286
- on ? [...this.picked, name] : [...this.picked].filter((item2) => item2 !== name)
49654
+ on2 ? [...this.picked, name] : [...this.picked].filter((item2) => item2 !== name)
49287
49655
  );
49288
49656
  }
49289
49657
  async exportAll(vault, trigger2 = null) {
@@ -50157,9 +50525,9 @@ var SliccSettings = class extends ThemedElement {
50157
50525
  return event2.target.checked;
50158
50526
  }
50159
50527
  #cancelled = /* @__PURE__ */ new Set();
50160
- #busy(id, on) {
50528
+ #busy(id, on2) {
50161
50529
  const rest = [...this.pending].filter((candidate) => candidate !== id);
50162
- this.pending = new Set(on ? [...rest, id] : rest);
50530
+ this.pending = new Set(on2 ? [...rest, id] : rest);
50163
50531
  }
50164
50532
  async connect(id, secret, fields) {
50165
50533
  this.#busy(id, true);
@@ -51431,10 +51799,10 @@ var SliccSprinkle = class extends ThemedElement {
51431
51799
  }
51432
51800
  #seen = /* @__PURE__ */ new Set();
51433
51801
  #frozen() {
51434
- const owner = this.#data?.agentId;
51802
+ const owner2 = this.#data?.agentId;
51435
51803
  const port = this.model?.agent;
51436
- if (!port || !owner) return false;
51437
- const id = plainId(owner);
51804
+ if (!port || !owner2) return false;
51805
+ const id = plainId(owner2);
51438
51806
  const agents = port.list();
51439
51807
  const live = agents.find((agent) => plainId(agent.id) === id);
51440
51808
  if (live) {
@@ -51853,9 +52221,9 @@ var SliccValueRequest = class extends ThemedElement {
51853
52221
  #current(queue) {
51854
52222
  return queue.find(({ id }) => id === this.#front) ?? queue.find(({ id }) => !this.#later.has(id)) ?? null;
51855
52223
  }
51856
- #tick(on) {
51857
- if (on && !this.#timer) this.#timer = setInterval(() => this.now = Date.now(), 1e3);
51858
- if (!on && this.#timer) {
52224
+ #tick(on2) {
52225
+ if (on2 && !this.#timer) this.#timer = setInterval(() => this.now = Date.now(), 1e3);
52226
+ if (!on2 && this.#timer) {
51859
52227
  clearInterval(this.#timer);
51860
52228
  this.#timer = null;
51861
52229
  }
@@ -60905,7 +61273,7 @@ function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
60905
61273
  if (colorTable) return colorTable;
60906
61274
  colorTable = [];
60907
61275
  for (let i26 = 0; i26 < namedColors.length; i26++) colorTable.push(namedColor(namedColors[i26]));
60908
- let levels = [
61276
+ let levels2 = [
60909
61277
  0,
60910
61278
  95,
60911
61279
  135,
@@ -60914,9 +61282,9 @@ function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
60914
61282
  255
60915
61283
  ];
60916
61284
  for (let r40 = 0; r40 < 6; r40++) for (let g7 = 0; g7 < 6; g7++) for (let b13 = 0; b13 < 6; b13++) colorTable.push(rgbColor([
60917
- levels[r40],
60918
- levels[g7],
60919
- levels[b13]
61285
+ levels2[r40],
61286
+ levels2[g7],
61287
+ levels2[b13]
60920
61288
  ]));
60921
61289
  let level = 8;
60922
61290
  for (let i26 = 0; i26 < 24; i26++, level += 10) colorTable.push(rgbColor([
@@ -63246,9 +63614,9 @@ var FirstPassVisitor = {
63246
63614
  },
63247
63615
  exit({ node: node2 }, { flagDirectivesByAlt }) {
63248
63616
  if (flagDirectivesByAlt.get(node2)?.length) {
63249
- const flags = getCombinedFlagModsFromFlagNodes(flagDirectivesByAlt.get(node2));
63250
- if (flags) {
63251
- const flagGroup = A8({ flags });
63617
+ const flags2 = getCombinedFlagModsFromFlagNodes(flagDirectivesByAlt.get(node2));
63618
+ if (flags2) {
63619
+ const flagGroup = A8({ flags: flags2 });
63252
63620
  flagGroup.body[0].body = node2.body;
63253
63621
  node2.body = [setParentDeep(flagGroup, node2)];
63254
63622
  }
@@ -63384,12 +63752,12 @@ var FirstPassVisitor = {
63384
63752
  }
63385
63753
  },
63386
63754
  Directive({ node: node2, parent, root: root2, remove: remove2, replaceWith, removeAllPrevSiblings, removeAllNextSiblings }) {
63387
- const { kind, flags } = node2;
63755
+ const { kind, flags: flags2 } = node2;
63388
63756
  if (kind === "flags") {
63389
- if (!flags.enable && !flags.disable) {
63757
+ if (!flags2.enable && !flags2.disable) {
63390
63758
  remove2();
63391
63759
  } else {
63392
- const flagGroup = A8({ flags });
63760
+ const flagGroup = A8({ flags: flags2 });
63393
63761
  flagGroup.body[0].body = removeAllNextSiblings();
63394
63762
  replaceWith(setParentDeep(flagGroup, parent), { traverse: true });
63395
63763
  }
@@ -63769,13 +64137,13 @@ function getAndStoreJsGroupName(name, map) {
63769
64137
  function getCombinedFlagModsFromFlagNodes(flagNodes) {
63770
64138
  const flagProps = ["dotAll", "ignoreCase"];
63771
64139
  const combinedFlags = { enable: {}, disable: {} };
63772
- flagNodes.forEach(({ flags }) => {
64140
+ flagNodes.forEach(({ flags: flags2 }) => {
63773
64141
  flagProps.forEach((prop) => {
63774
- if (flags.enable?.[prop]) {
64142
+ if (flags2.enable?.[prop]) {
63775
64143
  delete combinedFlags.disable[prop];
63776
64144
  combinedFlags.enable[prop] = true;
63777
64145
  }
63778
- if (flags.disable?.[prop]) {
64146
+ if (flags2.disable?.[prop]) {
63779
64147
  combinedFlags.disable[prop] = true;
63780
64148
  }
63781
64149
  });
@@ -64162,8 +64530,8 @@ var generator = {
64162
64530
  const extraChars = /* @__PURE__ */ new Set();
64163
64531
  if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase) {
64164
64532
  const charsOutsideRange = getCasesOutsideCharClassRange(node2);
64165
- const ranges = getCodePointRangesFromChars(charsOutsideRange);
64166
- ranges.forEach((value) => {
64533
+ const ranges2 = getCodePointRangesFromChars(charsOutsideRange);
64534
+ ranges2.forEach((value) => {
64167
64535
  extraChars.add(
64168
64536
  Array.isArray(value) ? `${getCharEscape(value[0], escOpts)}-${getCharEscape(value[1], escOpts)}` : getCharEscape(value, escOpts)
64169
64537
  );
@@ -64211,14 +64579,14 @@ var generator = {
64211
64579
  /**
64212
64580
  @param {GroupNode} node
64213
64581
  */
64214
- Group({ atomic: atomic2, body: body4, flags, parent }, state2, gen) {
64582
+ Group({ atomic: atomic2, body: body4, flags: flags2, parent }, state2, gen) {
64215
64583
  const currentFlags = state2.currentFlags;
64216
- if (flags) {
64217
- state2.currentFlags = getNewCurrentFlags(currentFlags, flags);
64584
+ if (flags2) {
64585
+ state2.currentFlags = getNewCurrentFlags(currentFlags, flags2);
64218
64586
  }
64219
64587
  const contents = body4.map(gen).join("|");
64220
64588
  const result = !state2.verbose && body4.length === 1 && // Single alt
64221
- parent.type !== "Quantifier" && !atomic2 && (!state2.useFlagMods || !flags) ? contents : `(?${getGroupPrefix(atomic2, flags, state2.useFlagMods)}${contents})`;
64589
+ parent.type !== "Quantifier" && !atomic2 && (!state2.useFlagMods || !flags2) ? contents : `(?${getGroupPrefix(atomic2, flags2, state2.useFlagMods)}${contents})`;
64222
64590
  state2.currentFlags = currentFlags;
64223
64591
  return result;
64224
64592
  },
@@ -64466,14 +64834,14 @@ var EmulatedRegExp = class _EmulatedRegExp extends RegExp {
64466
64834
  @param {EmulatedRegExp} pattern
64467
64835
  @param {string} [flags]
64468
64836
  */
64469
- constructor(pattern2, flags, options2) {
64837
+ constructor(pattern2, flags2, options2) {
64470
64838
  const lazyCompile = !!options2?.lazyCompile;
64471
64839
  if (pattern2 instanceof RegExp) {
64472
64840
  if (options2) {
64473
64841
  throw new Error("Cannot provide options when copying a regexp");
64474
64842
  }
64475
64843
  const re3 = pattern2;
64476
- super(re3, flags);
64844
+ super(re3, flags2);
64477
64845
  this.#pattern = re3.source;
64478
64846
  if (re3 instanceof _EmulatedRegExp) {
64479
64847
  this.#captureMap = re3.#captureMap;
@@ -64488,7 +64856,7 @@ var EmulatedRegExp = class _EmulatedRegExp extends RegExp {
64488
64856
  transfers: [],
64489
64857
  ...options2
64490
64858
  };
64491
- super(lazyCompile ? "" : pattern2, flags);
64859
+ super(lazyCompile ? "" : pattern2, flags2);
64492
64860
  this.#pattern = pattern2;
64493
64861
  this.#captureMap = createCaptureMap(opts.hiddenCaptures, opts.transfers);
64494
64862
  this.#strategy = opts.strategy;
@@ -66811,17 +67179,17 @@ var ResizeManager = class ResizeManager2 {
66811
67179
  }
66812
67180
  observe(element3) {
66813
67181
  const { managersByElement } = ResizeManager2;
66814
- const owner = managersByElement.get(element3);
66815
- if (owner === this) return;
66816
- else if (owner != null && owner !== this) throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");
67182
+ const owner2 = managersByElement.get(element3);
67183
+ if (owner2 === this) return;
67184
+ else if (owner2 != null && owner2 !== this) throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");
66817
67185
  managersByElement.set(element3, this);
66818
67186
  ResizeManager2.getResizeObserver().observe(element3);
66819
67187
  }
66820
67188
  unobserve(element3) {
66821
67189
  const { managersByElement, resizeObserver } = ResizeManager2;
66822
- const owner = managersByElement.get(element3);
66823
- if (owner == null) return;
66824
- else if (owner !== this) throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");
67190
+ const owner2 = managersByElement.get(element3);
67191
+ if (owner2 == null) return;
67192
+ else if (owner2 !== this) throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");
66825
67193
  managersByElement.delete(element3);
66826
67194
  resizeObserver?.unobserve(element3);
66827
67195
  if (resizeObserver != null && managersByElement.size === 0) {
@@ -67783,8 +68151,8 @@ function relativeLuminance(color2) {
67783
68151
  const r40 = rgba[0] / 255;
67784
68152
  const g7 = rgba[1] / 255;
67785
68153
  const b13 = rgba[2] / 255;
67786
- const channel = (v13) => v13 <= 0.03928 ? v13 / 12.92 : ((v13 + 0.055) / 1.055) ** 2.4;
67787
- return 0.2126 * channel(r40) + 0.7152 * channel(g7) + 0.0722 * channel(b13);
68154
+ const channel2 = (v13) => v13 <= 0.03928 ? v13 / 12.92 : ((v13 + 0.055) / 1.055) ** 2.4;
68155
+ return 0.2126 * channel2(r40) + 0.7152 * channel2(g7) + 0.0722 * channel2(b13);
67788
68156
  }
67789
68157
  function isFullyTransparent(color2) {
67790
68158
  if (color2 == null) return false;
@@ -72121,7 +72489,7 @@ function isAdditionLineRenderable({ fileDiff, lineNumber, expandedHunks, collaps
72121
72489
  }
72122
72490
  function getNearestRenderableAdditionLine({ fileDiff, lineNumber, direction, expandedHunks, collapsedContextThreshold }) {
72123
72491
  if (expandedHunks === true || fileDiff.isPartial) return lineNumber;
72124
- const ranges = [];
72492
+ const ranges2 = [];
72125
72493
  let modeledEnd = 1;
72126
72494
  for (const [hunkIndex, hunk] of fileDiff.hunks.entries()) {
72127
72495
  const [hunkStart, hunkEnd] = getHunkAdditionLineRange(hunk);
@@ -72133,12 +72501,12 @@ function getNearestRenderableAdditionLine({ fileDiff, lineNumber, direction, exp
72133
72501
  collapsedContextThreshold
72134
72502
  });
72135
72503
  const gapStart = hunkStart - region.rangeSize;
72136
- if (region.renderAll) ranges.push([gapStart, hunkStart]);
72504
+ if (region.renderAll) ranges2.push([gapStart, hunkStart]);
72137
72505
  else {
72138
- if (region.fromStart > 0) ranges.push([gapStart, gapStart + region.fromStart]);
72139
- if (region.fromEnd > 0) ranges.push([hunkStart - region.fromEnd, hunkStart]);
72506
+ if (region.fromStart > 0) ranges2.push([gapStart, gapStart + region.fromStart]);
72507
+ if (region.fromEnd > 0) ranges2.push([hunkStart - region.fromEnd, hunkStart]);
72140
72508
  }
72141
- ranges.push([hunkStart, hunkEnd]);
72509
+ ranges2.push([hunkStart, hunkEnd]);
72142
72510
  modeledEnd = hunkEnd;
72143
72511
  }
72144
72512
  const trailingRegion = getTrailingExpandedRegion({
@@ -72151,16 +72519,16 @@ function getNearestRenderableAdditionLine({ fileDiff, lineNumber, direction, exp
72151
72519
  if (trailingRegion != null) {
72152
72520
  const trailingStart = modeledEnd;
72153
72521
  modeledEnd = trailingStart + trailingRegion.rangeSize;
72154
- if (trailingRegion.renderAll) ranges.push([trailingStart, modeledEnd]);
72155
- else if (trailingRegion.fromStart > 0) ranges.push([trailingStart, trailingStart + trailingRegion.fromStart]);
72522
+ if (trailingRegion.renderAll) ranges2.push([trailingStart, modeledEnd]);
72523
+ else if (trailingRegion.fromStart > 0) ranges2.push([trailingStart, trailingStart + trailingRegion.fromStart]);
72156
72524
  }
72157
72525
  if (lineNumber >= modeledEnd) return lineNumber;
72158
72526
  if (direction === "down") {
72159
- for (const [start2, end] of ranges) if (end > lineNumber) return Math.max(start2, lineNumber);
72527
+ for (const [start2, end] of ranges2) if (end > lineNumber) return Math.max(start2, lineNumber);
72160
72528
  return;
72161
72529
  }
72162
- for (let index2 = ranges.length - 1; index2 >= 0; index2--) {
72163
- const [start2, end] = ranges[index2];
72530
+ for (let index2 = ranges2.length - 1; index2 >= 0; index2--) {
72531
+ const [start2, end] = ranges2[index2];
72164
72532
  if (start2 <= lineNumber) return Math.min(end - 1, lineNumber);
72165
72533
  }
72166
72534
  }
@@ -72522,19 +72890,19 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
72522
72890
  }
72523
72891
  function getContextLineIterationBounds(state2, count2, diffStyle) {
72524
72892
  if (!state2.isWindowedHighlight || count2 <= 0) return [0, count2];
72525
- const ranges = [];
72893
+ const ranges2 = [];
72526
72894
  function pushRange(currentCount) {
72527
72895
  const start3 = Math.max(0, state2.viewportStart - currentCount);
72528
72896
  const end2 = Math.min(count2, state2.viewportEnd - currentCount);
72529
- if (end2 > start3) ranges.push([start3, end2]);
72897
+ if (end2 > start3) ranges2.push([start3, end2]);
72530
72898
  }
72531
72899
  if (diffStyle !== "split") pushRange(state2.unifiedCount);
72532
72900
  if (diffStyle !== "unified") pushRange(state2.splitCount);
72533
- if (ranges.length === 0) return [0, 0];
72534
- let start2 = ranges[0][0];
72535
- let end = ranges[0][1];
72536
- for (let index2 = 1; index2 < ranges.length; index2++) {
72537
- const range3 = ranges[index2];
72901
+ if (ranges2.length === 0) return [0, 0];
72902
+ let start2 = ranges2[0][0];
72903
+ let end = ranges2[0][1];
72904
+ for (let index2 = 1; index2 < ranges2.length; index2++) {
72905
+ const range3 = ranges2[index2];
72538
72906
  start2 = Math.min(start2, range3[0]);
72539
72907
  end = Math.max(end, range3[1]);
72540
72908
  }
@@ -89487,15 +89855,15 @@ function buildColorPicker(tabGroup, palette) {
89487
89855
  wrapper.className = "dv-context-menu-color-picker";
89488
89856
  if (!palette.enabled) return wrapper;
89489
89857
  for (const entry of palette.entries()) {
89490
- const swatch = document.createElement("div");
89491
- swatch.className = "dv-context-menu-color-swatch";
89492
- swatch.style.setProperty("--dv-tab-group-color", entry.value);
89493
- if (entry.label) swatch.title = entry.label;
89494
- if (tabGroup.color === entry.id) swatch.classList.add("dv-context-menu-color-swatch--selected");
89495
- swatch.addEventListener("click", () => {
89858
+ const swatch2 = document.createElement("div");
89859
+ swatch2.className = "dv-context-menu-color-swatch";
89860
+ swatch2.style.setProperty("--dv-tab-group-color", entry.value);
89861
+ if (entry.label) swatch2.title = entry.label;
89862
+ if (tabGroup.color === entry.id) swatch2.classList.add("dv-context-menu-color-swatch--selected");
89863
+ swatch2.addEventListener("click", () => {
89496
89864
  tabGroup.setColor(entry.id);
89497
89865
  });
89498
- wrapper.appendChild(swatch);
89866
+ wrapper.appendChild(swatch2);
89499
89867
  }
89500
89868
  return wrapper;
89501
89869
  }
@@ -90018,7 +90386,7 @@ function createDismissableLayer(options2) {
90018
90386
  var _options$window, _options$capture, _options$escape, _options$keys, _options$outsidePoint, _options$pointerDownG, _options$now;
90019
90387
  const win = (_options$window = options2.window) !== null && _options$window !== void 0 ? _options$window : window;
90020
90388
  const capture = (_options$capture = options2.capture) !== null && _options$capture !== void 0 ? _options$capture : false;
90021
- const escape2 = (_options$escape = options2.escape) !== null && _options$escape !== void 0 ? _options$escape : true;
90389
+ const escape3 = (_options$escape = options2.escape) !== null && _options$escape !== void 0 ? _options$escape : true;
90022
90390
  const keys = (_options$keys = options2.keys) !== null && _options$keys !== void 0 ? _options$keys : [];
90023
90391
  const outside2 = (_options$outsidePoint = options2.outsidePointerDown) !== null && _options$outsidePoint !== void 0 ? _options$outsidePoint : true;
90024
90392
  const grace = (_options$pointerDownG = options2.pointerDownGraceMs) !== null && _options$pointerDownG !== void 0 ? _options$pointerDownG : 0;
@@ -90030,8 +90398,8 @@ function createDismissableLayer(options2) {
90030
90398
  if (options2.isInside) return options2.isInside(event2);
90031
90399
  return isEventWithin(event2, (_options$elements = (_options$elements2 = options2.elements) === null || _options$elements2 === void 0 ? void 0 : _options$elements2.call(options2)) !== null && _options$elements !== void 0 ? _options$elements : []);
90032
90400
  };
90033
- if (escape2 || keys.length > 0) disposables.addDisposables(addDisposableListener(win, "keydown", (event2) => {
90034
- if (escape2 && event2.key === "Escape" || keys.includes(event2.key)) options2.onDismiss();
90401
+ if (escape3 || keys.length > 0) disposables.addDisposables(addDisposableListener(win, "keydown", (event2) => {
90402
+ if (escape3 && event2.key === "Escape" || keys.includes(event2.key)) options2.onDismiss();
90035
90403
  }, capture));
90036
90404
  if (outside2 || options2.onInsidePointerDown) disposables.addDisposables(addDisposableListener(win, "pointerdown", (event2) => {
90037
90405
  if (isInside(event2)) {