@kukeon/console 0.10.0-edge.gaa95c2af → 0.10.0-edge.gbb89703f

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.
@@ -2,14 +2,14 @@ import { $ as e, B as t, Bt as n, Gn as r, Kn as i, L as a, T as o, Un as s, Wn
2
2
  import { A as m, C as h, E as g, L as _, P as v, T as y, _ as b, g as x, w as S, x as C, y as w } from "./onboarding-oZBJXTy0.js";
3
3
  import { t as T } from "./initialize-CAOkMhlL.js";
4
4
  import { createContext as E, useCallback as D, useContext as ee, useEffect as O, useId as k, useMemo as A, useRef as j, useState as M, useSyncExternalStore as N } from "react";
5
- import { apiFetch as P, apiSocket as F, onUnauthorized as I } from "@kukeon/api-client";
6
- import { Fragment as te, jsx as L, jsxs as R } from "react/jsx-runtime";
7
- import { DriftBadge as z, Icon as B, RollupDot as V, ScopePath as H, StateBadge as U, rememberFocus as W, stateTone as G, useModalDialog as K } from "@kukeon/ui";
8
- import { createPortal as ne } from "react-dom";
9
- import { Terminal as q } from "@xterm/xterm";
10
- import { FitAddon as J } from "@xterm/addon-fit";
5
+ import { apiFetch as P, apiSocket as te, onUnauthorized as F } from "@kukeon/api-client";
6
+ import { Fragment as ne, jsx as I, jsxs as L } from "react/jsx-runtime";
7
+ import { DriftBadge as R, Icon as z, RollupDot as B, ScopePath as V, StateBadge as H, rememberFocus as re, stateTone as U, useModalDialog as W } from "@kukeon/ui";
8
+ import { createPortal as ie } from "react-dom";
9
+ import { Terminal as G } from "@xterm/xterm";
10
+ import { FitAddon as K } from "@xterm/addon-fit";
11
11
  // src/cgroup-format.js
12
- var re = "Unlimited", Y = "Not available (controller not enabled)", ie = "Unreadable", ae = "Not set", oe = 1024, X = [
12
+ var q = "Unlimited", J = "Not available (controller not enabled)", ae = "Unreadable", Y = "Not set", X = 1024, oe = [
13
13
  "B",
14
14
  "KiB",
15
15
  "MiB",
@@ -18,15 +18,15 @@ var re = "Unlimited", Y = "Not available (controller not enabled)", ie = "Unread
18
18
  ];
19
19
  function Z(e) {
20
20
  let t = e, n = 0;
21
- for (; Math.abs(t) >= oe && n < X.length - 1;) t /= oe, n++;
22
- return n === 0 ? `${t} B` : `${Number(t.toFixed(t >= 100 ? 0 : t >= 10 ? 1 : 2))} ${X[n]}`;
21
+ for (; Math.abs(t) >= X && n < oe.length - 1;) t /= X, n++;
22
+ return n === 0 ? `${t} B` : `${Number(t.toFixed(t >= 100 ? 0 : t >= 10 ? 1 : 2))} ${oe[n]}`;
23
23
  }
24
24
  function se(e) {
25
- if (!e || e.state === "absent") return Y;
26
- if (e.state === "unreadable") return ie;
27
- if (e.state === "max") return re;
25
+ if (!e || e.state === "absent") return J;
26
+ if (e.state === "unreadable") return ae;
27
+ if (e.state === "max") return q;
28
28
  }
29
- function Q(e, t = "count") {
29
+ function ce(e, t = "count") {
30
30
  let n = se(e);
31
31
  if (n) return {
32
32
  text: n,
@@ -51,7 +51,7 @@ function Q(e, t = "count") {
51
51
  raw: e.raw
52
52
  };
53
53
  }
54
- function ce(e) {
54
+ function Q(e) {
55
55
  let t = se(e);
56
56
  if (t) return {
57
57
  text: t,
@@ -72,7 +72,7 @@ function le(e) {
72
72
  }
73
73
  function ue(e) {
74
74
  let t = se(e);
75
- return t ? [t] : e.entries?.length ? e.entries.map((e) => `${e.device} ${Object.entries(e.limits ?? {}).map(([e, t]) => `${e}=${t === "max" ? re : t}`).join(" ")}`) : ["No device limits"];
75
+ return t ? [t] : e.entries?.length ? e.entries.map((e) => `${e.device} ${Object.entries(e.limits ?? {}).map(([e, t]) => `${e}=${t === "max" ? q : t}`).join(" ")}`) : ["No device limits"];
76
76
  }
77
77
  var de = {
78
78
  container: "Container spec",
@@ -80,8 +80,8 @@ var de = {
80
80
  };
81
81
  function fe(e) {
82
82
  return !e || e.source === "unset" || typeof e.value != "number" ? {
83
- text: ae,
84
- source: ae
83
+ text: Y,
84
+ source: Y
85
85
  } : {
86
86
  text: e.field === "memoryLimitBytes" ? Z(e.value) : String(e.value),
87
87
  source: de[e.source] ?? e.source
@@ -89,7 +89,7 @@ function fe(e) {
89
89
  }
90
90
  function pe(e) {
91
91
  if (!e?.exists) return "Cgroup not present";
92
- let t = e.live?.memory, n = [e.ready ? "Ready" : "Not ready"], r = t?.current?.state === "set" ? Q(t.current, "bytes").text : "", i = ["set", "max"].includes(t?.max?.state) ? Q(t.max, "bytes").text : "";
92
+ let t = e.live?.memory, n = [e.ready ? "Ready" : "Not ready"], r = t?.current?.state === "set" ? ce(t.current, "bytes").text : "", i = ["set", "max"].includes(t?.max?.state) ? ce(t.max, "bytes").text : "";
93
93
  r ? n.push(`memory ${r}${i ? ` / ${i}` : ""}`) : i && n.push(`memory limit ${i}`);
94
94
  let a = e.live?.pids?.current;
95
95
  return a?.state === "set" && typeof a.value == "number" && n.push(`${a.value} ${a.value === 1 ? "PID" : "PIDs"}`), n.join(" · ");
@@ -199,10 +199,10 @@ function Fe(e, t) {
199
199
  }
200
200
  var Ie = (e, t) => t.length === 4 && e.every((e, n) => e === t[n]);
201
201
  function Le({ bytes: e, showBytes: t }) {
202
- return /* @__PURE__ */ R(te, { children: [/* @__PURE__ */ L("span", {
202
+ return /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I("span", {
203
203
  className: "unread-dot",
204
204
  "aria-hidden": "true"
205
- }), t && /* @__PURE__ */ L("span", {
205
+ }), t && /* @__PURE__ */ I("span", {
206
206
  className: "cell-unread-count",
207
207
  "aria-hidden": "true",
208
208
  children: ke(e)
@@ -212,7 +212,7 @@ function Re(e, t) {
212
212
  return e.reduce((e, n) => e + (t[JSON.stringify(n.scope)]?.unreadBytes ?? 0), 0);
213
213
  }
214
214
  function ze({ hidden: e }) {
215
- return e > 0 ? /* @__PURE__ */ R("a", {
215
+ return e > 0 ? /* @__PURE__ */ L("a", {
216
216
  className: "cell-stopped-link",
217
217
  href: t(3, [], "inactive"),
218
218
  children: ["Stopped · ", e]
@@ -220,31 +220,31 @@ function ze({ hidden: e }) {
220
220
  }
221
221
  function Be({ row: t, selectedScope: n, terminalStates: r, showScope: i, showTerminalStatus: a, labels: o, unread: s, showUnreadBytes: c }) {
222
222
  let l = t.scope.join(" / "), u = r[JSON.stringify(t.scope)], d = o.get(JSON.stringify(t.scope)), f = s[JSON.stringify(t.scope)]?.unreadBytes ?? 0;
223
- return /* @__PURE__ */ L("li", { children: /* @__PURE__ */ R("a", {
223
+ return /* @__PURE__ */ I("li", { children: /* @__PURE__ */ L("a", {
224
224
  className: `cell-link${f ? " has-unread" : ""}`,
225
225
  href: e(t.scope),
226
226
  "aria-current": Ie(t.scope, n) ? "page" : void 0,
227
227
  "aria-label": `Open ${d ? `${d} (${l})` : l}${Oe(f, c)}`,
228
228
  title: l,
229
229
  children: [
230
- /* @__PURE__ */ R("span", {
230
+ /* @__PURE__ */ L("span", {
231
231
  className: "cell-link-name",
232
- children: [d ?? t.doc.metadata.name, f > 0 && /* @__PURE__ */ L(Le, {
232
+ children: [d ?? t.doc.metadata.name, f > 0 && /* @__PURE__ */ I(Le, {
233
233
  bytes: f,
234
234
  showBytes: c
235
235
  })]
236
236
  }),
237
- d && /* @__PURE__ */ L("span", {
237
+ d && /* @__PURE__ */ I("span", {
238
238
  className: "cell-link-cell mono-id",
239
239
  children: t.doc.metadata.name
240
240
  }),
241
- i && /* @__PURE__ */ L("span", {
241
+ i && /* @__PURE__ */ I("span", {
242
242
  className: "cell-link-scope",
243
- children: /* @__PURE__ */ L(H, { parts: t.scope.slice(0, 3) })
243
+ children: /* @__PURE__ */ I(V, { parts: t.scope.slice(0, 3) })
244
244
  }),
245
- /* @__PURE__ */ L(U, { state: t.doc.status?.state }),
246
- /* @__PURE__ */ L(z, { status: t.doc.status }),
247
- a && u && /* @__PURE__ */ R("span", {
245
+ /* @__PURE__ */ I(H, { state: t.doc.status?.state }),
246
+ /* @__PURE__ */ I(R, { status: t.doc.status }),
247
+ a && u && /* @__PURE__ */ L("span", {
248
248
  className: `cell-terminal-state ${u}`,
249
249
  children: ["Terminal ", u]
250
250
  })
@@ -252,35 +252,35 @@ function Be({ row: t, selectedScope: n, terminalStates: r, showScope: i, showTer
252
252
  }) });
253
253
  }
254
254
  function Ve({ inventory: t, selectedScope: n, terminalStates: r, filter: i, listStyle: a = "default", showSearch: o = !0, showGroupBy: s = !0, showScope: c = !0, showTerminalStatus: l = !0, unread: u = {}, showUnreadBytes: d = !1 }) {
255
- let { search: f, setSearch: p, groupBy: _, setGroupBy: v } = i, C = a === "agent", [T, E] = M(Pe), [D, ee] = M({}), [O, k] = M(Me), j = t.data?.rows[3] ?? [], N = A(() => x(j, n), [j, n]), P = j.length - N.length, F = A(() => y(N, _), [N, _]), I = A(() => N.filter((e) => w(e, f)), [N, f]), U = A(() => S(I, _), [I, _]), W = t.data?.configs, G = A(() => b(N, W), [N, W]), { agents: K, others: ne } = A(() => h(G, (e) => w(e, f)), [G, f]), q = A(() => new Map(G.agents.map((e) => [e.id, e.rows.length])), [G]), J = A(() => C ? g(j, W) : /* @__PURE__ */ new Map(), [
255
+ let { search: f, setSearch: p, groupBy: _, setGroupBy: v } = i, C = a === "agent", [T, E] = M(Pe), [D, ee] = M({}), [O, k] = M(Me), j = t.data?.rows[3] ?? [], N = A(() => x(j, n), [j, n]), P = j.length - N.length, te = A(() => y(N, _), [N, _]), F = A(() => N.filter((e) => w(e, f)), [N, f]), H = A(() => S(F, _), [F, _]), re = t.data?.configs, U = A(() => b(N, re), [N, re]), { agents: W, others: ie } = A(() => h(U, (e) => w(e, f)), [U, f]), G = A(() => new Map(U.agents.map((e) => [e.id, e.rows.length])), [U]), K = A(() => C ? g(j, re) : /* @__PURE__ */ new Map(), [
256
256
  C,
257
257
  j,
258
- W
259
- ]), re = I.length && I.every((e) => e.scope.slice(0, 3).join(" / ") === I[0].scope.slice(0, 3).join(" / ")) ? I[0].scope.slice(0, 3).join(" / ") : "", Y = !!t.error || !!t.data?.failures.length, ie = {
258
+ re
259
+ ]), q = F.length && F.every((e) => e.scope.slice(0, 3).join(" / ") === F[0].scope.slice(0, 3).join(" / ")) ? F[0].scope.slice(0, 3).join(" / ") : "", J = !!t.error || !!t.data?.failures.length, ae = {
260
260
  selectedScope: n,
261
261
  terminalStates: r,
262
- showScope: c && !re,
262
+ showScope: c && !q,
263
263
  showTerminalStatus: l,
264
- labels: J,
264
+ labels: K,
265
265
  unread: u,
266
266
  showUnreadBytes: d
267
- }, ae = s && !C;
268
- function oe() {
267
+ }, Y = s && !C;
268
+ function X() {
269
269
  ee({}), k(Me);
270
270
  }
271
- function X(e) {
271
+ function oe(e) {
272
272
  let t = T.includes(e) ? T.filter((t) => t !== e) : [...T, e];
273
273
  E(t), Fe(Ae, JSON.stringify(t));
274
274
  }
275
275
  function Z(e, t, n) {
276
276
  let r = D[e] ?? je;
277
- return /* @__PURE__ */ R(te, { children: [/* @__PURE__ */ L("ul", {
277
+ return /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I("ul", {
278
278
  className: n,
279
- children: t.slice(0, r).map((e) => /* @__PURE__ */ L(Be, {
279
+ children: t.slice(0, r).map((e) => /* @__PURE__ */ I(Be, {
280
280
  row: e,
281
- ...ie
281
+ ...ae
282
282
  }, JSON.stringify(e.scope)))
283
- }), t.length > r && /* @__PURE__ */ R("button", {
283
+ }), t.length > r && /* @__PURE__ */ L("button", {
284
284
  className: "cell-more",
285
285
  onClick: () => ee((t) => ({
286
286
  ...t,
@@ -293,124 +293,124 @@ function Ve({ inventory: t, selectedScope: n, terminalStates: r, filter: i, list
293
293
  ]
294
294
  })] });
295
295
  }
296
- let se = [...K.map((e) => ({
296
+ let se = [...W.map((e) => ({
297
297
  id: e.id,
298
298
  agent: e
299
- })), ...ne.length ? [{
299
+ })), ...ie.length ? [{
300
300
  id: Ne,
301
301
  agent: void 0
302
- }] : []], Q = se.slice(0, O), ce = C ? se.length : U.length;
303
- return /* @__PURE__ */ R("section", {
302
+ }] : []], ce = se.slice(0, O), Q = C ? se.length : H.length;
303
+ return /* @__PURE__ */ L("section", {
304
304
  className: "cell-navigation",
305
305
  "aria-label": "All cells",
306
306
  children: [
307
- /* @__PURE__ */ R("div", {
307
+ /* @__PURE__ */ L("div", {
308
308
  className: "cell-navigation-heading",
309
- children: [/* @__PURE__ */ L("h2", { children: "Cells" }), /* @__PURE__ */ L("span", { children: N.length })]
309
+ children: [/* @__PURE__ */ I("h2", { children: "Cells" }), /* @__PURE__ */ I("span", { children: N.length })]
310
310
  }),
311
- (o || ae) && /* @__PURE__ */ R("div", {
311
+ (o || Y) && /* @__PURE__ */ L("div", {
312
312
  className: "cell-navigation-controls",
313
- children: [o && /* @__PURE__ */ R("label", { children: ["Search cells", /* @__PURE__ */ L("input", {
313
+ children: [o && /* @__PURE__ */ L("label", { children: ["Search cells", /* @__PURE__ */ I("input", {
314
314
  type: "search",
315
315
  value: f,
316
316
  placeholder: "Name or scope",
317
317
  onChange: (e) => {
318
- p(e.target.value), oe();
318
+ p(e.target.value), X();
319
319
  }
320
- })] }), ae && /* @__PURE__ */ R("label", { children: ["Group by", /* @__PURE__ */ R("select", {
320
+ })] }), Y && /* @__PURE__ */ L("label", { children: ["Group by", /* @__PURE__ */ L("select", {
321
321
  value: _,
322
322
  onChange: (e) => {
323
- v(e.target.value), oe();
323
+ v(e.target.value), X();
324
324
  },
325
325
  children: [
326
- /* @__PURE__ */ L("option", {
326
+ /* @__PURE__ */ I("option", {
327
327
  value: "",
328
328
  children: "None"
329
329
  }),
330
- F.map((e) => /* @__PURE__ */ L("option", {
330
+ te.map((e) => /* @__PURE__ */ I("option", {
331
331
  value: e,
332
332
  children: e
333
333
  }, e)),
334
- _ && !F.includes(_) && /* @__PURE__ */ R("option", {
334
+ _ && !te.includes(_) && /* @__PURE__ */ L("option", {
335
335
  value: _,
336
336
  children: [_, " (not in current inventory)"]
337
337
  })
338
338
  ]
339
339
  })] })]
340
340
  }),
341
- /* @__PURE__ */ R("div", {
341
+ /* @__PURE__ */ L("div", {
342
342
  className: "cell-navigation-results",
343
343
  "aria-live": "polite",
344
344
  children: [
345
- t.loading && !t.data && /* @__PURE__ */ L("p", {
345
+ t.loading && !t.data && /* @__PURE__ */ I("p", {
346
346
  role: "status",
347
347
  children: "Loading cells…"
348
348
  }),
349
- Y && /* @__PURE__ */ L("p", {
349
+ J && /* @__PURE__ */ I("p", {
350
350
  className: "cell-inventory-warning",
351
351
  children: t.data ? "Inventory incomplete or stale. Refresh to retry." : "Cells unavailable. Refresh to retry."
352
352
  }),
353
- !t.loading && !Y && !N.length && /* @__PURE__ */ L("p", { children: P ? "No active cells." : "No cells found." }),
354
- !!N.length && !I.length && /* @__PURE__ */ L("p", { children: "No matching cells." }),
355
- !!I.length && /* @__PURE__ */ R("p", {
353
+ !t.loading && !J && !N.length && /* @__PURE__ */ I("p", { children: P ? "No active cells." : "No cells found." }),
354
+ !!N.length && !F.length && /* @__PURE__ */ I("p", { children: "No matching cells." }),
355
+ !!F.length && /* @__PURE__ */ L("p", {
356
356
  className: "cell-result-count",
357
357
  children: [
358
- I.length,
358
+ F.length,
359
359
  " ",
360
- I.length === 1 ? "cell" : "cells",
361
- Y ? " in retained inventory" : ""
360
+ F.length === 1 ? "cell" : "cells",
361
+ J ? " in retained inventory" : ""
362
362
  ]
363
363
  })
364
364
  ]
365
365
  }),
366
- /* @__PURE__ */ R("nav", {
366
+ /* @__PURE__ */ L("nav", {
367
367
  className: "cell-navigation-list",
368
368
  "aria-label": "Cell navigation",
369
369
  children: [
370
- c && re && /* @__PURE__ */ L("p", {
370
+ c && q && /* @__PURE__ */ I("p", {
371
371
  className: "cell-group-scope",
372
372
  title: "Scope shared by every listed cell",
373
- children: /* @__PURE__ */ L(H, { parts: I[0].scope.slice(0, 3) })
373
+ children: /* @__PURE__ */ I(V, { parts: F[0].scope.slice(0, 3) })
374
374
  }),
375
- C ? /* @__PURE__ */ R(te, { children: [K.length > 0 && /* @__PURE__ */ L("h3", {
375
+ C ? /* @__PURE__ */ L(ne, { children: [W.length > 0 && /* @__PURE__ */ I("h3", {
376
376
  className: "cell-list-heading",
377
377
  children: "Agents"
378
- }), Q.map(({ id: t, agent: i }) => {
379
- if (!i) return /* @__PURE__ */ R("section", {
378
+ }), ce.map(({ id: t, agent: i }) => {
379
+ if (!i) return /* @__PURE__ */ L("section", {
380
380
  className: "cell-group",
381
381
  "aria-label": "Other cells",
382
- children: [/* @__PURE__ */ L("h3", {
382
+ children: [/* @__PURE__ */ I("h3", {
383
383
  className: "cell-list-heading",
384
384
  children: "Other cells"
385
- }), Z(t, ne)]
385
+ }), Z(t, ie)]
386
386
  }, t);
387
- let a = Re(i.rows, u), o = Oe(a, d), s = a ? " has-unread" : "", c = /* @__PURE__ */ R("span", {
387
+ let a = Re(i.rows, u), o = Oe(a, d), s = a ? " has-unread" : "", c = /* @__PURE__ */ L("span", {
388
388
  className: "agent-name",
389
389
  children: [
390
- /* @__PURE__ */ L(B, { name: "agent" }),
391
- /* @__PURE__ */ R("span", { children: [i.displayName, a > 0 && /* @__PURE__ */ L(Le, {
390
+ /* @__PURE__ */ I(z, { name: "agent" }),
391
+ /* @__PURE__ */ L("span", { children: [i.displayName, a > 0 && /* @__PURE__ */ I(Le, {
392
392
  bytes: a,
393
393
  showBytes: d
394
394
  })] }),
395
- i.named && /* @__PURE__ */ L("span", {
395
+ i.named && /* @__PURE__ */ I("span", {
396
396
  className: "agent-internal mono-id",
397
397
  children: i.name
398
398
  }),
399
- i.context && /* @__PURE__ */ L("span", {
399
+ i.context && /* @__PURE__ */ I("span", {
400
400
  className: "agent-context",
401
401
  children: i.context
402
402
  })
403
403
  ]
404
- }), f = /* @__PURE__ */ R("small", { children: [i.rows.length, /* @__PURE__ */ R("span", {
404
+ }), f = /* @__PURE__ */ L("small", { children: [i.rows.length, /* @__PURE__ */ L("span", {
405
405
  className: "sr-only",
406
406
  children: [" ", i.rows.length === 1 ? "instance" : "instances"]
407
407
  })] }), p = m(i.rows);
408
- if (q.get(t) === 1) {
408
+ if (G.get(t) === 1) {
409
409
  let a = i.rows[0], u = a.scope.join(" / "), d = r[JSON.stringify(a.scope)];
410
- return /* @__PURE__ */ L("section", {
410
+ return /* @__PURE__ */ I("section", {
411
411
  className: "cell-group cell-agent",
412
412
  "aria-label": `${i.displayName} agent`,
413
- children: /* @__PURE__ */ R("a", {
413
+ children: /* @__PURE__ */ L("a", {
414
414
  className: `agent-row agent-link${s}`,
415
415
  href: e(a.scope),
416
416
  "aria-current": Ie(a.scope, n) ? "page" : void 0,
@@ -419,9 +419,9 @@ function Ve({ inventory: t, selectedScope: n, terminalStates: r, filter: i, list
419
419
  children: [
420
420
  c,
421
421
  f,
422
- /* @__PURE__ */ L(V, { state: p }),
423
- /* @__PURE__ */ L(z, { status: a.doc.status }),
424
- l && d && /* @__PURE__ */ R("span", {
422
+ /* @__PURE__ */ I(B, { state: p }),
423
+ /* @__PURE__ */ I(R, { status: a.doc.status }),
424
+ l && d && /* @__PURE__ */ L("span", {
425
425
  className: `cell-terminal-state ${d}`,
426
426
  children: ["Terminal ", d]
427
427
  })
@@ -430,64 +430,64 @@ function Ve({ inventory: t, selectedScope: n, terminalStates: r, filter: i, list
430
430
  }, t);
431
431
  }
432
432
  let h = T.includes(t), g = h && i.rows.some((e) => Ie(e.scope, n));
433
- return /* @__PURE__ */ R("section", {
433
+ return /* @__PURE__ */ L("section", {
434
434
  className: "cell-group cell-agent",
435
435
  "aria-label": `${i.displayName} agent`,
436
- children: [/* @__PURE__ */ R("button", {
436
+ children: [/* @__PURE__ */ L("button", {
437
437
  className: `cell-group-toggle agent-row${g ? " has-current" : ""}${s}`,
438
438
  "aria-expanded": !h,
439
- onClick: () => X(t),
439
+ onClick: () => oe(t),
440
440
  children: [
441
- /* @__PURE__ */ L("span", {
441
+ /* @__PURE__ */ I("span", {
442
442
  "aria-hidden": "true",
443
443
  children: h ? "▸" : "▾"
444
444
  }),
445
445
  c,
446
- g && /* @__PURE__ */ L("span", {
446
+ g && /* @__PURE__ */ I("span", {
447
447
  className: "sr-only",
448
448
  children: ", contains the open cell"
449
449
  }),
450
450
  f,
451
- /* @__PURE__ */ L(V, { state: p }),
452
- o && /* @__PURE__ */ L("span", {
451
+ /* @__PURE__ */ I(B, { state: p }),
452
+ o && /* @__PURE__ */ I("span", {
453
453
  className: "sr-only",
454
454
  children: o
455
455
  })
456
456
  ]
457
457
  }), !h && Z(t, i.rows, "agent-instances")]
458
458
  }, t);
459
- })] }) : U.slice(0, O).map(({ id: e, label: t, rows: n }) => {
459
+ })] }) : H.slice(0, O).map(({ id: e, label: t, rows: n }) => {
460
460
  let r = !!_ && T.includes(e);
461
- return /* @__PURE__ */ R("section", {
461
+ return /* @__PURE__ */ L("section", {
462
462
  className: "cell-group",
463
463
  "aria-label": _ ? `${t} group` : void 0,
464
- children: [_ && /* @__PURE__ */ R("button", {
464
+ children: [_ && /* @__PURE__ */ L("button", {
465
465
  className: "cell-group-toggle",
466
466
  "aria-expanded": !r,
467
- onClick: () => X(e),
467
+ onClick: () => oe(e),
468
468
  children: [
469
- /* @__PURE__ */ L("span", {
469
+ /* @__PURE__ */ I("span", {
470
470
  "aria-hidden": "true",
471
471
  children: r ? "▸" : "▾"
472
472
  }),
473
- /* @__PURE__ */ L("span", { children: t }),
474
- /* @__PURE__ */ L("small", { children: n.length })
473
+ /* @__PURE__ */ I("span", { children: t }),
474
+ /* @__PURE__ */ I("small", { children: n.length })
475
475
  ]
476
476
  }), !r && Z(e, n)]
477
477
  }, e);
478
478
  }),
479
- ce > O && /* @__PURE__ */ R("button", {
479
+ Q > O && /* @__PURE__ */ L("button", {
480
480
  className: "cell-more",
481
481
  onClick: () => k((e) => e + Me),
482
482
  children: [
483
483
  "Show ",
484
- Math.min(Me, ce - O),
484
+ Math.min(Me, Q - O),
485
485
  " more groups"
486
486
  ]
487
487
  })
488
488
  ]
489
489
  }),
490
- /* @__PURE__ */ L(ze, { hidden: P })
490
+ /* @__PURE__ */ I(ze, { hidden: P })
491
491
  ]
492
492
  });
493
493
  }
@@ -535,15 +535,15 @@ function Ye() {
535
535
  };
536
536
  }
537
537
  function Xe() {
538
- return /* @__PURE__ */ L("span", {
538
+ return /* @__PURE__ */ I("span", {
539
539
  className: "mark",
540
540
  "aria-hidden": "true",
541
- children: /* @__PURE__ */ L(B, { name: "tornado" })
541
+ children: /* @__PURE__ */ I(z, { name: "tornado" })
542
542
  });
543
543
  }
544
544
  function Ze({ collapsed: e, onToggle: t }) {
545
545
  let n = e ? "Expand sidebar" : "Collapse sidebar";
546
- return /* @__PURE__ */ L("button", {
546
+ return /* @__PURE__ */ I("button", {
547
547
  type: "button",
548
548
  className: "icon-button sidebar-toggle",
549
549
  "aria-label": n,
@@ -551,7 +551,7 @@ function Ze({ collapsed: e, onToggle: t }) {
551
551
  "aria-expanded": !e,
552
552
  "aria-controls": "cell-sidebar",
553
553
  onClick: t,
554
- children: /* @__PURE__ */ L(B, { name: e ? "sidebarExpand" : "sidebarCollapse" })
554
+ children: /* @__PURE__ */ I(z, { name: e ? "sidebarExpand" : "sidebarCollapse" })
555
555
  });
556
556
  }
557
557
  function Qe({ width: e, onResize: t }) {
@@ -572,7 +572,7 @@ function Qe({ width: e, onResize: t }) {
572
572
  let r = n.key === "ArrowLeft" ? e - We.step : n.key === "ArrowRight" ? e + We.step : n.key === "Home" ? We.min : n.key === "End" ? We.max : null;
573
573
  r !== null && (n.preventDefault(), t(r));
574
574
  }
575
- return /* @__PURE__ */ L("div", {
575
+ return /* @__PURE__ */ I("div", {
576
576
  className: "sidebar-resizer",
577
577
  role: "separator",
578
578
  "aria-orientation": "vertical",
@@ -603,102 +603,102 @@ function et(e, t) {
603
603
  };
604
604
  }
605
605
  function tt({ label: e }) {
606
- return /* @__PURE__ */ L("span", {
606
+ return /* @__PURE__ */ I("span", {
607
607
  className: "version-warning",
608
608
  role: "img",
609
609
  "aria-label": e,
610
610
  title: e,
611
- children: /* @__PURE__ */ L(B, { name: "warning" })
611
+ children: /* @__PURE__ */ I(z, { name: "warning" })
612
612
  });
613
613
  }
614
614
  function nt({ info: e }) {
615
- return /* @__PURE__ */ R("div", {
615
+ return /* @__PURE__ */ L("div", {
616
616
  className: "connection-versions",
617
- children: [/* @__PURE__ */ R("dl", {
617
+ children: [/* @__PURE__ */ L("dl", {
618
618
  "aria-label": "Versions",
619
- children: [/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("dt", { children: "web" }), /* @__PURE__ */ L("dd", { children: e.web ?? "unknown" })] }), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("dt", { children: "daemon" }), /* @__PURE__ */ L("dd", { children: e.daemon ?? "unknown" })] })]
620
- }), e.mismatch && /* @__PURE__ */ L(tt, { label: e.warning })]
619
+ children: [/* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("dt", { children: "web" }), /* @__PURE__ */ I("dd", { children: e.web ?? "unknown" })] }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("dt", { children: "daemon" }), /* @__PURE__ */ I("dd", { children: e.daemon ?? "unknown" })] })]
620
+ }), e.mismatch && /* @__PURE__ */ I(tt, { label: e.warning })]
621
621
  });
622
622
  }
623
623
  function rt({ view: t, inventory: n, selectedScope: r, connection: i, onExpand: o, majordomo: s, listStyle: c = "default", unread: l = {}, showUnreadBytes: u = !1 }) {
624
624
  let d = x(n.data?.rows[3] ?? [], r), f = n.data?.configs, { agents: p, others: h } = b(d, f), _ = c === "agent" ? g(n.data?.rows[3] ?? [], f) : /* @__PURE__ */ new Map(), v = `Daemon: ${i.status} · ${i.info.summary}`, y = (e) => r.length === 4 && e.scope.every((e, t) => e === r[t]), S = (t) => {
625
625
  let n = t.doc.status?.state, r = _.get(JSON.stringify(t.scope)), i = l[JSON.stringify(t.scope)]?.unreadBytes ?? 0, a = `Open ${r ? `${r} (${t.scope.join(" / ")})` : t.scope.join(" / ")} (${n || "state not reported"})${Oe(i, u)}`;
626
- return /* @__PURE__ */ L("li", { children: /* @__PURE__ */ L("a", {
627
- className: `rail-cell tone-${G(n)}${i ? " has-unread" : ""}`,
626
+ return /* @__PURE__ */ I("li", { children: /* @__PURE__ */ I("a", {
627
+ className: `rail-cell tone-${U(n)}${i ? " has-unread" : ""}`,
628
628
  href: e(t.scope),
629
629
  "aria-label": a,
630
630
  title: a,
631
631
  "aria-current": y(t) ? "page" : void 0,
632
- children: /* @__PURE__ */ L("span", {
632
+ children: /* @__PURE__ */ I("span", {
633
633
  className: "state-dot",
634
634
  "aria-hidden": "true"
635
635
  })
636
636
  }) }, JSON.stringify(t.scope));
637
637
  };
638
- return /* @__PURE__ */ R("div", {
638
+ return /* @__PURE__ */ L("div", {
639
639
  className: "sidebar-rail",
640
640
  children: [
641
- /* @__PURE__ */ L("a", {
641
+ /* @__PURE__ */ I("a", {
642
642
  className: "rail-brand",
643
643
  href: a(),
644
644
  "aria-label": "kukeon home",
645
645
  title: "kukeon",
646
- children: /* @__PURE__ */ L(Xe, {})
646
+ children: /* @__PURE__ */ I(Xe, {})
647
647
  }),
648
- /* @__PURE__ */ L(Ze, {
648
+ /* @__PURE__ */ I(Ze, {
649
649
  collapsed: !0,
650
650
  onToggle: o
651
651
  }),
652
652
  s,
653
- t === "workbench" ? /* @__PURE__ */ L("nav", {
653
+ t === "workbench" ? /* @__PURE__ */ I("nav", {
654
654
  className: "rail-cells",
655
655
  "aria-label": "Cell shortcuts",
656
- children: c === "agent" ? /* @__PURE__ */ R("ul", { children: [p.map((t) => {
657
- let n = `${t.rows.length} ${t.rows.length === 1 ? "instance" : "instances"}`, r = Re(t.rows, l), i = Oe(r, u), a = `Agent ${t.displayName}${t.context ? ` (${t.context})` : ""}, ${n}`, o = `rail-agent-glyph tone-${G(m(t.rows))}${r ? " has-unread" : ""}`;
656
+ children: c === "agent" ? /* @__PURE__ */ L("ul", { children: [p.map((t) => {
657
+ let n = `${t.rows.length} ${t.rows.length === 1 ? "instance" : "instances"}`, r = Re(t.rows, l), i = Oe(r, u), a = `Agent ${t.displayName}${t.context ? ` (${t.context})` : ""}, ${n}`, o = `rail-agent-glyph tone-${U(m(t.rows))}${r ? " has-unread" : ""}`;
658
658
  if (t.rows.length === 1) {
659
659
  let n = t.rows[0], r = `${a}: open ${n.scope.join(" / ")} (${n.doc.status?.state || "state not reported"})${i}`;
660
- return /* @__PURE__ */ L("li", {
660
+ return /* @__PURE__ */ I("li", {
661
661
  className: "rail-agent",
662
- children: /* @__PURE__ */ L("a", {
662
+ children: /* @__PURE__ */ I("a", {
663
663
  className: o,
664
664
  href: e(n.scope),
665
665
  "aria-label": r,
666
666
  title: r,
667
667
  "aria-current": y(n) ? "page" : void 0,
668
- children: /* @__PURE__ */ L(B, { name: "agent" })
668
+ children: /* @__PURE__ */ I(z, { name: "agent" })
669
669
  })
670
670
  }, t.id);
671
671
  }
672
- return /* @__PURE__ */ R("li", {
672
+ return /* @__PURE__ */ L("li", {
673
673
  className: "rail-agent",
674
- children: [/* @__PURE__ */ L("span", {
674
+ children: [/* @__PURE__ */ I("span", {
675
675
  className: o,
676
676
  role: "img",
677
677
  "aria-label": a + i,
678
678
  title: a + i,
679
- children: /* @__PURE__ */ L(B, { name: "agent" })
680
- }), /* @__PURE__ */ L("ul", { children: t.rows.map(S) })]
679
+ children: /* @__PURE__ */ I(z, { name: "agent" })
680
+ }), /* @__PURE__ */ I("ul", { children: t.rows.map(S) })]
681
681
  }, t.id);
682
- }), h.length > 0 && /* @__PURE__ */ L("li", {
682
+ }), h.length > 0 && /* @__PURE__ */ I("li", {
683
683
  className: "rail-others",
684
- children: /* @__PURE__ */ L("ul", {
684
+ children: /* @__PURE__ */ I("ul", {
685
685
  "aria-label": "Other cells",
686
686
  children: h.map(S)
687
687
  })
688
- })] }) : /* @__PURE__ */ L("ul", { children: d.map(S) })
689
- }) : /* @__PURE__ */ L("div", { className: "rail-spacer" }),
690
- /* @__PURE__ */ R("div", {
688
+ })] }) : /* @__PURE__ */ I("ul", { children: d.map(S) })
689
+ }) : /* @__PURE__ */ I("div", { className: "rail-spacer" }),
690
+ /* @__PURE__ */ L("div", {
691
691
  className: "rail-connection",
692
- children: [/* @__PURE__ */ L("span", {
692
+ children: [/* @__PURE__ */ I("span", {
693
693
  className: "rail-connection-dot",
694
694
  role: "status",
695
695
  "aria-label": v,
696
696
  title: v,
697
- children: /* @__PURE__ */ L("span", {
697
+ children: /* @__PURE__ */ I("span", {
698
698
  className: `dot ${i.tone}`,
699
699
  "aria-hidden": "true"
700
700
  })
701
- }), i.info.mismatch && /* @__PURE__ */ L(tt, { label: i.info.warning })]
701
+ }), i.info.mismatch && /* @__PURE__ */ I(tt, { label: i.info.warning })]
702
702
  })
703
703
  ]
704
704
  });
@@ -785,7 +785,7 @@ function mt() {
785
785
  return O(() => {
786
786
  n();
787
787
  }, [n]), O(() => {
788
- let e = () => t((e) => e.phase === "signed-in" ? { phase: "signed-out" } : e), n = I((t) => {
788
+ let e = () => t((e) => e.phase === "signed-in" ? { phase: "signed-out" } : e), n = F((t) => {
789
789
  ct.endsSession(t) && e();
790
790
  });
791
791
  return dt.add(e), () => {
@@ -836,51 +836,51 @@ function ht({ notice: e, checking: t, onRetry: n, onSignedIn: i }) {
836
836
  }
837
837
  }
838
838
  }
839
- return /* @__PURE__ */ L("main", {
839
+ return /* @__PURE__ */ I("main", {
840
840
  className: "login-screen",
841
841
  id: "main-content",
842
- children: /* @__PURE__ */ R("form", {
842
+ children: /* @__PURE__ */ L("form", {
843
843
  className: "login-card",
844
844
  onSubmit: m,
845
845
  "aria-labelledby": "login-title",
846
846
  children: [
847
- /* @__PURE__ */ R("div", {
847
+ /* @__PURE__ */ L("div", {
848
848
  className: "login-brand",
849
- children: [/* @__PURE__ */ L(Xe, {}), /* @__PURE__ */ L("span", {
849
+ children: [/* @__PURE__ */ I(Xe, {}), /* @__PURE__ */ I("span", {
850
850
  className: "brand-title",
851
851
  children: "kukeon"
852
852
  })]
853
853
  }),
854
- /* @__PURE__ */ L("h1", {
854
+ /* @__PURE__ */ I("h1", {
855
855
  id: "login-title",
856
856
  children: "Sign in"
857
857
  }),
858
- t && /* @__PURE__ */ L("p", {
858
+ t && /* @__PURE__ */ I("p", {
859
859
  className: "login-status",
860
860
  role: "status",
861
861
  children: "Checking session…"
862
862
  }),
863
- e && /* @__PURE__ */ R("div", {
863
+ e && /* @__PURE__ */ L("div", {
864
864
  className: "error",
865
865
  role: "alert",
866
866
  children: [
867
- /* @__PURE__ */ L("strong", { children: c(e) }),
868
- /* @__PURE__ */ L("p", { children: e.message }),
869
- /* @__PURE__ */ L("button", {
867
+ /* @__PURE__ */ I("strong", { children: c(e) }),
868
+ /* @__PURE__ */ I("p", { children: e.message }),
869
+ /* @__PURE__ */ I("button", {
870
870
  type: "button",
871
871
  onClick: n,
872
872
  children: "Retry"
873
873
  })
874
874
  ]
875
875
  }),
876
- /* @__PURE__ */ R("label", { children: ["User", /* @__PURE__ */ L("input", {
876
+ /* @__PURE__ */ L("label", { children: ["User", /* @__PURE__ */ I("input", {
877
877
  name: "username",
878
878
  autoComplete: "username",
879
879
  value: a,
880
880
  onChange: (e) => o(e.target.value),
881
881
  required: !0
882
882
  })] }),
883
- /* @__PURE__ */ R("label", { children: ["Password", /* @__PURE__ */ L("input", {
883
+ /* @__PURE__ */ L("label", { children: ["Password", /* @__PURE__ */ I("input", {
884
884
  name: "password",
885
885
  type: "password",
886
886
  autoComplete: "current-password",
@@ -889,20 +889,20 @@ function ht({ notice: e, checking: t, onRetry: n, onSignedIn: i }) {
889
889
  required: !0,
890
890
  autoFocus: !0
891
891
  })] }),
892
- u && /* @__PURE__ */ L("div", {
892
+ u && /* @__PURE__ */ I("div", {
893
893
  className: "error",
894
894
  role: "alert",
895
- children: /* @__PURE__ */ L("p", { children: u.message })
895
+ children: /* @__PURE__ */ I("p", { children: u.message })
896
896
  }),
897
- /* @__PURE__ */ L("button", {
897
+ /* @__PURE__ */ I("button", {
898
898
  className: "primary-action",
899
899
  type: "submit",
900
900
  disabled: f,
901
901
  children: f ? "Signing in…" : "Sign in"
902
902
  }),
903
- /* @__PURE__ */ R("p", {
903
+ /* @__PURE__ */ L("p", {
904
904
  className: "login-hint",
905
- children: ["Print the password on the host with ", /* @__PURE__ */ L("code", { children: at })]
905
+ children: ["Print the password on the host with ", /* @__PURE__ */ I("code", { children: at })]
906
906
  })
907
907
  ]
908
908
  })
@@ -927,8 +927,8 @@ async function yt(e, t, n, r) {
927
927
  }
928
928
  var bt = (e) => e ? Uint8Array.from(atob(e), (e) => e.charCodeAt(0)) : /* @__PURE__ */ new Uint8Array();
929
929
  function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revision: o, theme: c, expanded: l }) {
930
- let u = j(null), d = j(null), f = j(() => {}), p = j(null), m = j(null), h = j(!1), g = j(!1), [_, v] = M(!1), [y, b] = M(!1), [x, S] = M();
931
- async function C(n) {
930
+ let u = j(null), d = j(null), f = j(() => {}), p = j(null), m = j(null), h = j(!1), g = j(!1), _ = j(!1), [v, y] = M(!1), [b, x] = M(!1), [S, C] = M();
931
+ async function w(n) {
932
932
  if (h.current) g.current = !0;
933
933
  else {
934
934
  h.current = !0;
@@ -936,31 +936,31 @@ function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revi
936
936
  for (let r = 0; r < vt; r++) {
937
937
  let r = m.current === null, i = await yt(e, t, r ? -1 : m.current, n);
938
938
  if (n.aborted) return;
939
- if (S(void 0), i === null) {
940
- v(!0);
939
+ if (C(void 0), i === null) {
940
+ y(!0);
941
941
  return;
942
942
  }
943
943
  if (!r && (i.size ?? 0) < m.current) {
944
944
  m.current = null;
945
945
  continue;
946
946
  }
947
- r && (d.current?.reset(), b(!!i.truncated));
947
+ r && (d.current?.reset(), x(!!i.truncated), _.current = !1);
948
948
  let a = bt(i.data);
949
- if (a.length && d.current?.write(a), m.current = i.next ?? m.current, v((i.size ?? 0) === 0), !i.more) return;
949
+ if (a.length && (d.current?.write(a), _.current = !0), m.current = i.next ?? m.current, y(!_.current && !i.truncated && !i.more), !i.more) return;
950
950
  }
951
951
  } catch (e) {
952
- n.aborted || S(r(e));
952
+ n.aborted || C(r(e));
953
953
  } finally {
954
954
  h.current = !1;
955
955
  let e = p.current?.signal;
956
- g.current && e && !e.aborted && (g.current = !1, C(e));
956
+ g.current && e && !e.aborted && (g.current = !1, w(e));
957
957
  }
958
958
  }
959
959
  }
960
- let w = j(C);
961
- return w.current = C, O(() => {
960
+ let T = j(w);
961
+ return T.current = w, O(() => {
962
962
  if (!u.current) return;
963
- let e = new q({
963
+ let e = new G({
964
964
  disableStdin: !0,
965
965
  cursorBlink: !1,
966
966
  cursorStyle: "underline",
@@ -969,8 +969,8 @@ function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revi
969
969
  fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace",
970
970
  fontSize: 14,
971
971
  scrollback: 1e4,
972
- theme: Zt(c)
973
- }), t = new J();
972
+ theme: Fn(c)
973
+ }), t = new K();
974
974
  d.current = e, p.current = new AbortController(), m.current = null, e.loadAddon(t), e.open(u.current);
975
975
  let r = 0, i = () => {
976
976
  r && cancelAnimationFrame(r), r = requestAnimationFrame(() => {
@@ -984,7 +984,7 @@ function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revi
984
984
  };
985
985
  }, []), O(() => {
986
986
  let e = () => {
987
- d.current && (d.current.options.theme = Zt(c));
987
+ d.current && (d.current.options.theme = Fn(c));
988
988
  };
989
989
  if (e(), c !== "system") return;
990
990
  let t = window.matchMedia("(prefers-color-scheme: dark)");
@@ -994,35 +994,35 @@ function xt({ scope: e, container: t, attachable: n, live: i, cellState: a, revi
994
994
  return () => cancelAnimationFrame(e);
995
995
  }, [l]), O(() => {
996
996
  let e = p.current?.signal;
997
- e && w.current(e);
997
+ e && T.current(e);
998
998
  }, [o, a]), O(() => {
999
999
  if (!i) return;
1000
1000
  let e = setInterval(() => {
1001
1001
  let e = p.current?.signal;
1002
- e && document.visibilityState === "visible" && w.current(e);
1002
+ e && document.visibilityState === "visible" && T.current(e);
1003
1003
  }, _t);
1004
1004
  return () => clearInterval(e);
1005
- }, [i]), /* @__PURE__ */ R("div", {
1005
+ }, [i]), /* @__PURE__ */ L("div", {
1006
1006
  className: "terminal-session terminal-log",
1007
1007
  children: [
1008
- _ && !x && /* @__PURE__ */ L("p", {
1008
+ v && !S && /* @__PURE__ */ I("p", {
1009
1009
  className: "empty-state terminal-empty",
1010
1010
  role: "status",
1011
1011
  children: "No output yet."
1012
1012
  }),
1013
- x && /* @__PURE__ */ L(s, {
1014
- error: x,
1013
+ S && /* @__PURE__ */ I(s, {
1014
+ error: S,
1015
1015
  kind: "Container log"
1016
1016
  }),
1017
- y && !_ && /* @__PURE__ */ L("p", {
1017
+ b && !v && /* @__PURE__ */ I("p", {
1018
1018
  className: "terminal-log-omitted",
1019
1019
  children: "Earlier output is not shown."
1020
1020
  }),
1021
- /* @__PURE__ */ L("div", {
1021
+ /* @__PURE__ */ I("div", {
1022
1022
  className: "terminal-screen",
1023
- hidden: _,
1023
+ hidden: v,
1024
1024
  "aria-label": `Log for ${e.join(" / ")} / ${t}`,
1025
- children: /* @__PURE__ */ L("div", {
1025
+ children: /* @__PURE__ */ I("div", {
1026
1026
  ref: u,
1027
1027
  className: "terminal-mount"
1028
1028
  })
@@ -1040,7 +1040,7 @@ var St = [{
1040
1040
  }];
1041
1041
  function Ct({ container: e, open: t, reason: n, onToggle: r }) {
1042
1042
  let i = n || (t ? `Close Exec for ${e}` : `Exec: run a command or open a shell in ${e}`);
1043
- return /* @__PURE__ */ L("button", {
1043
+ return /* @__PURE__ */ I("button", {
1044
1044
  type: "button",
1045
1045
  className: "icon-button exec-button",
1046
1046
  "aria-label": "Exec",
@@ -1049,12 +1049,12 @@ function Ct({ container: e, open: t, reason: n, onToggle: r }) {
1049
1049
  "data-tooltip": i,
1050
1050
  disabled: !!n,
1051
1051
  onClick: r,
1052
- children: /* @__PURE__ */ L(B, { name: "exec" })
1052
+ children: /* @__PURE__ */ I(z, { name: "exec" })
1053
1053
  });
1054
1054
  }
1055
1055
  function wt({ target: e, onCancel: t, onConfirm: n }) {
1056
1056
  let r = j(null);
1057
- return K(r), /* @__PURE__ */ L("dialog", {
1057
+ return W(r), /* @__PURE__ */ I("dialog", {
1058
1058
  className: "cell-action-dialog exec-root-dialog",
1059
1059
  ref: r,
1060
1060
  "aria-labelledby": "exec-root-dialog-title",
@@ -1065,30 +1065,30 @@ function wt({ target: e, onCancel: t, onConfirm: n }) {
1065
1065
  onClick: (e) => {
1066
1066
  e.target === e.currentTarget && t();
1067
1067
  },
1068
- children: /* @__PURE__ */ R("form", {
1068
+ children: /* @__PURE__ */ L("form", {
1069
1069
  onSubmit: (e) => {
1070
1070
  e.preventDefault(), n();
1071
1071
  },
1072
1072
  children: [
1073
- /* @__PURE__ */ L("h2", {
1073
+ /* @__PURE__ */ I("h2", {
1074
1074
  id: "exec-root-dialog-title",
1075
1075
  children: "Run as root"
1076
1076
  }),
1077
- /* @__PURE__ */ L("p", {
1077
+ /* @__PURE__ */ I("p", {
1078
1078
  id: "exec-root-dialog-description",
1079
1079
  children: "Commands and shells started from this panel will run as root (uid 0, gid 0) inside the container, whatever user the container itself runs as. kukeond records every root exec in its log. Changes made this way are lost when the cell is recreated."
1080
1080
  }),
1081
- /* @__PURE__ */ R("dl", {
1081
+ /* @__PURE__ */ L("dl", {
1082
1082
  className: "cell-action-target",
1083
- children: [/* @__PURE__ */ L("dt", { children: "Container" }), /* @__PURE__ */ L("dd", { children: /* @__PURE__ */ L("code", { children: e }) })]
1083
+ children: [/* @__PURE__ */ I("dt", { children: "Container" }), /* @__PURE__ */ I("dd", { children: /* @__PURE__ */ I("code", { children: e }) })]
1084
1084
  }),
1085
- /* @__PURE__ */ R("div", {
1085
+ /* @__PURE__ */ L("div", {
1086
1086
  className: "cell-action-dialog-buttons",
1087
- children: [/* @__PURE__ */ L("button", {
1087
+ children: [/* @__PURE__ */ I("button", {
1088
1088
  type: "button",
1089
1089
  onClick: t,
1090
1090
  children: "Cancel"
1091
- }), /* @__PURE__ */ L("button", {
1091
+ }), /* @__PURE__ */ I("button", {
1092
1092
  className: "danger-action",
1093
1093
  type: "submit",
1094
1094
  children: "Run as root"
@@ -1099,27 +1099,27 @@ function wt({ target: e, onCancel: t, onConfirm: n }) {
1099
1099
  });
1100
1100
  }
1101
1101
  function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose: o }) {
1102
- let c = k(), l = [...e, t].join(" / "), u = `${f(e)}/containers/${encodeURIComponent(t)}/exec`, d = j(null), p = j(null), [m, h] = M("container"), [g, _] = M(!1), [v, y] = M(!1), [b, x] = M("run"), [S, C] = M(""), [w, T] = M(!1), [E, ee] = M(), [N, F] = M(), [I, z] = M(!1), [B, V] = M({
1102
+ let c = k(), l = [...e, t].join(" / "), u = `${f(e)}/containers/${encodeURIComponent(t)}/exec`, d = j(null), p = j(null), [m, h] = M("container"), [g, _] = M(!1), [v, y] = M(!1), [b, x] = M("run"), [S, C] = M(""), [w, T] = M(!1), [E, ee] = M(), [N, te] = M(), [F, R] = M(!1), [z, B] = M({
1103
1103
  generation: 0,
1104
1104
  state: "connecting",
1105
1105
  message: "Connecting…"
1106
- }), H = m === "root" && g;
1106
+ }), V = m === "root" && g;
1107
1107
  O(() => {
1108
- let e = W();
1108
+ let e = re();
1109
1109
  return p.current?.focus(), e;
1110
1110
  }, []);
1111
- let U = (e) => {
1112
- e !== m && (e === "root" && !g ? y(!0) : (h(e), K()));
1113
- }, G = () => {
1114
- y(!1), _(!0), h("root"), K();
1115
- }, K = () => V((e) => ({
1111
+ let H = (e) => {
1112
+ e !== m && (e === "root" && !g ? y(!0) : (h(e), W()));
1113
+ }, U = () => {
1114
+ y(!1), _(!0), h("root"), W();
1115
+ }, W = () => B((e) => ({
1116
1116
  generation: e.generation + 1,
1117
1117
  state: "connecting",
1118
1118
  message: "Connecting…"
1119
1119
  }));
1120
- async function ne(e) {
1120
+ async function ie(e) {
1121
1121
  if (e.preventDefault(), !w && S.trim()) {
1122
- T(!0), F(void 0);
1122
+ T(!0), te(void 0);
1123
1123
  try {
1124
1124
  let e = await P(u, {
1125
1125
  method: "POST",
@@ -1129,8 +1129,8 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1129
1129
  },
1130
1130
  body: JSON.stringify({
1131
1131
  command: S,
1132
- identity: H ? "root" : "container",
1133
- ...H ? { confirmRoot: !0 } : {}
1132
+ identity: V ? "root" : "container",
1133
+ ...V ? { confirmRoot: !0 } : {}
1134
1134
  })
1135
1135
  }), t = await e.json();
1136
1136
  if (!e.ok) throw t.error ?? {
@@ -1139,88 +1139,88 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1139
1139
  };
1140
1140
  ee(t);
1141
1141
  } catch (e) {
1142
- ee(void 0), F(r(e));
1142
+ ee(void 0), te(r(e));
1143
1143
  } finally {
1144
1144
  T(!1);
1145
1145
  }
1146
1146
  }
1147
1147
  }
1148
- let q = JSON.stringify(e), J = A(() => ({
1149
- id: `exec:${Jt(e, t)}`,
1148
+ let G = JSON.stringify(e), K = A(() => ({
1149
+ id: `exec:${Mn(e, t)}`,
1150
1150
  scope: e,
1151
1151
  container: t,
1152
1152
  view: "main",
1153
- state: B.state,
1154
- message: B.message,
1155
- generation: B.generation
1153
+ state: z.state,
1154
+ message: z.message,
1155
+ generation: z.generation
1156
1156
  }), [
1157
- q,
1157
+ G,
1158
1158
  t,
1159
- B.state,
1160
- B.message,
1161
- B.generation
1162
- ]), re = D((e, t, n, r) => {
1163
- V((e) => e.generation === t ? {
1159
+ z.state,
1160
+ z.message,
1161
+ z.generation
1162
+ ]), q = D((e, t, n, r) => {
1163
+ B((e) => e.generation === t ? {
1164
1164
  ...e,
1165
1165
  state: n,
1166
1166
  message: r
1167
1167
  } : e);
1168
- }, []), Y = A(() => ({
1169
- path: `${u}/terminal?identity=${H ? "root&confirmRoot=1" : "container"}`,
1168
+ }, []), J = A(() => ({
1169
+ path: `${u}/terminal?identity=${V ? "root&confirmRoot=1" : "container"}`,
1170
1170
  label: `Exec terminal for ${l}`
1171
1171
  }), [
1172
1172
  u,
1173
- H,
1173
+ V,
1174
1174
  l
1175
- ]), ie = (e) => {
1176
- x(e), e === "terminal" && z(!0);
1175
+ ]), ae = (e) => {
1176
+ x(e), e === "terminal" && R(!0);
1177
1177
  };
1178
- function ae(e) {
1178
+ function Y(e) {
1179
1179
  let t = St.findIndex((e) => e.id === b), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : e.key === "Home" ? 0 : e.key === "End" ? St.length - 1 : null;
1180
- n !== null && (e.preventDefault(), ie(St[(n + St.length) % St.length].id), requestAnimationFrame(() => d.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]")?.focus()));
1180
+ n !== null && (e.preventDefault(), ae(St[(n + St.length) % St.length].id), requestAnimationFrame(() => d.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]")?.focus()));
1181
1181
  }
1182
- function oe(e) {
1182
+ function X(e) {
1183
1183
  e.key !== "Escape" || e.target.closest(".terminal-screen, dialog") || (e.preventDefault(), e.stopPropagation(), o());
1184
1184
  }
1185
- let X = B.state === "disconnected";
1186
- return /* @__PURE__ */ R("section", {
1185
+ let oe = z.state === "disconnected";
1186
+ return /* @__PURE__ */ L("section", {
1187
1187
  className: `exec-panel${a ? " is-expanded" : ""}`,
1188
1188
  ref: d,
1189
1189
  role: "group",
1190
1190
  "aria-labelledby": `${c}-title`,
1191
- onKeyDown: oe,
1191
+ onKeyDown: X,
1192
1192
  children: [
1193
- /* @__PURE__ */ R("header", {
1193
+ /* @__PURE__ */ L("header", {
1194
1194
  className: "exec-panel-header",
1195
1195
  children: [
1196
- /* @__PURE__ */ R("h2", {
1196
+ /* @__PURE__ */ L("h2", {
1197
1197
  id: `${c}-title`,
1198
- children: ["Exec in ", /* @__PURE__ */ L("code", { children: t })]
1198
+ children: ["Exec in ", /* @__PURE__ */ I("code", { children: t })]
1199
1199
  }),
1200
- /* @__PURE__ */ R("fieldset", {
1200
+ /* @__PURE__ */ L("fieldset", {
1201
1201
  className: "exec-identity",
1202
1202
  children: [
1203
- /* @__PURE__ */ L("legend", { children: "Run as" }),
1204
- /* @__PURE__ */ R("label", { children: [/* @__PURE__ */ L("input", {
1203
+ /* @__PURE__ */ I("legend", { children: "Run as" }),
1204
+ /* @__PURE__ */ L("label", { children: [/* @__PURE__ */ I("input", {
1205
1205
  type: "radio",
1206
1206
  name: `${c}-identity`,
1207
1207
  checked: m === "container",
1208
- onChange: () => U("container")
1208
+ onChange: () => H("container")
1209
1209
  }), "Container user"] }),
1210
- /* @__PURE__ */ R("label", { children: [/* @__PURE__ */ L("input", {
1210
+ /* @__PURE__ */ L("label", { children: [/* @__PURE__ */ I("input", {
1211
1211
  type: "radio",
1212
1212
  name: `${c}-identity`,
1213
1213
  checked: m === "root",
1214
- onChange: () => U("root")
1214
+ onChange: () => H("root")
1215
1215
  }), "root"] })
1216
1216
  ]
1217
1217
  }),
1218
- /* @__PURE__ */ L("div", {
1218
+ /* @__PURE__ */ I("div", {
1219
1219
  className: "exec-tabs",
1220
1220
  role: "tablist",
1221
1221
  "aria-label": "Exec mode",
1222
- onKeyDown: ae,
1223
- children: St.map((e) => /* @__PURE__ */ L("button", {
1222
+ onKeyDown: Y,
1223
+ children: St.map((e) => /* @__PURE__ */ I("button", {
1224
1224
  type: "button",
1225
1225
  role: "tab",
1226
1226
  className: "exec-tab",
@@ -1228,11 +1228,11 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1228
1228
  "aria-selected": b === e.id,
1229
1229
  "aria-controls": `${c}-panel-${e.id}`,
1230
1230
  tabIndex: b === e.id ? 0 : -1,
1231
- onClick: () => ie(e.id),
1231
+ onClick: () => ae(e.id),
1232
1232
  children: e.label
1233
1233
  }, e.id))
1234
1234
  }),
1235
- /* @__PURE__ */ L("button", {
1235
+ /* @__PURE__ */ I("button", {
1236
1236
  type: "button",
1237
1237
  className: "exec-close",
1238
1238
  "aria-label": "Close Exec",
@@ -1241,29 +1241,29 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1241
1241
  })
1242
1242
  ]
1243
1243
  }),
1244
- /* @__PURE__ */ R("div", {
1244
+ /* @__PURE__ */ L("div", {
1245
1245
  className: "exec-run",
1246
1246
  role: "tabpanel",
1247
1247
  id: `${c}-panel-run`,
1248
1248
  "aria-labelledby": `${c}-tab-run`,
1249
1249
  hidden: b !== "run",
1250
1250
  children: [
1251
- /* @__PURE__ */ R("form", {
1251
+ /* @__PURE__ */ L("form", {
1252
1252
  className: "exec-run-form",
1253
- onSubmit: ne,
1254
- children: [/* @__PURE__ */ R("label", {
1253
+ onSubmit: ie,
1254
+ children: [/* @__PURE__ */ L("label", {
1255
1255
  htmlFor: `${c}-command`,
1256
- children: ["Command ", /* @__PURE__ */ R("span", {
1256
+ children: ["Command ", /* @__PURE__ */ L("span", {
1257
1257
  className: "exec-hint",
1258
1258
  children: [
1259
1259
  "one line, run as ",
1260
- /* @__PURE__ */ L("code", { children: "sh -c" }),
1261
- H ? " as root" : ""
1260
+ /* @__PURE__ */ I("code", { children: "sh -c" }),
1261
+ V ? " as root" : ""
1262
1262
  ]
1263
1263
  })]
1264
- }), /* @__PURE__ */ R("div", {
1264
+ }), /* @__PURE__ */ L("div", {
1265
1265
  className: "exec-run-line",
1266
- children: [/* @__PURE__ */ L("input", {
1266
+ children: [/* @__PURE__ */ I("input", {
1267
1267
  ref: p,
1268
1268
  id: `${c}-command`,
1269
1269
  className: "mono-id",
@@ -1273,7 +1273,7 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1273
1273
  placeholder: "id -u",
1274
1274
  value: S,
1275
1275
  onChange: (e) => C(e.target.value)
1276
- }), /* @__PURE__ */ L("button", {
1276
+ }), /* @__PURE__ */ I("button", {
1277
1277
  type: "submit",
1278
1278
  className: "primary-action",
1279
1279
  disabled: w || !S.trim(),
@@ -1281,48 +1281,48 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1281
1281
  })]
1282
1282
  })]
1283
1283
  }),
1284
- N && /* @__PURE__ */ L(s, {
1284
+ N && /* @__PURE__ */ I(s, {
1285
1285
  error: N,
1286
1286
  kind: "Container"
1287
1287
  }),
1288
- E && /* @__PURE__ */ R("div", {
1288
+ E && /* @__PURE__ */ L("div", {
1289
1289
  className: "exec-result",
1290
1290
  role: "status",
1291
1291
  children: [
1292
- /* @__PURE__ */ L("p", {
1292
+ /* @__PURE__ */ I("p", {
1293
1293
  className: "exec-exit",
1294
- children: E.timedOut ? "Stopped after the time limit; no exit code." : /* @__PURE__ */ R(te, { children: ["Exit code ", /* @__PURE__ */ L("code", { children: E.exitCode })] })
1294
+ children: E.timedOut ? "Stopped after the time limit; no exit code." : /* @__PURE__ */ L(ne, { children: ["Exit code ", /* @__PURE__ */ I("code", { children: E.exitCode })] })
1295
1295
  }),
1296
- E.timedOut && /* @__PURE__ */ L("p", {
1296
+ E.timedOut && /* @__PURE__ */ I("p", {
1297
1297
  className: "stale",
1298
1298
  children: "The command ran longer than 60 seconds and was killed. The output up to that point is below."
1299
1299
  }),
1300
- E.truncated && /* @__PURE__ */ L("p", {
1300
+ E.truncated && /* @__PURE__ */ I("p", {
1301
1301
  className: "stale",
1302
1302
  children: "Output above 1 MiB per stream was dropped."
1303
1303
  }),
1304
- /* @__PURE__ */ L("h3", {
1304
+ /* @__PURE__ */ I("h3", {
1305
1305
  id: `${c}-stdout`,
1306
1306
  children: "stdout"
1307
1307
  }),
1308
- /* @__PURE__ */ L("pre", {
1308
+ /* @__PURE__ */ I("pre", {
1309
1309
  className: "exec-output",
1310
1310
  "aria-labelledby": `${c}-stdout`,
1311
1311
  tabIndex: 0,
1312
- children: E.stdout || /* @__PURE__ */ L("span", {
1312
+ children: E.stdout || /* @__PURE__ */ I("span", {
1313
1313
  className: "exec-empty",
1314
1314
  children: "(empty)"
1315
1315
  })
1316
1316
  }),
1317
- /* @__PURE__ */ L("h3", {
1317
+ /* @__PURE__ */ I("h3", {
1318
1318
  id: `${c}-stderr`,
1319
1319
  children: "stderr"
1320
1320
  }),
1321
- /* @__PURE__ */ L("pre", {
1321
+ /* @__PURE__ */ I("pre", {
1322
1322
  className: "exec-output",
1323
1323
  "aria-labelledby": `${c}-stderr`,
1324
1324
  tabIndex: 0,
1325
- children: E.stderr || /* @__PURE__ */ L("span", {
1325
+ children: E.stderr || /* @__PURE__ */ I("span", {
1326
1326
  className: "exec-empty",
1327
1327
  children: "(empty)"
1328
1328
  })
@@ -1331,81 +1331,782 @@ function Tt({ scope: e, container: t, theme: n, visible: i, expanded: a, onClose
1331
1331
  })
1332
1332
  ]
1333
1333
  }),
1334
- /* @__PURE__ */ R("div", {
1334
+ /* @__PURE__ */ L("div", {
1335
1335
  className: "exec-terminal",
1336
1336
  role: "tabpanel",
1337
1337
  id: `${c}-panel-terminal`,
1338
1338
  "aria-labelledby": `${c}-tab-terminal`,
1339
1339
  hidden: b !== "terminal",
1340
- children: [/* @__PURE__ */ R("div", {
1340
+ children: [/* @__PURE__ */ L("div", {
1341
1341
  className: "exec-terminal-status",
1342
- children: [/* @__PURE__ */ R("p", {
1342
+ children: [/* @__PURE__ */ L("p", {
1343
1343
  role: "status",
1344
- children: [B.message, H && !X ? " (root)" : ""]
1345
- }), X && /* @__PURE__ */ L("button", {
1344
+ children: [z.message, V && !oe ? " (root)" : ""]
1345
+ }), oe && /* @__PURE__ */ I("button", {
1346
1346
  type: "button",
1347
- onClick: K,
1347
+ onClick: W,
1348
1348
  children: "New shell"
1349
1349
  })]
1350
- }), I && /* @__PURE__ */ L(en, {
1351
- session: J,
1350
+ }), F && /* @__PURE__ */ I(Rn, {
1351
+ session: K,
1352
1352
  active: i && b === "terminal",
1353
1353
  expanded: a,
1354
1354
  theme: n,
1355
- update: re,
1356
- endpoint: Y
1357
- }, `${m}:${B.generation}`)]
1355
+ update: q,
1356
+ endpoint: J
1357
+ }, `${m}:${z.generation}`)]
1358
1358
  }),
1359
- v && /* @__PURE__ */ L(wt, {
1359
+ v && /* @__PURE__ */ I(wt, {
1360
1360
  target: l,
1361
1361
  onCancel: () => y(!1),
1362
- onConfirm: G
1362
+ onConfirm: U
1363
+ })
1364
+ ]
1365
+ });
1366
+ }
1367
+ var Et = 10;
1368
+ function Dt() {
1369
+ let e = new TextDecoder(), t = [], n = 0;
1370
+ return {
1371
+ push(r) {
1372
+ let i = [], a = 0;
1373
+ for (let o = r.indexOf(Et); o !== -1; o = r.indexOf(Et, a)) {
1374
+ let s = r.subarray(a, o);
1375
+ if (n) {
1376
+ let e = new Uint8Array(n + s.length), r = 0;
1377
+ for (let n of t) e.set(n, r), r += n.length;
1378
+ e.set(s, r), s = e, t = [], n = 0;
1379
+ }
1380
+ i.push(e.decode(s)), a = o + 1;
1381
+ }
1382
+ return a < r.length && (t.push(r.slice(a)), n += r.length - a), i;
1383
+ },
1384
+ get pending() {
1385
+ return n;
1386
+ }
1387
+ };
1388
+ }
1389
+ function Ot(e) {
1390
+ let t = e.trim();
1391
+ if (!t) return null;
1392
+ try {
1393
+ if (t[0] === "{") {
1394
+ let e = JSON.parse(t);
1395
+ return e?.version === 2 ? { header: {
1396
+ width: kt(e.width, 80),
1397
+ height: kt(e.height, 24),
1398
+ timestamp: Number(e.timestamp) || 0
1399
+ } } : null;
1400
+ }
1401
+ if (t[0] === "[") {
1402
+ let [e, n, r] = JSON.parse(t);
1403
+ return typeof e != "number" || !Number.isFinite(e) || typeof n != "string" || typeof r != "string" ? null : { event: {
1404
+ time: e,
1405
+ code: n,
1406
+ data: r
1407
+ } };
1408
+ }
1409
+ } catch {}
1410
+ return null;
1411
+ }
1412
+ var kt = (e, t) => Number.isInteger(e) && e > 0 ? e : t;
1413
+ function At(e) {
1414
+ let t = /^(\d+)x(\d+)$/.exec(e);
1415
+ if (!t) return null;
1416
+ let n = Number(t[1]), r = Number(t[2]);
1417
+ return n > 0 && r > 0 ? {
1418
+ cols: n,
1419
+ rows: r
1420
+ } : null;
1421
+ }
1422
+ function jt() {
1423
+ return {
1424
+ runs: [],
1425
+ ops: [],
1426
+ play: {
1427
+ idle: [],
1428
+ full: []
1429
+ },
1430
+ cols: 0,
1431
+ rows: 0,
1432
+ lastT: 0
1433
+ };
1434
+ }
1435
+ function Mt(e, t) {
1436
+ let { ops: n, play: r } = e, i = n.at(-1);
1437
+ if (!i) r.idle.push(0), r.full.push(0);
1438
+ else if (i.run !== t.run) r.idle.push(r.idle.at(-1) + 1), r.full.push(r.full.at(-1) + 1);
1439
+ else {
1440
+ let e = Math.max(0, t.t - i.t);
1441
+ r.idle.push(r.idle.at(-1) + Math.min(e, 2)), r.full.push(r.full.at(-1) + e);
1442
+ }
1443
+ n.push(t);
1444
+ }
1445
+ function Nt(e, t, n, r) {
1446
+ (t !== e.cols || n !== e.rows) && (e.cols = t, e.rows = n, Mt(e, {
1447
+ kind: "size",
1448
+ run: e.runs.length - 1,
1449
+ t: r,
1450
+ cols: t,
1451
+ rows: n
1452
+ }));
1453
+ }
1454
+ function Pt(e, t) {
1455
+ if (!t) return;
1456
+ let n = e.runs.at(-1);
1457
+ if (t.header) {
1458
+ let { width: r, height: i, timestamp: a } = t.header;
1459
+ !n || n.timestamp !== a ? (e.runs.push({
1460
+ timestamp: a,
1461
+ firstOp: e.ops.length
1462
+ }), e.lastT = 0, e.cols = 0, Nt(e, r, i, 0)) : Nt(e, r, i, e.lastT);
1463
+ return;
1464
+ }
1465
+ let { event: r } = t;
1466
+ n || (e.runs.push({
1467
+ timestamp: 0,
1468
+ firstOp: e.ops.length
1469
+ }), e.cols = 0, Nt(e, 80, 24, 0));
1470
+ let i = Math.max(r.time, e.lastT);
1471
+ if (e.lastT = i, r.code === "o") Mt(e, {
1472
+ kind: "o",
1473
+ run: e.runs.length - 1,
1474
+ t: i,
1475
+ data: r.data
1476
+ });
1477
+ else if (r.code === "r") {
1478
+ let t = At(r.data);
1479
+ t && Nt(e, t.cols, t.rows, i);
1480
+ }
1481
+ }
1482
+ function Ft(e, t) {
1483
+ for (let n of t) Pt(e, Ot(n));
1484
+ }
1485
+ var It = (e) => e ? "idle" : "full";
1486
+ function Lt(e, t) {
1487
+ return e.play[It(t)].at(-1) ?? 0;
1488
+ }
1489
+ function Rt(e, t, n) {
1490
+ let r = e.play[It(t)], i = 0, a = r.length;
1491
+ for (; i < a;) {
1492
+ let e = i + a >> 1;
1493
+ r[e] <= n ? i = e + 1 : a = e;
1494
+ }
1495
+ return i;
1496
+ }
1497
+ function zt(e, t, n) {
1498
+ return n > 0 ? e.play[It(t)][n - 1] : 0;
1499
+ }
1500
+ function Bt(e, t) {
1501
+ for (let n = Math.min(t, e.ops.length) - 1; n >= 0; n--) {
1502
+ let t = e.ops[n];
1503
+ if (t.kind === "size") return {
1504
+ cols: t.cols,
1505
+ rows: t.rows
1506
+ };
1507
+ }
1508
+ let n = e.ops.find((e) => e.kind === "size");
1509
+ return n ? {
1510
+ cols: n.cols,
1511
+ rows: n.rows
1512
+ } : {
1513
+ cols: 80,
1514
+ rows: 24
1515
+ };
1516
+ }
1517
+ function Vt(e, t, n) {
1518
+ let { ops: r, runs: i } = e;
1519
+ if (!r.length) return null;
1520
+ let a = e.play[It(t)], o = Math.max(1, Rt(e, t, n)), s = r[o - 1], c = s.t, l = r[o];
1521
+ return l && l.run === s.run && a[o] > a[o - 1] && (c += (l.t - s.t) * Math.min(1, Math.max(0, (n - a[o - 1]) / (a[o] - a[o - 1])))), i[s.run].timestamp + c;
1522
+ }
1523
+ function Ht(e, t) {
1524
+ let n = e.play[It(t)];
1525
+ return e.runs.map((e, t) => ({
1526
+ index: t,
1527
+ position: n[e.firstOp] ?? 0,
1528
+ timestamp: e.timestamp
1529
+ }));
1530
+ }
1531
+ function Ut(e, t, n, r = Infinity) {
1532
+ let i = [], a = "";
1533
+ for (let o = t; o < n; o++) {
1534
+ let t = e.ops[o];
1535
+ t.kind === "size" ? (a &&= (i.push({ data: a }), ""), i.push({
1536
+ cols: t.cols,
1537
+ rows: t.rows
1538
+ })) : (a += t.data, a.length >= r && (i.push({ data: a }), a = ""));
1539
+ }
1540
+ return a && i.push({ data: a }), i;
1541
+ }
1542
+ var Wt = (e) => Math.round(e * 1e6) / 1e6;
1543
+ function Gt(e) {
1544
+ let t = e.ops.find((e) => e.kind === "size") ?? {
1545
+ cols: 80,
1546
+ rows: 24
1547
+ }, n = {
1548
+ version: 2,
1549
+ width: t.cols,
1550
+ height: t.rows
1551
+ };
1552
+ e.runs[0]?.timestamp && (n.timestamp = e.runs[0].timestamp);
1553
+ let r = [JSON.stringify(n)], i = t.cols, a = t.rows;
1554
+ return e.ops.forEach((t, n) => {
1555
+ let o = Wt(e.play.full[n]);
1556
+ t.kind === "o" ? r.push(JSON.stringify([
1557
+ o,
1558
+ "o",
1559
+ t.data
1560
+ ])) : (t.cols !== i || t.rows !== a) && (i = t.cols, a = t.rows, r.push(JSON.stringify([
1561
+ o,
1562
+ "r",
1563
+ `${i}x${a}`
1564
+ ])));
1565
+ }), r.join("\n") + "\n";
1566
+ }
1567
+ // src/recording-source.ts
1568
+ var Kt = 1 << 20, qt = 2e3, Jt = 2e3;
1569
+ function Yt(e) {
1570
+ if (!e) return /* @__PURE__ */ new Uint8Array();
1571
+ let t = atob(e), n = new Uint8Array(t.length);
1572
+ for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
1573
+ return n;
1574
+ }
1575
+ var Xt = () => new Promise((e) => setTimeout(e, 0));
1576
+ async function Zt(e) {
1577
+ let t = new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));
1578
+ return new Uint8Array(await new Response(t).arrayBuffer());
1579
+ }
1580
+ function Qt(e) {
1581
+ let t = new Uint8Array(e.reduce((e, t) => e + t.length, 0)), n = 0;
1582
+ for (let r of e) t.set(r, n), n += r.length;
1583
+ return t;
1584
+ }
1585
+ var $t = class {
1586
+ handlers;
1587
+ following;
1588
+ base;
1589
+ controller = new AbortController();
1590
+ format = "asciicast";
1591
+ held = /* @__PURE__ */ new Map();
1592
+ lastSeq = -1;
1593
+ live = null;
1594
+ busy = !1;
1595
+ timer = 0;
1596
+ constructor(e, t, n, r) {
1597
+ this.handlers = n, this.following = r, this.base = `${f(e)}/containers/${encodeURIComponent(t)}/recording`;
1598
+ }
1599
+ start() {
1600
+ this.run(async () => {
1601
+ let e = await this.list();
1602
+ this.format = e.format, this.handlers.begin(e.format, (e.segments[0]?.seq ?? 0) > 0), await this.readNew(e, !0);
1603
+ }), this.timer = window.setInterval(() => {
1604
+ this.following() && document.visibilityState === "visible" && this.run(() => this.follow());
1605
+ }, qt);
1606
+ }
1607
+ close() {
1608
+ window.clearInterval(this.timer), this.controller.abort();
1609
+ }
1610
+ async run(e) {
1611
+ if (!(this.busy || this.controller.signal.aborted)) {
1612
+ this.busy = !0;
1613
+ try {
1614
+ await e();
1615
+ } catch (e) {
1616
+ this.controller.signal.aborted || this.handlers.error(e);
1617
+ } finally {
1618
+ this.busy = !1;
1619
+ }
1620
+ }
1621
+ }
1622
+ async get(e) {
1623
+ let t = await P(e, {
1624
+ signal: this.controller.signal,
1625
+ headers: { Accept: "application/json" }
1626
+ }), n = {};
1627
+ try {
1628
+ n = await t.json();
1629
+ } catch {}
1630
+ if (!t.ok) throw n.error ?? {
1631
+ code: "http_error",
1632
+ message: `HTTP ${t.status}`
1633
+ };
1634
+ return n;
1635
+ }
1636
+ list() {
1637
+ return this.get(this.base);
1638
+ }
1639
+ chunk(e, t) {
1640
+ return this.get(`${this.base}/segments/${e}?offset=${t}&maxBytes=${Kt}`);
1641
+ }
1642
+ async readNew(e, t) {
1643
+ let n = e.segments.filter((e) => e.seq > this.lastSeq || e.seq === this.live?.seq), r = 0;
1644
+ for (let e of n) {
1645
+ if (this.controller.signal.aborted) return;
1646
+ e.seq === this.live?.seq ? (await this.follow(), r++) : (e.live ? (this.live = this.hold(e.seq), await this.readLive() || (this.live = null, await this.readClosed(e.seq))) : await this.readClosed(e.seq), this.lastSeq = Math.max(this.lastSeq, e.seq), r++, t && this.handlers.progress(r, n.length, !1));
1647
+ }
1648
+ t && this.handlers.progress(n.length, n.length, !0);
1649
+ }
1650
+ hold(e) {
1651
+ let t = this.held.get(e);
1652
+ return t || (t = {
1653
+ seq: e,
1654
+ splitter: Dt(),
1655
+ lines: 0,
1656
+ bytes: 0,
1657
+ offset: 0
1658
+ }, this.held.set(e, t)), t;
1659
+ }
1660
+ async readClosed(e) {
1661
+ let t = [], n = 0, r = !1;
1662
+ for (;;) {
1663
+ let i;
1664
+ try {
1665
+ i = await this.chunk(e, n);
1666
+ } catch (e) {
1667
+ if (e.code === "segment_gone") return;
1668
+ throw e;
1669
+ }
1670
+ if (r = i.compressed, t.push(Yt(i.data)), n = i.next, !i.more) break;
1671
+ }
1672
+ let i = Qt(t), a = r ? await Zt(i) : i, o = this.held.get(e);
1673
+ if (this.held.delete(e), this.format === "raw") {
1674
+ let e = a.subarray(o?.bytes ?? 0);
1675
+ e.length && this.handlers.bytes(e);
1676
+ return;
1677
+ }
1678
+ let s = Dt().push(a).slice(o?.lines ?? 0);
1679
+ for (let e = 0; e < s.length; e += Jt) this.handlers.lines(s.slice(e, e + Jt)), e + Jt < s.length && await Xt();
1680
+ }
1681
+ async readLive() {
1682
+ let e = this.live;
1683
+ for (;;) {
1684
+ let t = await this.chunk(e.seq, e.offset);
1685
+ if (!t.live) return !1;
1686
+ if (t.size < e.offset) {
1687
+ e.offset = 0;
1688
+ continue;
1689
+ }
1690
+ let n = Yt(t.data);
1691
+ if (e.offset = t.next, this.format === "raw") e.bytes += n.length, n.length && this.handlers.bytes(n);
1692
+ else {
1693
+ let t = e.splitter.push(n);
1694
+ e.lines += t.length, t.length && this.handlers.lines(t);
1695
+ }
1696
+ if (!t.more) return !0;
1697
+ await Xt();
1698
+ }
1699
+ }
1700
+ async follow() {
1701
+ if (!this.live) {
1702
+ await this.readNew(await this.list(), !1);
1703
+ return;
1704
+ }
1705
+ let e;
1706
+ try {
1707
+ e = await this.readLive();
1708
+ } catch (t) {
1709
+ if (t.code !== "segment_gone") throw t;
1710
+ e = !1;
1711
+ }
1712
+ if (e) return;
1713
+ let t = this.live.seq;
1714
+ this.live = null, await this.readClosed(t), this.lastSeq = Math.max(this.lastSeq, t), await this.readNew(await this.list(), !1);
1715
+ }
1716
+ }, en = [
1717
+ 1,
1718
+ 2,
1719
+ 4,
1720
+ 8
1721
+ ], tn = 5, nn = 262144, rn = 2, an = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace";
1722
+ function on({ container: e, open: t, onToggle: n }) {
1723
+ let r = t ? `Close Replay for ${e}` : `Replay the recorded terminal of ${e}`;
1724
+ return /* @__PURE__ */ I("button", {
1725
+ type: "button",
1726
+ className: "icon-button replay-button",
1727
+ "aria-label": "Replay",
1728
+ "aria-expanded": t,
1729
+ title: r,
1730
+ "data-tooltip": r,
1731
+ onClick: n,
1732
+ children: /* @__PURE__ */ I(z, { name: "replay" })
1733
+ });
1734
+ }
1735
+ var sn = (e) => {
1736
+ let t = Math.max(0, Math.floor(e)), n = Math.floor(t / 3600), r = Math.floor(t / 60) % 60, i = t % 60;
1737
+ return `${n ? `${n}:${String(r).padStart(2, "0")}` : r}:${String(i).padStart(2, "0")}`;
1738
+ }, cn = (e) => e ? (/* @__PURE__ */ new Date(e * 1e3)).toLocaleString() : "";
1739
+ function ln({ scope: e, container: t, live: n, theme: r, expanded: i, onClose: a }) {
1740
+ let o = k(), s = j(null), c = j(null), l = j(null), u = j(null), d = j(null), f = j(jt()), [p, m] = M(null), [h, g] = M(!1), [_, v] = M({
1741
+ phase: "loading",
1742
+ read: 0,
1743
+ total: 0
1744
+ }), [, y] = M(0), [b, x] = M(!1), [S, C] = M(0), [w, T] = M(1), [E, ee] = M(!0), [A, N] = M(!1), P = j({
1745
+ written: 0,
1746
+ position: 0,
1747
+ playing: !1,
1748
+ speed: 1,
1749
+ idleSkip: !0,
1750
+ base: 0,
1751
+ baseAt: 0,
1752
+ pending: 0,
1753
+ seekGeneration: 0,
1754
+ seeking: !1,
1755
+ following: !1
1756
+ }), te = j(n);
1757
+ te.current = n;
1758
+ let F = D(() => {
1759
+ let e = u.current?.element;
1760
+ if (!e || !c.current || !l.current) return;
1761
+ if (d.current) {
1762
+ l.current.clientWidth && l.current.clientHeight && d.current.fit();
1763
+ return;
1764
+ }
1765
+ l.current.style.transform = "";
1766
+ let t = e.offsetWidth, n = e.offsetHeight, r = c.current.getBoundingClientRect();
1767
+ if (!t || !n || !r.width || !r.height) return;
1768
+ let i = Math.min(1, (r.width - 20) / t, (r.height - 20) / n);
1769
+ l.current.style.transform = `scale(${i})`;
1770
+ }, []), ne = D((e) => {
1771
+ let t = P.current;
1772
+ t.pending++, u.current?.write(e, () => {
1773
+ t.pending--;
1774
+ });
1775
+ }, []), R = D((e, t) => {
1776
+ u.current?.write("", () => {
1777
+ !u.current || u.current.cols === e && u.current.rows === t || (u.current.resize(e, t), requestAnimationFrame(F));
1778
+ });
1779
+ }, [F]), B = D((e, t, n) => {
1780
+ for (let r of Ut(f.current, e, t, n)) r.data === void 0 ? R(r.cols, r.rows) : ne(r.data);
1781
+ }, [ne, R]), V = () => new Promise((e) => {
1782
+ u.current ? u.current.write("", e) : e();
1783
+ }), H = D(async (e) => {
1784
+ let t = P.current, n = f.current, r = Lt(n, t.idleSkip);
1785
+ e = Math.min(Math.max(0, e), r);
1786
+ let i = ++t.seekGeneration;
1787
+ if (t.seeking = !0, N(!0), t.position = e, t.base = e, t.baseAt = performance.now(), t.following = !1, C(e), await V(), i !== t.seekGeneration || !u.current) return;
1788
+ let a = Rt(n, t.idleSkip, e);
1789
+ if (a < t.written) {
1790
+ u.current.reset();
1791
+ let e = Bt(n, 0);
1792
+ (u.current.cols !== e.cols || u.current.rows !== e.rows) && (u.current.resize(e.cols, e.rows), F()), t.written = 0;
1793
+ }
1794
+ for (; t.written < a;) {
1795
+ let e = Math.min(a, t.written + 2e3);
1796
+ if (B(t.written, e, nn), t.written = e, await V(), i !== t.seekGeneration) return;
1797
+ }
1798
+ t.base = t.position, t.baseAt = performance.now(), t.seeking = !1, N(!1);
1799
+ }, [F, B]), U = j(H);
1800
+ U.current = H, O(() => {
1801
+ if (!l.current) return;
1802
+ let e = new G({
1803
+ disableStdin: !0,
1804
+ cursorBlink: !1,
1805
+ cursorStyle: "underline",
1806
+ cursorInactiveStyle: "none",
1807
+ fontFamily: an,
1808
+ fontSize: 14,
1809
+ scrollback: 1e3,
1810
+ cols: 80,
1811
+ rows: 24,
1812
+ theme: Fn(r)
1813
+ });
1814
+ u.current = e, e.open(l.current);
1815
+ let t = new ResizeObserver(() => requestAnimationFrame(F));
1816
+ return c.current && t.observe(c.current), () => {
1817
+ t.disconnect(), e.dispose(), u.current = null, d.current = null;
1818
+ };
1819
+ }, []), O(() => {
1820
+ let e = () => {
1821
+ u.current && (u.current.options.theme = Fn(r));
1822
+ };
1823
+ if (e(), r !== "system") return;
1824
+ let t = window.matchMedia("(prefers-color-scheme: dark)");
1825
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
1826
+ }, [r]), O(() => {
1827
+ let e = requestAnimationFrame(F);
1828
+ return () => cancelAnimationFrame(e);
1829
+ }, [i, F]), O(() => {
1830
+ let n = !0, r = 0, i = () => {
1831
+ r ||= requestAnimationFrame(() => {
1832
+ r = 0, y((e) => e + 1);
1833
+ });
1834
+ }, a = new $t(e, t, {
1835
+ begin(e, t) {
1836
+ if (m(e), g(t), e === "raw" && u.current && l.current) {
1837
+ u.current.options.scrollback = 1e4;
1838
+ let e = new K();
1839
+ d.current = e, u.current.loadAddon(e), requestAnimationFrame(F);
1840
+ }
1841
+ },
1842
+ lines(e) {
1843
+ let t = f.current;
1844
+ if (Ft(t, e), n && t.ops.length) {
1845
+ n = !1;
1846
+ let e = Bt(t, 0);
1847
+ u.current?.resize(e.cols, e.rows), requestAnimationFrame(F);
1848
+ }
1849
+ let r = P.current;
1850
+ if (r.following && !r.seeking) {
1851
+ let e = t.ops.length;
1852
+ B(r.written, e), r.written = e, r.position = Lt(t, r.idleSkip), r.base = r.position, r.baseAt = performance.now(), C(r.position);
1853
+ }
1854
+ i();
1855
+ },
1856
+ bytes(e) {
1857
+ u.current?.write(e);
1858
+ },
1859
+ progress(e, t, n) {
1860
+ v({
1861
+ phase: n ? "ready" : "loading",
1862
+ read: e,
1863
+ total: t
1864
+ });
1865
+ },
1866
+ error(e) {
1867
+ v({
1868
+ phase: "error",
1869
+ error: e
1870
+ });
1871
+ }
1872
+ }, () => te.current);
1873
+ return a.start(), () => {
1874
+ a.close(), r && cancelAnimationFrame(r);
1875
+ };
1876
+ }, [e.join("/"), t]), O(() => {
1877
+ if (!b) return;
1878
+ let e = P.current;
1879
+ e.playing = !0, e.base = e.position, e.baseAt = performance.now();
1880
+ let t = 0, n = 0, r = (i) => {
1881
+ if (t = requestAnimationFrame(r), e.seeking) return;
1882
+ let a = f.current, o = Lt(a, e.idleSkip), s = e.base + (i - e.baseAt) / 1e3 * e.speed;
1883
+ if (s >= o) {
1884
+ if (s = o, te.current) e.following = !0;
1885
+ else {
1886
+ B(e.written, a.ops.length), e.written = a.ops.length, e.position = o, C(o), x(!1);
1887
+ return;
1888
+ }
1889
+ }
1890
+ if (e.pending < rn) {
1891
+ let t = Rt(a, e.idleSkip, s);
1892
+ t > e.written && (B(e.written, t), e.written = t), e.position = s;
1893
+ }
1894
+ i - n > 100 && (n = i, C(e.position));
1895
+ };
1896
+ return t = requestAnimationFrame(r), () => {
1897
+ cancelAnimationFrame(t), e.playing = !1, e.following = !1, C(e.position);
1898
+ };
1899
+ }, [b, B]), O(() => {
1900
+ let e = P.current;
1901
+ e.base = e.position, e.baseAt = performance.now(), e.speed = w;
1902
+ }, [w]), O(() => {
1903
+ let e = P.current;
1904
+ e.idleSkip !== E && (e.idleSkip = E, e.position = zt(f.current, E, e.written), e.base = e.position, e.baseAt = performance.now(), C(e.position));
1905
+ }, [E]), O(() => {
1906
+ let e = re();
1907
+ return s.current?.querySelector(".replay-play")?.focus(), e;
1908
+ }, []);
1909
+ function W() {
1910
+ let n = new Blob([Gt(f.current)], { type: "application/x-asciicast" }), r = URL.createObjectURL(n), i = document.createElement("a");
1911
+ i.href = r, i.download = `${[...e, t].join("_")}.cast`, document.body.append(i), i.click(), i.remove(), setTimeout(() => URL.revokeObjectURL(r), 1e3);
1912
+ }
1913
+ let ie = f.current, q = Lt(ie, E), J = () => {
1914
+ b ? x(!1) : (!n && S >= q && q > 0 && H(0), x(!0));
1915
+ };
1916
+ function ae(e) {
1917
+ let t = e.target;
1918
+ e.key === "Escape" && !t.closest("select") ? (e.preventDefault(), e.stopPropagation(), a()) : p !== "asciicast" || t.closest("select, input[type=checkbox]") || (e.key === " " && !t.closest("button") ? (e.preventDefault(), J()) : (e.key === "ArrowRight" || e.key === "ArrowLeft") && (e.preventDefault(), H(P.current.position + (e.key === "ArrowRight" ? tn : -5))));
1919
+ }
1920
+ let Y = _.phase === "error" ? _.error : null, X = Y?.code === "daemon_outdated", oe = _.phase === "loading", Z = p === "asciicast", se = Z ? Ht(ie, E) : [], ce = _.phase === "ready" && (Z ? !ie.ops.some((e) => e.kind === "o") : !1), Q = Z ? Vt(ie, E, S) : null, le = X ? "" : Y ? Y.message : oe ? `Loading the recording…${_.total ? ` (${_.read} of ${_.total} segments)` : ""}` : A ? "Seeking…" : "";
1921
+ return /* @__PURE__ */ L("section", {
1922
+ className: `replay-panel${i ? " is-expanded" : ""}`,
1923
+ ref: s,
1924
+ role: "group",
1925
+ "aria-labelledby": `${o}-title`,
1926
+ onKeyDown: ae,
1927
+ children: [
1928
+ /* @__PURE__ */ L("header", {
1929
+ className: "replay-panel-header",
1930
+ children: [/* @__PURE__ */ L("h2", {
1931
+ id: `${o}-title`,
1932
+ children: ["Replay of ", /* @__PURE__ */ I("code", { children: t })]
1933
+ }), /* @__PURE__ */ L("div", {
1934
+ className: "replay-actions",
1935
+ children: [
1936
+ Z && /* @__PURE__ */ I("button", {
1937
+ type: "button",
1938
+ onClick: W,
1939
+ disabled: !ie.ops.length,
1940
+ children: "Download"
1941
+ }),
1942
+ n && /* @__PURE__ */ I("button", {
1943
+ type: "button",
1944
+ onClick: a,
1945
+ children: "Live"
1946
+ }),
1947
+ /* @__PURE__ */ I("button", {
1948
+ type: "button",
1949
+ className: "replay-close",
1950
+ "aria-label": "Close Replay",
1951
+ onClick: a,
1952
+ children: "Close"
1953
+ })
1954
+ ]
1955
+ })]
1956
+ }),
1957
+ X && /* @__PURE__ */ I("p", {
1958
+ className: "replay-notice",
1959
+ role: "alert",
1960
+ children: "kukeond must be upgraded to replay this terminal. The terminal and its log keep working."
1961
+ }),
1962
+ h && /* @__PURE__ */ I("p", {
1963
+ className: "replay-notice",
1964
+ children: "Earlier output was dropped by retention: the recording starts at its oldest retained output."
1965
+ }),
1966
+ p === "raw" && /* @__PURE__ */ I("p", {
1967
+ className: "replay-notice",
1968
+ children: "This recording has no timing: the container started before recordings were timed. Its output is shown from the oldest retained byte."
1969
+ }),
1970
+ ce && /* @__PURE__ */ I("p", {
1971
+ className: "replay-notice",
1972
+ role: "status",
1973
+ children: "No output recorded yet."
1974
+ }),
1975
+ Z && /* @__PURE__ */ L("div", {
1976
+ className: "replay-controls",
1977
+ children: [
1978
+ /* @__PURE__ */ I("button", {
1979
+ type: "button",
1980
+ className: "icon-button replay-play",
1981
+ "aria-label": b ? "Pause" : "Play",
1982
+ "data-tooltip": b ? "Pause (space)" : "Play (space)",
1983
+ onClick: J,
1984
+ disabled: !ie.ops.length,
1985
+ children: /* @__PURE__ */ I(z, { name: b ? "pause" : "start" })
1986
+ }),
1987
+ /* @__PURE__ */ L("div", {
1988
+ className: "replay-timeline",
1989
+ children: [/* @__PURE__ */ I("input", {
1990
+ type: "range",
1991
+ "aria-label": "Position",
1992
+ min: 0,
1993
+ max: q || 0,
1994
+ step: "any",
1995
+ value: Math.min(S, q),
1996
+ disabled: !ie.ops.length,
1997
+ "aria-valuetext": `${sn(S)} of ${sn(q)}${Q ? `, ${cn(Q)}` : ""}`,
1998
+ onChange: (e) => void H(Number(e.target.value))
1999
+ }), /* @__PURE__ */ I("div", {
2000
+ className: "replay-marks",
2001
+ "aria-hidden": "true",
2002
+ children: se.map((e) => /* @__PURE__ */ I("span", {
2003
+ className: "replay-mark",
2004
+ style: { left: `${q ? e.position / q * 100 : 0}%` },
2005
+ title: `Run ${e.index + 1}: ${cn(e.timestamp)}`
2006
+ }, e.index))
2007
+ })]
2008
+ }),
2009
+ /* @__PURE__ */ L("span", {
2010
+ className: "replay-time",
2011
+ "aria-live": "off",
2012
+ children: [/* @__PURE__ */ L("span", {
2013
+ className: "replay-elapsed",
2014
+ children: [
2015
+ sn(S),
2016
+ " / ",
2017
+ sn(q)
2018
+ ]
2019
+ }), Q ? /* @__PURE__ */ I("time", {
2020
+ className: "replay-wall",
2021
+ dateTime: (/* @__PURE__ */ new Date(Q * 1e3)).toISOString(),
2022
+ children: cn(Q)
2023
+ }) : null]
2024
+ }),
2025
+ se.length > 1 && /* @__PURE__ */ L("span", {
2026
+ className: "replay-runs",
2027
+ children: [se.length, " runs"]
2028
+ }),
2029
+ /* @__PURE__ */ L("label", {
2030
+ className: "replay-speed",
2031
+ children: ["Speed ", /* @__PURE__ */ I("select", {
2032
+ value: w,
2033
+ onChange: (e) => T(Number(e.target.value)),
2034
+ children: en.map((e) => /* @__PURE__ */ L("option", {
2035
+ value: e,
2036
+ children: [e, "×"]
2037
+ }, e))
2038
+ })]
2039
+ }),
2040
+ /* @__PURE__ */ L("label", {
2041
+ className: "replay-idle",
2042
+ children: [/* @__PURE__ */ I("input", {
2043
+ type: "checkbox",
2044
+ checked: E,
2045
+ onChange: (e) => ee(e.target.checked)
2046
+ }), "Skip idle"]
2047
+ })
2048
+ ]
2049
+ }),
2050
+ le && /* @__PURE__ */ I("p", {
2051
+ className: "replay-status",
2052
+ role: "status",
2053
+ children: le
2054
+ }),
2055
+ /* @__PURE__ */ I("div", {
2056
+ className: "replay-screen",
2057
+ ref: c,
2058
+ hidden: X,
2059
+ "aria-label": `Replay for ${[...e, t].join(" / ")}`,
2060
+ children: /* @__PURE__ */ I("div", {
2061
+ ref: l,
2062
+ className: `replay-mount${p === "raw" ? " is-fitted" : ""}`
2063
+ })
1363
2064
  })
1364
2065
  ]
1365
2066
  });
1366
2067
  }
1367
2068
  // src/lifecycle-policy.js
1368
- function Et(e) {
2069
+ function un(e) {
1369
2070
  return e === "Ready" ? ["stop", "restart"] : ["start"];
1370
2071
  }
1371
- function Dt(e, t, n, r) {
2072
+ function dn(e, t, n, r) {
1372
2073
  return e === "purge" ? n === r : t === !0;
1373
2074
  }
1374
- function Ot(e = !1, t = !1) {
2075
+ function fn(e = !1, t = !1) {
1375
2076
  return {
1376
2077
  force: e === !0,
1377
2078
  cascade: t === !0
1378
2079
  };
1379
2080
  }
1380
- function kt(e, t) {
2081
+ function pn(e, t) {
1381
2082
  return e === !0 || t === !1;
1382
2083
  }
1383
- function At(e) {
2084
+ function mn(e) {
1384
2085
  return e.metadataDeleted === !0 && e.cgroupDeleted === !0;
1385
2086
  }
1386
- function jt(e) {
2087
+ function hn(e) {
1387
2088
  return e.purgeSucceeded === !0 && e.metadataDeleted === !0 && e.cgroupDeleted === !0;
1388
2089
  }
1389
- var Mt = "kuke-system";
1390
- function Nt(e) {
2090
+ var gn = "kuke-system";
2091
+ function _n(e) {
1391
2092
  return e.length >= 1 && e.length <= 3 && (e.length !== 1 || e[0] !== "kuke-system");
1392
2093
  }
1393
- function Pt(e) {
1394
- return e[0] === Mt;
2094
+ function vn(e) {
2095
+ return e[0] === gn;
1395
2096
  }
1396
- function Ft(e, t) {
2097
+ function yn(e, t) {
1397
2098
  return t.length > e.length && e.every((e, n) => t[n] === e);
1398
2099
  }
1399
- function It(e, t) {
2100
+ function bn(e, t) {
1400
2101
  let n = [];
1401
- for (let r = t.length; r < 4; r++) n.push((e[r] ?? []).filter((e) => Ft(t, e.scope)).length);
2102
+ for (let r = t.length; r < 4; r++) n.push((e[r] ?? []).filter((e) => yn(t, e.scope)).length);
1402
2103
  return n;
1403
2104
  }
1404
- function Lt(e, t) {
1405
- return (e[3] ?? []).filter((e) => Ft(t, e.scope)).map((e) => e.scope);
2105
+ function xn(e, t) {
2106
+ return (e[3] ?? []).filter((e) => yn(t, e.scope)).map((e) => e.scope);
1406
2107
  }
1407
2108
  // src/terminal-palette.js
1408
- var Rt = "#0d1421", zt = "#f8fafc", Bt = {
2109
+ var Sn = "#0d1421", Cn = "#f8fafc", wn = {
1409
2110
  black: "#000000",
1410
2111
  red: "#cd0000",
1411
2112
  green: "#00cd00",
@@ -1422,7 +2123,7 @@ var Rt = "#0d1421", zt = "#f8fafc", Bt = {
1422
2123
  brightMagenta: "#ff00ff",
1423
2124
  brightCyan: "#00ffff",
1424
2125
  brightWhite: "#ffffff"
1425
- }, Vt = {
2126
+ }, Tn = {
1426
2127
  black: "#1f2328",
1427
2128
  red: "#b3261e",
1428
2129
  green: "#1a7f37",
@@ -1439,15 +2140,15 @@ var Rt = "#0d1421", zt = "#f8fafc", Bt = {
1439
2140
  brightMagenta: "#a626a4",
1440
2141
  brightCyan: "#0e7d8f",
1441
2142
  brightWhite: "#808891"
1442
- }, Ht = 20, Ut = 150, Wt = 2e3, Gt = 20, Kt = [
2143
+ }, En = 20, Dn = 150, On = 2e3, kn = 20, An = [
1443
2144
  1e3,
1444
2145
  2e3,
1445
2146
  5e3
1446
- ], qt = 1e4, $ = (e) => JSON.stringify(e), Jt = (e, t, n = "main") => JSON.stringify([
2147
+ ], jn = 1e4, $ = (e) => JSON.stringify(e), Mn = (e, t, n = "main") => JSON.stringify([
1447
2148
  ...e,
1448
2149
  t,
1449
2150
  n
1450
- ]), Yt = /* @__PURE__ */ new Set([
2151
+ ]), Nn = /* @__PURE__ */ new Set([
1451
2152
  "Stopped",
1452
2153
  "Stopping",
1453
2154
  "Exited",
@@ -1456,21 +2157,21 @@ var Rt = "#0d1421", zt = "#f8fafc", Bt = {
1456
2157
  "Error",
1457
2158
  "Pending",
1458
2159
  "Unknown"
1459
- ]), Xt = {
2160
+ ]), Pn = {
1460
2161
  cursorAccent: "#000000",
1461
2162
  selectionBackground: "#4d4d4d"
1462
2163
  };
1463
- function Zt(e) {
2164
+ function Fn(e) {
1464
2165
  let t = e === "dark" || e === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches;
1465
2166
  return {
1466
- ...Xt,
1467
- ...t ? Bt : Vt,
1468
- background: t ? Rt : zt,
2167
+ ...Pn,
2168
+ ...t ? wn : Tn,
2169
+ background: t ? Sn : Cn,
1469
2170
  foreground: t ? "#e5e6ec" : "#20232b",
1470
2171
  cursor: t ? "#e5e6ec" : "#20232b"
1471
2172
  };
1472
2173
  }
1473
- function Qt(e) {
2174
+ function In(e) {
1474
2175
  let [t, n] = M([]), [r, i] = M({}), a = j(/* @__PURE__ */ new Set()), [o, s] = M({}), c = j(0), l = D((e, t) => {
1475
2176
  c.current += 1;
1476
2177
  let n = c.current;
@@ -1499,10 +2200,10 @@ function Qt(e) {
1499
2200
  [$(e)]: t
1500
2201
  }));
1501
2202
  }, []), m = D((e, t, r = "main") => {
1502
- let i = Jt(e, t, r);
2203
+ let i = Mn(e, t, r);
1503
2204
  n((n) => {
1504
2205
  let a = n.find((e) => e.id === i);
1505
- return a?.state === "attached" || a?.state === "connecting" || n.filter((e) => e.state === "attached" || e.state === "connecting").length >= Ht || !a && n.length >= Gt ? n : a ? n.map((e) => e.id === i ? {
2206
+ return a?.state === "attached" || a?.state === "connecting" || n.filter((e) => e.state === "attached" || e.state === "connecting").length >= En || !a && n.length >= kn ? n : a ? n.map((e) => e.id === i ? {
1506
2207
  ...e,
1507
2208
  generation: e.generation + 1,
1508
2209
  state: "connecting",
@@ -1557,7 +2258,7 @@ function Qt(e) {
1557
2258
  let t = new Map(e.data.rows[3].map((e) => [$(e.scope), e.doc.status?.state ?? ""]));
1558
2259
  n((e) => e.filter((e) => {
1559
2260
  let n = $(e.scope), r = t.get(n);
1560
- return r === void 0 ? !1 : a.current.has(n) ? !0 : !Yt.has(r) || e.state === "interrupted";
2261
+ return r === void 0 ? !1 : a.current.has(n) ? !0 : !Nn.has(r) || e.state === "interrupted";
1561
2262
  })), f((e) => t.has(e)), i((e) => {
1562
2263
  let n = !1, r = { ...e };
1563
2264
  for (let e of Object.keys(r)) t.has(e) || (delete r[e], n = !0);
@@ -1594,7 +2295,7 @@ function Qt(e) {
1594
2295
  pasteDelivered: u
1595
2296
  };
1596
2297
  }
1597
- function $t(e, t, n) {
2298
+ function Ln(e, t, n) {
1598
2299
  let r = j({}), i = j(n);
1599
2300
  return i.current = n, O(() => {
1600
2301
  if (!e) return;
@@ -1603,10 +2304,10 @@ function $t(e, t, n) {
1603
2304
  n.attachedAt ??= Date.now();
1604
2305
  return;
1605
2306
  }
1606
- if (e.state === "connecting" || (n.attachedAt !== void 0 && (Date.now() - n.attachedAt >= qt && (n.count = 0), n.attachedAt = void 0), e.state === "interrupted" && e.reattach && (n.count = 0), !t || e.state === "interrupted" && !e.reattach || n.count >= Kt.length)) return;
2307
+ if (e.state === "connecting" || (n.attachedAt !== void 0 && (Date.now() - n.attachedAt >= jn && (n.count = 0), n.attachedAt = void 0), e.state === "interrupted" && e.reattach && (n.count = 0), !t || e.state === "interrupted" && !e.reattach || n.count >= An.length)) return;
1607
2308
  let a = e, o = window.setTimeout(() => {
1608
2309
  n.count += 1, i.current(a);
1609
- }, e.state === "interrupted" ? 0 : Kt[n.count]);
2310
+ }, e.state === "interrupted" ? 0 : An[n.count]);
1610
2311
  return () => window.clearTimeout(o);
1611
2312
  }, [
1612
2313
  e?.id,
@@ -1618,14 +2319,14 @@ function $t(e, t, n) {
1618
2319
  delete r.current[e];
1619
2320
  }, []);
1620
2321
  }
1621
- function en({ session: e, active: t, expanded: n, theme: r, update: i, pending: a, onPasted: o, endpoint: s }) {
2322
+ function Rn({ session: e, active: t, expanded: n, theme: r, update: i, pending: a, onPasted: o, endpoint: s }) {
1622
2323
  let c = j(null), l = j(null), u = j(null), d = j(() => {}), p = j(""), m = j(t), h = j(!1), g = j({
1623
2324
  received: 0,
1624
2325
  parsed: 0
1625
2326
  }), [_, v] = M(0);
1626
2327
  m.current = t, O(() => {
1627
2328
  if (!c.current) return;
1628
- let e = new q({
2329
+ let e = new G({
1629
2330
  cursorBlink: !0,
1630
2331
  cursorStyle: "underline",
1631
2332
  cursorInactiveStyle: "outline",
@@ -1633,8 +2334,8 @@ function en({ session: e, active: t, expanded: n, theme: r, update: i, pending:
1633
2334
  fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace",
1634
2335
  fontSize: 14,
1635
2336
  scrollback: 2e3,
1636
- theme: Zt(r)
1637
- }), t = new J();
2337
+ theme: Fn(r)
2338
+ }), t = new K();
1638
2339
  l.current = e, e.loadAddon(t), e.open(c.current);
1639
2340
  let n = 0, i = !1, a = (r = !1) => {
1640
2341
  m.current && (i ||= r, n && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
@@ -1661,7 +2362,7 @@ function en({ session: e, active: t, expanded: n, theme: r, update: i, pending:
1661
2362
  };
1662
2363
  }, []), O(() => {
1663
2364
  let e = () => {
1664
- l.current && (l.current.options.theme = Zt(r));
2365
+ l.current && (l.current.options.theme = Fn(r));
1665
2366
  };
1666
2367
  if (e(), r !== "system") return;
1667
2368
  let t = window.matchMedia("(prefers-color-scheme: dark)");
@@ -1672,7 +2373,7 @@ function en({ session: e, active: t, expanded: n, theme: r, update: i, pending:
1672
2373
  if (e.state === "disconnected" || e.state === "interrupted") return;
1673
2374
  let t;
1674
2375
  try {
1675
- t = F(s?.path ?? `${f(e.scope)}/containers/${encodeURIComponent(e.container)}/attach`);
2376
+ t = te(s?.path ?? `${f(e.scope)}/containers/${encodeURIComponent(e.container)}/attach`);
1676
2377
  } catch {
1677
2378
  i(e.id, e.generation, "disconnected", "Terminal connection failed. Check the server and retry.");
1678
2379
  return;
@@ -1734,9 +2435,9 @@ function en({ session: e, active: t, expanded: n, theme: r, update: i, pending:
1734
2435
  nonce: a.nonce,
1735
2436
  at: Date.now()
1736
2437
  });
1737
- let { received: n, parsed: r } = g.current, i = n > 0 && r === n, s = Math.max(0, y.current.at + Wt - Date.now()), c = setTimeout(() => {
2438
+ let { received: n, parsed: r } = g.current, i = n > 0 && r === n, s = Math.max(0, y.current.at + On - Date.now()), c = setTimeout(() => {
1738
2439
  l.current?.paste(a.text), l.current?.focus(), o?.(e.id, a.nonce);
1739
- }, i ? Math.min(Ut, s) : s);
2440
+ }, i ? Math.min(Dn, s) : s);
1740
2441
  return () => clearTimeout(c);
1741
2442
  }, [
1742
2443
  a,
@@ -1751,22 +2452,22 @@ function en({ session: e, active: t, expanded: n, theme: r, update: i, pending:
1751
2452
  d.current(), l.current?.focus();
1752
2453
  });
1753
2454
  return () => cancelAnimationFrame(e);
1754
- }, [t, n]), /* @__PURE__ */ L("div", {
2455
+ }, [t, n]), /* @__PURE__ */ I("div", {
1755
2456
  className: "terminal-session",
1756
2457
  hidden: !t,
1757
2458
  "aria-hidden": !t,
1758
- children: /* @__PURE__ */ L("div", {
2459
+ children: /* @__PURE__ */ I("div", {
1759
2460
  className: "terminal-screen",
1760
2461
  "aria-label": s?.label ?? `Terminal for ${e.scope.join(" / ")} / ${e.container}`,
1761
- children: /* @__PURE__ */ L("div", {
2462
+ children: /* @__PURE__ */ I("div", {
1762
2463
  ref: c,
1763
2464
  className: "terminal-mount"
1764
2465
  })
1765
2466
  })
1766
2467
  });
1767
2468
  }
1768
- function tn({ scope: e, revision: t, inventory: n, manager: r, theme: a, autoAttach: o = !0, visible: c = !0, controlsHost: l, onExpandedChange: u, inPanel: d = !1, onOpenInPanel: p, operation: m, onLifecycleAction: h }) {
1769
- let [g, _] = M(!1), [v, y] = M(""), [b, x] = M(""), S = j(null), C = j(null);
2469
+ function zn({ scope: e, revision: t, inventory: n, manager: r, theme: a, autoAttach: o = !0, visible: c = !0, controlsHost: l, onExpandedChange: u, inPanel: d = !1, onOpenInPanel: p, operation: m, onLifecycleAction: h }) {
2470
+ let [g, _] = M(!1), [v, y] = M(""), [b, x] = M(""), [S, C] = M(""), w = j(null), T = j(null);
1770
2471
  O(() => {
1771
2472
  e || (_(!1), u(!1));
1772
2473
  }, [e, u]), O(() => {
@@ -1778,34 +2479,34 @@ function tn({ scope: e, revision: t, inventory: n, manager: r, theme: a, autoAtt
1778
2479
  ]), O(() => {
1779
2480
  if (!g) return;
1780
2481
  let e = (e) => {
1781
- e.key !== "Escape" || C.current?.contains(e.target) || e.target?.closest?.("details[open]") || (e.preventDefault(), e.stopPropagation(), _(!1), u(!1), requestAnimationFrame(() => S.current?.focus()));
2482
+ e.key !== "Escape" || T.current?.contains(e.target) || e.target?.closest?.("details[open]") || (e.preventDefault(), e.stopPropagation(), _(!1), u(!1), requestAnimationFrame(() => w.current?.focus()));
1782
2483
  };
1783
2484
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
1784
2485
  }, [g]);
1785
- let w = e?.length === 4 ? `${f(e)}/containers` : null, T = i(w, t), E = T.data?.filter((e) => !e.root) ?? [], D = E.filter((e) => e.attachable), ee = E.filter((e) => !e.attachable), k = e ? $(e) : "", A = r.sessions.filter((e) => e.view === "main"), N = A.filter((e) => $(e.scope) === k), P = [
1786
- ...D.map((e) => e.id),
1787
- ...ee.map((e) => e.id),
1788
- ...N.map((e) => e.container).filter((e) => !E.some((t) => t.id === e))
1789
- ], F = P.includes(r.selection[k]) ? r.selection[k] : P[0] ?? "", I = e && F ? Jt(e, F) : "", z = A.find((e) => e.id === I), V = D.some((e) => e.id === F), H = r.sessions.filter((e) => e.state === "attached" || e.state === "connecting").length, U = n.data?.rows[3].find((e) => $(e.scope) === k)?.doc.status?.state, W = U && Yt.has(U), G = E.some((e) => e.id === F), K = (e && G && (!V || W) ? "logs" : "terminal") == "logs", q = !!I && b === I && G && !W, J = !z && (H >= Ht || r.sessions.length >= Gt), re = (z?.state === "disconnected" || z?.state === "interrupted") && H >= Ht;
2486
+ let E = e?.length === 4 ? `${f(e)}/containers` : null, D = i(E, t), ee = D.data?.filter((e) => !e.root) ?? [], k = ee.filter((e) => e.attachable), A = ee.filter((e) => !e.attachable), N = e ? $(e) : "", P = r.sessions.filter((e) => e.view === "main"), te = P.filter((e) => $(e.scope) === N), F = [
2487
+ ...k.map((e) => e.id),
2488
+ ...A.map((e) => e.id),
2489
+ ...te.map((e) => e.container).filter((e) => !ee.some((t) => t.id === e))
2490
+ ], R = F.includes(r.selection[N]) ? r.selection[N] : F[0] ?? "", B = e && R ? Mn(e, R) : "", V = P.find((e) => e.id === B), H = k.some((e) => e.id === R), re = r.sessions.filter((e) => e.state === "attached" || e.state === "connecting").length, U = n.data?.rows[3].find((e) => $(e.scope) === N)?.doc.status?.state, W = U && Nn.has(U), G = ee.some((e) => e.id === R), K = (e && G && (!H || W) ? "logs" : "terminal") == "logs", q = !!B && b === B && G && !W, J = !q && !!B && S === B && H, ae = q || J, Y = !V && (re >= En || r.sessions.length >= kn), X = (V?.state === "disconnected" || V?.state === "interrupted") && re >= En;
1790
2491
  O(() => {
1791
2492
  y("");
1792
- }, [k]);
1793
- let Y = o && c && !!e && !K && !!n.data && !T.loading && !T.error && !!F && V && !W && m?.phase !== "pending" && v !== I;
2493
+ }, [N]);
2494
+ let oe = o && c && !!e && !K && !!n.data && !D.loading && !D.error && !!R && H && !W && m?.phase !== "pending" && v !== B;
1794
2495
  O(() => {
1795
- !Y || J || z || r.autoAttach(e, F, r.selection[k]);
2496
+ !oe || Y || V || r.autoAttach(e, R, r.selection[N]);
1796
2497
  }, [
2498
+ oe,
2499
+ N,
2500
+ R,
1797
2501
  Y,
1798
- k,
1799
- F,
1800
- J,
1801
- z,
2502
+ V,
1802
2503
  r.autoAttach
1803
2504
  ]);
1804
- let ie = $t(z, Y && !re, (e) => r.attach(e.scope, e.container)), ae = !!I && !z && (v === I || !o), oe = K ? "Logs" : z?.state === "attached" ? "Attached" : z?.message || (v === I && I ? "Detached" : J ? "Connection limit reached" : W ? `Unavailable: ${U}` : T.loading ? "Loading containers…" : T.error ? "Container list unavailable" : D.length ? V ? o ? "Connecting…" : "Detached" : "Container unavailable" : "No attachable containers"), X = !!e && !T.loading && !T.error && !E.length && !P.length, Z = z?.state === "attached" || z?.state === "connecting", se = "Terminal limit reached. Detach another terminal to free a connection or retained slot.", Q = T.error && T.data ? "Container list is stale. Refresh before attaching." : "", ce = K ? W ? `Cell is ${U}. Showing the last output of ${F}.` : `Showing the output of ${F}.` : J || re ? se : W && !Z ? `Terminal unavailable: cell is ${U}.` : T.error && !Z ? `${oe}: ${T.error.message}` : Q && !Z ? Q : z?.message || oe, le = !e || X || Z || K || q ? null : J || re ? /* @__PURE__ */ L("p", {
2505
+ let Z = Ln(V, oe && !X, (e) => r.attach(e.scope, e.container)), se = !!B && !V && (v === B || !o), ce = K ? "Logs" : V?.state === "attached" ? "Attached" : V?.message || (v === B && B ? "Detached" : Y ? "Connection limit reached" : W ? `Unavailable: ${U}` : D.loading ? "Loading containers…" : D.error ? "Container list unavailable" : k.length ? H ? o ? "Connecting…" : "Detached" : "Container unavailable" : "No attachable containers"), Q = !!e && !D.loading && !D.error && !ee.length && !F.length, le = V?.state === "attached" || V?.state === "connecting", ue = "Terminal limit reached. Detach another terminal to free a connection or retained slot.", de = D.error && D.data ? "Container list is stale. Refresh before attaching." : "", fe = K ? W ? `Cell is ${U}. Showing the last output of ${R}.` : `Showing the output of ${R}.` : Y || X ? ue : W && !le ? `Terminal unavailable: cell is ${U}.` : D.error && !le ? `${ce}: ${D.error.message}` : de && !le ? de : V?.message || ce, pe = !e || Q || le || K || ae ? null : Y || X ? /* @__PURE__ */ I("p", {
1805
2506
  className: "terminal-limit",
1806
2507
  role: "status",
1807
- children: se
1808
- }) : W ? /* @__PURE__ */ R("p", {
2508
+ children: ue
2509
+ }) : W ? /* @__PURE__ */ L("p", {
1809
2510
  className: "terminal-unavailable",
1810
2511
  role: "status",
1811
2512
  children: [
@@ -1813,272 +2514,289 @@ function tn({ scope: e, revision: t, inventory: n, manager: r, theme: a, autoAtt
1813
2514
  U,
1814
2515
  "."
1815
2516
  ]
1816
- }) : T.error ? /* @__PURE__ */ R(te, { children: [/* @__PURE__ */ L(s, {
1817
- error: T.error,
2517
+ }) : D.error ? /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I(s, {
2518
+ error: D.error,
1818
2519
  kind: "Containers"
1819
- }), Q && /* @__PURE__ */ L("p", {
2520
+ }), de && /* @__PURE__ */ I("p", {
1820
2521
  className: "stale",
1821
- children: Q
1822
- })] }) : T.loading && !T.data ? /* @__PURE__ */ L("p", {
2522
+ children: de
2523
+ })] }) : D.loading && !D.data ? /* @__PURE__ */ I("p", {
1823
2524
  role: "status",
1824
2525
  children: "Loading containers…"
1825
- }) : null, ue = K ? "logs" : z?.state ?? (v === I && I || J || W || T.error || !D.length || !V || !o ? "disconnected" : "connecting"), de = () => {
2526
+ }) : null, me = K ? "logs" : V?.state ?? (v === B && B || Y || W || D.error || !k.length || !H || !o ? "disconnected" : "connecting"), he = () => {
1826
2527
  let e = !g;
1827
2528
  _(e), u(e);
1828
- }, fe = () => {
1829
- y(""), ie(I), r.attach(e, F);
1830
- }, pe = (e, t, n) => /* @__PURE__ */ L("button", {
2529
+ }, ge = () => {
2530
+ y(""), Z(B), r.attach(e, R);
2531
+ }, _e = (e, t, n) => /* @__PURE__ */ I("button", {
1831
2532
  type: "button",
1832
2533
  className: "icon-button",
1833
2534
  "aria-label": e,
1834
2535
  "data-tooltip": e,
1835
2536
  disabled: t,
1836
2537
  onClick: n,
1837
- children: /* @__PURE__ */ L(B, { name: e === "Attach" ? "attach" : e === "Detach" ? "detach" : "reconnect" })
1838
- }), me = z?.state === "attached" || z?.state === "connecting" ? pe("Detach", !1, () => {
1839
- y(z.id), r.detach(z.id);
1840
- }) : z ? /* @__PURE__ */ R(te, { children: [pe("Reconnect", re || !V || !!W || !!T.error, fe), pe("Detach", !1, () => {
1841
- y(z.id), r.detach(z.id);
1842
- })] }) : ae ? pe("Attach", !!J || !V || !!W || !!T.error, fe) : null, he = (e) => D.some((t) => t.id === e) ? e : ee.some((t) => t.id === e) ? `${e} (logs)` : `${e} (unavailable)`, ge = e && /* @__PURE__ */ R("div", {
2538
+ children: /* @__PURE__ */ I(z, { name: e === "Attach" ? "attach" : e === "Detach" ? "detach" : "reconnect" })
2539
+ }), ve = V?.state === "attached" || V?.state === "connecting" ? _e("Detach", !1, () => {
2540
+ y(V.id), r.detach(V.id);
2541
+ }) : V ? /* @__PURE__ */ L(ne, { children: [_e("Reconnect", X || !H || !!W || !!D.error, ge), _e("Detach", !1, () => {
2542
+ y(V.id), r.detach(V.id);
2543
+ })] }) : se ? _e("Attach", !!Y || !H || !!W || !!D.error, ge) : null, ye = (e) => k.some((t) => t.id === e) ? e : A.some((t) => t.id === e) ? `${e} (logs)` : `${e} (unavailable)`, be = e && /* @__PURE__ */ L("div", {
1843
2544
  className: "terminal-workspace-tools",
1844
- children: [!X && /* @__PURE__ */ R("span", {
1845
- className: `terminal-connection-state ${ue}`,
2545
+ children: [!Q && /* @__PURE__ */ L("span", {
2546
+ className: `terminal-connection-state ${me}`,
1846
2547
  role: "status",
1847
2548
  tabIndex: 0,
1848
- title: ce,
1849
- "data-tooltip": ce,
1850
- children: [/* @__PURE__ */ L("span", {
2549
+ title: fe,
2550
+ "data-tooltip": fe,
2551
+ children: [/* @__PURE__ */ I("span", {
1851
2552
  className: "state-dot",
1852
2553
  "aria-hidden": "true"
1853
- }), /* @__PURE__ */ L("span", {
2554
+ }), /* @__PURE__ */ I("span", {
1854
2555
  className: "sr-only",
1855
- children: oe
2556
+ children: ce
1856
2557
  })]
1857
- }), /* @__PURE__ */ R("div", {
2558
+ }), /* @__PURE__ */ L("div", {
1858
2559
  className: "terminal-controls",
1859
2560
  children: [
1860
- !!P.length && /* @__PURE__ */ R(te, { children: [
1861
- /* @__PURE__ */ L("label", {
2561
+ !!F.length && /* @__PURE__ */ L(ne, { children: [
2562
+ /* @__PURE__ */ I("label", {
1862
2563
  htmlFor: "terminal-container",
1863
2564
  className: "sr-only",
1864
2565
  children: "Container"
1865
2566
  }),
1866
- /* @__PURE__ */ L("select", {
2567
+ /* @__PURE__ */ I("select", {
1867
2568
  id: "terminal-container",
1868
2569
  className: "mono-id",
1869
- value: F,
2570
+ value: R,
1870
2571
  onChange: (t) => r.select(e, t.target.value),
1871
- children: P.map((e) => /* @__PURE__ */ L("option", {
2572
+ children: F.map((e) => /* @__PURE__ */ I("option", {
1872
2573
  value: e,
1873
- children: he(e)
2574
+ children: ye(e)
1874
2575
  }, e))
1875
2576
  }),
1876
- !K && me,
1877
- G && /* @__PURE__ */ L(Ct, {
1878
- container: F,
2577
+ !K && ve,
2578
+ H && /* @__PURE__ */ I(on, {
2579
+ container: R,
2580
+ open: J,
2581
+ onToggle: () => {
2582
+ x(""), C(J ? "" : B);
2583
+ }
2584
+ }),
2585
+ G && /* @__PURE__ */ I(Ct, {
2586
+ container: R,
1879
2587
  open: q,
1880
2588
  reason: W ? `Exec unavailable: cell is ${U}.` : "",
1881
- onToggle: () => x(q ? "" : I)
2589
+ onToggle: () => {
2590
+ C(""), x(q ? "" : B);
2591
+ }
1882
2592
  })
1883
2593
  ] }),
1884
- !d && p && /* @__PURE__ */ L("button", {
2594
+ !d && p && /* @__PURE__ */ I("button", {
1885
2595
  type: "button",
1886
2596
  className: "icon-button",
1887
2597
  "aria-label": "Open in side panel",
1888
2598
  "data-tooltip": "Open in side panel",
1889
2599
  onClick: () => p(e),
1890
- children: /* @__PURE__ */ L(B, { name: "sidePanel" })
2600
+ children: /* @__PURE__ */ I(z, { name: "sidePanel" })
1891
2601
  }),
1892
- !X && /* @__PURE__ */ L("button", {
1893
- ref: S,
2602
+ !Q && /* @__PURE__ */ I("button", {
2603
+ ref: w,
1894
2604
  type: "button",
1895
2605
  className: "icon-button",
1896
2606
  "aria-label": g ? "Collapse terminal" : "Expand terminal",
1897
2607
  "data-tooltip": g ? "Collapse terminal" : "Expand terminal",
1898
2608
  "aria-expanded": g,
1899
2609
  "aria-controls": "terminal-screens",
1900
- onClick: de,
1901
- children: /* @__PURE__ */ L(B, { name: g ? "collapse" : "expand" })
2610
+ onClick: he,
2611
+ children: /* @__PURE__ */ I(z, { name: g ? "collapse" : "expand" })
1902
2612
  })
1903
2613
  ]
1904
2614
  })]
1905
2615
  });
1906
- return /* @__PURE__ */ R(te, { children: [ge && l && ne(ge, l), /* @__PURE__ */ R("section", {
1907
- className: `panel terminal-workspace${g ? " is-expanded" : ""}${X ? " is-empty" : ""}`,
2616
+ return /* @__PURE__ */ L(ne, { children: [be && l && ie(be, l), /* @__PURE__ */ L("section", {
2617
+ className: `panel terminal-workspace${g ? " is-expanded" : ""}${Q ? " is-empty" : ""}`,
1908
2618
  id: "cell-terminal",
1909
2619
  hidden: !e,
1910
2620
  "aria-label": "Terminal workspace",
1911
2621
  children: [
1912
- X && /* @__PURE__ */ L("p", {
2622
+ Q && /* @__PURE__ */ I("p", {
1913
2623
  className: "empty-state terminal-empty",
1914
2624
  role: "status",
1915
2625
  children: "No containers are available."
1916
2626
  }),
1917
- le && /* @__PURE__ */ L("div", {
2627
+ pe && /* @__PURE__ */ I("div", {
1918
2628
  className: "terminal-overlay",
1919
- children: le
2629
+ children: pe
1920
2630
  }),
1921
- K && W && /* @__PURE__ */ R("div", {
2631
+ K && W && /* @__PURE__ */ L("div", {
1922
2632
  className: "terminal-log-status",
1923
2633
  role: "status",
1924
- children: [/* @__PURE__ */ R("span", { children: [
2634
+ children: [/* @__PURE__ */ L("span", { children: [
1925
2635
  "Cell is ",
1926
2636
  U,
1927
2637
  ". Showing the last output of ",
1928
- /* @__PURE__ */ L("code", { children: F }),
2638
+ /* @__PURE__ */ I("code", { children: R }),
1929
2639
  "."
1930
- ] }), Et(U).includes("start") && /* @__PURE__ */ L("button", {
2640
+ ] }), un(U).includes("start") && /* @__PURE__ */ I("button", {
1931
2641
  type: "button",
1932
2642
  disabled: m?.phase === "pending",
1933
2643
  onClick: () => h?.(e, "start", U),
1934
2644
  children: "Start"
1935
2645
  })]
1936
2646
  }),
1937
- /* @__PURE__ */ R("div", {
2647
+ /* @__PURE__ */ L("div", {
1938
2648
  className: "terminal-screens",
1939
2649
  id: "terminal-screens",
1940
- ref: C,
2650
+ ref: T,
1941
2651
  children: [
1942
- A.map((t) => /* @__PURE__ */ L(en, {
2652
+ P.map((t) => /* @__PURE__ */ I(Rn, {
1943
2653
  session: t,
1944
- active: !!e && c && !K && !q && t.id === I,
2654
+ active: !!e && c && !K && !ae && t.id === B,
1945
2655
  expanded: g,
1946
2656
  theme: a,
1947
2657
  update: r.update,
1948
2658
  pending: r.pastes[t.id],
1949
2659
  onPasted: r.pasteDelivered
1950
2660
  }, t.id)),
1951
- c && K && !q && /* @__PURE__ */ L(xt, {
2661
+ c && K && !ae && /* @__PURE__ */ I(xt, {
1952
2662
  scope: e,
1953
- container: F,
1954
- attachable: V,
2663
+ container: R,
2664
+ attachable: H,
1955
2665
  live: !W,
1956
2666
  cellState: U,
1957
2667
  revision: t,
1958
2668
  theme: a,
1959
2669
  expanded: g
1960
- }, Jt(e, F)),
1961
- q && /* @__PURE__ */ L(Tt, {
2670
+ }, Mn(e, R)),
2671
+ q && /* @__PURE__ */ I(Tt, {
1962
2672
  scope: e,
1963
- container: F,
2673
+ container: R,
1964
2674
  theme: a,
1965
2675
  visible: c,
1966
2676
  expanded: g,
1967
2677
  onClose: () => x("")
1968
- }, I)
2678
+ }, B),
2679
+ J && c && /* @__PURE__ */ I(ln, {
2680
+ scope: e,
2681
+ container: R,
2682
+ live: !W,
2683
+ theme: a,
2684
+ expanded: g,
2685
+ onClose: () => C("")
2686
+ }, B)
1969
2687
  ]
1970
2688
  })
1971
2689
  ]
1972
2690
  })] });
1973
2691
  }
1974
2692
  // src/settings-values.mjs
1975
- function nn(e, t) {
2693
+ function Bn(e, t) {
1976
2694
  let n = typeof e == "string" ? e.trim() : "";
1977
2695
  if (!/^\d+$/.test(n)) return;
1978
2696
  let r = Number(n);
1979
2697
  return t.includes(r) ? r : void 0;
1980
2698
  }
1981
- var rn = [
2699
+ var Vn = [
1982
2700
  5,
1983
2701
  10,
1984
2702
  30,
1985
2703
  60
1986
2704
  ];
1987
- function an(e) {
1988
- return nn(e, rn);
2705
+ function Hn(e) {
2706
+ return Bn(e, Vn);
1989
2707
  }
1990
- var on = [
2708
+ var Un = [
1991
2709
  1,
1992
2710
  2,
1993
2711
  5,
1994
2712
  10,
1995
2713
  30
1996
2714
  ];
1997
- function sn(e) {
1998
- return nn(e, on);
2715
+ function Wn(e) {
2716
+ return Bn(e, Un);
1999
2717
  }
2000
- var cn = [
2718
+ var Gn = [
2001
2719
  2,
2002
2720
  5,
2003
2721
  10,
2004
2722
  30
2005
2723
  ];
2006
- function ln(e) {
2007
- return nn(e, cn);
2724
+ function Kn(e) {
2725
+ return Bn(e, Gn);
2008
2726
  }
2009
- var un = [
2727
+ var qn = [
2010
2728
  0,
2011
2729
  1,
2012
2730
  3,
2013
2731
  5,
2014
2732
  10
2015
2733
  ];
2016
- function dn(e) {
2017
- return nn(e, un);
2734
+ function Jn(e) {
2735
+ return Bn(e, qn);
2018
2736
  }
2019
- function fn(e) {
2737
+ function Yn(e) {
2020
2738
  if (e === "true" || e === "auto" || e === "shown") return !0;
2021
2739
  if (e === "false" || e === "hidden") return !1;
2022
2740
  }
2023
- function pn(e) {
2741
+ function Xn(e) {
2024
2742
  return e === "true" || e !== "false" && void 0;
2025
2743
  }
2026
2744
  // src/settings.ts
2027
- var mn = [
2745
+ var Zn = [
2028
2746
  "system",
2029
2747
  "light",
2030
2748
  "dark"
2031
- ], hn = {
2749
+ ], Qn = {
2032
2750
  system: "System",
2033
2751
  light: "Light",
2034
2752
  dark: "Dark"
2035
- }, gn = ["agent", "default"], _n = {
2753
+ }, $n = ["agent", "default"], er = {
2036
2754
  agent: "Agent",
2037
2755
  default: "Default"
2038
- }, vn = "Applies to the Default cell list style.", yn = (e, t, n, r) => ({
2756
+ }, tr = "Applies to the Default cell list style.", nr = (e, t, n, r) => ({
2039
2757
  key: e,
2040
2758
  label: t,
2041
2759
  defaultValue: n,
2042
2760
  note: r,
2043
- parse: pn,
2761
+ parse: Xn,
2044
2762
  format: (e) => String(e)
2045
- }), bn = {
2763
+ }), rr = {
2046
2764
  theme: {
2047
2765
  key: "kukeon-theme",
2048
2766
  label: "Appearance",
2049
2767
  defaultValue: "system",
2050
- parse: (e) => mn.includes(e) ? e : void 0,
2768
+ parse: (e) => Zn.includes(e) ? e : void 0,
2051
2769
  format: (e) => e
2052
2770
  },
2053
2771
  cellListStyle: {
2054
2772
  key: "kukeon-cell-list-style",
2055
2773
  label: "Cell list style",
2056
2774
  defaultValue: "agent",
2057
- parse: (e) => gn.includes(e) ? e : void 0,
2775
+ parse: (e) => $n.includes(e) ? e : void 0,
2058
2776
  format: (e) => e
2059
2777
  },
2060
2778
  defaultGroupBy: {
2061
2779
  key: "kukeon-default-group-by",
2062
2780
  label: "Default Group by",
2063
2781
  defaultValue: C,
2064
- note: vn,
2782
+ note: tr,
2065
2783
  parse: (e) => e,
2066
2784
  format: (e) => e
2067
2785
  },
2068
- showCellScope: yn("kukeon-sidebar-show-scope", "Show cell scope in sidebar", !0),
2069
- showTerminalStatus: yn("kukeon-sidebar-show-terminal-status", "Show terminal status in sidebar", !0),
2070
- showUnreadBytes: yn("kukeon-show-unread-bytes", "Show unread bytes", !1),
2071
- showSidebarSearch: yn("kukeon-sidebar-show-search", "Show search in sidebar", !1),
2072
- showSidebarGroupBy: yn("kukeon-sidebar-show-group-by", "Show Group by in sidebar", !1, vn),
2073
- showGridSearch: yn("kukeon-grid-show-search", "Show search in grid", !0),
2074
- showGridGroupBy: yn("kukeon-grid-show-group-by", "Show Group by in grid", !0, vn),
2075
- autoAttach: yn("kukeon-terminal-auto-attach", "Auto-attach terminals", !0),
2786
+ showCellScope: nr("kukeon-sidebar-show-scope", "Show cell scope in sidebar", !0),
2787
+ showTerminalStatus: nr("kukeon-sidebar-show-terminal-status", "Show terminal status in sidebar", !0),
2788
+ showUnreadBytes: nr("kukeon-show-unread-bytes", "Show unread bytes", !1),
2789
+ showSidebarSearch: nr("kukeon-sidebar-show-search", "Show search in sidebar", !1),
2790
+ showSidebarGroupBy: nr("kukeon-sidebar-show-group-by", "Show Group by in sidebar", !1, tr),
2791
+ showGridSearch: nr("kukeon-grid-show-search", "Show search in grid", !0),
2792
+ showGridGroupBy: nr("kukeon-grid-show-group-by", "Show Group by in grid", !0, tr),
2793
+ autoAttach: nr("kukeon-terminal-auto-attach", "Auto-attach terminals", !0),
2076
2794
  refreshSeconds: {
2077
2795
  key: "kukeon-refresh-seconds",
2078
2796
  label: "Refresh interval",
2079
2797
  defaultValue: 10,
2080
2798
  note: "How often the inventory is read while this tab is visible.",
2081
- parse: an,
2799
+ parse: Hn,
2082
2800
  format: (e) => String(e)
2083
2801
  },
2084
2802
  unreadPollSeconds: {
@@ -2086,7 +2804,7 @@ var mn = [
2086
2804
  label: "Unread check interval",
2087
2805
  defaultValue: 2,
2088
2806
  note: "How often terminal output is checked for the unread marks in the sidebar, the collapsed rail and the grid tile badges.",
2089
- parse: sn,
2807
+ parse: Wn,
2090
2808
  format: (e) => String(e)
2091
2809
  },
2092
2810
  gridScreenSeconds: {
@@ -2094,7 +2812,7 @@ var mn = [
2094
2812
  label: "Thumbnail refresh interval",
2095
2813
  defaultValue: 5,
2096
2814
  note: "How often the Workbench grid tiles' terminal thumbnails are read.",
2097
- parse: ln,
2815
+ parse: Kn,
2098
2816
  format: (e) => String(e)
2099
2817
  },
2100
2818
  unreadQuietSeconds: {
@@ -2102,17 +2820,17 @@ var mn = [
2102
2820
  label: "Mark unread after quiet for",
2103
2821
  defaultValue: 0,
2104
2822
  note: "How long a terminal must be quiet before its new output marks the cell. Off marks it on the first new byte.",
2105
- parse: dn,
2823
+ parse: Jn,
2106
2824
  format: (e) => String(e)
2107
2825
  },
2108
2826
  showGetStarted: {
2109
2827
  key: "kukeon-get-started",
2110
2828
  label: "Show Get started",
2111
2829
  defaultValue: !0,
2112
- parse: fn,
2830
+ parse: Yn,
2113
2831
  format: (e) => String(e)
2114
2832
  }
2115
- }, xn = [
2833
+ }, ir = [
2116
2834
  {
2117
2835
  title: "Appearance",
2118
2836
  settings: ["theme"]
@@ -2153,8 +2871,8 @@ var mn = [
2153
2871
  settings: ["showGridSearch", "showGridGroupBy"]
2154
2872
  }
2155
2873
  ];
2156
- function Sn(e) {
2157
- let t = bn[e];
2874
+ function ar(e) {
2875
+ let t = rr[e];
2158
2876
  try {
2159
2877
  let e = localStorage.getItem(t.key);
2160
2878
  return e === null ? t.defaultValue : t.parse(e) ?? t.defaultValue;
@@ -2162,32 +2880,32 @@ function Sn(e) {
2162
2880
  return t.defaultValue;
2163
2881
  }
2164
2882
  }
2165
- function Cn() {
2166
- return Object.fromEntries(Object.keys(bn).map((e) => [e, Sn(e)]));
2883
+ function or() {
2884
+ return Object.fromEntries(Object.keys(rr).map((e) => [e, ar(e)]));
2167
2885
  }
2168
- var wn = Cn(), Tn = /* @__PURE__ */ new Set();
2169
- function En(e) {
2170
- return Tn.add(e), () => {
2171
- Tn.delete(e);
2886
+ var sr = or(), cr = /* @__PURE__ */ new Set();
2887
+ function lr(e) {
2888
+ return cr.add(e), () => {
2889
+ cr.delete(e);
2172
2890
  };
2173
2891
  }
2174
- function Dn(e, t) {
2175
- let n = bn[e];
2892
+ function ur(e, t) {
2893
+ let n = rr[e];
2176
2894
  try {
2177
2895
  localStorage.setItem(n.key, n.format(t));
2178
2896
  } catch {}
2179
- wn = {
2180
- ...wn,
2897
+ sr = {
2898
+ ...sr,
2181
2899
  [e]: t
2182
2900
  };
2183
- for (let e of Tn) e();
2901
+ for (let e of cr) e();
2184
2902
  }
2185
- function On() {
2186
- return [N(En, () => wn), D((e, t) => Dn(e, t), [])];
2903
+ function dr() {
2904
+ return [N(lr, () => sr), D((e, t) => ur(e, t), [])];
2187
2905
  }
2188
2906
  // src/panel-cells.mjs
2189
- var kn = "kukeon-panel-cells", An = (e) => Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string" && e))] : [];
2190
- function jn(e) {
2907
+ var fr = "kukeon-panel-cells", pr = (e) => Array.isArray(e) ? [...new Set(e.filter((e) => typeof e == "string" && e))] : [];
2908
+ function mr(e) {
2191
2909
  if (typeof e != "string") return {
2192
2910
  added: [],
2193
2911
  removed: []
@@ -2205,15 +2923,15 @@ function jn(e) {
2205
2923
  added: [],
2206
2924
  removed: []
2207
2925
  } : {
2208
- added: An(t.added),
2209
- removed: An(t.removed)
2926
+ added: pr(t.added),
2927
+ removed: pr(t.removed)
2210
2928
  };
2211
2929
  }
2212
- function Mn(e, t, n) {
2930
+ function hr(e, t, n) {
2213
2931
  let r = new Set(n.removed), i = new Set(e), a = new Set(t);
2214
2932
  return [...e.filter((e) => !r.has(e)), ...n.added.filter((e) => a.has(e) && !i.has(e))];
2215
2933
  }
2216
- function Nn(e, t, n) {
2934
+ function gr(e, t, n) {
2217
2935
  let r = e.removed.filter((e) => e !== t);
2218
2936
  return n ? {
2219
2937
  added: e.added.filter((e) => e !== t),
@@ -2223,7 +2941,7 @@ function Nn(e, t, n) {
2223
2941
  removed: r
2224
2942
  };
2225
2943
  }
2226
- function Pn(e, t, n) {
2944
+ function _r(e, t, n) {
2227
2945
  let r = e.added.filter((e) => e !== t);
2228
2946
  return n ? {
2229
2947
  added: r,
@@ -2233,38 +2951,38 @@ function Pn(e, t, n) {
2233
2951
  removed: e.removed.filter((e) => e !== t)
2234
2952
  };
2235
2953
  }
2236
- function Fn(e, t) {
2954
+ function vr(e, t) {
2237
2955
  let n = new Set(t);
2238
2956
  return {
2239
2957
  added: e.added.filter((e) => n.has(e)),
2240
2958
  removed: e.removed.filter((e) => n.has(e))
2241
2959
  };
2242
2960
  }
2243
- function In(e, t) {
2961
+ function yr(e, t) {
2244
2962
  return e.added.length === t.added.length && e.removed.length === t.removed.length && e.added.every((e, n) => e === t.added[n]) && e.removed.every((e, n) => e === t.removed[n]);
2245
2963
  }
2246
2964
  // src/majordomo.tsx
2247
- var Ln = "kukeon.io/team", Rn = "kukeon.io/role", zn = "kukeon.io/task", Bn = "kukeon.io/harness", Vn = "kuke", Hn = "majordomo", Un = Hn, Wn = "health-sweep", Gn = "majordomo", Kn = "kukeon-majordomo-active";
2248
- function qn(e) {
2249
- return e?.[Ln] === Vn && e?.[Rn] === Un;
2965
+ var br = "kukeon.io/team", xr = "kukeon.io/role", Sr = "kukeon.io/task", Cr = "kukeon.io/harness", wr = "kuke", Tr = "majordomo", Er = Tr, Dr = "health-sweep", Or = "majordomo", kr = "kukeon-majordomo-active";
2966
+ function Ar(e) {
2967
+ return e?.[br] === wr && e?.[xr] === Er;
2250
2968
  }
2251
- function Jn(e) {
2252
- return qn(e.metadata.labels) && !e.metadata.labels?.[zn];
2969
+ function jr(e) {
2970
+ return Ar(e.metadata.labels) && !e.metadata.labels?.[Sr];
2253
2971
  }
2254
- function Yn(e) {
2255
- return qn(e.metadata.labels) && e.metadata.labels?.[zn] === "health-sweep";
2972
+ function Mr(e) {
2973
+ return Ar(e.metadata.labels) && e.metadata.labels?.[Sr] === "health-sweep";
2256
2974
  }
2257
- function Xn(e) {
2258
- return qn(e.metadata.labels) && !e.metadata.labels?.[zn];
2975
+ function Nr(e) {
2976
+ return Ar(e.metadata.labels) && !e.metadata.labels?.[Sr];
2259
2977
  }
2260
- function Zn(e) {
2978
+ function Pr(e) {
2261
2979
  return [
2262
2980
  e.metadata.realm || "default",
2263
2981
  e.metadata.space || "default",
2264
2982
  e.metadata.stack || "default"
2265
2983
  ];
2266
2984
  }
2267
- function Qn(e) {
2985
+ function Fr(e) {
2268
2986
  return {
2269
2987
  name: e.metadata.name,
2270
2988
  realm: e.metadata.realm,
@@ -2272,34 +2990,34 @@ function Qn(e) {
2272
2990
  stack: e.metadata.stack
2273
2991
  };
2274
2992
  }
2275
- function $n(e, t) {
2993
+ function Ir(e, t) {
2276
2994
  let n = v(e.doc);
2277
- return n ? _(Qn(t), n) : e.doc.metadata.labels?.["kukeon.io/config"] === t.metadata.name && e.scope[0] === Zn(t)[0];
2995
+ return n ? _(Fr(t), n) : e.doc.metadata.labels?.["kukeon.io/config"] === t.metadata.name && e.scope[0] === Pr(t)[0];
2278
2996
  }
2279
- function er(e, t) {
2280
- return t.find((t) => $n(e, t));
2997
+ function Lr(e, t) {
2998
+ return t.find((t) => Ir(e, t));
2281
2999
  }
2282
- function tr(e) {
3000
+ function Rr(e) {
2283
3001
  let t = Date.parse(e.doc.status?.createdAt ?? "");
2284
3002
  return Number.isFinite(t) && !(e.doc.status?.createdAt ?? "").startsWith("0001-") ? t : 2 ** 53 - 1;
2285
3003
  }
2286
- var nr = (e) => e.find((e) => e.doc.status?.state === "Ready") ?? e[0];
2287
- function rr(e, t) {
2288
- let n = i("/catalog/configs", t), [r, a] = M(() => hr(Kn) ?? ""), o = A(() => (e) => {
2289
- a(e), gr(Kn, e);
2290
- }, []), [s, c] = M(() => jn(hr(kn))), l = D((e) => c((t) => {
3004
+ var zr = (e) => e.find((e) => e.doc.status?.state === "Ready") ?? e[0];
3005
+ function Br(e, t) {
3006
+ let n = i("/catalog/configs", t), [r, a] = M(() => Qr(kr) ?? ""), o = A(() => (e) => {
3007
+ a(e), $r(kr, e);
3008
+ }, []), [s, c] = M(() => mr(Qr(fr))), l = D((e) => c((t) => {
2291
3009
  let n = e(t);
2292
- return In(n, t) ? t : n;
3010
+ return yr(n, t) ? t : n;
2293
3011
  }), []);
2294
3012
  O(() => {
2295
- gr(kn, JSON.stringify(s));
3013
+ $r(fr, JSON.stringify(s));
2296
3014
  }, [s]);
2297
3015
  let u = A(() => {
2298
- let t = n.data ?? [], i = e.data?.rows[3] ?? [], a = i.filter((e) => Xn(e.doc)).sort((e, t) => tr(e) - tr(t) || e.scope.join("/").localeCompare(t.scope.join("/"))), c = new Map(i.map((e) => [$(e.scope), e])), u = a.map((e) => $(e.scope)), d = Mn(u, c.keys(), s), f = d.map((e) => c.get(e)), p = f.find((e) => $(e.scope) === r) ?? nr(f), m = p && Xn(p.doc) ? p : nr(f.filter((e) => Xn(e.doc))) ?? nr(a), h = i.filter((e) => !d.includes($(e.scope))).sort((e, t) => e.scope.join("/").localeCompare(t.scope.join("/"))), g = t.filter(Jn), _ = g.filter((e) => !a.some((t) => $n(t, e)));
3016
+ let t = n.data ?? [], i = e.data?.rows[3] ?? [], a = i.filter((e) => Nr(e.doc)).sort((e, t) => Rr(e) - Rr(t) || e.scope.join("/").localeCompare(t.scope.join("/"))), c = new Map(i.map((e) => [$(e.scope), e])), u = a.map((e) => $(e.scope)), d = hr(u, c.keys(), s), f = d.map((e) => c.get(e)), p = f.find((e) => $(e.scope) === r) ?? zr(f), m = p && Nr(p.doc) ? p : zr(f.filter((e) => Nr(e.doc))) ?? zr(a), h = i.filter((e) => !d.includes($(e.scope))).sort((e, t) => e.scope.join("/").localeCompare(t.scope.join("/"))), g = t.filter(jr), _ = g.filter((e) => !a.some((t) => Ir(t, e)));
2299
3017
  return {
2300
3018
  configs: n,
2301
3019
  pairs: g,
2302
- sweeps: t.filter(Yn),
3020
+ sweeps: t.filter(Mr),
2303
3021
  cells: a,
2304
3022
  cell: m,
2305
3023
  panel: f,
@@ -2308,9 +3026,9 @@ function rr(e, t) {
2308
3026
  unused: _,
2309
3027
  select: o,
2310
3028
  add: (e) => {
2311
- l((t) => Nn(t, e, u.includes(e))), o(e);
3029
+ l((t) => gr(t, e, u.includes(e))), o(e);
2312
3030
  },
2313
- remove: (e) => l((t) => Pn(t, e, u.includes(e)))
3031
+ remove: (e) => l((t) => _r(t, e, u.includes(e)))
2314
3032
  };
2315
3033
  }, [
2316
3034
  n,
@@ -2331,65 +3049,65 @@ function rr(e, t) {
2331
3049
  ]);
2332
3050
  let p = f ? (e.data?.rows[3] ?? []).map((e) => $(e.scope)).join("\n") : null;
2333
3051
  return O(() => {
2334
- p !== null && l((e) => Fn(e, p ? p.split("\n") : []));
3052
+ p !== null && l((e) => vr(e, p ? p.split("\n") : []));
2335
3053
  }, [p, l]), u;
2336
3054
  }
2337
- function ir(e) {
3055
+ function Vr(e) {
2338
3056
  return e.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
2339
3057
  }
2340
- function ar(e) {
3058
+ function Hr(e) {
2341
3059
  let t = [`state ${e?.state || "not reported"}`];
2342
3060
  return e?.reason && t.push(`reason: ${e.reason}`), e?.message && t.push(`message: ${e.message}`), e?.outOfSyncError ? t.push(`config comparison failed: ${e.outOfSyncError}`) : e?.outOfSync && t.push(`out of sync with its config: ${e.outOfSyncReason || "reason not reported"}`), t.join("; ");
2343
3061
  }
2344
- function or(e, t) {
2345
- return ir(`About the cell ${e[3]} in realm ${e[0]}, space ${e[1]}, stack ${e[2]} (${ar(t)}): what is going on with it, and what should I do?`);
3062
+ function Ur(e, t) {
3063
+ return Vr(`About the cell ${e[3]} in realm ${e[0]}, space ${e[1]}, stack ${e[2]} (${Hr(t)}): what is going on with it, and what should I do?`);
2346
3064
  }
2347
- function sr(e, t, n) {
3065
+ function Wr(e, t, n) {
2348
3066
  let [r, i, a] = t.length === 4 ? t : [
2349
3067
  t[0],
2350
3068
  t[1],
2351
3069
  t[2]
2352
3070
  ];
2353
- return ir(`About the ${e} ${t.at(-1)} in ${[
3071
+ return Vr(`About the ${e} ${t.at(-1)} in ${[
2354
3072
  `realm ${r}`,
2355
3073
  i && t.length > 2 ? `space ${i}` : "",
2356
3074
  a && t.length > 3 ? `stack ${a}` : ""
2357
3075
  ].filter(Boolean).join(", ")} (${n}): explain what it is for and check whether anything is wrong with it.`);
2358
3076
  }
2359
- var cr = E(null), lr = cr.Provider;
2360
- function ur({ question: e, subject: t, prominent: n = !1 }) {
2361
- let r = ee(cr);
2362
- return r ? /* @__PURE__ */ R("button", {
3077
+ var Gr = E(null), Kr = Gr.Provider;
3078
+ function qr({ question: e, subject: t, prominent: n = !1 }) {
3079
+ let r = ee(Gr);
3080
+ return r ? /* @__PURE__ */ L("button", {
2363
3081
  type: "button",
2364
3082
  className: `ask-majordomo${n ? " is-prominent" : ""}`,
2365
3083
  "aria-label": `Ask majordomo about ${t}`,
2366
3084
  title: "Opens the majordomo panel and pastes this question without sending it",
2367
3085
  onClick: () => r(e),
2368
- children: [/* @__PURE__ */ L(B, { name: "majordomo" }), /* @__PURE__ */ L("span", { children: "Ask majordomo" })]
3086
+ children: [/* @__PURE__ */ I(z, { name: "majordomo" }), /* @__PURE__ */ I("span", { children: "Ask majordomo" })]
2369
3087
  }) : null;
2370
3088
  }
2371
- var dr = "kukeon-majordomo-open", fr = "kukeon-majordomo-width", pr = {
3089
+ var Jr = "kukeon-majordomo-open", Yr = "kukeon-majordomo-width", Xr = {
2372
3090
  min: 320,
2373
3091
  max: 960,
2374
3092
  initial: 480,
2375
3093
  step: 24
2376
3094
  };
2377
- function mr(e) {
2378
- return Math.round(Math.min(pr.max, Math.max(pr.min, e)));
3095
+ function Zr(e) {
3096
+ return Math.round(Math.min(Xr.max, Math.max(Xr.min, e)));
2379
3097
  }
2380
- function hr(e) {
3098
+ function Qr(e) {
2381
3099
  try {
2382
3100
  return localStorage.getItem(e);
2383
3101
  } catch {
2384
3102
  return null;
2385
3103
  }
2386
3104
  }
2387
- function gr(e, t) {
3105
+ function $r(e, t) {
2388
3106
  try {
2389
3107
  localStorage.setItem(e, t);
2390
3108
  } catch {}
2391
3109
  }
2392
- function _r() {
3110
+ function ei() {
2393
3111
  let [e, t] = M(() => window.innerWidth);
2394
3112
  return O(() => {
2395
3113
  let e = 0, n = () => {
@@ -2400,17 +3118,17 @@ function _r() {
2400
3118
  };
2401
3119
  }, []), e;
2402
3120
  }
2403
- function vr(e, t) {
2404
- let [n, r] = M(() => hr(dr) === "true"), [i, a] = M(() => {
2405
- let e = Number(hr(fr));
2406
- return Number.isFinite(e) && e > 0 ? mr(e) : pr.initial;
3121
+ function ti(e, t) {
3122
+ let [n, r] = M(() => Qr(Jr) === "true"), [i, a] = M(() => {
3123
+ let e = Number(Qr(Yr));
3124
+ return Number.isFinite(e) && e > 0 ? Zr(e) : Xr.initial;
2407
3125
  }), [o, s] = M("");
2408
3126
  O(() => {
2409
- gr(dr, String(n));
3127
+ $r(Jr, String(n));
2410
3128
  }, [n]), O(() => {
2411
- gr(fr, String(i));
3129
+ $r(Yr, String(i));
2412
3130
  }, [i]);
2413
- let c = e - t - 800, l = e <= 760 || c < pr.min, u = Math.max(pr.min, Math.min(pr.max, l ? e : c));
3131
+ let c = e - t - 800, l = e <= 760 || c < Xr.min, u = Math.max(Xr.min, Math.min(Xr.max, l ? e : c));
2414
3132
  return {
2415
3133
  open: n,
2416
3134
  setOpen: r,
@@ -2418,61 +3136,61 @@ function vr(e, t) {
2418
3136
  effectiveWidth: Math.min(i, u),
2419
3137
  maxWidth: u,
2420
3138
  overlay: l,
2421
- setWidth: (e) => a(mr(e)),
3139
+ setWidth: (e) => a(Zr(e)),
2422
3140
  question: o,
2423
3141
  ask: (e) => {
2424
- s(ir(e)), r(!0);
3142
+ s(Vr(e)), r(!0);
2425
3143
  },
2426
3144
  clearQuestion: () => s("")
2427
3145
  };
2428
3146
  }
2429
- function yr(e) {
3147
+ function ni(e) {
2430
3148
  return e.cell ? {
2431
3149
  label: `${e.cell.doc.status?.state || "State not reported"}${e.cells.length > 1 ? `, ${e.cells.length} cells` : ""}`,
2432
3150
  state: e.cell.doc.status?.state
2433
3151
  } : e.configs.loading && !e.configs.data ? { label: "Checking…" } : e.configs.error && !e.configs.data ? { label: "Unavailable" } : { label: e.pairs.length ? "Not enabled" : "Not initialized" };
2434
3152
  }
2435
- function br(e) {
3153
+ function ri(e) {
2436
3154
  return !e.cell && !!e.configs.data && !e.pairs.length;
2437
3155
  }
2438
- function xr({ major: e, dock: t, onChanged: n }) {
2439
- let { label: r, state: i } = yr(e);
2440
- return /* @__PURE__ */ R("section", {
3156
+ function ii({ major: e, dock: t, onChanged: n }) {
3157
+ let { label: r, state: i } = ni(e);
3158
+ return /* @__PURE__ */ L("section", {
2441
3159
  className: "majordomo-entry",
2442
3160
  "aria-label": "Majordomo",
2443
- children: [/* @__PURE__ */ R("button", {
3161
+ children: [/* @__PURE__ */ L("button", {
2444
3162
  type: "button",
2445
3163
  className: "majordomo-entry-button",
2446
3164
  "aria-expanded": t.open,
2447
3165
  "aria-controls": "majordomo-panel",
2448
3166
  onClick: () => t.setOpen(!0),
2449
3167
  children: [
2450
- /* @__PURE__ */ L(B, { name: "majordomo" }),
2451
- /* @__PURE__ */ L("span", {
3168
+ /* @__PURE__ */ I(z, { name: "majordomo" }),
3169
+ /* @__PURE__ */ I("span", {
2452
3170
  className: "majordomo-entry-name",
2453
3171
  children: "Majordomo"
2454
3172
  }),
2455
- i ? /* @__PURE__ */ L(U, { state: i }) : /* @__PURE__ */ L("span", {
3173
+ i ? /* @__PURE__ */ I(H, { state: i }) : /* @__PURE__ */ I("span", {
2456
3174
  className: "badge",
2457
3175
  children: r
2458
3176
  }),
2459
- e.cells.length > 1 && /* @__PURE__ */ L("span", {
3177
+ e.cells.length > 1 && /* @__PURE__ */ I("span", {
2460
3178
  className: "badge majordomo-count",
2461
3179
  "aria-label": `${e.cells.length} majordomo cells`,
2462
3180
  title: `${e.cells.length} majordomo cells`,
2463
3181
  children: e.cells.length
2464
3182
  })
2465
3183
  ]
2466
- }), br(e) && /* @__PURE__ */ L(T, {
3184
+ }), ri(e) && /* @__PURE__ */ I(T, {
2467
3185
  compact: !0,
2468
3186
  onChanged: n,
2469
3187
  subject: "majordomo and the agent templates"
2470
3188
  })]
2471
3189
  });
2472
3190
  }
2473
- function Sr({ major: e, dock: t }) {
2474
- let n = `Majordomo (${yr(e).label})`;
2475
- return /* @__PURE__ */ L("button", {
3191
+ function ai({ major: e, dock: t }) {
3192
+ let n = `Majordomo (${ni(e).label})`;
3193
+ return /* @__PURE__ */ I("button", {
2476
3194
  type: "button",
2477
3195
  className: "icon-button rail-majordomo",
2478
3196
  "aria-label": n,
@@ -2480,12 +3198,12 @@ function Sr({ major: e, dock: t }) {
2480
3198
  "aria-expanded": t.open,
2481
3199
  "aria-controls": "majordomo-panel",
2482
3200
  onClick: () => t.setOpen(!0),
2483
- children: /* @__PURE__ */ L(B, { name: "majordomo" })
3201
+ children: /* @__PURE__ */ I(z, { name: "majordomo" })
2484
3202
  });
2485
3203
  }
2486
- function Cr({ dock: e }) {
3204
+ function oi({ dock: e }) {
2487
3205
  let t = e.open ? "Hide majordomo panel" : "Show majordomo panel";
2488
- return /* @__PURE__ */ L("button", {
3206
+ return /* @__PURE__ */ I("button", {
2489
3207
  type: "button",
2490
3208
  className: "icon-button majordomo-toolbar-button",
2491
3209
  "aria-label": t,
@@ -2493,10 +3211,10 @@ function Cr({ dock: e }) {
2493
3211
  "aria-pressed": e.open,
2494
3212
  "aria-controls": "majordomo-panel",
2495
3213
  onClick: () => e.setOpen(!e.open),
2496
- children: /* @__PURE__ */ L(B, { name: "majordomo" })
3214
+ children: /* @__PURE__ */ I(z, { name: "majordomo" })
2497
3215
  });
2498
3216
  }
2499
- async function wr(e, t) {
3217
+ async function si(e, t) {
2500
3218
  let n = await P(e, {
2501
3219
  method: "POST",
2502
3220
  headers: t === void 0 ? { Accept: "application/json" } : {
@@ -2514,7 +3232,7 @@ async function wr(e, t) {
2514
3232
  body: r
2515
3233
  };
2516
3234
  }
2517
- function Tr({ width: e, max: t, onResize: n }) {
3235
+ function ci({ width: e, max: t, onResize: n }) {
2518
3236
  let r = j(null);
2519
3237
  function i(t) {
2520
3238
  t.button === 0 && (t.preventDefault(), r.current = {
@@ -2529,17 +3247,17 @@ function Tr({ width: e, max: t, onResize: n }) {
2529
3247
  r.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
2530
3248
  }
2531
3249
  function s(t) {
2532
- let r = t.key === "ArrowLeft" ? e + pr.step : t.key === "ArrowRight" ? e - pr.step : t.key === "Home" ? pr.max : t.key === "End" ? pr.min : null;
3250
+ let r = t.key === "ArrowLeft" ? e + Xr.step : t.key === "ArrowRight" ? e - Xr.step : t.key === "Home" ? Xr.max : t.key === "End" ? Xr.min : null;
2533
3251
  r !== null && (t.preventDefault(), n(r));
2534
3252
  }
2535
- return /* @__PURE__ */ L("div", {
3253
+ return /* @__PURE__ */ I("div", {
2536
3254
  className: "majordomo-resizer",
2537
3255
  role: "separator",
2538
3256
  "aria-orientation": "vertical",
2539
3257
  "aria-label": "Resize majordomo panel",
2540
3258
  "aria-controls": "majordomo-panel",
2541
3259
  "aria-valuenow": e,
2542
- "aria-valuemin": pr.min,
3260
+ "aria-valuemin": Xr.min,
2543
3261
  "aria-valuemax": t,
2544
3262
  tabIndex: 0,
2545
3263
  onPointerDown: i,
@@ -2549,10 +3267,10 @@ function Tr({ width: e, max: t, onResize: n }) {
2549
3267
  onKeyDown: s
2550
3268
  });
2551
3269
  }
2552
- function Er(e) {
3270
+ function li(e) {
2553
3271
  return p(e).find((e) => d(e) && !!e.login);
2554
3272
  }
2555
- function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged: s }) {
3273
+ function ui({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged: s }) {
2556
3274
  let [c, d] = M(!1), [f, p] = M(""), [m, h] = M(!1), [g, _] = M(0), v = i(m ? "/connectors/logins" : null, g), y = j(!1), b = j(0);
2557
3275
  O(() => {
2558
3276
  if (!m) return;
@@ -2580,16 +3298,16 @@ function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged:
2580
3298
  }
2581
3299
  if (S !== "logged in" && S !== "empty") return null;
2582
3300
  let w = t && S === "empty";
2583
- return /* @__PURE__ */ R("div", {
3301
+ return /* @__PURE__ */ L("div", {
2584
3302
  className: `majordomo-login${w ? " is-asking" : ""}`,
2585
3303
  role: w ? "group" : void 0,
2586
3304
  "aria-label": w ? "Log in first" : void 0,
2587
3305
  children: [
2588
- /* @__PURE__ */ R("p", {
3306
+ /* @__PURE__ */ L("p", {
2589
3307
  role: "status",
2590
3308
  "aria-label": `${x} login`,
2591
3309
  children: [
2592
- /* @__PURE__ */ L("span", {
3310
+ /* @__PURE__ */ I("span", {
2593
3311
  className: `state-dot tone-${S === "logged in" ? "ok" : "stopped"}`,
2594
3312
  "aria-hidden": "true"
2595
3313
  }),
@@ -2598,7 +3316,7 @@ function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged:
2598
3316
  S === "logged in" ? "logged in" : "not logged in"
2599
3317
  ]
2600
3318
  }),
2601
- w && /* @__PURE__ */ R("p", {
3319
+ w && /* @__PURE__ */ L("p", {
2602
3320
  className: "majordomo-login-ask",
2603
3321
  children: [
2604
3322
  "Majordomo starts without a login, and ",
@@ -2606,7 +3324,7 @@ function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged:
2606
3324
  " then asks for one in its terminal. Log in first, or continue."
2607
3325
  ]
2608
3326
  }),
2609
- S === "empty" && e.volumeRef && /* @__PURE__ */ L("button", {
3327
+ S === "empty" && e.volumeRef && /* @__PURE__ */ I("button", {
2610
3328
  type: "button",
2611
3329
  className: "text-button",
2612
3330
  disabled: c || r,
@@ -2614,14 +3332,14 @@ function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged:
2614
3332
  onClick: () => void C(),
2615
3333
  children: c ? "Starting…" : m ? "Open login session" : "Log in"
2616
3334
  }),
2617
- w && /* @__PURE__ */ L("button", {
3335
+ w && /* @__PURE__ */ I("button", {
2618
3336
  type: "button",
2619
3337
  className: "text-button",
2620
3338
  disabled: r,
2621
3339
  onClick: a,
2622
3340
  children: "Continue anyway"
2623
3341
  }),
2624
- f && /* @__PURE__ */ L("p", {
3342
+ f && /* @__PURE__ */ I("p", {
2625
3343
  className: "error",
2626
3344
  role: "alert",
2627
3345
  children: f
@@ -2629,7 +3347,7 @@ function Dr({ status: e, asking: t = !1, busy: r = !1, onContinue: a, onChanged:
2629
3347
  ]
2630
3348
  });
2631
3349
  }
2632
- function Or({ major: e }) {
3350
+ function di({ major: e }) {
2633
3351
  let t = j(null), n = e.configs.data ?? [], r = e.active ? $(e.active.scope) : "";
2634
3352
  function i(n) {
2635
3353
  let i = e.panel.findIndex((e) => $(e.scope) === r), a = n.key === "ArrowRight" ? i + 1 : n.key === "ArrowLeft" ? i - 1 : n.key === "Home" ? 0 : n.key === "End" ? e.panel.length - 1 : null;
@@ -2638,16 +3356,16 @@ function Or({ major: e }) {
2638
3356
  let o = e.panel[(a + e.panel.length) % e.panel.length];
2639
3357
  e.select($(o.scope)), requestAnimationFrame(() => t.current?.querySelector("[aria-selected=\"true\"]")?.focus());
2640
3358
  }
2641
- let a = (e) => er(e, n)?.metadata.name ?? v(e.doc)?.name ?? e.doc.metadata.labels?.["kukeon.io/config"] ?? e.doc.metadata.name, o = e.panel.filter((e) => Xn(e.doc)).map(a);
2642
- return /* @__PURE__ */ L("div", {
3359
+ let a = (e) => Lr(e, n)?.metadata.name ?? v(e.doc)?.name ?? e.doc.metadata.labels?.["kukeon.io/config"] ?? e.doc.metadata.name, o = e.panel.filter((e) => Nr(e.doc)).map(a);
3360
+ return /* @__PURE__ */ I("div", {
2643
3361
  className: "majordomo-tabs",
2644
3362
  role: "tablist",
2645
3363
  "aria-label": "Panel cells",
2646
3364
  ref: t,
2647
3365
  onKeyDown: i,
2648
3366
  children: e.panel.map((t) => {
2649
- let n = $(t.scope), i = n === r, s = Xn(t.doc) ? a(t) : "", c = s && o.indexOf(s) === o.lastIndexOf(s) ? s : t.doc.metadata.name, l = t.doc.status?.state, u = l === "Ready" ? "ok" : l && Yt.has(l) ? "stopped" : "pending";
2650
- return /* @__PURE__ */ R("button", {
3367
+ let n = $(t.scope), i = n === r, s = Nr(t.doc) ? a(t) : "", c = s && o.indexOf(s) === o.lastIndexOf(s) ? s : t.doc.metadata.name, l = t.doc.status?.state, u = l === "Ready" ? "ok" : l && Nn.has(l) ? "stopped" : "pending";
3368
+ return /* @__PURE__ */ L("button", {
2651
3369
  type: "button",
2652
3370
  role: "tab",
2653
3371
  className: "majordomo-tab",
@@ -2657,15 +3375,15 @@ function Or({ major: e }) {
2657
3375
  title: `${t.scope.join(" / ")} (${l || "state not reported"})`,
2658
3376
  onClick: () => e.select(n),
2659
3377
  children: [
2660
- /* @__PURE__ */ L("span", {
3378
+ /* @__PURE__ */ I("span", {
2661
3379
  className: `state-dot tone-${u}`,
2662
3380
  "aria-hidden": "true"
2663
3381
  }),
2664
- /* @__PURE__ */ L("span", {
3382
+ /* @__PURE__ */ I("span", {
2665
3383
  className: "majordomo-tab-label",
2666
3384
  children: c
2667
3385
  }),
2668
- /* @__PURE__ */ R("span", {
3386
+ /* @__PURE__ */ L("span", {
2669
3387
  className: "sr-only",
2670
3388
  children: [", ", l || "state not reported"]
2671
3389
  })
@@ -2674,12 +3392,12 @@ function Or({ major: e }) {
2674
3392
  })
2675
3393
  });
2676
3394
  }
2677
- function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o, onChanged: c }) {
2678
- let l = e.active, u = l?.scope ?? null, d = u ? $(u) : "", p = !!l && Xn(l.doc), m = p ? "majordomo" : l?.doc.metadata.name ?? "", h = l?.doc.status?.state, g = !!u && !!h && !Yt.has(h), _ = i(u ? `${f(u)}/containers` : null, o), v = _.data?.filter((e) => e.attachable && !e.root) ?? [], y = v.some((e) => e.id === r.selection[d]) ? r.selection[d] : v[0]?.id ?? "", b = u && y ? Jt(u, y, "panel") : "", x = e.panel.map((e) => $(e.scope)), S = r.sessions.filter((e) => e.view === "panel" && x.includes($(e.scope))), C = S.find((e) => e.id === b), [w, E] = M({}), [D, ee] = M(""), [k, A] = M(!1), [j, N] = M(!1), [P, F] = M(""), [I, z] = M(""), [V, H] = M(""), [W, G] = M(!1), K = !l && !e.cells.length, ne = !l && !K && !j && !k, q = e.cells.length ? e.unused : e.pairs, J = q.find((e) => JSON.stringify([...Zn(e), e.metadata.name]) === D) ?? q[0], re = K || k, Y = Er(re ? J : p ? er(l, e.configs.data ?? []) : void 0), ie = re && Y?.login?.state === "empty";
3395
+ function fi({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o, onChanged: c }) {
3396
+ let l = e.active, u = l?.scope ?? null, d = u ? $(u) : "", p = !!l && Nr(l.doc), m = p ? "majordomo" : l?.doc.metadata.name ?? "", h = l?.doc.status?.state, g = !!u && !!h && !Nn.has(h), _ = i(u ? `${f(u)}/containers` : null, o), v = _.data?.filter((e) => e.attachable && !e.root) ?? [], y = v.some((e) => e.id === r.selection[d]) ? r.selection[d] : v[0]?.id ?? "", b = u && y ? Mn(u, y, "panel") : "", x = e.panel.map((e) => $(e.scope)), S = r.sessions.filter((e) => e.view === "panel" && x.includes($(e.scope))), C = S.find((e) => e.id === b), [w, E] = M({}), [D, ee] = M(""), [k, A] = M(!1), [j, N] = M(!1), [P, te] = M(""), [F, R] = M(""), [B, V] = M(""), [re, U] = M(!1), W = !l && !e.cells.length, ie = !l && !W && !j && !k, G = e.cells.length ? e.unused : e.pairs, K = G.find((e) => JSON.stringify([...Pr(e), e.metadata.name]) === D) ?? G[0], q = W || k, J = li(q ? K : p ? Lr(l, e.configs.data ?? []) : void 0), ae = q && J?.login?.state === "empty";
2679
3397
  O(() => {
2680
- ie || G(!1);
2681
- }, [ie]);
2682
- let ae = !_.loading && !!_.data, oe = e.candidates.some((e) => $(e.scope) === P) ? P : e.candidates[0] ? $(e.candidates[0].scope) : "", [{ autoAttach: X }] = On(), Z = X && t.open && !!u && g && !!y && !w[d] && ae;
3398
+ ae || U(!1);
3399
+ }, [ae]);
3400
+ let Y = !_.loading && !!_.data, X = e.candidates.some((e) => $(e.scope) === P) ? P : e.candidates[0] ? $(e.candidates[0].scope) : "", [{ autoAttach: oe }] = dr(), Z = oe && t.open && !!u && g && !!y && !w[d] && Y;
2683
3401
  O(() => {
2684
3402
  Z && !C && r.attach(u, y, "panel");
2685
3403
  }, [
@@ -2689,13 +3407,13 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2689
3407
  C,
2690
3408
  r.attach
2691
3409
  ]);
2692
- let se = $t(C, Z, (e) => r.attach(e.scope, e.container, "panel")), Q = e.cell ? $(e.cell.scope) : "", ce = x.includes(Q);
3410
+ let se = Ln(C, Z, (e) => r.attach(e.scope, e.container, "panel")), ce = e.cell ? $(e.cell.scope) : "", Q = x.includes(ce);
2693
3411
  O(() => {
2694
- t.question && Q && !p && (ce ? e.select(Q) : e.add(Q));
3412
+ t.question && ce && !p && (Q ? e.select(ce) : e.add(ce));
2695
3413
  }, [
2696
3414
  t.question,
2697
- Q,
2698
3415
  ce,
3416
+ Q,
2699
3417
  p
2700
3418
  ]), O(() => {
2701
3419
  t.question && p && C && C.state === "attached" && (r.paste(C.id, t.question), t.clearQuestion());
@@ -2705,36 +3423,36 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2705
3423
  C?.id,
2706
3424
  C?.state
2707
3425
  ]), O(() => {
2708
- q.length || A(!1);
2709
- }, [q.length]), O(() => {
3426
+ G.length || A(!1);
3427
+ }, [G.length]), O(() => {
2710
3428
  e.candidates.length || N(!1);
2711
3429
  }, [e.candidates.length]);
2712
3430
  async function le(e) {
2713
- let t = await wr(`${f(e)}/start`);
3431
+ let t = await si(`${f(e)}/start`);
2714
3432
  if (!t.ok) throw Error(t.body.error?.message ?? `HTTP ${t.status}`);
2715
3433
  }
2716
3434
  async function ue(t = !1) {
2717
- if (!J || I || !K && !k) return;
2718
- if (ie && !t) {
2719
- G(!0);
3435
+ if (!K || F || !W && !k) return;
3436
+ if (ae && !t) {
3437
+ U(!0);
2720
3438
  return;
2721
3439
  }
2722
- G(!1), z("enable"), H("");
2723
- let r = e.cells.length ? J.metadata.name : Gn;
3440
+ U(!1), R("enable"), V("");
3441
+ let r = e.cells.length ? K.metadata.name : Or;
2724
3442
  try {
2725
3443
  let t = {
2726
3444
  config: {
2727
- name: J.metadata.name,
2728
- realm: J.metadata.realm,
2729
- space: J.metadata.space,
2730
- stack: J.metadata.stack
3445
+ name: K.metadata.name,
3446
+ realm: K.metadata.realm,
3447
+ space: K.metadata.space,
3448
+ stack: K.metadata.stack
2731
3449
  },
2732
3450
  name: r,
2733
3451
  env: [],
2734
3452
  ignoreDiskPressure: !1
2735
- }, i = await wr("/cells/from-config/preview", t);
3453
+ }, i = await si("/cells/from-config/preview", t);
2736
3454
  if (!i.ok) throw Error(i.body.error?.message ?? `HTTP ${i.status}`);
2737
- let a = i.body.document, o = await wr("/cells/from-config/create", {
3455
+ let a = i.body.document, o = await si("/cells/from-config/create", {
2738
3456
  ...t,
2739
3457
  resolvedName: a?.metadata.name,
2740
3458
  preview: i.body.preview
@@ -2742,23 +3460,23 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2742
3460
  if (!o.ok) throw Error(o.body.error?.message ?? `HTTP ${o.status}`);
2743
3461
  let s = o.body;
2744
3462
  n.upsertCell(s);
2745
- let c = [...Zn(J), s.metadata.name];
3463
+ let c = [...Pr(K), s.metadata.name];
2746
3464
  e.select($(c)), A(!1), await le(c);
2747
3465
  } catch (e) {
2748
- H(e instanceof Error ? e.message : "The request could not reach the web server.");
3466
+ V(e instanceof Error ? e.message : "The request could not reach the web server.");
2749
3467
  } finally {
2750
- z(""), c();
3468
+ R(""), c();
2751
3469
  }
2752
3470
  }
2753
3471
  async function de() {
2754
- if (u && !I) {
2755
- z("start"), H("");
3472
+ if (u && !F) {
3473
+ R("start"), V("");
2756
3474
  try {
2757
3475
  await le(u);
2758
3476
  } catch (e) {
2759
- H(e instanceof Error ? e.message : "The request could not reach the web server.");
3477
+ V(e instanceof Error ? e.message : "The request could not reach the web server.");
2760
3478
  } finally {
2761
- z(""), c();
3479
+ R(""), c();
2762
3480
  }
2763
3481
  }
2764
3482
  }
@@ -2767,10 +3485,10 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2767
3485
  r.detachView(t.scope, "panel"), E((e) => {
2768
3486
  let t = { ...e };
2769
3487
  return delete t[n], t;
2770
- }), H(""), e.remove(n);
3488
+ }), V(""), e.remove(n);
2771
3489
  }
2772
3490
  function pe() {
2773
- oe && (e.add(oe), N(!1), F(""));
3491
+ X && (e.add(X), N(!1), te(""));
2774
3492
  }
2775
3493
  let me = () => {
2776
3494
  A(!1), N((e) => !e);
@@ -2785,7 +3503,7 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2785
3503
  } : !_.loading && !v.length ? {
2786
3504
  tone: "disconnected",
2787
3505
  label: "No attachable container"
2788
- } : X ? {
3506
+ } : oe ? {
2789
3507
  tone: "connecting",
2790
3508
  label: "Connecting…"
2791
3509
  } : {
@@ -2796,186 +3514,186 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2796
3514
  label: `Cell is ${h || "in an unknown state"}`
2797
3515
  } : {
2798
3516
  tone: "disconnected",
2799
- label: K ? "No majordomo cell" : "No cell in the panel"
3517
+ label: W ? "No majordomo cell" : "No cell in the panel"
2800
3518
  }, ve = !!u && g && !!y && !ge, ye = () => {
2801
3519
  u && y && (E((e) => ({
2802
3520
  ...e,
2803
3521
  [d]: !1
2804
3522
  })), se(b), r.attach(u, y, "panel"));
2805
- }, be = (t, n) => /* @__PURE__ */ R(te, { children: [
2806
- /* @__PURE__ */ L("p", { children: t }),
2807
- /* @__PURE__ */ R("label", { children: ["Harness", /* @__PURE__ */ L("select", {
2808
- value: J ? JSON.stringify([...Zn(J), J.metadata.name]) : "",
2809
- disabled: !!I,
3523
+ }, be = (t, n) => /* @__PURE__ */ L(ne, { children: [
3524
+ /* @__PURE__ */ I("p", { children: t }),
3525
+ /* @__PURE__ */ L("label", { children: ["Harness", /* @__PURE__ */ I("select", {
3526
+ value: K ? JSON.stringify([...Pr(K), K.metadata.name]) : "",
3527
+ disabled: !!F,
2810
3528
  onChange: (e) => ee(e.target.value),
2811
- children: q.map((e) => {
2812
- let t = JSON.stringify([...Zn(e), e.metadata.name]);
2813
- return /* @__PURE__ */ L("option", {
3529
+ children: G.map((e) => {
3530
+ let t = JSON.stringify([...Pr(e), e.metadata.name]);
3531
+ return /* @__PURE__ */ I("option", {
2814
3532
  value: t,
2815
3533
  children: e.metadata.name
2816
3534
  }, t);
2817
3535
  })
2818
3536
  })] }),
2819
- /* @__PURE__ */ L("button", {
3537
+ /* @__PURE__ */ I("button", {
2820
3538
  type: "button",
2821
3539
  className: "majordomo-primary",
2822
- disabled: !!I || !J,
2823
- "aria-busy": I === "enable" || void 0,
3540
+ disabled: !!F || !K,
3541
+ "aria-busy": F === "enable" || void 0,
2824
3542
  onClick: () => void ue(),
2825
- children: I === "enable" ? e.cells.length ? "Adding majordomo…" : "Enabling majordomo…" : e.cells.length ? "Add majordomo" : "Enable majordomo"
3543
+ children: F === "enable" ? e.cells.length ? "Adding majordomo…" : "Enabling majordomo…" : e.cells.length ? "Add majordomo" : "Enable majordomo"
2826
3544
  }),
2827
- /* @__PURE__ */ L("small", { children: n })
2828
- ] }), xe = "Majordomo is kukeon's own assistant: ask it for help, and it changes things only when you ask.", Se = j ? /* @__PURE__ */ R("div", {
3545
+ /* @__PURE__ */ I("small", { children: n })
3546
+ ] }), xe = "Majordomo is kukeon's own assistant: ask it for help, and it changes things only when you ask.", Se = j ? /* @__PURE__ */ L("div", {
2829
3547
  className: "majordomo-setup majordomo-add",
2830
3548
  role: "group",
2831
3549
  "aria-label": "Add cell to the panel",
2832
3550
  children: [
2833
- /* @__PURE__ */ L("p", { children: "Add a cell to the side panel. It stays open beside every page, and its cell screen keeps its own terminal." }),
2834
- /* @__PURE__ */ R("label", { children: ["Cell", /* @__PURE__ */ L("select", {
2835
- value: oe,
2836
- onChange: (e) => F(e.target.value),
3551
+ /* @__PURE__ */ I("p", { children: "Add a cell to the side panel. It stays open beside every page, and its cell screen keeps its own terminal." }),
3552
+ /* @__PURE__ */ L("label", { children: ["Cell", /* @__PURE__ */ I("select", {
3553
+ value: X,
3554
+ onChange: (e) => te(e.target.value),
2837
3555
  children: e.candidates.map((e) => {
2838
3556
  let t = $(e.scope);
2839
- return /* @__PURE__ */ L("option", {
3557
+ return /* @__PURE__ */ I("option", {
2840
3558
  value: t,
2841
3559
  children: e.scope.join(" / ")
2842
3560
  }, t);
2843
3561
  })
2844
3562
  })] }),
2845
- /* @__PURE__ */ L("button", {
3563
+ /* @__PURE__ */ I("button", {
2846
3564
  type: "button",
2847
3565
  className: "majordomo-primary",
2848
- disabled: !oe,
3566
+ disabled: !X,
2849
3567
  onClick: pe,
2850
3568
  children: "Add to panel"
2851
3569
  }),
2852
- /* @__PURE__ */ L("button", {
3570
+ /* @__PURE__ */ I("button", {
2853
3571
  type: "button",
2854
3572
  className: "text-button",
2855
3573
  onClick: () => N(!1),
2856
3574
  children: "Cancel"
2857
3575
  })
2858
3576
  ]
2859
- }) : k ? /* @__PURE__ */ R("div", {
3577
+ }) : k ? /* @__PURE__ */ L("div", {
2860
3578
  className: "majordomo-setup majordomo-add",
2861
3579
  role: "group",
2862
3580
  "aria-label": "Add majordomo",
2863
- children: [e.cells.length ? be("Add another majordomo with a different harness. Each runs in its own cell, in its own tab.", "Creates and starts a cell named after the selected config.") : be(xe, `Creates and starts one cell named ${Gn} from the selected config.`), /* @__PURE__ */ L("button", {
3581
+ children: [e.cells.length ? be("Add another majordomo with a different harness. Each runs in its own cell, in its own tab.", "Creates and starts a cell named after the selected config.") : be(xe, `Creates and starts one cell named ${Or} from the selected config.`), /* @__PURE__ */ I("button", {
2864
3582
  type: "button",
2865
3583
  className: "text-button",
2866
- disabled: !!I,
3584
+ disabled: !!F,
2867
3585
  onClick: () => A(!1),
2868
3586
  children: "Cancel"
2869
3587
  })]
2870
- }) : K ? /* @__PURE__ */ L("div", {
3588
+ }) : W ? /* @__PURE__ */ I("div", {
2871
3589
  className: "majordomo-setup",
2872
- children: e.configs.loading && !e.configs.data ? /* @__PURE__ */ L("p", {
3590
+ children: e.configs.loading && !e.configs.data ? /* @__PURE__ */ I("p", {
2873
3591
  role: "status",
2874
3592
  children: "Looking for majordomo configs…"
2875
- }) : e.configs.error && !e.configs.data ? /* @__PURE__ */ L(s, {
3593
+ }) : e.configs.error && !e.configs.data ? /* @__PURE__ */ I(s, {
2876
3594
  error: e.configs.error,
2877
3595
  kind: "Configs"
2878
- }) : e.pairs.length ? be(xe, `Creates and starts one cell named ${Gn} from the selected config.`) : /* @__PURE__ */ R("div", {
3596
+ }) : e.pairs.length ? be(xe, `Creates and starts one cell named ${Or} from the selected config.`) : /* @__PURE__ */ L("div", {
2879
3597
  className: "majordomo-missing",
2880
- children: [/* @__PURE__ */ R("p", {
3598
+ children: [/* @__PURE__ */ L("p", {
2881
3599
  role: "status",
2882
- children: [/* @__PURE__ */ L("strong", { children: "Majordomo is not installed on this host." }), " Initialize applies its configs."]
2883
- }), /* @__PURE__ */ L(T, {
3600
+ children: [/* @__PURE__ */ I("strong", { children: "Majordomo is not installed on this host." }), " Initialize applies its configs."]
3601
+ }), /* @__PURE__ */ I(T, {
2884
3602
  onChanged: c,
2885
3603
  subject: "majordomo and the agent templates"
2886
3604
  })]
2887
3605
  })
2888
- }) : ne ? /* @__PURE__ */ R("div", {
3606
+ }) : ie ? /* @__PURE__ */ L("div", {
2889
3607
  className: "majordomo-setup majordomo-empty",
2890
- children: [/* @__PURE__ */ L("p", {
3608
+ children: [/* @__PURE__ */ I("p", {
2891
3609
  role: "status",
2892
3610
  children: "The side panel holds no cells. Add any cell to it, majordomo included."
2893
- }), /* @__PURE__ */ L("button", {
3611
+ }), /* @__PURE__ */ I("button", {
2894
3612
  type: "button",
2895
3613
  className: "majordomo-primary",
2896
3614
  disabled: !e.candidates.length,
2897
3615
  onClick: () => N(!0),
2898
3616
  children: "Add cell"
2899
3617
  })]
2900
- }) : u && !g ? /* @__PURE__ */ R("div", {
3618
+ }) : u && !g ? /* @__PURE__ */ L("div", {
2901
3619
  className: "majordomo-setup",
2902
- children: [/* @__PURE__ */ R("p", {
3620
+ children: [/* @__PURE__ */ L("p", {
2903
3621
  role: "status",
2904
3622
  children: [
2905
3623
  p ? "The majordomo cell" : "The cell",
2906
3624
  " ",
2907
- /* @__PURE__ */ L("code", { children: u.join(" / ") }),
3625
+ /* @__PURE__ */ I("code", { children: u.join(" / ") }),
2908
3626
  " is ",
2909
- /* @__PURE__ */ L(U, { state: h }),
3627
+ /* @__PURE__ */ I(H, { state: h }),
2910
3628
  "."
2911
3629
  ]
2912
- }), /* @__PURE__ */ L("button", {
3630
+ }), /* @__PURE__ */ I("button", {
2913
3631
  type: "button",
2914
3632
  className: "majordomo-primary",
2915
- disabled: !!I,
2916
- "aria-busy": I === "start" || void 0,
3633
+ disabled: !!F,
3634
+ "aria-busy": F === "start" || void 0,
2917
3635
  onClick: de,
2918
- children: I === "start" ? "Starting…" : "Start"
3636
+ children: F === "start" ? "Starting…" : "Start"
2919
3637
  })]
2920
3638
  }) : null, Ce = e.panel.length > 1 || !!l && !p, we = k || j;
2921
- return /* @__PURE__ */ R("aside", {
3639
+ return /* @__PURE__ */ L("aside", {
2922
3640
  className: "majordomo-panel",
2923
3641
  id: "majordomo-panel",
2924
3642
  "aria-label": "Majordomo panel",
2925
3643
  hidden: !t.open,
2926
3644
  style: { width: t.effectiveWidth },
2927
3645
  children: [
2928
- /* @__PURE__ */ L(Tr, {
3646
+ /* @__PURE__ */ I(ci, {
2929
3647
  width: t.effectiveWidth,
2930
3648
  max: t.maxWidth,
2931
3649
  onResize: t.setWidth
2932
3650
  }),
2933
- /* @__PURE__ */ R("header", {
3651
+ /* @__PURE__ */ L("header", {
2934
3652
  className: "majordomo-header",
2935
3653
  children: [
2936
- /* @__PURE__ */ R("h2", { children: [/* @__PURE__ */ L(B, { name: "majordomo" }), "Majordomo"] }),
2937
- /* @__PURE__ */ R("span", {
3654
+ /* @__PURE__ */ L("h2", { children: [/* @__PURE__ */ I(z, { name: "majordomo" }), "Majordomo"] }),
3655
+ /* @__PURE__ */ L("span", {
2938
3656
  className: `terminal-connection-state ${_e.tone}`,
2939
3657
  role: "status",
2940
3658
  title: _e.label,
2941
- children: [/* @__PURE__ */ L("span", {
3659
+ children: [/* @__PURE__ */ I("span", {
2942
3660
  className: "state-dot",
2943
3661
  "aria-hidden": "true"
2944
- }), /* @__PURE__ */ L("span", {
3662
+ }), /* @__PURE__ */ I("span", {
2945
3663
  className: "majordomo-connection-label",
2946
3664
  children: _e.label
2947
3665
  })]
2948
3666
  }),
2949
- /* @__PURE__ */ R("div", {
3667
+ /* @__PURE__ */ L("div", {
2950
3668
  className: "majordomo-header-actions",
2951
3669
  children: [
2952
- e.candidates.length > 0 && !ne && /* @__PURE__ */ L("button", {
3670
+ e.candidates.length > 0 && !ie && /* @__PURE__ */ I("button", {
2953
3671
  type: "button",
2954
3672
  className: "icon-button",
2955
3673
  "aria-label": "Add cell",
2956
3674
  title: "Add a cell to the side panel",
2957
3675
  "aria-expanded": j,
2958
3676
  onClick: me,
2959
- children: /* @__PURE__ */ L(B, { name: "sidePanel" })
3677
+ children: /* @__PURE__ */ I(z, { name: "sidePanel" })
2960
3678
  }),
2961
- q.length > 0 && !K && /* @__PURE__ */ L("button", {
3679
+ G.length > 0 && !W && /* @__PURE__ */ I("button", {
2962
3680
  type: "button",
2963
3681
  className: "icon-button",
2964
3682
  "aria-label": "Add majordomo",
2965
3683
  title: e.cells.length ? "Add majordomo with another harness" : "Enable majordomo",
2966
3684
  "aria-expanded": k,
2967
3685
  onClick: he,
2968
- children: /* @__PURE__ */ L(B, { name: "create" })
3686
+ children: /* @__PURE__ */ I(z, { name: "create" })
2969
3687
  }),
2970
- ve && /* @__PURE__ */ L("button", {
3688
+ ve && /* @__PURE__ */ I("button", {
2971
3689
  type: "button",
2972
3690
  className: "icon-button",
2973
3691
  "aria-label": `Reconnect ${m}`,
2974
3692
  title: "Reconnect",
2975
3693
  onClick: ye,
2976
- children: /* @__PURE__ */ L(B, { name: "reconnect" })
3694
+ children: /* @__PURE__ */ I(z, { name: "reconnect" })
2977
3695
  }),
2978
- ge && C && /* @__PURE__ */ L("button", {
3696
+ ge && C && /* @__PURE__ */ I("button", {
2979
3697
  type: "button",
2980
3698
  className: "icon-button",
2981
3699
  "aria-label": `Detach ${m}`,
@@ -2986,38 +3704,38 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
2986
3704
  [d]: !0
2987
3705
  })), r.detach(C.id);
2988
3706
  },
2989
- children: /* @__PURE__ */ L(B, { name: "detach" })
3707
+ children: /* @__PURE__ */ I(z, { name: "detach" })
2990
3708
  }),
2991
- l && /* @__PURE__ */ L("button", {
3709
+ l && /* @__PURE__ */ I("button", {
2992
3710
  type: "button",
2993
3711
  className: "icon-button",
2994
3712
  "aria-label": `Remove ${l.doc.metadata.name} from the side panel`,
2995
3713
  title: "Remove from the side panel (the cell and its cell screen's terminal stay)",
2996
3714
  onClick: () => fe(l),
2997
- children: /* @__PURE__ */ L(B, { name: "remove" })
3715
+ children: /* @__PURE__ */ I(z, { name: "remove" })
2998
3716
  }),
2999
- /* @__PURE__ */ L("button", {
3717
+ /* @__PURE__ */ I("button", {
3000
3718
  type: "button",
3001
3719
  className: "icon-button",
3002
3720
  "aria-label": "Collapse majordomo panel",
3003
3721
  title: "Collapse (the session stays attached)",
3004
3722
  onClick: () => t.setOpen(!1),
3005
- children: /* @__PURE__ */ L(B, { name: "sidebarExpand" })
3723
+ children: /* @__PURE__ */ I(z, { name: "sidebarExpand" })
3006
3724
  })
3007
3725
  ]
3008
3726
  })
3009
3727
  ]
3010
3728
  }),
3011
- Ce && /* @__PURE__ */ L(Or, { major: e }),
3012
- t.question && /* @__PURE__ */ R("p", {
3729
+ Ce && /* @__PURE__ */ I(di, { major: e }),
3730
+ t.question && /* @__PURE__ */ L("p", {
3013
3731
  className: "majordomo-question",
3014
3732
  role: "status",
3015
3733
  children: [
3016
- /* @__PURE__ */ L("strong", { children: "Waiting to paste:" }),
3734
+ /* @__PURE__ */ I("strong", { children: "Waiting to paste:" }),
3017
3735
  " ",
3018
3736
  t.question,
3019
3737
  " ",
3020
- /* @__PURE__ */ L("button", {
3738
+ /* @__PURE__ */ I("button", {
3021
3739
  type: "button",
3022
3740
  className: "text-button",
3023
3741
  onClick: t.clearQuestion,
@@ -3025,30 +3743,30 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
3025
3743
  })
3026
3744
  ]
3027
3745
  }),
3028
- Y && /* @__PURE__ */ L(Dr, {
3029
- status: Y,
3030
- asking: W,
3031
- busy: !!I,
3746
+ J && /* @__PURE__ */ I(ui, {
3747
+ status: J,
3748
+ asking: re,
3749
+ busy: !!F,
3032
3750
  onContinue: () => void ue(!0),
3033
3751
  onChanged: c
3034
- }, `${Y.connector}/${JSON.stringify(Y.volumeRef ?? null)}`),
3035
- V && /* @__PURE__ */ R("div", {
3752
+ }, `${J.connector}/${JSON.stringify(J.volumeRef ?? null)}`),
3753
+ B && /* @__PURE__ */ L("div", {
3036
3754
  className: "error",
3037
3755
  role: "alert",
3038
- children: [/* @__PURE__ */ L("strong", { children: u && !k ? p ? "Majordomo did not start" : "The cell did not start" : e.cells.length ? "Majordomo could not be added" : "Majordomo could not be enabled" }), /* @__PURE__ */ L("p", { children: V })]
3756
+ children: [/* @__PURE__ */ I("strong", { children: u && !k ? p ? "Majordomo did not start" : "The cell did not start" : e.cells.length ? "Majordomo could not be added" : "Majordomo could not be enabled" }), /* @__PURE__ */ I("p", { children: B })]
3039
3757
  }),
3040
3758
  Se,
3041
- u && g && !we && _.error && !ge && /* @__PURE__ */ L(s, {
3759
+ u && g && !we && _.error && !ge && /* @__PURE__ */ I(s, {
3042
3760
  error: _.error,
3043
3761
  kind: "Containers"
3044
3762
  }),
3045
- /* @__PURE__ */ L("div", {
3763
+ /* @__PURE__ */ I("div", {
3046
3764
  className: "majordomo-screens",
3047
3765
  id: "majordomo-screens",
3048
3766
  role: Ce ? "tabpanel" : void 0,
3049
3767
  "aria-label": l ? `Terminal of ${l.doc.metadata.name}` : void 0,
3050
3768
  hidden: !u || !g || we,
3051
- children: S.map((e) => /* @__PURE__ */ L(en, {
3769
+ children: S.map((e) => /* @__PURE__ */ I(Rn, {
3052
3770
  session: e,
3053
3771
  active: t.open && !we && e.id === b,
3054
3772
  expanded: !1,
@@ -3061,4 +3779,4 @@ function kr({ major: e, dock: t, inventory: n, manager: r, theme: a, revision: o
3061
3779
  ]
3062
3780
  });
3063
3781
  }
3064
- export { nt as $, on as A, At as B, On as C, sn as D, an as E, Qt as F, Ot as G, Pt as H, Et as I, mt as J, ut as K, Dt as L, tn as M, $ as N, dn as O, Yt as P, Ze as Q, kt as R, mn as S, ln as T, Nt as U, It as V, jt as W, rt as X, Xe as Y, Qe as Z, _n as _, fe as _t, xr as a, Ee as at, bn as b, or as c, _e as ct, Hn as d, ke as dt, Ye as et, ir as f, Oe as ft, _r as g, Q as gt, vr as h, le as ht, Sr as i, we as it, un as j, rn as k, Zn as l, Ce as lt, rr as m, ce as mt, lr as n, Ve as nt, Cr as o, he as ot, Wn as p, De as pt, lt as q, kr as r, ze as rt, sr as s, ve as st, ur as t, et as tt, Bn as u, Te as ut, gn as v, ue as vt, cn as w, hn as x, xn as y, pe as yt, Lt as z };
3782
+ export { nt as $, Un as A, mn as B, dr as C, Wn as D, Hn as E, In as F, fn as G, vn as H, un as I, mt as J, ut as K, dn as L, zn as M, $ as N, Jn as O, Nn as P, Ze as Q, pn as R, Zn as S, Kn as T, _n as U, bn as V, hn as W, rt as X, Xe as Y, Qe as Z, er as _, fe as _t, ii as a, Ee as at, rr as b, Ur as c, _e as ct, Tr as d, ke as dt, Ye as et, Vr as f, Oe as ft, ei as g, ce as gt, ti as h, le as ht, ai as i, we as it, qn as j, Vn as k, Pr as l, Ce as lt, Br as m, Q as mt, Kr as n, Ve as nt, oi as o, he as ot, Dr as p, De as pt, lt as q, fi as r, ze as rt, Wr as s, ve as st, qr as t, et as tt, Cr as u, Te as ut, $n as v, ue as vt, Gn as w, Qn as x, ir as y, pe as yt, xn as z };