citadel_cli 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -15
- package/dist/.vite/manifest.json +0 -4
- package/dist/citadel.css +472 -1
- package/dist/citadel.es.js +1103 -1604
- package/dist/citadel.umd.cjs +479 -0
- package/dist/citadel.umd.js +295 -837
- package/dist/components/Citadel/config/defaults.d.ts +6 -2
- package/dist/components/Citadel/config/types.d.ts +12 -4
- package/dist/components/Citadel/hooks/useGlobalShortcut.d.ts +2 -1
- package/dist/components/Citadel/hooks/useSlideAnimation.d.ts +1 -5
- package/dist/components/Citadel/types/command-dsl.d.ts +2 -1
- package/dist/components/Citadel/types/command-results.d.ts +7 -0
- package/dist/components/Citadel/utils/typography.d.ts +0 -1
- package/package.json +10 -6
package/dist/citadel.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as m, jsxs as
|
|
5
|
-
import
|
|
6
|
-
import { createRoot as
|
|
7
|
-
var
|
|
8
|
-
class
|
|
1
|
+
var Ie = Object.defineProperty;
|
|
2
|
+
var Pe = (t, e, n) => e in t ? Ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var y = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as m, jsxs as A, Fragment as He } from "react/jsx-runtime";
|
|
5
|
+
import $, { createContext as Re, useState as _, useMemo as P, useEffect as I, useContext as Z, useCallback as f, useReducer as _e, useRef as T, useLayoutEffect as Me } from "react";
|
|
6
|
+
import { createRoot as Te } from "react-dom/client";
|
|
7
|
+
var V = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Success = "success", t.Failure = "failure", t.Timeout = "timeout", t))(V || {});
|
|
8
|
+
class K {
|
|
9
9
|
constructor(e = Date.now()) {
|
|
10
|
-
|
|
10
|
+
y(this, "_status", "pending");
|
|
11
11
|
this.timestamp = e;
|
|
12
12
|
}
|
|
13
13
|
get status() {
|
|
@@ -23,80 +23,88 @@ class O {
|
|
|
23
23
|
this._status = "timeout";
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class ze extends K {
|
|
27
27
|
constructor(e, n) {
|
|
28
28
|
super(n), this.data = e;
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
return /* @__PURE__ */ m("pre", { className: "
|
|
31
|
+
return /* @__PURE__ */ m("pre", { className: "citadel-result-json", children: JSON.stringify(this.data, null, 2) });
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class G extends K {
|
|
35
35
|
constructor(e, n) {
|
|
36
36
|
super(n), this.text = e;
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
-
return /* @__PURE__ */ m("div", { className: "
|
|
39
|
+
return /* @__PURE__ */ m("div", { className: "citadel-result-text", children: this.text });
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
class
|
|
42
|
+
class De extends K {
|
|
43
|
+
constructor(e, n = "true", s = "false", r) {
|
|
44
|
+
super(r), this.value = e, this.trueText = n, this.falseText = s;
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return /* @__PURE__ */ m("div", { className: "citadel-result-text citadel-result-boolean", children: this.value ? this.trueText : this.falseText });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class we extends K {
|
|
43
51
|
constructor(e, n) {
|
|
44
52
|
super(n), this.error = e, this.markFailure();
|
|
45
53
|
}
|
|
46
54
|
render() {
|
|
47
|
-
return /* @__PURE__ */ m("div", { className: "
|
|
55
|
+
return /* @__PURE__ */ m("div", { className: "citadel-result-error", children: this.error });
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
|
-
class
|
|
58
|
+
class Oe extends K {
|
|
51
59
|
render() {
|
|
52
|
-
return /* @__PURE__ */ m("div", { className: "
|
|
60
|
+
return /* @__PURE__ */ m("div", { className: "citadel-result-pending", children: "..." });
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
|
-
class
|
|
56
|
-
constructor(e, n = "",
|
|
57
|
-
super(
|
|
63
|
+
class Fe extends K {
|
|
64
|
+
constructor(e, n = "", s) {
|
|
65
|
+
super(s), this.imageUrl = e, this.altText = n;
|
|
58
66
|
}
|
|
59
67
|
render() {
|
|
60
|
-
return /* @__PURE__ */ m("div", { className: "
|
|
68
|
+
return /* @__PURE__ */ m("div", { className: "citadel-result-image-wrap", children: /* @__PURE__ */ m(
|
|
61
69
|
"img",
|
|
62
70
|
{
|
|
63
71
|
src: this.imageUrl,
|
|
64
72
|
alt: this.altText,
|
|
65
|
-
className: "
|
|
73
|
+
className: "citadel-result-image"
|
|
66
74
|
}
|
|
67
75
|
) });
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
|
-
const
|
|
71
|
-
const n = t.commands.filter((
|
|
72
|
-
const
|
|
78
|
+
const Le = (t) => async function() {
|
|
79
|
+
const n = t.commands.filter((s) => s.fullPath[0] !== "help").map((s) => {
|
|
80
|
+
const o = `${s.segments.map((c) => c.type === "argument" ? `<${c.name}>` : c.name).join(" ")} - ${s.description}`, a = s.segments.filter((c) => c.type === "argument" && c.description).map((c) => ` <${c.name}>: ${c.description}`);
|
|
73
81
|
return {
|
|
74
|
-
commandLine:
|
|
75
|
-
argumentLines:
|
|
82
|
+
commandLine: o,
|
|
83
|
+
argumentLines: a
|
|
76
84
|
};
|
|
77
|
-
}).sort((
|
|
78
|
-
|
|
79
|
-
...
|
|
85
|
+
}).sort((s, r) => s.commandLine.localeCompare(r.commandLine)).flatMap((s) => [
|
|
86
|
+
s.commandLine,
|
|
87
|
+
...s.argumentLines
|
|
80
88
|
]);
|
|
81
|
-
return n.length === 0 ? new
|
|
89
|
+
return n.length === 0 ? new G(
|
|
82
90
|
"No commands available yet. Add some commands to get started!"
|
|
83
|
-
) : (n.push("help - Show available commands"), new
|
|
91
|
+
) : (n.push("help - Show available commands"), new G(
|
|
84
92
|
`Available Commands:
|
|
85
93
|
` + n.join(`
|
|
86
94
|
`)
|
|
87
95
|
));
|
|
88
96
|
};
|
|
89
|
-
var
|
|
90
|
-
const
|
|
91
|
-
class
|
|
97
|
+
var ie = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.ERROR = 1] = "ERROR", t[t.WARN = 2] = "WARN", t[t.INFO = 3] = "INFO", t[t.DEBUG = 4] = "DEBUG", t[t.TRACE = 5] = "TRACE", t))(ie || {});
|
|
98
|
+
const ue = !0;
|
|
99
|
+
class b {
|
|
92
100
|
static configure(e) {
|
|
93
101
|
this.level = e.level, this.prefix = e.prefix || "[Citadel]";
|
|
94
102
|
}
|
|
95
103
|
static trace(...e) {
|
|
96
|
-
this.level >= 5 && !
|
|
104
|
+
this.level >= 5 && !ue && console.trace(this.prefix, ...e);
|
|
97
105
|
}
|
|
98
106
|
static debug(...e) {
|
|
99
|
-
this.level >= 4 && !
|
|
107
|
+
this.level >= 4 && !ue && console.debug(this.prefix, ...e);
|
|
100
108
|
}
|
|
101
109
|
static info(...e) {
|
|
102
110
|
this.level >= 3 && console.info(this.prefix, ...e);
|
|
@@ -108,8 +116,8 @@ class k {
|
|
|
108
116
|
this.level >= 1 && console.error(this.prefix, ...e);
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
|
-
b
|
|
112
|
-
const
|
|
119
|
+
y(b, "level", 0), y(b, "prefix", "");
|
|
120
|
+
const x = {
|
|
113
121
|
commandTimeoutMs: 1e4,
|
|
114
122
|
cursorColor: "var(--cursor-color, #fff)",
|
|
115
123
|
cursorSpeed: 530,
|
|
@@ -117,63 +125,65 @@ const N = {
|
|
|
117
125
|
includeHelpCommand: !0,
|
|
118
126
|
fontFamily: "monospace",
|
|
119
127
|
fontSize: "0.875rem",
|
|
120
|
-
initialHeight: "
|
|
121
|
-
logLevel:
|
|
128
|
+
initialHeight: "50vh",
|
|
129
|
+
logLevel: ie.ERROR,
|
|
122
130
|
maxHeight: "80vh",
|
|
123
131
|
minHeight: "200",
|
|
124
132
|
outputFontSize: "0.875rem",
|
|
125
133
|
resetStateOnHide: !1,
|
|
134
|
+
closeOnEscape: !0,
|
|
126
135
|
showCitadelKey: ".",
|
|
136
|
+
showOnLoad: !1,
|
|
127
137
|
displayMode: "panel",
|
|
128
138
|
storage: {
|
|
129
139
|
type: "localStorage",
|
|
130
140
|
maxCommands: 100
|
|
131
141
|
}
|
|
132
|
-
},
|
|
133
|
-
class
|
|
134
|
-
constructor(e, n,
|
|
135
|
-
this.type = e, this.name = n, this.description =
|
|
142
|
+
}, Ce = async () => new G("");
|
|
143
|
+
class ce {
|
|
144
|
+
constructor(e, n, s) {
|
|
145
|
+
this.type = e, this.name = n, this.description = s;
|
|
136
146
|
}
|
|
137
147
|
toString() {
|
|
138
148
|
return this.name;
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
|
-
class
|
|
151
|
+
class le extends ce {
|
|
142
152
|
constructor() {
|
|
143
153
|
super("null", ">null<", "Empty segment");
|
|
144
154
|
}
|
|
145
155
|
}
|
|
146
|
-
class
|
|
156
|
+
class ve extends ce {
|
|
147
157
|
constructor(e, n) {
|
|
148
158
|
super("word", e, n);
|
|
149
159
|
}
|
|
150
160
|
}
|
|
151
|
-
class
|
|
152
|
-
constructor(e, n,
|
|
153
|
-
super("argument", e, n), this.value =
|
|
161
|
+
class q extends ce {
|
|
162
|
+
constructor(e, n, s, r) {
|
|
163
|
+
super("argument", e, n), this.value = s, this.valid = r;
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
|
-
const
|
|
166
|
+
const je = (t) => {
|
|
157
167
|
if (t.type === "word")
|
|
158
|
-
return new
|
|
168
|
+
return new ve(t.name, t.description);
|
|
159
169
|
if (t.type === "argument") {
|
|
160
170
|
const e = t;
|
|
161
|
-
return new
|
|
171
|
+
return new q(
|
|
162
172
|
e.name,
|
|
163
173
|
e.description,
|
|
164
174
|
e.value,
|
|
165
175
|
e.valid
|
|
166
176
|
);
|
|
167
177
|
}
|
|
168
|
-
return new
|
|
169
|
-
},
|
|
170
|
-
class
|
|
171
|
-
constructor(e, n,
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
return new le();
|
|
179
|
+
}, z = (t) => t.map((e) => je(e));
|
|
180
|
+
class Ue {
|
|
181
|
+
constructor(e, n, s = Ce) {
|
|
182
|
+
y(this, "_segments");
|
|
183
|
+
y(this, "_description");
|
|
174
184
|
// Used by `Help` command, etc.
|
|
175
|
-
|
|
176
|
-
this._segments = e, this._description = n, this._handler =
|
|
185
|
+
y(this, "_handler");
|
|
186
|
+
this._segments = e, this._description = n, this._handler = s;
|
|
177
187
|
}
|
|
178
188
|
get segments() {
|
|
179
189
|
return this._segments;
|
|
@@ -197,9 +207,9 @@ class De {
|
|
|
197
207
|
return this.fullPath.join(" ") === e.fullPath.join(" ");
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
|
-
class
|
|
210
|
+
class ee {
|
|
201
211
|
constructor() {
|
|
202
|
-
|
|
212
|
+
y(this, "_commands", []);
|
|
203
213
|
}
|
|
204
214
|
get commands() {
|
|
205
215
|
return this._commands;
|
|
@@ -215,20 +225,20 @@ class X {
|
|
|
215
225
|
* @param handler Async handler executed when the command is submitted; defaults to `NoopHandler`.
|
|
216
226
|
* @throws {Error} If the segment list is empty or the path collides with an existing command.
|
|
217
227
|
*/
|
|
218
|
-
addCommand(e, n,
|
|
228
|
+
addCommand(e, n, s = Ce) {
|
|
219
229
|
if (e === void 0 || e.length === 0)
|
|
220
230
|
throw new Error("Command path cannot be empty");
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
(
|
|
224
|
-
).join(" "),
|
|
225
|
-
(
|
|
231
|
+
const r = new Ue(e, n, s), o = this._commands.find((a) => {
|
|
232
|
+
const c = a.segments.map(
|
|
233
|
+
(d) => d.type === "argument" ? "*" : d.name
|
|
234
|
+
).join(" "), i = e.map(
|
|
235
|
+
(d) => d.type === "argument" ? "*" : d.name
|
|
226
236
|
).join(" ");
|
|
227
|
-
return
|
|
237
|
+
return c === i;
|
|
228
238
|
});
|
|
229
|
-
if (
|
|
230
|
-
throw new Error(`Duplicate commands: '${
|
|
231
|
-
this._commands.push(
|
|
239
|
+
if (o)
|
|
240
|
+
throw new Error(`Duplicate commands: '${o.fullPath_s}' and '${r.fullPath_s}'`);
|
|
241
|
+
this._commands.push(r);
|
|
232
242
|
}
|
|
233
243
|
/**
|
|
234
244
|
* Removes a command that exactly matches the provided path.
|
|
@@ -237,8 +247,8 @@ class X {
|
|
|
237
247
|
* @returns True if a command was removed; otherwise false.
|
|
238
248
|
*/
|
|
239
249
|
removeCommand(e) {
|
|
240
|
-
const n = e.join(" "),
|
|
241
|
-
return
|
|
250
|
+
const n = e.join(" "), s = this._commands.findIndex((r) => r.fullPath.join(" ") === n);
|
|
251
|
+
return s === -1 ? !1 : (this._commands.splice(s, 1), !0);
|
|
242
252
|
}
|
|
243
253
|
/**
|
|
244
254
|
* Retrieves a command from the registry for the given path.
|
|
@@ -248,25 +258,25 @@ class X {
|
|
|
248
258
|
*/
|
|
249
259
|
getCommand(e) {
|
|
250
260
|
return this._commands.find((n) => {
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
261
|
+
const s = n.fullPath.join(" "), r = e.join(" ");
|
|
262
|
+
if (s === r)
|
|
253
263
|
return !0;
|
|
254
|
-
const
|
|
255
|
-
return
|
|
264
|
+
const a = n.segments.filter((c) => c.type === "word").map((c) => c.name);
|
|
265
|
+
return a.length === e.length && a.join(" ") === r;
|
|
256
266
|
});
|
|
257
267
|
}
|
|
258
268
|
commandExistsForPath(e) {
|
|
259
269
|
const n = this._commands.map(
|
|
260
|
-
(
|
|
261
|
-
(
|
|
270
|
+
(r) => r.segments.map(
|
|
271
|
+
(o) => o.type === "argument" ? "*" : o.name
|
|
262
272
|
).join(" ")
|
|
263
|
-
),
|
|
264
|
-
(
|
|
265
|
-
var
|
|
266
|
-
return ((
|
|
273
|
+
), s = e.map((r, o) => this._commands.some(
|
|
274
|
+
(c) => {
|
|
275
|
+
var i;
|
|
276
|
+
return ((i = c.segments[o]) == null ? void 0 : i.type) === "argument";
|
|
267
277
|
}
|
|
268
|
-
) ? "*" :
|
|
269
|
-
return n.includes(
|
|
278
|
+
) ? "*" : r).join(" ");
|
|
279
|
+
return n.includes(s);
|
|
270
280
|
}
|
|
271
281
|
/**
|
|
272
282
|
* Gets possible matches for a given path.
|
|
@@ -282,19 +292,19 @@ class X {
|
|
|
282
292
|
* Matching is case-insensitive.
|
|
283
293
|
*/
|
|
284
294
|
getMatchingCompletions(e, n) {
|
|
285
|
-
const
|
|
286
|
-
return
|
|
287
|
-
(
|
|
288
|
-
) :
|
|
295
|
+
const s = n.trim().toLowerCase(), r = this.getCompletions(e);
|
|
296
|
+
return s ? r.filter(
|
|
297
|
+
(o) => o.name.toLowerCase().startsWith(s)
|
|
298
|
+
) : r;
|
|
289
299
|
}
|
|
290
300
|
/**
|
|
291
301
|
* Returns a single completion when prefix matching is unambiguous.
|
|
292
302
|
* Returns undefined for ambiguous or no-match prefixes.
|
|
293
303
|
*/
|
|
294
304
|
getUniqueCompletion(e, n) {
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
return
|
|
305
|
+
const s = this.getMatchingCompletions(e, n);
|
|
306
|
+
if (s.length === 1)
|
|
307
|
+
return s[0];
|
|
298
308
|
}
|
|
299
309
|
/**
|
|
300
310
|
* Gets an array of segments reachable from a given path
|
|
@@ -303,29 +313,29 @@ class X {
|
|
|
303
313
|
* @returns An array of completion strings.
|
|
304
314
|
*/
|
|
305
315
|
getCompletions(e) {
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
return
|
|
309
|
-
(
|
|
316
|
+
if (b.debug("[getCompletions] path: ", e), !e.length) {
|
|
317
|
+
const o = this._commands.map((i) => i.segments[0]), a = (i, d) => i.type === d.type && i.name === d.name;
|
|
318
|
+
return o.filter(
|
|
319
|
+
(i, d, g) => d === g.findIndex((u) => a(u, i))
|
|
310
320
|
);
|
|
311
321
|
}
|
|
312
322
|
const n = e.length;
|
|
313
|
-
return this._commands.filter((
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
323
|
+
return this._commands.filter((o) => {
|
|
324
|
+
const a = o.segments;
|
|
325
|
+
if (a.length <= n - 1)
|
|
316
326
|
return !1;
|
|
317
|
-
for (let
|
|
318
|
-
const
|
|
319
|
-
if (!(
|
|
327
|
+
for (let c = 0; c < n; c++) {
|
|
328
|
+
const i = e[c], d = a[c];
|
|
329
|
+
if (!(i === "*" && d.type === "argument") && i !== d.name)
|
|
320
330
|
return !1;
|
|
321
331
|
}
|
|
322
332
|
return !0;
|
|
323
|
-
}).filter((
|
|
324
|
-
const
|
|
325
|
-
return new
|
|
333
|
+
}).filter((o) => o.segments.length > n).map((o) => {
|
|
334
|
+
const a = o.segments[n], c = a.type === "argument" ? q : ve;
|
|
335
|
+
return new c(a.name, a.description);
|
|
326
336
|
}).filter(
|
|
327
|
-
(
|
|
328
|
-
(
|
|
337
|
+
(o, a, c) => a === c.findIndex(
|
|
338
|
+
(i) => i.type === o.type && i.name === o.name
|
|
329
339
|
)
|
|
330
340
|
);
|
|
331
341
|
}
|
|
@@ -333,9 +343,9 @@ class X {
|
|
|
333
343
|
return this.getCompletions(e).length > 0;
|
|
334
344
|
}
|
|
335
345
|
}
|
|
336
|
-
class
|
|
346
|
+
class Se {
|
|
337
347
|
constructor(e) {
|
|
338
|
-
|
|
348
|
+
y(this, "config");
|
|
339
349
|
this.config = {
|
|
340
350
|
type: "localStorage",
|
|
341
351
|
maxCommands: 100,
|
|
@@ -352,17 +362,17 @@ class be {
|
|
|
352
362
|
await this.saveCommands(n);
|
|
353
363
|
}
|
|
354
364
|
}
|
|
355
|
-
class
|
|
365
|
+
class $e extends Se {
|
|
356
366
|
constructor(n) {
|
|
357
367
|
super(n);
|
|
358
|
-
|
|
368
|
+
y(this, "storageKey", "citadel_command_history");
|
|
359
369
|
}
|
|
360
370
|
async getStoredCommands() {
|
|
361
371
|
try {
|
|
362
372
|
const n = window.localStorage.getItem(this.storageKey);
|
|
363
|
-
return n ? JSON.parse(n).map((
|
|
364
|
-
commandSegments: Array.isArray(
|
|
365
|
-
timestamp:
|
|
373
|
+
return n ? JSON.parse(n).map((r) => ({
|
|
374
|
+
commandSegments: Array.isArray(r.commandSegments) ? z(r.commandSegments) : [],
|
|
375
|
+
timestamp: r.timestamp
|
|
366
376
|
})) : [];
|
|
367
377
|
} catch (n) {
|
|
368
378
|
return console.warn("Failed to load commands from localStorage:", n), [];
|
|
@@ -377,29 +387,29 @@ class Ue extends be {
|
|
|
377
387
|
}
|
|
378
388
|
async saveCommands(n) {
|
|
379
389
|
try {
|
|
380
|
-
const
|
|
381
|
-
commandSegments: Array.isArray(
|
|
382
|
-
type:
|
|
383
|
-
name:
|
|
384
|
-
description:
|
|
385
|
-
...
|
|
390
|
+
const s = n.map((r) => ({
|
|
391
|
+
commandSegments: Array.isArray(r.commandSegments) ? z(r.commandSegments).map((o) => ({
|
|
392
|
+
type: o.type,
|
|
393
|
+
name: o.name,
|
|
394
|
+
description: o.description,
|
|
395
|
+
...o instanceof q ? { value: o.value } : {}
|
|
386
396
|
})) : [],
|
|
387
|
-
timestamp:
|
|
397
|
+
timestamp: r.timestamp
|
|
388
398
|
}));
|
|
389
|
-
window.localStorage.setItem(this.storageKey, JSON.stringify(
|
|
390
|
-
} catch (
|
|
391
|
-
throw console.warn("Failed to save commands to localStorage:",
|
|
399
|
+
window.localStorage.setItem(this.storageKey, JSON.stringify(s));
|
|
400
|
+
} catch (s) {
|
|
401
|
+
throw console.warn("Failed to save commands to localStorage:", s), s;
|
|
392
402
|
}
|
|
393
403
|
}
|
|
394
404
|
}
|
|
395
|
-
class
|
|
405
|
+
class pe extends Se {
|
|
396
406
|
constructor(n) {
|
|
397
407
|
super(n);
|
|
398
|
-
|
|
408
|
+
y(this, "storedCommands", []);
|
|
399
409
|
}
|
|
400
410
|
async getStoredCommands() {
|
|
401
411
|
return this.storedCommands.map((n) => ({
|
|
402
|
-
commandSegments: Array.isArray(n.commandSegments) ?
|
|
412
|
+
commandSegments: Array.isArray(n.commandSegments) ? z(n.commandSegments) : [],
|
|
403
413
|
timestamp: n.timestamp
|
|
404
414
|
}));
|
|
405
415
|
}
|
|
@@ -407,27 +417,27 @@ class le extends be {
|
|
|
407
417
|
this.storedCommands = [];
|
|
408
418
|
}
|
|
409
419
|
async saveCommands(n) {
|
|
410
|
-
this.storedCommands = n.map((
|
|
411
|
-
commandSegments: Array.isArray(
|
|
412
|
-
timestamp:
|
|
420
|
+
this.storedCommands = n.map((s) => ({
|
|
421
|
+
commandSegments: Array.isArray(s.commandSegments) ? z(s.commandSegments) : [],
|
|
422
|
+
timestamp: s.timestamp
|
|
413
423
|
}));
|
|
414
424
|
}
|
|
415
425
|
}
|
|
416
|
-
const
|
|
426
|
+
const j = class j {
|
|
417
427
|
constructor() {
|
|
418
|
-
|
|
428
|
+
y(this, "currentStorage");
|
|
419
429
|
}
|
|
420
430
|
static reset() {
|
|
421
|
-
|
|
431
|
+
j.instance = void 0;
|
|
422
432
|
}
|
|
423
433
|
static getInstance() {
|
|
424
|
-
return
|
|
434
|
+
return j.instance || (j.instance = new j()), j.instance;
|
|
425
435
|
}
|
|
426
436
|
initializeStorage(e) {
|
|
427
437
|
try {
|
|
428
|
-
e.type === "memory" ? this.currentStorage = new
|
|
438
|
+
e.type === "memory" ? this.currentStorage = new pe(e) : this.currentStorage = new $e(e);
|
|
429
439
|
} catch (n) {
|
|
430
|
-
console.warn("Failed to create storage, falling back to memory storage:", n), this.currentStorage = new
|
|
440
|
+
console.warn("Failed to create storage, falling back to memory storage:", n), this.currentStorage = new pe(e);
|
|
431
441
|
}
|
|
432
442
|
}
|
|
433
443
|
getStorage() {
|
|
@@ -436,13 +446,13 @@ const U = class U {
|
|
|
436
446
|
return this.currentStorage;
|
|
437
447
|
}
|
|
438
448
|
};
|
|
439
|
-
|
|
440
|
-
let
|
|
449
|
+
y(j, "instance");
|
|
450
|
+
let Q = j;
|
|
441
451
|
class xe {
|
|
442
452
|
constructor() {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
453
|
+
y(this, "segments", []);
|
|
454
|
+
y(this, "nullSegment", new le());
|
|
455
|
+
y(this, "observers", []);
|
|
446
456
|
}
|
|
447
457
|
subscribe(e) {
|
|
448
458
|
this.observers.push(e);
|
|
@@ -525,420 +535,417 @@ class xe {
|
|
|
525
535
|
return [...this.segments];
|
|
526
536
|
}
|
|
527
537
|
}
|
|
528
|
-
const
|
|
529
|
-
config:
|
|
530
|
-
commands: new
|
|
538
|
+
const Ke = {
|
|
539
|
+
config: x,
|
|
540
|
+
commands: new ee(),
|
|
531
541
|
segmentStack: new xe()
|
|
532
|
-
},
|
|
533
|
-
const [
|
|
534
|
-
...
|
|
542
|
+
}, Y = Re(Ke), We = ({ config: t = x, commandRegistry: e, children: n }) => {
|
|
543
|
+
const [s, r] = $.useState(), [o] = _(() => new xe()), a = P(() => ({
|
|
544
|
+
...x,
|
|
535
545
|
...t,
|
|
536
546
|
// Ensure nested objects are properly merged
|
|
537
547
|
storage: {
|
|
538
|
-
...
|
|
548
|
+
...x.storage,
|
|
539
549
|
...t.storage
|
|
540
550
|
},
|
|
541
551
|
// Ensure explicit values from config take precedence
|
|
542
|
-
cursorType: t.cursorType ??
|
|
543
|
-
cursorColor: t.cursorColor ??
|
|
544
|
-
cursorSpeed: t.cursorSpeed ??
|
|
545
|
-
|
|
552
|
+
cursorType: t.cursorType ?? x.cursorType,
|
|
553
|
+
cursorColor: t.cursorColor ?? x.cursorColor,
|
|
554
|
+
cursorSpeed: t.cursorSpeed ?? x.cursorSpeed,
|
|
555
|
+
closeOnEscape: t.closeOnEscape ?? x.closeOnEscape,
|
|
556
|
+
showCitadelKey: t.showCitadelKey ?? x.showCitadelKey,
|
|
557
|
+
showOnLoad: t.showOnLoad ?? x.showOnLoad
|
|
546
558
|
}), [t]);
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
),
|
|
551
|
-
}, [
|
|
559
|
+
I(() => {
|
|
560
|
+
Q.getInstance().initializeStorage(
|
|
561
|
+
a.storage ?? x.storage
|
|
562
|
+
), r(Q.getInstance().getStorage());
|
|
563
|
+
}, [a.storage]), I(() => {
|
|
552
564
|
if (e) {
|
|
553
|
-
if (
|
|
565
|
+
if (a.includeHelpCommand) {
|
|
554
566
|
if (!e.commandExistsForPath(["help"])) {
|
|
555
|
-
const
|
|
567
|
+
const i = Le(e);
|
|
556
568
|
e.addCommand(
|
|
557
569
|
[{ type: "word", name: "help" }],
|
|
558
570
|
"Show available commands",
|
|
559
|
-
|
|
571
|
+
i
|
|
560
572
|
);
|
|
561
573
|
}
|
|
562
574
|
return;
|
|
563
575
|
}
|
|
564
576
|
e.removeCommand(["help"]);
|
|
565
577
|
}
|
|
566
|
-
}, [e,
|
|
567
|
-
const
|
|
568
|
-
config:
|
|
569
|
-
commands: e || new
|
|
570
|
-
storage:
|
|
571
|
-
segmentStack:
|
|
572
|
-
}), [
|
|
573
|
-
return /* @__PURE__ */ m(
|
|
574
|
-
},
|
|
575
|
-
const t =
|
|
578
|
+
}, [e, a.includeHelpCommand]);
|
|
579
|
+
const c = P(() => ({
|
|
580
|
+
config: a,
|
|
581
|
+
commands: e || new ee(),
|
|
582
|
+
storage: s,
|
|
583
|
+
segmentStack: o
|
|
584
|
+
}), [a, e, s, o]);
|
|
585
|
+
return /* @__PURE__ */ m(Y.Provider, { value: c, children: n });
|
|
586
|
+
}, U = () => {
|
|
587
|
+
const t = Z(Y);
|
|
576
588
|
if (t === void 0)
|
|
577
589
|
throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");
|
|
578
590
|
return t.config;
|
|
579
|
-
},
|
|
580
|
-
const t =
|
|
591
|
+
}, te = () => {
|
|
592
|
+
const t = Z(Y);
|
|
581
593
|
if (t === void 0)
|
|
582
594
|
throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");
|
|
583
595
|
return t.commands;
|
|
584
|
-
},
|
|
585
|
-
const t =
|
|
596
|
+
}, be = () => {
|
|
597
|
+
const t = Z(Y);
|
|
586
598
|
if (t === void 0)
|
|
587
599
|
throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");
|
|
588
600
|
return t.storage;
|
|
589
|
-
},
|
|
590
|
-
const t =
|
|
601
|
+
}, J = () => {
|
|
602
|
+
const t = Z(Y);
|
|
591
603
|
if (t === void 0)
|
|
592
604
|
throw new Error("useSegmentStack must be used within a CitadelConfigProvider");
|
|
593
605
|
return t.segmentStack;
|
|
594
|
-
},
|
|
606
|
+
}, X = class X {
|
|
595
607
|
constructor(e, n) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
this.id = `output-${Date.now()}-${
|
|
608
|
+
y(this, "id");
|
|
609
|
+
y(this, "timestamp");
|
|
610
|
+
y(this, "command");
|
|
611
|
+
y(this, "result");
|
|
612
|
+
this.id = `output-${Date.now()}-${X.idCounter++}`, this.command = e.toArray().map((s) => s.type === "argument" ? s.value || "" : s.name), this.timestamp = Date.now(), this.result = n ?? new Oe();
|
|
601
613
|
}
|
|
602
614
|
};
|
|
603
|
-
|
|
604
|
-
let
|
|
605
|
-
function
|
|
615
|
+
y(X, "idCounter", 0);
|
|
616
|
+
let oe = X;
|
|
617
|
+
function qe(t) {
|
|
606
618
|
return {
|
|
607
|
-
commandSegments:
|
|
619
|
+
commandSegments: z(t),
|
|
608
620
|
timestamp: Date.now()
|
|
609
621
|
};
|
|
610
622
|
}
|
|
611
|
-
function
|
|
612
|
-
const t =
|
|
623
|
+
function ke() {
|
|
624
|
+
const t = be(), [e, n] = _({
|
|
613
625
|
storedCommands: [],
|
|
614
626
|
position: null
|
|
615
|
-
}),
|
|
627
|
+
}), s = f(async (c) => {
|
|
616
628
|
if (t)
|
|
617
629
|
try {
|
|
618
|
-
const
|
|
619
|
-
await t.addStoredCommand(
|
|
620
|
-
...
|
|
621
|
-
storedCommands: [...
|
|
622
|
-
...
|
|
623
|
-
commandSegments:
|
|
630
|
+
const i = qe(c);
|
|
631
|
+
await t.addStoredCommand(i), n((d) => ({
|
|
632
|
+
...d,
|
|
633
|
+
storedCommands: [...d.storedCommands, {
|
|
634
|
+
...i,
|
|
635
|
+
commandSegments: z(i.commandSegments)
|
|
624
636
|
}],
|
|
625
637
|
position: null
|
|
626
638
|
}));
|
|
627
|
-
} catch (
|
|
628
|
-
console.warn("Failed to save command to history:",
|
|
639
|
+
} catch (i) {
|
|
640
|
+
console.warn("Failed to save command to history:", i);
|
|
629
641
|
}
|
|
630
|
-
}, [t]),
|
|
631
|
-
...
|
|
632
|
-
commandSegments:
|
|
642
|
+
}, [t]), r = f(async () => t ? (await t.getStoredCommands()).map((i) => ({
|
|
643
|
+
...i,
|
|
644
|
+
commandSegments: z(i.commandSegments)
|
|
633
645
|
})) : [], [t]);
|
|
634
|
-
|
|
646
|
+
I(() => {
|
|
635
647
|
if (!t) return;
|
|
636
648
|
(async () => {
|
|
637
649
|
try {
|
|
638
|
-
const
|
|
650
|
+
const d = (await t.getStoredCommands()).map((g) => ({
|
|
639
651
|
...g,
|
|
640
|
-
commandSegments:
|
|
652
|
+
commandSegments: z(g.commandSegments)
|
|
641
653
|
}));
|
|
642
654
|
return n((g) => ({
|
|
643
655
|
...g,
|
|
644
|
-
storedCommands:
|
|
645
|
-
})),
|
|
646
|
-
} catch (
|
|
647
|
-
console.warn("Failed to load command history:",
|
|
656
|
+
storedCommands: d
|
|
657
|
+
})), d;
|
|
658
|
+
} catch (i) {
|
|
659
|
+
console.warn("Failed to load command history:", i);
|
|
648
660
|
}
|
|
649
661
|
})();
|
|
650
662
|
}, [t]);
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
654
|
-
return n((
|
|
655
|
-
...
|
|
663
|
+
const o = f(async (c) => {
|
|
664
|
+
const i = await r();
|
|
665
|
+
if (i.length === 0)
|
|
666
|
+
return n((u) => ({
|
|
667
|
+
...u,
|
|
656
668
|
storedCommands: [],
|
|
657
669
|
position: null
|
|
658
670
|
})), { segments: null, position: null };
|
|
659
|
-
let
|
|
660
|
-
if (
|
|
661
|
-
...
|
|
662
|
-
storedCommands:
|
|
663
|
-
...
|
|
664
|
-
commandSegments:
|
|
671
|
+
let d = null;
|
|
672
|
+
if (c === "up" ? e.position === null ? d = i.length - 1 : e.position > 0 ? d = e.position - 1 : d = 0 : e.position === null || e.position >= i.length - 1 ? d = null : d = e.position + 1, n((u) => ({
|
|
673
|
+
...u,
|
|
674
|
+
storedCommands: i.map((h) => ({
|
|
675
|
+
...h,
|
|
676
|
+
commandSegments: z(h.commandSegments)
|
|
665
677
|
})),
|
|
666
|
-
position:
|
|
667
|
-
})),
|
|
678
|
+
position: d
|
|
679
|
+
})), d === null)
|
|
668
680
|
return {
|
|
669
681
|
segments: [],
|
|
670
682
|
position: null
|
|
671
683
|
};
|
|
672
|
-
const g =
|
|
684
|
+
const g = i[d];
|
|
673
685
|
return g ? {
|
|
674
|
-
segments:
|
|
675
|
-
position:
|
|
686
|
+
segments: z(g.commandSegments),
|
|
687
|
+
position: d
|
|
676
688
|
} : {
|
|
677
689
|
segments: [],
|
|
678
690
|
position: null
|
|
679
691
|
};
|
|
680
|
-
}, [e.position,
|
|
692
|
+
}, [e.position, r]), a = f(async () => {
|
|
681
693
|
try {
|
|
682
694
|
if (!t) return;
|
|
683
695
|
await t.clear(), n({
|
|
684
696
|
storedCommands: [],
|
|
685
697
|
position: null
|
|
686
698
|
});
|
|
687
|
-
} catch (
|
|
688
|
-
console.warn("Failed to clear command history:",
|
|
699
|
+
} catch (c) {
|
|
700
|
+
console.warn("Failed to clear command history:", c);
|
|
689
701
|
}
|
|
690
702
|
}, [t]);
|
|
691
703
|
return {
|
|
692
704
|
history: e,
|
|
693
|
-
addStoredCommand:
|
|
694
|
-
getStoredCommands:
|
|
695
|
-
navigateHistory:
|
|
696
|
-
clear:
|
|
705
|
+
addStoredCommand: s,
|
|
706
|
+
getStoredCommands: r,
|
|
707
|
+
navigateHistory: o,
|
|
708
|
+
clear: a
|
|
697
709
|
};
|
|
698
710
|
}
|
|
699
|
-
const
|
|
700
|
-
const t =
|
|
711
|
+
const de = () => {
|
|
712
|
+
const t = U(), e = te(), n = ke(), s = J(), r = be(), [o, a] = _({
|
|
701
713
|
currentInput: "",
|
|
702
714
|
isEnteringArg: !1,
|
|
703
715
|
output: [],
|
|
704
716
|
history: {
|
|
705
717
|
commands: [],
|
|
706
718
|
position: null,
|
|
707
|
-
storage:
|
|
719
|
+
storage: r
|
|
708
720
|
}
|
|
709
721
|
});
|
|
710
|
-
|
|
711
|
-
}, [
|
|
712
|
-
|
|
713
|
-
...
|
|
722
|
+
I(() => {
|
|
723
|
+
}, [r]), I(() => {
|
|
724
|
+
a((i) => ({
|
|
725
|
+
...i,
|
|
714
726
|
history: {
|
|
715
727
|
commands: n.history.storedCommands,
|
|
716
728
|
position: n.history.position,
|
|
717
|
-
storage:
|
|
729
|
+
storage: r
|
|
718
730
|
}
|
|
719
731
|
}));
|
|
720
|
-
}, [n.history,
|
|
721
|
-
const
|
|
722
|
-
setCurrentInput:
|
|
723
|
-
|
|
732
|
+
}, [n.history, r]);
|
|
733
|
+
const c = {
|
|
734
|
+
setCurrentInput: f((i) => {
|
|
735
|
+
b.debug("[CitadelActions] setCurrentInput: ", i), a((d) => ({ ...d, currentInput: i }));
|
|
724
736
|
}, []),
|
|
725
|
-
setIsEnteringArg:
|
|
726
|
-
|
|
737
|
+
setIsEnteringArg: f((i) => {
|
|
738
|
+
b.debug("[CitadelActions] setIsEnteringArg: ", i), a((d) => ({ ...d, isEnteringArg: i }));
|
|
727
739
|
}, []),
|
|
728
|
-
addOutput:
|
|
729
|
-
|
|
730
|
-
...
|
|
731
|
-
output: [...
|
|
740
|
+
addOutput: f((i) => {
|
|
741
|
+
b.debug("[CitadelActions]addOutput: ", i), a((d) => ({
|
|
742
|
+
...d,
|
|
743
|
+
output: [...d.output, i]
|
|
732
744
|
}));
|
|
733
745
|
}, []),
|
|
734
|
-
executeCommand:
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
737
|
-
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ",
|
|
746
|
+
executeCommand: f(async () => {
|
|
747
|
+
const i = s.path(), d = e.getCommand(i);
|
|
748
|
+
if (!d) {
|
|
749
|
+
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ", i);
|
|
738
750
|
return;
|
|
739
751
|
}
|
|
740
|
-
const g = new
|
|
741
|
-
|
|
742
|
-
...
|
|
743
|
-
output: [...
|
|
752
|
+
const g = new oe(s);
|
|
753
|
+
a((u) => ({
|
|
754
|
+
...u,
|
|
755
|
+
output: [...u.output, g]
|
|
744
756
|
}));
|
|
745
757
|
try {
|
|
746
|
-
const
|
|
758
|
+
const u = new Promise((C, k) => {
|
|
747
759
|
setTimeout(() => {
|
|
748
|
-
|
|
760
|
+
k(new Error("Request timed out"));
|
|
749
761
|
}, t.commandTimeoutMs);
|
|
750
|
-
}),
|
|
751
|
-
|
|
752
|
-
|
|
762
|
+
}), h = s.arguments.map((C) => C.value || ""), S = await Promise.race([
|
|
763
|
+
d.handler(h),
|
|
764
|
+
u
|
|
753
765
|
]);
|
|
754
|
-
if (!(
|
|
766
|
+
if (!(S instanceof K))
|
|
755
767
|
throw new Error(
|
|
756
|
-
`The ${
|
|
768
|
+
`The ${i.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
|
|
757
769
|
For example:
|
|
758
770
|
return new JsonCommandResult({ text: "Hello World" });
|
|
759
|
-
Check the definition of the ${
|
|
771
|
+
Check the definition of the ${i.join(".")} command and update the return type for its handler.`
|
|
760
772
|
);
|
|
761
|
-
|
|
762
|
-
...
|
|
763
|
-
output:
|
|
764
|
-
(
|
|
773
|
+
S.markSuccess(), a((C) => ({
|
|
774
|
+
...C,
|
|
775
|
+
output: C.output.map(
|
|
776
|
+
(k) => k.id === g.id ? { ...k, result: S } : k
|
|
765
777
|
)
|
|
766
778
|
}));
|
|
767
|
-
} catch (
|
|
768
|
-
const
|
|
769
|
-
|
|
779
|
+
} catch (u) {
|
|
780
|
+
const h = new we(
|
|
781
|
+
u instanceof Error ? u.message : "Unknown error"
|
|
770
782
|
);
|
|
771
|
-
|
|
772
|
-
...
|
|
773
|
-
output:
|
|
774
|
-
(
|
|
783
|
+
h.markFailure(), a((S) => ({
|
|
784
|
+
...S,
|
|
785
|
+
output: S.output.map(
|
|
786
|
+
(C) => C.id === g.id ? { ...C, result: h } : C
|
|
775
787
|
)
|
|
776
788
|
}));
|
|
777
789
|
}
|
|
778
|
-
}, [e, t.commandTimeoutMs,
|
|
779
|
-
clearHistory:
|
|
790
|
+
}, [e, t.commandTimeoutMs, s]),
|
|
791
|
+
clearHistory: f(async () => {
|
|
780
792
|
try {
|
|
781
793
|
await n.clear();
|
|
782
|
-
} catch (
|
|
783
|
-
console.warn("Failed to clear history:",
|
|
794
|
+
} catch (i) {
|
|
795
|
+
console.warn("Failed to clear history:", i);
|
|
784
796
|
}
|
|
785
797
|
}, [n])
|
|
786
798
|
};
|
|
787
|
-
return { state:
|
|
788
|
-
},
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
799
|
+
return { state: o, actions: c };
|
|
800
|
+
}, Be = ({
|
|
801
|
+
onOpen: t,
|
|
802
|
+
onClose: e,
|
|
803
|
+
isVisible: n,
|
|
804
|
+
showCitadelKey: s,
|
|
805
|
+
closeOnEscape: r
|
|
806
|
+
}) => {
|
|
807
|
+
I(() => {
|
|
808
|
+
const o = (a) => {
|
|
809
|
+
var c, i;
|
|
810
|
+
!n && a.key === s && !["input", "textarea"].includes(((i = (c = a.target) == null ? void 0 : c.tagName) == null ? void 0 : i.toLowerCase()) || "") && (a.preventDefault(), t()), r && n && a.key === "Escape" && (a.preventDefault(), e());
|
|
793
811
|
};
|
|
794
812
|
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
795
|
-
}, [t, e, n, r]);
|
|
796
|
-
},
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
inlineContainer: Ge
|
|
804
|
-
}, Je = (t) => {
|
|
805
|
-
const { isVisible: e, isClosing: n, onAnimationComplete: r } = t, o = M(() => e ? n ? ce.slideDown : ce.slideUp : "", [e, n]);
|
|
806
|
-
return z(() => {
|
|
807
|
-
if (r) {
|
|
808
|
-
const i = setTimeout(() => {
|
|
809
|
-
r();
|
|
810
|
-
}, 200);
|
|
811
|
-
return () => clearTimeout(i);
|
|
813
|
+
}, [t, e, n, s, r]);
|
|
814
|
+
}, Ve = 200, Ye = (t) => {
|
|
815
|
+
const { isVisible: e, isClosing: n, onAnimationComplete: s } = t, r = P(() => e ? n ? "citadel_slideDown" : "citadel_slideUp" : "", [e, n]);
|
|
816
|
+
return I(() => {
|
|
817
|
+
if (!n || !s) return;
|
|
818
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
819
|
+
s();
|
|
820
|
+
return;
|
|
812
821
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
animationClass: o
|
|
822
|
+
const a = setTimeout(() => {
|
|
823
|
+
s();
|
|
824
|
+
}, Ve);
|
|
825
|
+
return () => clearTimeout(a);
|
|
826
|
+
}, [n, s]), {
|
|
827
|
+
animationClass: r
|
|
820
828
|
};
|
|
821
|
-
},
|
|
829
|
+
}, Je = () => /* @__PURE__ */ m(
|
|
822
830
|
"div",
|
|
823
831
|
{
|
|
824
832
|
"data-testid": "spinner",
|
|
825
|
-
className: "
|
|
833
|
+
className: "citadel-spinner"
|
|
826
834
|
}
|
|
827
|
-
),
|
|
835
|
+
), Ee = (t) => {
|
|
828
836
|
const e = t == null ? void 0 : t.trim();
|
|
829
837
|
return e || void 0;
|
|
830
|
-
},
|
|
831
|
-
const e =
|
|
832
|
-
return e ?
|
|
833
|
-
},
|
|
834
|
-
const n =
|
|
835
|
-
...
|
|
838
|
+
}, Ge = (t) => {
|
|
839
|
+
const e = Ee(t);
|
|
840
|
+
return e ? { style: { fontSize: e } } : {};
|
|
841
|
+
}, ne = (t, e) => {
|
|
842
|
+
const n = Ee(t), r = {
|
|
843
|
+
...Ge(e).style
|
|
836
844
|
};
|
|
837
|
-
return n && (
|
|
838
|
-
|
|
839
|
-
style: Object.keys(o).length > 0 ? o : void 0
|
|
845
|
+
return n && (r.fontFamily = n), {
|
|
846
|
+
style: Object.keys(r).length > 0 ? r : void 0
|
|
840
847
|
};
|
|
841
|
-
},
|
|
848
|
+
}, Qe = ({
|
|
842
849
|
command: t,
|
|
843
850
|
timestamp: e,
|
|
844
851
|
status: n,
|
|
845
|
-
fontFamily:
|
|
846
|
-
fontSize:
|
|
852
|
+
fontFamily: s,
|
|
853
|
+
fontSize: r
|
|
847
854
|
}) => {
|
|
848
|
-
const
|
|
849
|
-
() =>
|
|
850
|
-
[
|
|
855
|
+
const o = P(
|
|
856
|
+
() => ne(s, r ?? "0.875rem"),
|
|
857
|
+
[s, r]
|
|
851
858
|
);
|
|
852
|
-
return /* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ A(
|
|
853
860
|
"div",
|
|
854
861
|
{
|
|
855
|
-
className:
|
|
856
|
-
style:
|
|
862
|
+
className: "citadel-output-line",
|
|
863
|
+
style: o.style,
|
|
857
864
|
children: [
|
|
858
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ A("span", { className: "citadel-output-command", children: [
|
|
859
866
|
"> ",
|
|
860
|
-
t.split(" ").map((
|
|
861
|
-
const
|
|
862
|
-
return /* @__PURE__ */
|
|
867
|
+
t.split(" ").map((a, c) => {
|
|
868
|
+
const i = a.startsWith("<") && a.endsWith(">");
|
|
869
|
+
return /* @__PURE__ */ A(
|
|
863
870
|
"span",
|
|
864
871
|
{
|
|
865
|
-
className:
|
|
872
|
+
className: i ? "citadel-output-command-arg" : "citadel-output-command-word",
|
|
866
873
|
children: [
|
|
867
|
-
|
|
868
|
-
|
|
874
|
+
c > 0 ? " " : "",
|
|
875
|
+
a
|
|
869
876
|
]
|
|
870
877
|
},
|
|
871
|
-
|
|
878
|
+
c
|
|
872
879
|
);
|
|
873
880
|
})
|
|
874
881
|
] }),
|
|
875
|
-
/* @__PURE__ */ m("span", { className: "
|
|
876
|
-
/* @__PURE__ */ m("span", { className: "
|
|
877
|
-
n ===
|
|
878
|
-
n ===
|
|
882
|
+
/* @__PURE__ */ m("span", { className: "citadel-output-separator", children: "·" }),
|
|
883
|
+
/* @__PURE__ */ m("span", { className: "citadel-output-timestamp", children: e }),
|
|
884
|
+
n === V.Pending && /* @__PURE__ */ m(Je, {}),
|
|
885
|
+
n === V.Success && /* @__PURE__ */ m(
|
|
879
886
|
"div",
|
|
880
887
|
{
|
|
881
888
|
"data-testid": "success-indicator",
|
|
882
|
-
className: "
|
|
889
|
+
className: "citadel-status-dot citadel-status-dot-success"
|
|
883
890
|
}
|
|
884
891
|
),
|
|
885
|
-
(n ===
|
|
892
|
+
(n === V.Timeout || n === V.Failure) && /* @__PURE__ */ m(
|
|
886
893
|
"div",
|
|
887
894
|
{
|
|
888
895
|
"data-testid": "success-indicator",
|
|
889
|
-
className: "
|
|
896
|
+
className: "citadel-status-dot citadel-status-dot-failure"
|
|
890
897
|
}
|
|
891
898
|
)
|
|
892
899
|
]
|
|
893
900
|
}
|
|
894
901
|
);
|
|
895
|
-
},
|
|
896
|
-
const n =
|
|
897
|
-
() =>
|
|
902
|
+
}, Xe = ({ output: t, outputRef: e }) => {
|
|
903
|
+
const n = U(), s = P(
|
|
904
|
+
() => ne(n.fontFamily, n.outputFontSize ?? n.fontSize),
|
|
898
905
|
[n.fontFamily, n.fontSize, n.outputFontSize]
|
|
899
|
-
),
|
|
906
|
+
), r = f(() => {
|
|
900
907
|
if (e.current) {
|
|
901
|
-
const
|
|
908
|
+
const o = e.current;
|
|
902
909
|
requestAnimationFrame(() => {
|
|
903
|
-
|
|
910
|
+
o.scrollTop = o.scrollHeight;
|
|
904
911
|
});
|
|
905
912
|
}
|
|
906
913
|
}, [e]);
|
|
907
|
-
return
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
return
|
|
914
|
+
return I(() => {
|
|
915
|
+
if (r(), e.current) {
|
|
916
|
+
const o = e.current.getElementsByTagName("img"), a = o[o.length - 1];
|
|
917
|
+
if (a && !a.complete)
|
|
918
|
+
return a.addEventListener("load", r), () => a.removeEventListener("load", r);
|
|
912
919
|
}
|
|
913
|
-
}, [t,
|
|
920
|
+
}, [t, r, e]), /* @__PURE__ */ m(
|
|
914
921
|
"div",
|
|
915
922
|
{
|
|
916
923
|
ref: e,
|
|
917
|
-
className: "
|
|
924
|
+
className: "citadel-output",
|
|
918
925
|
"data-testid": "citadel-command-output",
|
|
919
|
-
children: t.map((
|
|
926
|
+
children: t.map((o) => /* @__PURE__ */ A("div", { className: "citadel-output-item", children: [
|
|
920
927
|
/* @__PURE__ */ m(
|
|
921
|
-
|
|
928
|
+
Qe,
|
|
922
929
|
{
|
|
923
|
-
command:
|
|
924
|
-
timestamp: new Date(
|
|
925
|
-
status:
|
|
930
|
+
command: o.command.join(" "),
|
|
931
|
+
timestamp: new Date(o.timestamp).toLocaleTimeString(),
|
|
932
|
+
status: o.result.status,
|
|
926
933
|
fontFamily: n.fontFamily,
|
|
927
934
|
fontSize: n.fontSize
|
|
928
935
|
}
|
|
929
936
|
),
|
|
930
937
|
/* @__PURE__ */ m(
|
|
931
|
-
"
|
|
938
|
+
"div",
|
|
932
939
|
{
|
|
933
|
-
className:
|
|
934
|
-
style:
|
|
935
|
-
children:
|
|
940
|
+
className: "citadel-output-content",
|
|
941
|
+
style: s.style,
|
|
942
|
+
children: o.result.render()
|
|
936
943
|
}
|
|
937
944
|
)
|
|
938
|
-
] },
|
|
945
|
+
] }, o.id))
|
|
939
946
|
}
|
|
940
947
|
);
|
|
941
|
-
},
|
|
948
|
+
}, Ze = {
|
|
942
949
|
blink: {
|
|
943
950
|
character: "▋",
|
|
944
951
|
speed: 530,
|
|
@@ -959,487 +966,517 @@ Check the definition of the ${a.join(".")} command and update the return type fo
|
|
|
959
966
|
speed: 120,
|
|
960
967
|
color: "#fff"
|
|
961
968
|
}
|
|
962
|
-
},
|
|
969
|
+
}, he = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], ge = ["|", "/", "-", "\\"], et = ({
|
|
963
970
|
style: t = { type: "blink" },
|
|
964
971
|
isValid: e = !0,
|
|
965
972
|
errorMessage: n
|
|
966
973
|
}) => {
|
|
967
|
-
const
|
|
968
|
-
...
|
|
974
|
+
const s = P(() => ({
|
|
975
|
+
...Ze[t.type],
|
|
969
976
|
...t
|
|
970
|
-
}), [t]), [
|
|
971
|
-
|
|
972
|
-
if (
|
|
977
|
+
}), [t]), [r, o] = _(!0), [a, c] = _(0);
|
|
978
|
+
I(() => {
|
|
979
|
+
if (s.speed === 0) return;
|
|
973
980
|
const g = setInterval(() => {
|
|
974
|
-
|
|
975
|
-
},
|
|
981
|
+
s.type === "blink" ? o((u) => !u) : ["spin", "bbs"].includes(s.type) && c((u) => (u + 1) % (s.type === "bbs" ? ge.length : he.length));
|
|
982
|
+
}, s.speed);
|
|
976
983
|
return () => clearInterval(g);
|
|
977
|
-
}, [
|
|
978
|
-
const
|
|
979
|
-
color: e ?
|
|
984
|
+
}, [s.type, s.speed]);
|
|
985
|
+
const i = P(() => ({
|
|
986
|
+
color: e ? s.color : "#ff4444",
|
|
980
987
|
transition: "color 0.15s ease-in-out"
|
|
981
|
-
}), [e,
|
|
982
|
-
return /* @__PURE__ */ m("div", { className: "
|
|
988
|
+
}), [e, s.color]);
|
|
989
|
+
return /* @__PURE__ */ m("div", { className: "citadel-cursor-wrapper", children: /* @__PURE__ */ m(
|
|
983
990
|
"span",
|
|
984
991
|
{
|
|
985
992
|
className: `command-cursor ${e ? "" : "animate-shake"}`,
|
|
986
|
-
style:
|
|
993
|
+
style: i,
|
|
987
994
|
title: n,
|
|
988
|
-
children: !e && n ? "✗" : ["spin", "bbs"].includes(
|
|
995
|
+
children: !e && n ? "✗" : ["spin", "bbs"].includes(s.type) ? (s.type === "bbs" ? ge : he)[a] : s.type === "solid" || r ? s.character : " "
|
|
989
996
|
}
|
|
990
997
|
) });
|
|
991
998
|
};
|
|
992
|
-
function
|
|
999
|
+
function tt(t, e) {
|
|
993
1000
|
switch (e.type) {
|
|
994
1001
|
case "set":
|
|
995
|
-
return
|
|
1002
|
+
return b.debug(`[inputStateReducer] InputState changing from ${t} to ${e.state}`), e.state;
|
|
996
1003
|
default:
|
|
997
1004
|
return t;
|
|
998
1005
|
}
|
|
999
1006
|
}
|
|
1000
|
-
const
|
|
1001
|
-
const { state: t } =
|
|
1002
|
-
|
|
1003
|
-
},
|
|
1004
|
-
const
|
|
1005
|
-
return
|
|
1006
|
-
}, [e,
|
|
1007
|
-
if (!
|
|
1008
|
-
const
|
|
1009
|
-
return
|
|
1010
|
-
const
|
|
1011
|
-
return !
|
|
1007
|
+
const nt = () => {
|
|
1008
|
+
const { state: t } = de(), e = te(), n = ke(), s = J(), [r, o] = _e(tt, "idle"), a = (l) => {
|
|
1009
|
+
o({ type: "set", state: l });
|
|
1010
|
+
}, c = f(() => {
|
|
1011
|
+
const p = e.getCompletions(s.path())[0] || s.nullSegment;
|
|
1012
|
+
return b.debug("[getNextExpectedSegment] ", p), p;
|
|
1013
|
+
}, [e, s]), i = f(() => e.getCompletionNames(s.path()).map((p) => e.getCommand([...s.path(), p])).filter((p) => p !== void 0), [e, s]), d = f((l, p) => {
|
|
1014
|
+
if (!l) return p;
|
|
1015
|
+
const w = s.path().length;
|
|
1016
|
+
return p.filter((D) => {
|
|
1017
|
+
const v = D.segments[w];
|
|
1018
|
+
return !v || v.type !== "word" ? !1 : v.name.toLowerCase().startsWith(l.toLowerCase());
|
|
1012
1019
|
});
|
|
1013
|
-
}, [
|
|
1014
|
-
const
|
|
1015
|
-
return
|
|
1016
|
-
}, [e,
|
|
1017
|
-
const
|
|
1018
|
-
return
|
|
1019
|
-
}, [e,
|
|
1020
|
-
|
|
1021
|
-
const
|
|
1022
|
-
return !
|
|
1023
|
-
}, [g]),
|
|
1020
|
+
}, [s]), g = f((l) => {
|
|
1021
|
+
const p = e.getUniqueCompletion(s.path(), l);
|
|
1022
|
+
return p && p.type === "word" ? p : s.nullSegment;
|
|
1023
|
+
}, [e, s]), u = f((l) => {
|
|
1024
|
+
const p = s.path(), w = e.getCompletions(p);
|
|
1025
|
+
return w.length === 0 && l ? !1 : w.some((v) => v.type === "argument") ? !0 : e.getMatchingCompletions(p, l).some((v) => v.type === "word");
|
|
1026
|
+
}, [e, s]), h = f((l) => {
|
|
1027
|
+
b.debug("[tryAutoComplete] input: ", l);
|
|
1028
|
+
const p = g(l);
|
|
1029
|
+
return !p || p.type === "null" ? new le() : (b.debug("[tryAutoComplete] result: ", p), p);
|
|
1030
|
+
}, [g]), S = f((l, p) => {
|
|
1024
1031
|
if (t.history.position !== null)
|
|
1025
1032
|
return;
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1031
|
-
if (
|
|
1032
|
-
if (!(
|
|
1033
|
-
|
|
1033
|
+
p.setCurrentInput(l), b.debug("[useCommandParser][handleInputChange] newValue: ", l);
|
|
1034
|
+
const w = c();
|
|
1035
|
+
if (w.type === "argument" || r === "entering_argument") {
|
|
1036
|
+
const H = fe(l);
|
|
1037
|
+
if (H.isQuoted)
|
|
1038
|
+
if (H.isComplete) {
|
|
1039
|
+
if (!(w instanceof q)) return;
|
|
1040
|
+
w.value = l.trim() || "", b.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", w), s.push(w), p.setCurrentInput(""), a("idle");
|
|
1034
1041
|
return;
|
|
1035
1042
|
} else
|
|
1036
1043
|
return;
|
|
1037
|
-
else if (
|
|
1038
|
-
if (!(
|
|
1039
|
-
|
|
1044
|
+
else if (H.isComplete) {
|
|
1045
|
+
if (!(w instanceof q)) return;
|
|
1046
|
+
w.value = l.trim() || "", b.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", w), s.push(w), p.setCurrentInput(""), a("idle");
|
|
1040
1047
|
return;
|
|
1041
1048
|
} else
|
|
1042
1049
|
return;
|
|
1043
1050
|
}
|
|
1044
|
-
if (
|
|
1045
|
-
const
|
|
1046
|
-
(
|
|
1051
|
+
if (l.endsWith(" ")) {
|
|
1052
|
+
const H = l.trim().toLowerCase(), M = e.getCompletions(s.path()).filter(
|
|
1053
|
+
(E) => E.type === "word" && E.name.toLowerCase() === H
|
|
1047
1054
|
);
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1055
|
+
if (M.length === 1) {
|
|
1056
|
+
s.push(M[0]), p.setCurrentInput(""), a("idle");
|
|
1050
1057
|
return;
|
|
1051
1058
|
}
|
|
1052
1059
|
}
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
1060
|
+
const v = h(l);
|
|
1061
|
+
if (v.type === "word") {
|
|
1062
|
+
b.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", v), s.push(v), p.setCurrentInput(""), a("idle");
|
|
1056
1063
|
return;
|
|
1057
1064
|
}
|
|
1058
|
-
}, [
|
|
1059
|
-
|
|
1060
|
-
}, [
|
|
1061
|
-
if (!(
|
|
1065
|
+
}, [h, t, c, r, s, e]), C = f((l) => {
|
|
1066
|
+
l.setCurrentInput(""), l.setIsEnteringArg(!1), s.clear(), a("idle");
|
|
1067
|
+
}, [s]), k = f((l, p, w) => {
|
|
1068
|
+
if (!(l.key === "Backspace" || l.key === "Enter" || l.key === "ArrowUp" || l.key === "ArrowDown" || l.key === "ArrowLeft" || l.key === "ArrowRight" || l.key === "Escape" || l.key === "Delete" || l.key === "Home" || l.key === "End" || l.key.length === 1))
|
|
1062
1069
|
return !0;
|
|
1063
|
-
const { currentInput:
|
|
1064
|
-
switch (
|
|
1070
|
+
const { currentInput: v, isEnteringArg: H } = p, M = fe(v);
|
|
1071
|
+
switch (l.key) {
|
|
1065
1072
|
case "Backspace":
|
|
1066
|
-
return
|
|
1073
|
+
return v === "" && (l.preventDefault(), s.size() > 0 && s.pop(), a("idle")), !0;
|
|
1067
1074
|
case "Enter": {
|
|
1068
|
-
if (
|
|
1075
|
+
if (l.preventDefault(), M.isQuoted && !M.isComplete)
|
|
1069
1076
|
return !0;
|
|
1070
|
-
if (
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1077
|
+
if (r === "entering_argument" || H && v.trim()) {
|
|
1078
|
+
const F = c();
|
|
1079
|
+
F instanceof q && (F.value = v, b.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ", F), s.push(F));
|
|
1073
1080
|
}
|
|
1074
|
-
const
|
|
1075
|
-
if (!
|
|
1081
|
+
const E = s.path(), B = e.getCommand(E);
|
|
1082
|
+
if (!B)
|
|
1076
1083
|
return !1;
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1084
|
+
const O = B.segments.filter((F) => F.type === "argument"), W = s.arguments;
|
|
1085
|
+
return O.length > W.length ? !1 : (b.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ", s), w.executeCommand(), n.addStoredCommand(s.toArray()), C(w), !0);
|
|
1079
1086
|
}
|
|
1080
1087
|
case "ArrowUp":
|
|
1081
|
-
return
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
1088
|
+
return l.preventDefault(), (async () => {
|
|
1089
|
+
const E = await n.navigateHistory("up");
|
|
1090
|
+
return E.segments && (s.clear(), s.pushAll(E.segments), w.setCurrentInput("")), !0;
|
|
1084
1091
|
})();
|
|
1085
1092
|
case "ArrowDown":
|
|
1086
|
-
return
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1093
|
+
return l.preventDefault(), (async () => {
|
|
1094
|
+
const E = await n.navigateHistory("down");
|
|
1095
|
+
return E.segments && (s.clear(), s.pushAll(E.segments), w.setCurrentInput("")), !0;
|
|
1089
1096
|
})();
|
|
1090
1097
|
default: {
|
|
1091
|
-
if (!
|
|
1092
|
-
const
|
|
1093
|
-
if (!
|
|
1094
|
-
return
|
|
1098
|
+
if (!H && l.key.length === 1) {
|
|
1099
|
+
const E = v + l.key;
|
|
1100
|
+
if (!u(E))
|
|
1101
|
+
return l.preventDefault(), !1;
|
|
1095
1102
|
}
|
|
1096
1103
|
return !0;
|
|
1097
1104
|
}
|
|
1098
1105
|
}
|
|
1099
1106
|
}, [
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1107
|
+
r,
|
|
1108
|
+
u,
|
|
1109
|
+
c,
|
|
1103
1110
|
n,
|
|
1104
|
-
|
|
1111
|
+
C,
|
|
1105
1112
|
e,
|
|
1106
|
-
|
|
1113
|
+
s
|
|
1107
1114
|
]);
|
|
1108
1115
|
return {
|
|
1109
|
-
handleInputChange:
|
|
1110
|
-
handleKeyDown:
|
|
1111
|
-
inputState:
|
|
1112
|
-
setInputStateWithLogging:
|
|
1116
|
+
handleInputChange: S,
|
|
1117
|
+
handleKeyDown: k,
|
|
1118
|
+
inputState: r,
|
|
1119
|
+
setInputStateWithLogging: a,
|
|
1113
1120
|
// Expose internal functions for testing
|
|
1114
|
-
findMatchingCommands:
|
|
1121
|
+
findMatchingCommands: d,
|
|
1115
1122
|
getAutocompleteSuggestion: g,
|
|
1116
|
-
getAvailableNodes:
|
|
1117
|
-
getNextExpectedSegment:
|
|
1118
|
-
isValidCommandInput:
|
|
1123
|
+
getAvailableNodes: i,
|
|
1124
|
+
getNextExpectedSegment: c,
|
|
1125
|
+
isValidCommandInput: u
|
|
1119
1126
|
};
|
|
1120
1127
|
};
|
|
1121
|
-
function
|
|
1128
|
+
function fe(t) {
|
|
1122
1129
|
const e = [];
|
|
1123
|
-
let n = "",
|
|
1124
|
-
for (let
|
|
1125
|
-
const
|
|
1126
|
-
(
|
|
1130
|
+
let n = "", s = !1, r;
|
|
1131
|
+
for (let o = 0; o < t.length; o++) {
|
|
1132
|
+
const a = t[o];
|
|
1133
|
+
(a === '"' || a === "'") && (!s || a === r) ? s ? (e.push(n), n = "", s = !1, r = void 0) : (n && (e.push(n), n = ""), s = !0, r = a) : !s && a === " " ? n && (e.push(n), n = "") : n += a;
|
|
1127
1134
|
}
|
|
1128
1135
|
return {
|
|
1129
1136
|
words: e,
|
|
1130
1137
|
currentWord: n,
|
|
1131
|
-
isQuoted:
|
|
1132
|
-
quoteChar:
|
|
1133
|
-
isComplete: !
|
|
1138
|
+
isQuoted: s,
|
|
1139
|
+
quoteChar: r,
|
|
1140
|
+
isComplete: !s && !n
|
|
1134
1141
|
};
|
|
1135
1142
|
}
|
|
1136
|
-
const
|
|
1137
|
-
const t =
|
|
1138
|
-
return
|
|
1139
|
-
const
|
|
1143
|
+
const st = () => {
|
|
1144
|
+
const t = J(), [e, n] = _(0);
|
|
1145
|
+
return I(() => {
|
|
1146
|
+
const s = {
|
|
1140
1147
|
update: () => {
|
|
1141
|
-
n((
|
|
1148
|
+
n((r) => r + 1);
|
|
1142
1149
|
}
|
|
1143
1150
|
};
|
|
1144
|
-
return t.subscribe(
|
|
1145
|
-
t.unsubscribe(
|
|
1151
|
+
return t.subscribe(s), () => {
|
|
1152
|
+
t.unsubscribe(s);
|
|
1146
1153
|
};
|
|
1147
1154
|
}, [t]), e;
|
|
1148
|
-
},
|
|
1155
|
+
}, rt = ({
|
|
1149
1156
|
state: t,
|
|
1150
1157
|
actions: e
|
|
1151
1158
|
}) => {
|
|
1152
|
-
const n =
|
|
1153
|
-
handleKeyDown:
|
|
1154
|
-
handleInputChange:
|
|
1155
|
-
inputState:
|
|
1156
|
-
setInputStateWithLogging:
|
|
1157
|
-
getNextExpectedSegment:
|
|
1158
|
-
} =
|
|
1159
|
-
() =>
|
|
1160
|
-
[
|
|
1161
|
-
),
|
|
1162
|
-
const
|
|
1163
|
-
await Promise.resolve(
|
|
1164
|
-
},
|
|
1165
|
-
|
|
1166
|
-
},
|
|
1167
|
-
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
n.current && n.current.focus(),
|
|
1173
|
-
}, [
|
|
1174
|
-
if (
|
|
1175
|
-
const
|
|
1176
|
-
let
|
|
1177
|
-
switch (
|
|
1159
|
+
const n = T(null), s = te(), r = J(), {
|
|
1160
|
+
handleKeyDown: o,
|
|
1161
|
+
handleInputChange: a,
|
|
1162
|
+
inputState: c,
|
|
1163
|
+
setInputStateWithLogging: i,
|
|
1164
|
+
getNextExpectedSegment: d
|
|
1165
|
+
} = nt(), [g, u] = _(!1), h = U(), S = st(), C = T(null), [k, l] = _(0), p = P(
|
|
1166
|
+
() => ne(h.fontFamily, h.fontSize),
|
|
1167
|
+
[h.fontFamily, h.fontSize]
|
|
1168
|
+
), w = f(async (N) => {
|
|
1169
|
+
const R = o(N, t, e);
|
|
1170
|
+
await Promise.resolve(R) === !1 && (u(!0), setTimeout(() => u(!1), 500));
|
|
1171
|
+
}, [e, o, t]), D = f((N) => {
|
|
1172
|
+
a(N.target.value, e);
|
|
1173
|
+
}, [e, a]), v = f((N) => {
|
|
1174
|
+
N.preventDefault();
|
|
1175
|
+
const R = N.clipboardData.getData("text");
|
|
1176
|
+
a(R, e);
|
|
1177
|
+
}, [e, a]);
|
|
1178
|
+
I(() => {
|
|
1179
|
+
n.current && n.current.focus(), c !== "entering_command" && i("entering_command");
|
|
1180
|
+
}, [c, i]), I(() => {
|
|
1181
|
+
if (c !== "idle") return;
|
|
1182
|
+
const N = d();
|
|
1183
|
+
let R = "idle";
|
|
1184
|
+
switch (N.type) {
|
|
1178
1185
|
case "word":
|
|
1179
|
-
|
|
1186
|
+
R = "entering_command", e.setIsEnteringArg(!1);
|
|
1180
1187
|
break;
|
|
1181
1188
|
case "argument":
|
|
1182
|
-
|
|
1189
|
+
R = "entering_argument", e.setIsEnteringArg(!0);
|
|
1183
1190
|
break;
|
|
1184
1191
|
}
|
|
1185
|
-
|
|
1186
|
-
}, [
|
|
1187
|
-
const
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
const
|
|
1191
|
-
if (
|
|
1192
|
-
const
|
|
1193
|
-
return /* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */ m("span", { className: "
|
|
1195
|
-
|
|
1196
|
-
] }, "arg-" +
|
|
1192
|
+
i(R);
|
|
1193
|
+
}, [S, c, d, i, e]);
|
|
1194
|
+
const H = P(() => {
|
|
1195
|
+
const N = [], R = r.toArray().map((L, se) => {
|
|
1196
|
+
N.push(L.name);
|
|
1197
|
+
const me = s.hasNextSegment(N);
|
|
1198
|
+
if (L.type === "argument") {
|
|
1199
|
+
const re = L;
|
|
1200
|
+
return /* @__PURE__ */ A($.Fragment, { children: [
|
|
1201
|
+
/* @__PURE__ */ m("span", { className: "citadel-input-segment-arg", children: re.value }),
|
|
1202
|
+
se < r.size() && me && /* @__PURE__ */ m("span", { className: "citadel-input-segment-space", children: " " })
|
|
1203
|
+
] }, "arg-" + re.name + re.value);
|
|
1197
1204
|
}
|
|
1198
|
-
return /* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */ m("span", { className: "
|
|
1200
|
-
|
|
1201
|
-
] }, "word-" +
|
|
1205
|
+
return /* @__PURE__ */ A($.Fragment, { children: [
|
|
1206
|
+
/* @__PURE__ */ m("span", { className: "citadel-input-segment-word", children: L.name }),
|
|
1207
|
+
se < r.size() && me && /* @__PURE__ */ m("span", { className: "citadel-input-segment-space citadel-input-segment-space-command", children: " " })
|
|
1208
|
+
] }, "word-" + L.name);
|
|
1202
1209
|
});
|
|
1203
|
-
return [/* @__PURE__ */ m("div", { className: "
|
|
1204
|
-
}, [
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
}, [
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1210
|
+
return [/* @__PURE__ */ m("div", { className: "citadel-input-segments", "data-testid": "user-input-area", children: R }, S)];
|
|
1211
|
+
}, [S, s, r]), [M, E] = _("");
|
|
1212
|
+
I(() => {
|
|
1213
|
+
const N = d();
|
|
1214
|
+
N.type === "argument" ? E(N.name) : E("");
|
|
1215
|
+
}, [S, d]);
|
|
1216
|
+
const O = !t.isEnteringArg ? "is-command-mode" : "is-argument-mode", W = P(
|
|
1217
|
+
() => ({
|
|
1218
|
+
left: `${k}px`,
|
|
1219
|
+
transition: "left 0.05s ease-out"
|
|
1220
|
+
}),
|
|
1221
|
+
[k]
|
|
1222
|
+
), F = P(
|
|
1223
|
+
() => ({
|
|
1224
|
+
type: h.cursorType ?? x.cursorType,
|
|
1225
|
+
color: h.cursorColor || x.cursorColor,
|
|
1226
|
+
speed: h.cursorSpeed || x.cursorSpeed
|
|
1227
|
+
}),
|
|
1228
|
+
[h.cursorColor, h.cursorSpeed, h.cursorType]
|
|
1229
|
+
);
|
|
1230
|
+
return Me(() => {
|
|
1231
|
+
const N = C.current, R = n.current;
|
|
1232
|
+
if (!N || !R) {
|
|
1233
|
+
l(0);
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
const L = N.getBoundingClientRect().width;
|
|
1237
|
+
l(Math.max(0, L - R.scrollLeft));
|
|
1238
|
+
}, [t.currentInput, O, p.style]), /* @__PURE__ */ m("div", { className: "citadel-input-shell", children: /* @__PURE__ */ A(
|
|
1239
|
+
"div",
|
|
1240
|
+
{
|
|
1241
|
+
className: "citadel-input-line",
|
|
1242
|
+
style: p.style,
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ m("div", { className: "citadel-input-prompt", children: ">" }),
|
|
1245
|
+
/* @__PURE__ */ A("div", { className: "citadel-input-row", children: [
|
|
1246
|
+
H,
|
|
1247
|
+
/* @__PURE__ */ A("div", { className: "citadel-input-control", children: [
|
|
1248
|
+
/* @__PURE__ */ m(
|
|
1249
|
+
"span",
|
|
1250
|
+
{
|
|
1251
|
+
ref: C,
|
|
1252
|
+
className: `citadel-input-measure ${O}`.trim(),
|
|
1253
|
+
"aria-hidden": "true",
|
|
1254
|
+
children: t.currentInput
|
|
1255
|
+
}
|
|
1256
|
+
),
|
|
1257
|
+
/* @__PURE__ */ m(
|
|
1258
|
+
"input",
|
|
1259
|
+
{
|
|
1260
|
+
ref: n,
|
|
1261
|
+
type: "text",
|
|
1262
|
+
role: "textbox",
|
|
1263
|
+
value: t.currentInput,
|
|
1264
|
+
onChange: D,
|
|
1265
|
+
onKeyDown: w,
|
|
1266
|
+
onPaste: v,
|
|
1267
|
+
"data-testid": "citadel-command-input",
|
|
1268
|
+
className: `citadel-input-field ${O} ${g ? "invalid-input-animation" : ""}`.trim(),
|
|
1269
|
+
spellCheck: !1,
|
|
1270
|
+
autoComplete: "off",
|
|
1271
|
+
placeholder: M
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
/* @__PURE__ */ m(
|
|
1275
|
+
"div",
|
|
1276
|
+
{
|
|
1277
|
+
className: "citadel-input-cursor",
|
|
1278
|
+
style: W,
|
|
1279
|
+
children: /* @__PURE__ */ m(et, { style: F })
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1268
1282
|
] })
|
|
1269
|
-
]
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
},
|
|
1274
|
-
const e =
|
|
1275
|
-
() =>
|
|
1283
|
+
] })
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
) });
|
|
1287
|
+
}, at = ({ currentInput: t = "" }) => {
|
|
1288
|
+
const e = te(), n = U(), s = J(), r = $.useMemo(
|
|
1289
|
+
() => ne(n.fontFamily, n.fontSize),
|
|
1276
1290
|
[n.fontFamily, n.fontSize]
|
|
1277
|
-
),
|
|
1278
|
-
|
|
1279
|
-
|
|
1291
|
+
), o = t.trim().toLowerCase(), a = e.getMatchingCompletions(
|
|
1292
|
+
s.path(),
|
|
1293
|
+
o
|
|
1280
1294
|
);
|
|
1281
|
-
|
|
1282
|
-
const c =
|
|
1283
|
-
const
|
|
1284
|
-
return [...
|
|
1285
|
-
(
|
|
1295
|
+
b.debug("[AvailableCommands] nextCommandSegments: ", a);
|
|
1296
|
+
const c = $.useMemo(() => {
|
|
1297
|
+
const u = [...a], h = (l) => l.name.toLowerCase() === "help", S = u.filter(h);
|
|
1298
|
+
return [...u.filter((l) => !h(l)).sort(
|
|
1299
|
+
(l, p) => l.name.localeCompare(p.name, void 0, { sensitivity: "base" })
|
|
1286
1300
|
), ...S];
|
|
1287
|
-
}, [a]),
|
|
1288
|
-
const
|
|
1301
|
+
}, [a]), i = $.useMemo(() => {
|
|
1302
|
+
const u = /* @__PURE__ */ new Map();
|
|
1289
1303
|
for (const h of c) {
|
|
1290
|
-
const S = c.reduce((
|
|
1291
|
-
if (
|
|
1292
|
-
let
|
|
1293
|
-
for (;
|
|
1294
|
-
|
|
1295
|
-
return Math.max(
|
|
1304
|
+
const S = c.reduce((C, k) => {
|
|
1305
|
+
if (k === h) return C;
|
|
1306
|
+
let l = 0;
|
|
1307
|
+
for (; l < h.name.length && l < k.name.length && h.name[l].toLowerCase() === k.name[l].toLowerCase(); )
|
|
1308
|
+
l++;
|
|
1309
|
+
return Math.max(C, l + 1);
|
|
1296
1310
|
}, 1);
|
|
1297
|
-
|
|
1311
|
+
u.set(h.name, S);
|
|
1298
1312
|
}
|
|
1299
|
-
return
|
|
1300
|
-
}, [c]),
|
|
1301
|
-
return /* @__PURE__ */ m("div", { className:
|
|
1302
|
-
/* @__PURE__ */ m("span", { className: "
|
|
1303
|
-
|
|
1313
|
+
return u;
|
|
1314
|
+
}, [c]), d = a.some((u) => u.type === "argument"), g = a[0];
|
|
1315
|
+
return /* @__PURE__ */ m("div", { className: "citadel-available-commands", "data-testid": "available-commands", children: /* @__PURE__ */ m("div", { className: "citadel-available-commands-content", style: r.style, children: d ? a.length > 0 ? /* @__PURE__ */ A(He, { children: [
|
|
1316
|
+
/* @__PURE__ */ m("span", { className: "citadel-available-next-arg", children: g.name }),
|
|
1317
|
+
g.description && /* @__PURE__ */ A("span", { className: "citadel-available-next-desc", children: [
|
|
1304
1318
|
"- ",
|
|
1305
|
-
|
|
1319
|
+
g.description
|
|
1306
1320
|
] })
|
|
1307
|
-
] }) : null : /* @__PURE__ */ m("div", { className: "
|
|
1308
|
-
const h =
|
|
1321
|
+
] }) : null : /* @__PURE__ */ m("div", { className: "citadel-available-chip-list", children: c == null ? void 0 : c.map((u) => {
|
|
1322
|
+
const h = i.get(u.name) ?? 1;
|
|
1309
1323
|
return /* @__PURE__ */ m(
|
|
1310
1324
|
"div",
|
|
1311
1325
|
{
|
|
1312
1326
|
"data-testid": "available-command-chip",
|
|
1313
|
-
className: "
|
|
1314
|
-
children: /* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */ m("strong", { className: "
|
|
1316
|
-
|
|
1327
|
+
className: "citadel-available-chip",
|
|
1328
|
+
children: /* @__PURE__ */ A("span", { className: "citadel-available-chip-text", children: [
|
|
1329
|
+
/* @__PURE__ */ m("strong", { className: "citadel-available-chip-prefix", children: u.name.slice(0, h) }),
|
|
1330
|
+
u.name.slice(h)
|
|
1317
1331
|
] })
|
|
1318
1332
|
},
|
|
1319
|
-
|
|
1333
|
+
u.name
|
|
1320
1334
|
);
|
|
1321
1335
|
}) }) }) });
|
|
1322
|
-
},
|
|
1336
|
+
}, Ne = ({
|
|
1323
1337
|
state: t,
|
|
1324
1338
|
actions: e,
|
|
1325
1339
|
outputRef: n
|
|
1326
1340
|
}) => {
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1341
|
+
const r = U().displayMode === "inline", o = $.useMemo(
|
|
1342
|
+
() => r ? { overflow: "hidden" } : void 0,
|
|
1343
|
+
[r]
|
|
1344
|
+
);
|
|
1345
|
+
return /* @__PURE__ */ A("div", { className: "innerContainer citadel-tty", children: [
|
|
1329
1346
|
/* @__PURE__ */ m(
|
|
1330
1347
|
"div",
|
|
1331
1348
|
{
|
|
1332
|
-
className: "
|
|
1349
|
+
className: "citadel-tty-output-pane",
|
|
1333
1350
|
"data-testid": "citadel-output-pane",
|
|
1334
|
-
style: o
|
|
1335
|
-
children: /* @__PURE__ */ m(
|
|
1351
|
+
style: o,
|
|
1352
|
+
children: /* @__PURE__ */ m(Xe, { output: t.output, outputRef: n })
|
|
1336
1353
|
}
|
|
1337
1354
|
),
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
/* @__PURE__ */ m(
|
|
1340
|
-
/* @__PURE__ */ m(
|
|
1355
|
+
/* @__PURE__ */ A("div", { className: "citadel-tty-input-region", children: [
|
|
1356
|
+
/* @__PURE__ */ m(rt, { state: t, actions: e }),
|
|
1357
|
+
/* @__PURE__ */ m(at, { currentInput: t.isEnteringArg ? "" : t.currentInput })
|
|
1341
1358
|
] })
|
|
1342
1359
|
] });
|
|
1343
|
-
},
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1360
|
+
}, ot = () => {
|
|
1361
|
+
const t = U(), [e, n] = _(() => t.showOnLoad ?? !1), [s, r] = _(!1), [o, a] = _(() => t.initialHeight || null), c = T(null), i = T(null), d = T(!1), g = T(0), u = T(0), { state: h, actions: S } = de(), C = f(() => {
|
|
1362
|
+
r(!1), n(!0);
|
|
1363
|
+
}, []), k = f(() => {
|
|
1364
|
+
r(!0);
|
|
1365
|
+
}, []);
|
|
1366
|
+
Be({
|
|
1367
|
+
onOpen: C,
|
|
1368
|
+
onClose: k,
|
|
1369
|
+
isVisible: e && !s,
|
|
1370
|
+
showCitadelKey: t.showCitadelKey || ".",
|
|
1371
|
+
closeOnEscape: t.closeOnEscape ?? !0
|
|
1350
1372
|
});
|
|
1351
|
-
const
|
|
1352
|
-
var
|
|
1353
|
-
if (!
|
|
1354
|
-
const
|
|
1355
|
-
Math.max(
|
|
1356
|
-
|
|
1373
|
+
const l = f((M) => {
|
|
1374
|
+
var W;
|
|
1375
|
+
if (!d.current) return;
|
|
1376
|
+
const E = M.clientY - g.current, B = (W = t.maxHeight) != null && W.endsWith("vh") ? window.innerHeight * parseInt(t.maxHeight, 10) / 100 : parseInt(t.maxHeight || "80vh", 10), O = Math.min(
|
|
1377
|
+
Math.max(u.current - E, parseInt(t.minHeight || "200", 10)),
|
|
1378
|
+
B
|
|
1357
1379
|
);
|
|
1358
|
-
|
|
1359
|
-
}, [
|
|
1360
|
-
|
|
1361
|
-
}, [
|
|
1362
|
-
|
|
1363
|
-
}, [
|
|
1364
|
-
|
|
1365
|
-
document.removeEventListener("mousemove",
|
|
1366
|
-
}, [
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
}, [
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1380
|
+
i.current && (i.current.style.height = `${O}px`, i.current.style.bottom = "0", a(`${O}px`));
|
|
1381
|
+
}, [t.maxHeight, t.minHeight]), p = f(() => {
|
|
1382
|
+
d.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", p);
|
|
1383
|
+
}, [l]), w = f((M) => {
|
|
1384
|
+
i.current && (d.current = !0, g.current = M.clientY, u.current = i.current.offsetHeight, document.documentElement.style.userSelect = "none", document.documentElement.style.webkitUserSelect = "none", document.documentElement.style.mozUserSelect = "none", document.documentElement.style.msUserSelect = "none", document.addEventListener("mousemove", l), document.addEventListener("mouseup", p));
|
|
1385
|
+
}, [l, p]);
|
|
1386
|
+
I(() => () => {
|
|
1387
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", p);
|
|
1388
|
+
}, [l, p]);
|
|
1389
|
+
const D = f(() => {
|
|
1390
|
+
s && (n(!1), r(!1));
|
|
1391
|
+
}, [s]), { animationClass: v } = Ye({
|
|
1392
|
+
isVisible: e,
|
|
1393
|
+
isClosing: s,
|
|
1394
|
+
onAnimationComplete: D
|
|
1395
|
+
}), H = P(
|
|
1396
|
+
() => ({
|
|
1397
|
+
...o ? { height: o } : {},
|
|
1398
|
+
maxHeight: t.maxHeight
|
|
1399
|
+
}),
|
|
1400
|
+
[t.maxHeight, o]
|
|
1401
|
+
);
|
|
1402
|
+
return e ? /* @__PURE__ */ A(
|
|
1375
1403
|
"div",
|
|
1376
1404
|
{
|
|
1377
|
-
ref:
|
|
1378
|
-
className: `panelContainer ${
|
|
1379
|
-
style:
|
|
1380
|
-
...s ? { height: s } : void 0,
|
|
1381
|
-
maxHeight: o.maxHeight
|
|
1382
|
-
},
|
|
1405
|
+
ref: i,
|
|
1406
|
+
className: `panelContainer ${v}`.trim(),
|
|
1407
|
+
style: H,
|
|
1383
1408
|
children: [
|
|
1384
|
-
/* @__PURE__ */ m("div", { className: "resizeHandle", onMouseDown:
|
|
1409
|
+
/* @__PURE__ */ m("div", { className: "resizeHandle", onMouseDown: w }),
|
|
1385
1410
|
/* @__PURE__ */ m(
|
|
1386
|
-
|
|
1411
|
+
Ne,
|
|
1387
1412
|
{
|
|
1388
|
-
state:
|
|
1389
|
-
actions:
|
|
1390
|
-
outputRef:
|
|
1413
|
+
state: h,
|
|
1414
|
+
actions: S,
|
|
1415
|
+
outputRef: c
|
|
1391
1416
|
}
|
|
1392
1417
|
)
|
|
1393
1418
|
]
|
|
1394
1419
|
}
|
|
1395
1420
|
) : null;
|
|
1396
|
-
},
|
|
1421
|
+
}, ae = (t) => {
|
|
1397
1422
|
if (!t) return;
|
|
1398
1423
|
const e = t.trim();
|
|
1399
1424
|
if (e)
|
|
1400
1425
|
return /^\d+(\.\d+)?$/.test(e) ? `${e}px` : e;
|
|
1401
|
-
},
|
|
1402
|
-
const { state: t, actions: e } =
|
|
1426
|
+
}, it = () => {
|
|
1427
|
+
const { state: t, actions: e } = de(), n = U(), s = T(null), r = P(
|
|
1428
|
+
() => ({
|
|
1429
|
+
height: ae(n.initialHeight),
|
|
1430
|
+
maxHeight: ae(n.maxHeight),
|
|
1431
|
+
minHeight: ae(n.minHeight)
|
|
1432
|
+
}),
|
|
1433
|
+
[n.initialHeight, n.maxHeight, n.minHeight]
|
|
1434
|
+
);
|
|
1403
1435
|
return /* @__PURE__ */ m(
|
|
1404
1436
|
"div",
|
|
1405
1437
|
{
|
|
1406
1438
|
className: "inlineContainer",
|
|
1407
1439
|
"data-testid": "citadel-inline-container",
|
|
1408
|
-
style:
|
|
1409
|
-
height: ne(n.initialHeight),
|
|
1410
|
-
maxHeight: ne(n.maxHeight),
|
|
1411
|
-
minHeight: ne(n.minHeight)
|
|
1412
|
-
},
|
|
1440
|
+
style: r,
|
|
1413
1441
|
children: /* @__PURE__ */ m(
|
|
1414
|
-
|
|
1442
|
+
Ne,
|
|
1415
1443
|
{
|
|
1416
1444
|
state: t,
|
|
1417
1445
|
actions: e,
|
|
1418
|
-
outputRef:
|
|
1446
|
+
outputRef: s
|
|
1419
1447
|
}
|
|
1420
1448
|
)
|
|
1421
1449
|
}
|
|
1422
1450
|
);
|
|
1423
|
-
},
|
|
1424
|
-
--citadel-bg:
|
|
1425
|
-
--citadel-
|
|
1426
|
-
--citadel-border:
|
|
1427
|
-
--citadel-
|
|
1428
|
-
--citadel-
|
|
1451
|
+
}, ye = `:host {
|
|
1452
|
+
--citadel-bg: oklch(20.8% 0.042 265.8);
|
|
1453
|
+
--citadel-surface: oklch(27.9% 0.041 260);
|
|
1454
|
+
--citadel-border: oklch(37.2% 0.044 257.3);
|
|
1455
|
+
--citadel-text: oklch(92.8% 0.006 264.5);
|
|
1456
|
+
--citadel-muted: oklch(70.7% 0.022 261.3);
|
|
1457
|
+
--citadel-subtle: oklch(55.1% 0.023 264.4);
|
|
1458
|
+
--citadel-word: oklch(70.7% 0.165 254.6);
|
|
1459
|
+
--citadel-arg: oklch(72.3% 0.219 149.6);
|
|
1460
|
+
--citadel-error: oklch(70.4% 0.191 22.2);
|
|
1461
|
+
--citadel-success: oklch(72.3% 0.219 149.6);
|
|
1429
1462
|
--citadel-min-height: 200px;
|
|
1430
1463
|
--citadel-max-height: 80vh;
|
|
1431
1464
|
--citadel-default-height: 35vh;
|
|
1432
|
-
--citadel-
|
|
1465
|
+
--citadel-panel-enter-duration: 200ms;
|
|
1466
|
+
--citadel-panel-exit-duration: 200ms;
|
|
1467
|
+
--citadel-panel-enter-easing: cubic-bezier(0.16, 1, 0.3, 1);
|
|
1468
|
+
--citadel-panel-exit-easing: cubic-bezier(0.4, 0, 1, 1);
|
|
1433
1469
|
|
|
1434
1470
|
display: block;
|
|
1435
1471
|
pointer-events: auto;
|
|
1472
|
+
color: var(--citadel-text);
|
|
1436
1473
|
font-synthesis: none;
|
|
1437
1474
|
text-rendering: optimizeLegibility;
|
|
1438
1475
|
-webkit-font-smoothing: antialiased;
|
|
1439
1476
|
-moz-osx-font-smoothing: grayscale;
|
|
1440
1477
|
}
|
|
1441
1478
|
|
|
1442
|
-
:host([data-display-mode=
|
|
1479
|
+
:host([data-display-mode='panel']) {
|
|
1443
1480
|
position: fixed;
|
|
1444
1481
|
bottom: 0;
|
|
1445
1482
|
left: 0;
|
|
@@ -1448,11 +1485,11 @@ const an = () => {
|
|
|
1448
1485
|
height: var(--citadel-default-height);
|
|
1449
1486
|
max-height: var(--citadel-max-height);
|
|
1450
1487
|
min-height: var(--citadel-min-height);
|
|
1451
|
-
z-index: 2147483647;
|
|
1488
|
+
z-index: 2147483647;
|
|
1452
1489
|
overflow: hidden;
|
|
1453
1490
|
}
|
|
1454
1491
|
|
|
1455
|
-
:host([data-display-mode=
|
|
1492
|
+
:host([data-display-mode='inline']) {
|
|
1456
1493
|
position: relative;
|
|
1457
1494
|
bottom: auto;
|
|
1458
1495
|
left: auto;
|
|
@@ -1465,135 +1502,110 @@ const an = () => {
|
|
|
1465
1502
|
overflow: hidden;
|
|
1466
1503
|
}
|
|
1467
1504
|
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
border: 1px solid transparent;
|
|
1471
|
-
padding: 0.6em 1.2em;
|
|
1472
|
-
font-size: 1em;
|
|
1473
|
-
font-weight: 500;
|
|
1474
|
-
font-family: inherit;
|
|
1475
|
-
background-color: #1a1a1a;
|
|
1476
|
-
cursor: pointer;
|
|
1477
|
-
transition: border-color 0.25s;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
button:hover {
|
|
1481
|
-
border-color: var(--citadel-accent);
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
button:focus,
|
|
1485
|
-
button:focus-visible {
|
|
1486
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
a {
|
|
1490
|
-
font-weight: 500;
|
|
1491
|
-
color: var(--citadel-accent);
|
|
1492
|
-
text-decoration: inherit;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
a:hover {
|
|
1496
|
-
color: var(--citadel-accent-hover);
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
.flex-1 { flex: 1 1 0%; }
|
|
1500
|
-
.flex-shrink-0 { flex-shrink: 0; }
|
|
1501
|
-
.min-h-0 { min-height: 0px; }
|
|
1502
|
-
.pt-3 { padding-top: 0.75rem; }
|
|
1503
|
-
.px-4 { padding-left: 1rem; padding-right: 1rem; }
|
|
1504
|
-
|
|
1505
|
-
.h-full {
|
|
1505
|
+
#citadel-root {
|
|
1506
|
+
width: 100%;
|
|
1506
1507
|
height: 100%;
|
|
1507
1508
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
border-width: 1px;
|
|
1513
|
-
}
|
|
1514
|
-
.border-gray-700 {
|
|
1515
|
-
--tw-border-opacity: 1;
|
|
1516
|
-
border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
|
|
1517
|
-
}
|
|
1518
|
-
.rounded-lg {
|
|
1519
|
-
border-radius: 0.5rem;
|
|
1520
|
-
}
|
|
1521
|
-
.p-3 {
|
|
1522
|
-
padding: 0.75rem;
|
|
1523
|
-
}
|
|
1524
|
-
.text-left {
|
|
1525
|
-
text-align: left;
|
|
1509
|
+
|
|
1510
|
+
#citadel-root,
|
|
1511
|
+
#citadel-root * {
|
|
1512
|
+
box-sizing: border-box;
|
|
1526
1513
|
}
|
|
1527
|
-
`, he = `/* Keep only component-specific styles here */
|
|
1528
1514
|
|
|
1529
1515
|
.panelContainer {
|
|
1530
1516
|
position: fixed;
|
|
1517
|
+
bottom: 0;
|
|
1518
|
+
left: 0;
|
|
1519
|
+
right: 0;
|
|
1520
|
+
width: 100%;
|
|
1531
1521
|
height: var(--citadel-default-height);
|
|
1532
1522
|
min-height: var(--citadel-min-height);
|
|
1533
1523
|
max-height: var(--citadel-max-height);
|
|
1534
|
-
background-color: var(--citadel-bg);
|
|
1535
|
-
overflow: hidden;
|
|
1536
|
-
width: 100%;
|
|
1537
|
-
box-sizing: border-box;
|
|
1538
1524
|
margin: 0;
|
|
1539
1525
|
padding: 0;
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1526
|
+
background-color: var(--citadel-bg);
|
|
1527
|
+
overflow: hidden;
|
|
1528
|
+
transform: translateY(0);
|
|
1529
|
+
will-change: transform;
|
|
1543
1530
|
}
|
|
1544
1531
|
|
|
1545
1532
|
.innerContainer {
|
|
1546
|
-
height: 100%;
|
|
1547
|
-
flex: 1;
|
|
1548
1533
|
width: 100%;
|
|
1549
|
-
|
|
1550
|
-
flex-direction: column;
|
|
1534
|
+
height: 100%;
|
|
1551
1535
|
margin: 0;
|
|
1552
1536
|
padding: 0;
|
|
1537
|
+
display: flex;
|
|
1538
|
+
flex: 1;
|
|
1539
|
+
flex-direction: column;
|
|
1553
1540
|
}
|
|
1554
1541
|
|
|
1555
|
-
.
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1542
|
+
.citadel-tty {
|
|
1543
|
+
background: var(--citadel-bg);
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
.citadel-tty-output-pane {
|
|
1547
|
+
display: flex;
|
|
1548
|
+
flex: 1 1 auto;
|
|
1549
|
+
min-height: 0;
|
|
1550
|
+
padding: 0.75rem 1rem 0;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
.citadel-tty-input-region {
|
|
1554
|
+
flex-shrink: 0;
|
|
1560
1555
|
}
|
|
1561
1556
|
|
|
1562
1557
|
.resizeHandle {
|
|
1563
|
-
width: 100%;
|
|
1564
|
-
height: 6px;
|
|
1565
|
-
background: transparent;
|
|
1566
|
-
cursor: ns-resize;
|
|
1567
1558
|
position: absolute;
|
|
1568
1559
|
top: -3px;
|
|
1569
1560
|
left: 0;
|
|
1570
1561
|
right: 0;
|
|
1571
1562
|
z-index: 10;
|
|
1563
|
+
width: 100%;
|
|
1564
|
+
height: 6px;
|
|
1565
|
+
background: transparent;
|
|
1566
|
+
cursor: ns-resize;
|
|
1572
1567
|
user-select: none;
|
|
1573
1568
|
-webkit-user-select: none;
|
|
1574
1569
|
pointer-events: all;
|
|
1575
1570
|
}
|
|
1576
1571
|
|
|
1577
1572
|
.resizeHandle:hover {
|
|
1578
|
-
background:
|
|
1573
|
+
background: color-mix(in oklch, var(--citadel-text) 10%, transparent);
|
|
1579
1574
|
}
|
|
1580
1575
|
|
|
1581
1576
|
@keyframes citadel_slideUp {
|
|
1582
|
-
from {
|
|
1583
|
-
|
|
1577
|
+
from {
|
|
1578
|
+
transform: translateY(100%);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
to {
|
|
1582
|
+
transform: translateY(0);
|
|
1583
|
+
}
|
|
1584
1584
|
}
|
|
1585
1585
|
|
|
1586
1586
|
@keyframes citadel_slideDown {
|
|
1587
|
-
from {
|
|
1588
|
-
|
|
1587
|
+
from {
|
|
1588
|
+
transform: translateY(0);
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
to {
|
|
1592
|
+
transform: translateY(100%);
|
|
1593
|
+
}
|
|
1589
1594
|
}
|
|
1590
1595
|
|
|
1591
1596
|
.citadel_slideUp {
|
|
1592
|
-
animation: citadel_slideUp
|
|
1597
|
+
animation: citadel_slideUp var(--citadel-panel-enter-duration) var(--citadel-panel-enter-easing) forwards;
|
|
1593
1598
|
}
|
|
1594
1599
|
|
|
1595
1600
|
.citadel_slideDown {
|
|
1596
|
-
animation: citadel_slideDown
|
|
1601
|
+
animation: citadel_slideDown var(--citadel-panel-exit-duration) var(--citadel-panel-exit-easing) forwards;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1605
|
+
:host {
|
|
1606
|
+
--citadel-panel-enter-duration: 1ms;
|
|
1607
|
+
--citadel-panel-exit-duration: 1ms;
|
|
1608
|
+
}
|
|
1597
1609
|
}
|
|
1598
1610
|
|
|
1599
1611
|
.inlineContainer {
|
|
@@ -1604,882 +1616,364 @@ a:hover {
|
|
|
1604
1616
|
flex-direction: column;
|
|
1605
1617
|
background-color: var(--citadel-bg);
|
|
1606
1618
|
overflow: hidden;
|
|
1607
|
-
box-sizing: border-box;
|
|
1608
|
-
}
|
|
1609
|
-
`, ge = `@tailwind base;
|
|
1610
|
-
@tailwind components;
|
|
1611
|
-
@tailwind utilities;
|
|
1612
|
-
`, un = `*, ::before, ::after {
|
|
1613
|
-
--tw-border-spacing-x: 0;
|
|
1614
|
-
--tw-border-spacing-y: 0;
|
|
1615
|
-
--tw-translate-x: 0;
|
|
1616
|
-
--tw-translate-y: 0;
|
|
1617
|
-
--tw-rotate: 0;
|
|
1618
|
-
--tw-skew-x: 0;
|
|
1619
|
-
--tw-skew-y: 0;
|
|
1620
|
-
--tw-scale-x: 1;
|
|
1621
|
-
--tw-scale-y: 1;
|
|
1622
|
-
--tw-pan-x: ;
|
|
1623
|
-
--tw-pan-y: ;
|
|
1624
|
-
--tw-pinch-zoom: ;
|
|
1625
|
-
--tw-scroll-snap-strictness: proximity;
|
|
1626
|
-
--tw-gradient-from-position: ;
|
|
1627
|
-
--tw-gradient-via-position: ;
|
|
1628
|
-
--tw-gradient-to-position: ;
|
|
1629
|
-
--tw-ordinal: ;
|
|
1630
|
-
--tw-slashed-zero: ;
|
|
1631
|
-
--tw-numeric-figure: ;
|
|
1632
|
-
--tw-numeric-spacing: ;
|
|
1633
|
-
--tw-numeric-fraction: ;
|
|
1634
|
-
--tw-ring-inset: ;
|
|
1635
|
-
--tw-ring-offset-width: 0px;
|
|
1636
|
-
--tw-ring-offset-color: #fff;
|
|
1637
|
-
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
1638
|
-
--tw-ring-offset-shadow: 0 0 #0000;
|
|
1639
|
-
--tw-ring-shadow: 0 0 #0000;
|
|
1640
|
-
--tw-shadow: 0 0 #0000;
|
|
1641
|
-
--tw-shadow-colored: 0 0 #0000;
|
|
1642
|
-
--tw-blur: ;
|
|
1643
|
-
--tw-brightness: ;
|
|
1644
|
-
--tw-contrast: ;
|
|
1645
|
-
--tw-grayscale: ;
|
|
1646
|
-
--tw-hue-rotate: ;
|
|
1647
|
-
--tw-invert: ;
|
|
1648
|
-
--tw-saturate: ;
|
|
1649
|
-
--tw-sepia: ;
|
|
1650
|
-
--tw-drop-shadow: ;
|
|
1651
|
-
--tw-backdrop-blur: ;
|
|
1652
|
-
--tw-backdrop-brightness: ;
|
|
1653
|
-
--tw-backdrop-contrast: ;
|
|
1654
|
-
--tw-backdrop-grayscale: ;
|
|
1655
|
-
--tw-backdrop-hue-rotate: ;
|
|
1656
|
-
--tw-backdrop-invert: ;
|
|
1657
|
-
--tw-backdrop-opacity: ;
|
|
1658
|
-
--tw-backdrop-saturate: ;
|
|
1659
|
-
--tw-backdrop-sepia: ;
|
|
1660
|
-
--tw-contain-size: ;
|
|
1661
|
-
--tw-contain-layout: ;
|
|
1662
|
-
--tw-contain-paint: ;
|
|
1663
|
-
--tw-contain-style: ;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
::backdrop {
|
|
1667
|
-
--tw-border-spacing-x: 0;
|
|
1668
|
-
--tw-border-spacing-y: 0;
|
|
1669
|
-
--tw-translate-x: 0;
|
|
1670
|
-
--tw-translate-y: 0;
|
|
1671
|
-
--tw-rotate: 0;
|
|
1672
|
-
--tw-skew-x: 0;
|
|
1673
|
-
--tw-skew-y: 0;
|
|
1674
|
-
--tw-scale-x: 1;
|
|
1675
|
-
--tw-scale-y: 1;
|
|
1676
|
-
--tw-pan-x: ;
|
|
1677
|
-
--tw-pan-y: ;
|
|
1678
|
-
--tw-pinch-zoom: ;
|
|
1679
|
-
--tw-scroll-snap-strictness: proximity;
|
|
1680
|
-
--tw-gradient-from-position: ;
|
|
1681
|
-
--tw-gradient-via-position: ;
|
|
1682
|
-
--tw-gradient-to-position: ;
|
|
1683
|
-
--tw-ordinal: ;
|
|
1684
|
-
--tw-slashed-zero: ;
|
|
1685
|
-
--tw-numeric-figure: ;
|
|
1686
|
-
--tw-numeric-spacing: ;
|
|
1687
|
-
--tw-numeric-fraction: ;
|
|
1688
|
-
--tw-ring-inset: ;
|
|
1689
|
-
--tw-ring-offset-width: 0px;
|
|
1690
|
-
--tw-ring-offset-color: #fff;
|
|
1691
|
-
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
1692
|
-
--tw-ring-offset-shadow: 0 0 #0000;
|
|
1693
|
-
--tw-ring-shadow: 0 0 #0000;
|
|
1694
|
-
--tw-shadow: 0 0 #0000;
|
|
1695
|
-
--tw-shadow-colored: 0 0 #0000;
|
|
1696
|
-
--tw-blur: ;
|
|
1697
|
-
--tw-brightness: ;
|
|
1698
|
-
--tw-contrast: ;
|
|
1699
|
-
--tw-grayscale: ;
|
|
1700
|
-
--tw-hue-rotate: ;
|
|
1701
|
-
--tw-invert: ;
|
|
1702
|
-
--tw-saturate: ;
|
|
1703
|
-
--tw-sepia: ;
|
|
1704
|
-
--tw-drop-shadow: ;
|
|
1705
|
-
--tw-backdrop-blur: ;
|
|
1706
|
-
--tw-backdrop-brightness: ;
|
|
1707
|
-
--tw-backdrop-contrast: ;
|
|
1708
|
-
--tw-backdrop-grayscale: ;
|
|
1709
|
-
--tw-backdrop-hue-rotate: ;
|
|
1710
|
-
--tw-backdrop-invert: ;
|
|
1711
|
-
--tw-backdrop-opacity: ;
|
|
1712
|
-
--tw-backdrop-saturate: ;
|
|
1713
|
-
--tw-backdrop-sepia: ;
|
|
1714
|
-
--tw-contain-size: ;
|
|
1715
|
-
--tw-contain-layout: ;
|
|
1716
|
-
--tw-contain-paint: ;
|
|
1717
|
-
--tw-contain-style: ;
|
|
1718
|
-
}/*
|
|
1719
|
-
! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com
|
|
1720
|
-
*//*
|
|
1721
|
-
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
1722
|
-
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
1723
|
-
*/
|
|
1724
|
-
|
|
1725
|
-
*,
|
|
1726
|
-
::before,
|
|
1727
|
-
::after {
|
|
1728
|
-
box-sizing: border-box; /* 1 */
|
|
1729
|
-
border-width: 0; /* 2 */
|
|
1730
|
-
border-style: solid; /* 2 */
|
|
1731
|
-
border-color: #e5e7eb; /* 2 */
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
::before,
|
|
1735
|
-
::after {
|
|
1736
|
-
--tw-content: '';
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
/*
|
|
1740
|
-
1. Use a consistent sensible line-height in all browsers.
|
|
1741
|
-
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
1742
|
-
3. Use a more readable tab size.
|
|
1743
|
-
4. Use the user's configured \`sans\` font-family by default.
|
|
1744
|
-
5. Use the user's configured \`sans\` font-feature-settings by default.
|
|
1745
|
-
6. Use the user's configured \`sans\` font-variation-settings by default.
|
|
1746
|
-
7. Disable tap highlights on iOS
|
|
1747
|
-
*/
|
|
1748
|
-
|
|
1749
|
-
html,
|
|
1750
|
-
:host {
|
|
1751
|
-
line-height: 1.5; /* 1 */
|
|
1752
|
-
-webkit-text-size-adjust: 100%; /* 2 */
|
|
1753
|
-
-moz-tab-size: 4; /* 3 */
|
|
1754
|
-
-o-tab-size: 4;
|
|
1755
|
-
tab-size: 4; /* 3 */
|
|
1756
|
-
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
|
|
1757
|
-
font-feature-settings: normal; /* 5 */
|
|
1758
|
-
font-variation-settings: normal; /* 6 */
|
|
1759
|
-
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
/*
|
|
1763
|
-
1. Remove the margin in all browsers.
|
|
1764
|
-
2. Inherit line-height from \`html\` so users can set them as a class directly on the \`html\` element.
|
|
1765
|
-
*/
|
|
1766
|
-
|
|
1767
|
-
body {
|
|
1768
|
-
margin: 0; /* 1 */
|
|
1769
|
-
line-height: inherit; /* 2 */
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
/*
|
|
1773
|
-
1. Add the correct height in Firefox.
|
|
1774
|
-
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
|
1775
|
-
3. Ensure horizontal rules are visible by default.
|
|
1776
|
-
*/
|
|
1777
|
-
|
|
1778
|
-
hr {
|
|
1779
|
-
height: 0; /* 1 */
|
|
1780
|
-
color: inherit; /* 2 */
|
|
1781
|
-
border-top-width: 1px; /* 3 */
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
/*
|
|
1785
|
-
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
1786
|
-
*/
|
|
1787
|
-
|
|
1788
|
-
abbr:where([title]) {
|
|
1789
|
-
-webkit-text-decoration: underline dotted;
|
|
1790
|
-
text-decoration: underline dotted;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
/*
|
|
1794
|
-
Remove the default font size and weight for headings.
|
|
1795
|
-
*/
|
|
1796
|
-
|
|
1797
|
-
h1,
|
|
1798
|
-
h2,
|
|
1799
|
-
h3,
|
|
1800
|
-
h4,
|
|
1801
|
-
h5,
|
|
1802
|
-
h6 {
|
|
1803
|
-
font-size: inherit;
|
|
1804
|
-
font-weight: inherit;
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
/*
|
|
1808
|
-
Reset links to optimize for opt-in styling instead of opt-out.
|
|
1809
|
-
*/
|
|
1810
|
-
|
|
1811
|
-
a {
|
|
1812
|
-
color: inherit;
|
|
1813
|
-
text-decoration: inherit;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
/*
|
|
1817
|
-
Add the correct font weight in Edge and Safari.
|
|
1818
|
-
*/
|
|
1819
|
-
|
|
1820
|
-
b,
|
|
1821
|
-
strong {
|
|
1822
|
-
font-weight: bolder;
|
|
1823
1619
|
}
|
|
1824
1620
|
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
samp,
|
|
1835
|
-
pre {
|
|
1836
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
|
|
1837
|
-
font-feature-settings: normal; /* 2 */
|
|
1838
|
-
font-variation-settings: normal; /* 3 */
|
|
1839
|
-
font-size: 1em; /* 4 */
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
/*
|
|
1843
|
-
Add the correct font size in all browsers.
|
|
1844
|
-
*/
|
|
1845
|
-
|
|
1846
|
-
small {
|
|
1847
|
-
font-size: 80%;
|
|
1621
|
+
.citadel-output {
|
|
1622
|
+
width: 100%;
|
|
1623
|
+
height: 100%;
|
|
1624
|
+
overflow-y: auto;
|
|
1625
|
+
padding: 0.75rem;
|
|
1626
|
+
border: 1px solid var(--citadel-border);
|
|
1627
|
+
border-radius: 0.5rem;
|
|
1628
|
+
background: color-mix(in oklch, var(--citadel-bg) 75%, black);
|
|
1629
|
+
text-align: left;
|
|
1848
1630
|
}
|
|
1849
1631
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
*/
|
|
1853
|
-
|
|
1854
|
-
sub,
|
|
1855
|
-
sup {
|
|
1856
|
-
font-size: 75%;
|
|
1857
|
-
line-height: 0;
|
|
1858
|
-
position: relative;
|
|
1859
|
-
vertical-align: baseline;
|
|
1632
|
+
.citadel-output-item {
|
|
1633
|
+
margin-bottom: 1rem;
|
|
1860
1634
|
}
|
|
1861
1635
|
|
|
1862
|
-
|
|
1863
|
-
bottom:
|
|
1636
|
+
.citadel-output-item:last-child {
|
|
1637
|
+
margin-bottom: 0;
|
|
1864
1638
|
}
|
|
1865
1639
|
|
|
1866
|
-
|
|
1867
|
-
top:
|
|
1640
|
+
.citadel-output-content {
|
|
1641
|
+
margin-top: 0.35rem;
|
|
1642
|
+
color: var(--citadel-text);
|
|
1868
1643
|
}
|
|
1869
1644
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
|
1873
|
-
3. Remove gaps between table borders by default.
|
|
1874
|
-
*/
|
|
1875
|
-
|
|
1876
|
-
table {
|
|
1877
|
-
text-indent: 0; /* 1 */
|
|
1878
|
-
border-color: inherit; /* 2 */
|
|
1879
|
-
border-collapse: collapse; /* 3 */
|
|
1645
|
+
.citadel-output-content > :first-child {
|
|
1646
|
+
margin-top: 0;
|
|
1880
1647
|
}
|
|
1881
1648
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
2. Remove the margin in Firefox and Safari.
|
|
1885
|
-
3. Remove default padding in all browsers.
|
|
1886
|
-
*/
|
|
1887
|
-
|
|
1888
|
-
button,
|
|
1889
|
-
input,
|
|
1890
|
-
optgroup,
|
|
1891
|
-
select,
|
|
1892
|
-
textarea {
|
|
1893
|
-
font-family: inherit; /* 1 */
|
|
1894
|
-
font-feature-settings: inherit; /* 1 */
|
|
1895
|
-
font-variation-settings: inherit; /* 1 */
|
|
1896
|
-
font-size: 100%; /* 1 */
|
|
1897
|
-
font-weight: inherit; /* 1 */
|
|
1898
|
-
line-height: inherit; /* 1 */
|
|
1899
|
-
letter-spacing: inherit; /* 1 */
|
|
1900
|
-
color: inherit; /* 1 */
|
|
1901
|
-
margin: 0; /* 2 */
|
|
1902
|
-
padding: 0; /* 3 */
|
|
1649
|
+
.citadel-output-content > :last-child {
|
|
1650
|
+
margin-bottom: 0;
|
|
1903
1651
|
}
|
|
1904
1652
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
select {
|
|
1911
|
-
text-transform: none;
|
|
1653
|
+
.citadel-output-line {
|
|
1654
|
+
display: flex;
|
|
1655
|
+
flex-wrap: wrap;
|
|
1656
|
+
align-items: center;
|
|
1657
|
+
gap: 0.5rem;
|
|
1912
1658
|
}
|
|
1913
1659
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
*/
|
|
1918
|
-
|
|
1919
|
-
button,
|
|
1920
|
-
input:where([type='button']),
|
|
1921
|
-
input:where([type='reset']),
|
|
1922
|
-
input:where([type='submit']) {
|
|
1923
|
-
-webkit-appearance: button; /* 1 */
|
|
1924
|
-
background-color: transparent; /* 2 */
|
|
1925
|
-
background-image: none; /* 2 */
|
|
1660
|
+
.citadel-output-command,
|
|
1661
|
+
.citadel-output-command-word {
|
|
1662
|
+
color: var(--citadel-text);
|
|
1926
1663
|
}
|
|
1927
1664
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
*/
|
|
1931
|
-
|
|
1932
|
-
:-moz-focusring {
|
|
1933
|
-
outline: auto;
|
|
1665
|
+
.citadel-output-command-arg {
|
|
1666
|
+
color: var(--citadel-arg);
|
|
1934
1667
|
}
|
|
1935
1668
|
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1669
|
+
.citadel-output-separator {
|
|
1670
|
+
color: var(--citadel-muted);
|
|
1671
|
+
}
|
|
1939
1672
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1673
|
+
.citadel-output-timestamp {
|
|
1674
|
+
color: var(--citadel-subtle);
|
|
1942
1675
|
}
|
|
1943
1676
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1677
|
+
.citadel-status-dot {
|
|
1678
|
+
width: 1rem;
|
|
1679
|
+
height: 1rem;
|
|
1680
|
+
border-radius: 999px;
|
|
1681
|
+
}
|
|
1947
1682
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1683
|
+
.citadel-status-dot-success {
|
|
1684
|
+
background: var(--citadel-success);
|
|
1950
1685
|
}
|
|
1951
1686
|
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1687
|
+
.citadel-status-dot-failure {
|
|
1688
|
+
background: var(--citadel-error);
|
|
1689
|
+
}
|
|
1955
1690
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
height:
|
|
1691
|
+
.citadel-spinner {
|
|
1692
|
+
width: 1rem;
|
|
1693
|
+
height: 1rem;
|
|
1694
|
+
border: 2px solid color-mix(in oklch, var(--citadel-text) 60%, transparent);
|
|
1695
|
+
border-top-color: color-mix(in oklch, var(--citadel-muted) 80%, black);
|
|
1696
|
+
border-radius: 999px;
|
|
1697
|
+
animation: citadel-spin 0.9s linear infinite;
|
|
1959
1698
|
}
|
|
1960
1699
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1700
|
+
@keyframes citadel-spin {
|
|
1701
|
+
to {
|
|
1702
|
+
transform: rotate(360deg);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1965
1705
|
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1706
|
+
.citadel-input-shell {
|
|
1707
|
+
width: 100%;
|
|
1708
|
+
padding: 1rem;
|
|
1709
|
+
border-radius: 0.5rem;
|
|
1710
|
+
background-color: var(--citadel-bg);
|
|
1969
1711
|
}
|
|
1970
1712
|
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1713
|
+
.citadel-input-line {
|
|
1714
|
+
display: flex;
|
|
1715
|
+
align-items: center;
|
|
1716
|
+
gap: 0.5rem;
|
|
1717
|
+
}
|
|
1974
1718
|
|
|
1975
|
-
|
|
1976
|
-
|
|
1719
|
+
.citadel-input-prompt {
|
|
1720
|
+
color: var(--citadel-muted);
|
|
1977
1721
|
}
|
|
1978
1722
|
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1723
|
+
.citadel-input-row {
|
|
1724
|
+
display: flex;
|
|
1725
|
+
align-items: center;
|
|
1726
|
+
flex: 1 1 auto;
|
|
1727
|
+
min-width: 0;
|
|
1728
|
+
}
|
|
1983
1729
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1730
|
+
.citadel-input-segments {
|
|
1731
|
+
display: flex;
|
|
1732
|
+
align-items: center;
|
|
1733
|
+
gap: 0.25rem;
|
|
1987
1734
|
}
|
|
1988
1735
|
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1736
|
+
.citadel-input-segment-arg {
|
|
1737
|
+
color: var(--citadel-text);
|
|
1738
|
+
white-space: pre;
|
|
1739
|
+
}
|
|
1992
1740
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1741
|
+
.citadel-input-segment-word {
|
|
1742
|
+
color: var(--citadel-word);
|
|
1743
|
+
white-space: pre;
|
|
1995
1744
|
}
|
|
1996
1745
|
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
1746
|
+
.citadel-input-segment-space {
|
|
1747
|
+
color: var(--citadel-text);
|
|
1748
|
+
white-space: pre;
|
|
1749
|
+
}
|
|
2000
1750
|
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
dd,
|
|
2004
|
-
h1,
|
|
2005
|
-
h2,
|
|
2006
|
-
h3,
|
|
2007
|
-
h4,
|
|
2008
|
-
h5,
|
|
2009
|
-
h6,
|
|
2010
|
-
hr,
|
|
2011
|
-
figure,
|
|
2012
|
-
p,
|
|
2013
|
-
pre {
|
|
2014
|
-
margin: 0;
|
|
1751
|
+
.citadel-input-segment-space-command {
|
|
1752
|
+
color: var(--citadel-word);
|
|
2015
1753
|
}
|
|
2016
1754
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1755
|
+
.citadel-input-control {
|
|
1756
|
+
position: relative;
|
|
1757
|
+
flex: 1 1 auto;
|
|
1758
|
+
min-width: 0;
|
|
2020
1759
|
}
|
|
2021
1760
|
|
|
2022
|
-
|
|
2023
|
-
|
|
1761
|
+
.citadel-input-measure {
|
|
1762
|
+
position: absolute;
|
|
1763
|
+
top: 0;
|
|
1764
|
+
left: 0;
|
|
1765
|
+
visibility: hidden;
|
|
1766
|
+
pointer-events: none;
|
|
1767
|
+
white-space: pre;
|
|
1768
|
+
font: inherit;
|
|
1769
|
+
letter-spacing: inherit;
|
|
2024
1770
|
}
|
|
2025
1771
|
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
menu {
|
|
2029
|
-
list-style: none;
|
|
1772
|
+
.citadel-input-field {
|
|
1773
|
+
width: 100%;
|
|
2030
1774
|
margin: 0;
|
|
2031
1775
|
padding: 0;
|
|
1776
|
+
border: 0;
|
|
1777
|
+
border-radius: 0;
|
|
1778
|
+
outline: none;
|
|
1779
|
+
background: transparent;
|
|
1780
|
+
font: inherit;
|
|
1781
|
+
line-height: inherit;
|
|
1782
|
+
letter-spacing: inherit;
|
|
1783
|
+
appearance: none;
|
|
1784
|
+
-webkit-appearance: none;
|
|
1785
|
+
caret-color: transparent;
|
|
2032
1786
|
}
|
|
2033
1787
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
dialog {
|
|
2038
|
-
padding: 0;
|
|
1788
|
+
.citadel-input-field::placeholder {
|
|
1789
|
+
color: var(--citadel-subtle);
|
|
1790
|
+
opacity: 1;
|
|
2039
1791
|
}
|
|
2040
1792
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
*/
|
|
2044
|
-
|
|
2045
|
-
textarea {
|
|
2046
|
-
resize: vertical;
|
|
1793
|
+
.citadel-input-field.is-command-mode {
|
|
1794
|
+
color: var(--citadel-word);
|
|
2047
1795
|
}
|
|
2048
1796
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
2. Set the default placeholder color to the user's configured gray 400 color.
|
|
2052
|
-
*/
|
|
2053
|
-
|
|
2054
|
-
input::-moz-placeholder, textarea::-moz-placeholder {
|
|
2055
|
-
opacity: 1; /* 1 */
|
|
2056
|
-
color: #9ca3af; /* 2 */
|
|
1797
|
+
.citadel-input-field.is-argument-mode {
|
|
1798
|
+
color: var(--citadel-text);
|
|
2057
1799
|
}
|
|
2058
1800
|
|
|
2059
|
-
input
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
1801
|
+
.citadel-input-cursor {
|
|
1802
|
+
position: absolute;
|
|
1803
|
+
top: 0;
|
|
1804
|
+
pointer-events: none;
|
|
2063
1805
|
}
|
|
2064
1806
|
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
1807
|
+
@keyframes citadel-invalid-glow {
|
|
1808
|
+
0%,
|
|
1809
|
+
100% {
|
|
1810
|
+
box-shadow: 0 0 0 color-mix(in oklch, var(--citadel-error) 0%, transparent);
|
|
1811
|
+
}
|
|
2068
1812
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
1813
|
+
50% {
|
|
1814
|
+
box-shadow: 0 0 8px color-mix(in oklch, var(--citadel-error) 70%, transparent);
|
|
1815
|
+
}
|
|
2072
1816
|
}
|
|
2073
1817
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
*/
|
|
2077
|
-
:disabled {
|
|
2078
|
-
cursor: default;
|
|
1818
|
+
.invalid-input-animation {
|
|
1819
|
+
animation: citadel-invalid-glow 0.4s ease-in-out;
|
|
2079
1820
|
}
|
|
2080
1821
|
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
*/
|
|
1822
|
+
.citadel-cursor-wrapper {
|
|
1823
|
+
position: relative;
|
|
1824
|
+
display: inline-block;
|
|
1825
|
+
}
|
|
2086
1826
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
canvas,
|
|
2091
|
-
audio,
|
|
2092
|
-
iframe,
|
|
2093
|
-
embed,
|
|
2094
|
-
object {
|
|
2095
|
-
display: block; /* 1 */
|
|
2096
|
-
vertical-align: middle; /* 2 */
|
|
1827
|
+
.command-cursor {
|
|
1828
|
+
display: inline-block;
|
|
1829
|
+
white-space: pre;
|
|
2097
1830
|
}
|
|
2098
1831
|
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
1832
|
+
@keyframes citadel-shake {
|
|
1833
|
+
0%,
|
|
1834
|
+
100% {
|
|
1835
|
+
transform: translateX(0);
|
|
1836
|
+
}
|
|
2102
1837
|
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
height: auto;
|
|
2107
|
-
}
|
|
1838
|
+
25% {
|
|
1839
|
+
transform: translateX(-4px);
|
|
1840
|
+
}
|
|
2108
1841
|
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
}
|
|
2113
|
-
.container {
|
|
2114
|
-
width: 100%;
|
|
2115
|
-
}
|
|
2116
|
-
.pointer-events-none {
|
|
2117
|
-
pointer-events: none;
|
|
2118
|
-
}
|
|
2119
|
-
.visible {
|
|
2120
|
-
visibility: visible;
|
|
2121
|
-
}
|
|
2122
|
-
.static {
|
|
2123
|
-
position: static;
|
|
2124
|
-
}
|
|
2125
|
-
.fixed {
|
|
2126
|
-
position: fixed;
|
|
2127
|
-
}
|
|
2128
|
-
.absolute {
|
|
2129
|
-
position: absolute;
|
|
2130
|
-
}
|
|
2131
|
-
.relative {
|
|
2132
|
-
position: relative;
|
|
2133
|
-
}
|
|
2134
|
-
.top-0 {
|
|
2135
|
-
top: 0px;
|
|
2136
|
-
}
|
|
2137
|
-
.my-2 {
|
|
2138
|
-
margin-top: 0.5rem;
|
|
2139
|
-
margin-bottom: 0.5rem;
|
|
2140
|
-
}
|
|
2141
|
-
.mb-4 {
|
|
2142
|
-
margin-bottom: 1rem;
|
|
2143
|
-
}
|
|
2144
|
-
.ml-2 {
|
|
2145
|
-
margin-left: 0.5rem;
|
|
2146
|
-
}
|
|
2147
|
-
.mr-2 {
|
|
2148
|
-
margin-right: 0.5rem;
|
|
1842
|
+
75% {
|
|
1843
|
+
transform: translateX(4px);
|
|
1844
|
+
}
|
|
2149
1845
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
1846
|
+
|
|
1847
|
+
.animate-shake {
|
|
1848
|
+
animation: citadel-shake 0.2s ease-in-out;
|
|
2152
1849
|
}
|
|
2153
|
-
|
|
1850
|
+
|
|
1851
|
+
.citadel-available-commands {
|
|
2154
1852
|
margin-top: 0.5rem;
|
|
1853
|
+
padding: 0.5rem 1rem;
|
|
1854
|
+
border-top: 1px solid var(--citadel-border);
|
|
2155
1855
|
}
|
|
2156
|
-
.block {
|
|
2157
|
-
display: block;
|
|
2158
|
-
}
|
|
2159
|
-
.inline-block {
|
|
2160
|
-
display: inline-block;
|
|
2161
|
-
}
|
|
2162
|
-
.flex {
|
|
2163
|
-
display: flex;
|
|
2164
|
-
}
|
|
2165
|
-
.hidden {
|
|
2166
|
-
display: none;
|
|
2167
|
-
}
|
|
2168
|
-
.h-12 {
|
|
2169
|
-
height: 3rem;
|
|
2170
|
-
}
|
|
2171
|
-
.h-4 {
|
|
2172
|
-
height: 1rem;
|
|
2173
|
-
}
|
|
2174
|
-
.h-auto {
|
|
2175
|
-
height: auto;
|
|
2176
|
-
}
|
|
2177
|
-
.h-full {
|
|
2178
|
-
height: 100%;
|
|
2179
|
-
}
|
|
2180
|
-
.max-h-\\[300px\\] {
|
|
2181
|
-
max-height: 300px;
|
|
2182
|
-
}
|
|
2183
|
-
.min-h-0 {
|
|
2184
|
-
min-height: 0px;
|
|
2185
|
-
}
|
|
2186
|
-
.min-h-screen {
|
|
2187
|
-
min-height: 100vh;
|
|
2188
|
-
}
|
|
2189
|
-
.w-4 {
|
|
2190
|
-
width: 1rem;
|
|
2191
|
-
}
|
|
2192
|
-
.w-full {
|
|
2193
|
-
width: 100%;
|
|
2194
|
-
}
|
|
2195
|
-
.max-w-\\[400px\\] {
|
|
2196
|
-
max-width: 400px;
|
|
2197
|
-
}
|
|
2198
|
-
.flex-1 {
|
|
2199
|
-
flex: 1 1 0%;
|
|
2200
|
-
}
|
|
2201
|
-
.flex-shrink-0 {
|
|
2202
|
-
flex-shrink: 0;
|
|
2203
|
-
}
|
|
2204
|
-
.transform {
|
|
2205
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2206
|
-
}
|
|
2207
|
-
@keyframes spin {
|
|
2208
1856
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
.animate-spin {
|
|
2214
|
-
animation: spin 1s linear infinite;
|
|
2215
|
-
}
|
|
2216
|
-
.flex-col {
|
|
2217
|
-
flex-direction: column;
|
|
1857
|
+
.citadel-available-commands-content {
|
|
1858
|
+
color: var(--citadel-muted);
|
|
2218
1859
|
}
|
|
2219
|
-
|
|
1860
|
+
|
|
1861
|
+
.citadel-available-chip-list {
|
|
1862
|
+
display: flex;
|
|
2220
1863
|
flex-wrap: wrap;
|
|
2221
|
-
}
|
|
2222
|
-
.items-center {
|
|
2223
|
-
align-items: center;
|
|
2224
|
-
}
|
|
2225
|
-
.justify-center {
|
|
2226
|
-
justify-content: center;
|
|
2227
|
-
}
|
|
2228
|
-
.gap-2 {
|
|
2229
1864
|
gap: 0.5rem;
|
|
2230
1865
|
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
}
|
|
2237
|
-
.rounded {
|
|
2238
|
-
border-radius: 0.25rem;
|
|
2239
|
-
}
|
|
2240
|
-
.rounded-full {
|
|
2241
|
-
border-radius: 9999px;
|
|
2242
|
-
}
|
|
2243
|
-
.rounded-lg {
|
|
2244
|
-
border-radius: 0.5rem;
|
|
2245
|
-
}
|
|
2246
|
-
.border {
|
|
2247
|
-
border-width: 1px;
|
|
2248
|
-
}
|
|
2249
|
-
.border-2 {
|
|
2250
|
-
border-width: 2px;
|
|
2251
|
-
}
|
|
2252
|
-
.border-t {
|
|
2253
|
-
border-top-width: 1px;
|
|
2254
|
-
}
|
|
2255
|
-
.border-gray-300 {
|
|
2256
|
-
--tw-border-opacity: 1;
|
|
2257
|
-
border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
|
|
2258
|
-
}
|
|
2259
|
-
.border-gray-700 {
|
|
2260
|
-
--tw-border-opacity: 1;
|
|
2261
|
-
border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
|
|
2262
|
-
}
|
|
2263
|
-
.border-t-gray-600 {
|
|
2264
|
-
--tw-border-opacity: 1;
|
|
2265
|
-
border-top-color: rgb(75 85 99 / var(--tw-border-opacity, 1));
|
|
2266
|
-
}
|
|
2267
|
-
.bg-gray-100 {
|
|
2268
|
-
--tw-bg-opacity: 1;
|
|
2269
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
|
|
2270
|
-
}
|
|
2271
|
-
.bg-gray-800 {
|
|
2272
|
-
--tw-bg-opacity: 1;
|
|
2273
|
-
background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
|
|
2274
|
-
}
|
|
2275
|
-
.bg-gray-900 {
|
|
2276
|
-
--tw-bg-opacity: 1;
|
|
2277
|
-
background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1));
|
|
2278
|
-
}
|
|
2279
|
-
.bg-green-500 {
|
|
2280
|
-
--tw-bg-opacity: 1;
|
|
2281
|
-
background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
|
|
2282
|
-
}
|
|
2283
|
-
.bg-red-500 {
|
|
2284
|
-
--tw-bg-opacity: 1;
|
|
2285
|
-
background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
|
|
2286
|
-
}
|
|
2287
|
-
.bg-transparent {
|
|
2288
|
-
background-color: transparent;
|
|
2289
|
-
}
|
|
2290
|
-
.bg-white {
|
|
2291
|
-
--tw-bg-opacity: 1;
|
|
2292
|
-
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
2293
|
-
}
|
|
2294
|
-
.object-contain {
|
|
2295
|
-
-o-object-fit: contain;
|
|
2296
|
-
object-fit: contain;
|
|
2297
|
-
}
|
|
2298
|
-
.p-3 {
|
|
2299
|
-
padding: 0.75rem;
|
|
2300
|
-
}
|
|
2301
|
-
.p-4 {
|
|
2302
|
-
padding: 1rem;
|
|
2303
|
-
}
|
|
2304
|
-
.p-6 {
|
|
2305
|
-
padding: 1.5rem;
|
|
2306
|
-
}
|
|
2307
|
-
.px-2 {
|
|
2308
|
-
padding-left: 0.5rem;
|
|
2309
|
-
padding-right: 0.5rem;
|
|
2310
|
-
}
|
|
2311
|
-
.px-4 {
|
|
2312
|
-
padding-left: 1rem;
|
|
2313
|
-
padding-right: 1rem;
|
|
2314
|
-
}
|
|
2315
|
-
.py-1 {
|
|
2316
|
-
padding-top: 0.25rem;
|
|
2317
|
-
padding-bottom: 0.25rem;
|
|
2318
|
-
}
|
|
2319
|
-
.pt-2 {
|
|
2320
|
-
padding-top: 0.5rem;
|
|
2321
|
-
}
|
|
2322
|
-
.pt-3 {
|
|
2323
|
-
padding-top: 0.75rem;
|
|
2324
|
-
}
|
|
2325
|
-
.text-left {
|
|
2326
|
-
text-align: left;
|
|
2327
|
-
}
|
|
2328
|
-
.font-mono {
|
|
2329
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
2330
|
-
}
|
|
2331
|
-
.text-base {
|
|
2332
|
-
font-size: 1rem;
|
|
2333
|
-
line-height: 1.5rem;
|
|
2334
|
-
}
|
|
2335
|
-
.text-lg {
|
|
2336
|
-
font-size: 1.125rem;
|
|
2337
|
-
line-height: 1.75rem;
|
|
2338
|
-
}
|
|
2339
|
-
.text-sm {
|
|
2340
|
-
font-size: 0.875rem;
|
|
2341
|
-
line-height: 1.25rem;
|
|
2342
|
-
}
|
|
2343
|
-
.text-xs {
|
|
2344
|
-
font-size: 0.75rem;
|
|
2345
|
-
line-height: 1rem;
|
|
2346
|
-
}
|
|
2347
|
-
.text-blue-400 {
|
|
2348
|
-
--tw-text-opacity: 1;
|
|
2349
|
-
color: rgb(96 165 250 / var(--tw-text-opacity, 1));
|
|
2350
|
-
}
|
|
2351
|
-
.text-gray-200 {
|
|
2352
|
-
--tw-text-opacity: 1;
|
|
2353
|
-
color: rgb(229 231 235 / var(--tw-text-opacity, 1));
|
|
2354
|
-
}
|
|
2355
|
-
.text-gray-300 {
|
|
2356
|
-
--tw-text-opacity: 1;
|
|
2357
|
-
color: rgb(209 213 219 / var(--tw-text-opacity, 1));
|
|
2358
|
-
}
|
|
2359
|
-
.text-gray-400 {
|
|
2360
|
-
--tw-text-opacity: 1;
|
|
2361
|
-
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
2362
|
-
}
|
|
2363
|
-
.text-gray-500 {
|
|
2364
|
-
--tw-text-opacity: 1;
|
|
2365
|
-
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
2366
|
-
}
|
|
2367
|
-
.text-gray-700 {
|
|
2368
|
-
--tw-text-opacity: 1;
|
|
2369
|
-
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
2370
|
-
}
|
|
2371
|
-
.text-green-500 {
|
|
2372
|
-
--tw-text-opacity: 1;
|
|
2373
|
-
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
|
2374
|
-
}
|
|
2375
|
-
.text-red-400 {
|
|
2376
|
-
--tw-text-opacity: 1;
|
|
2377
|
-
color: rgb(248 113 113 / var(--tw-text-opacity, 1));
|
|
2378
|
-
}
|
|
2379
|
-
.text-red-500 {
|
|
2380
|
-
--tw-text-opacity: 1;
|
|
2381
|
-
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
|
2382
|
-
}
|
|
2383
|
-
.text-white {
|
|
2384
|
-
--tw-text-opacity: 1;
|
|
2385
|
-
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
|
|
1866
|
+
|
|
1867
|
+
.citadel-available-chip {
|
|
1868
|
+
padding: 0.25rem 0.5rem;
|
|
1869
|
+
border-radius: 0.375rem;
|
|
1870
|
+
background: var(--citadel-surface);
|
|
2386
1871
|
}
|
|
2387
|
-
|
|
2388
|
-
|
|
1872
|
+
|
|
1873
|
+
.citadel-available-chip-text {
|
|
1874
|
+
color: white;
|
|
2389
1875
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
1876
|
+
|
|
1877
|
+
.citadel-available-chip-prefix {
|
|
1878
|
+
text-decoration: underline;
|
|
2392
1879
|
}
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
1880
|
+
|
|
1881
|
+
.citadel-available-next-arg {
|
|
1882
|
+
color: var(--citadel-word);
|
|
2397
1883
|
}
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
1884
|
+
|
|
1885
|
+
.citadel-available-next-desc {
|
|
1886
|
+
margin-left: 0.5rem;
|
|
1887
|
+
color: var(--citadel-muted);
|
|
2402
1888
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
1889
|
+
|
|
1890
|
+
.citadel-result-json,
|
|
1891
|
+
.citadel-result-text {
|
|
1892
|
+
color: var(--citadel-text);
|
|
2406
1893
|
}
|
|
2407
|
-
|
|
2408
|
-
|
|
1894
|
+
|
|
1895
|
+
.citadel-result-json {
|
|
1896
|
+
margin: 0;
|
|
2409
1897
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
|
|
2414
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2415
|
-
transition-duration: 150ms;
|
|
1898
|
+
|
|
1899
|
+
.citadel-result-text {
|
|
1900
|
+
white-space: pre;
|
|
2416
1901
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
1902
|
+
|
|
1903
|
+
.citadel-result-error {
|
|
1904
|
+
margin-top: 0.25rem;
|
|
1905
|
+
color: var(--citadel-error);
|
|
2419
1906
|
}
|
|
2420
|
-
|
|
2421
|
-
|
|
1907
|
+
|
|
1908
|
+
.citadel-result-pending {
|
|
1909
|
+
color: var(--citadel-muted);
|
|
2422
1910
|
}
|
|
2423
|
-
|
|
2424
|
-
|
|
1911
|
+
|
|
1912
|
+
.citadel-result-image-wrap {
|
|
1913
|
+
margin-block: 0.5rem;
|
|
2425
1914
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
1915
|
+
|
|
1916
|
+
.citadel-result-image {
|
|
1917
|
+
max-width: 400px;
|
|
1918
|
+
max-height: 300px;
|
|
1919
|
+
height: auto;
|
|
1920
|
+
object-fit: contain;
|
|
1921
|
+
border-radius: 0.5rem;
|
|
2428
1922
|
}
|
|
2429
|
-
`,
|
|
2430
|
-
config: t =
|
|
1923
|
+
`, vt = ({
|
|
1924
|
+
config: t = x,
|
|
2431
1925
|
commandRegistry: e,
|
|
2432
1926
|
containerId: n = null
|
|
2433
1927
|
}) => {
|
|
2434
|
-
const
|
|
2435
|
-
return
|
|
2436
|
-
|
|
2437
|
-
level: t.logLevel ||
|
|
1928
|
+
const s = T(new ee()), r = e ?? s.current, o = T(null), a = P(() => ({ width: "100%", height: "100%" }), []), c = t.displayMode ?? x.displayMode ?? "panel";
|
|
1929
|
+
return I(() => {
|
|
1930
|
+
b.configure({
|
|
1931
|
+
level: t.logLevel || x.logLevel || ie.ERROR,
|
|
2438
1932
|
prefix: "[Citadel]"
|
|
2439
1933
|
});
|
|
2440
|
-
const
|
|
2441
|
-
if (
|
|
2442
|
-
|
|
1934
|
+
const i = new Ae(r, t), d = c === "inline" && !n, g = d ? o.current : n ? document.getElementById(n) : document.body;
|
|
1935
|
+
if (g)
|
|
1936
|
+
g.appendChild(i);
|
|
2443
1937
|
else {
|
|
2444
|
-
if (
|
|
1938
|
+
if (d) {
|
|
2445
1939
|
console.warn("[Citadel] No host available for inline mode; skipping mount.");
|
|
2446
1940
|
return;
|
|
2447
1941
|
}
|
|
2448
|
-
console.warn(`Container with id "${n}" not found, falling back to body`), document.body.appendChild(
|
|
1942
|
+
console.warn(`Container with id "${n}" not found, falling back to body`), document.body.appendChild(i);
|
|
2449
1943
|
}
|
|
2450
1944
|
return () => {
|
|
2451
|
-
var
|
|
2452
|
-
(
|
|
1945
|
+
var u;
|
|
1946
|
+
(u = i.parentElement) == null || u.removeChild(i);
|
|
2453
1947
|
};
|
|
2454
|
-
}, [
|
|
1948
|
+
}, [r, n, t, c]), c === "inline" && !n ? /* @__PURE__ */ m("div", { ref: o, style: a }) : null;
|
|
2455
1949
|
};
|
|
2456
|
-
class
|
|
2457
|
-
constructor(n,
|
|
2458
|
-
var
|
|
1950
|
+
class Ae extends HTMLElement {
|
|
1951
|
+
constructor(n, s) {
|
|
1952
|
+
var o;
|
|
2459
1953
|
super();
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = n, this.config =
|
|
2465
|
-
const
|
|
2466
|
-
this.setAttribute("data-display-mode",
|
|
1954
|
+
y(this, "shadow");
|
|
1955
|
+
y(this, "root", null);
|
|
1956
|
+
y(this, "commandRegistry");
|
|
1957
|
+
y(this, "config");
|
|
1958
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = n, this.config = s;
|
|
1959
|
+
const r = ((o = this.config) == null ? void 0 : o.displayMode) ?? "panel";
|
|
1960
|
+
this.setAttribute("data-display-mode", r);
|
|
2467
1961
|
}
|
|
2468
1962
|
connectedCallback() {
|
|
2469
1963
|
try {
|
|
2470
|
-
const
|
|
2471
|
-
const
|
|
2472
|
-
return
|
|
1964
|
+
const s = [ye].map((r) => {
|
|
1965
|
+
const o = new CSSStyleSheet();
|
|
1966
|
+
return o.replaceSync(r), o;
|
|
2473
1967
|
});
|
|
2474
|
-
this.shadow.adoptedStyleSheets = [...
|
|
1968
|
+
this.shadow.adoptedStyleSheets = [...s];
|
|
2475
1969
|
} catch {
|
|
2476
|
-
const
|
|
2477
|
-
`),
|
|
2478
|
-
|
|
1970
|
+
const s = [ye].join(`
|
|
1971
|
+
`), r = document.createElement("style");
|
|
1972
|
+
r.textContent = s, this.shadow.appendChild(r);
|
|
2479
1973
|
}
|
|
2480
1974
|
const n = document.createElement("div");
|
|
2481
|
-
n.id = "citadel-root", n.style.width = "100%", n.style.height = "100%", this.shadow.appendChild(n), this.root =
|
|
2482
|
-
/* @__PURE__ */ m(
|
|
1975
|
+
n.id = "citadel-root", n.style.width = "100%", n.style.height = "100%", this.shadow.appendChild(n), this.root = Te(n), this.root.render(
|
|
1976
|
+
/* @__PURE__ */ m(We, { config: this.config || x, commandRegistry: this.commandRegistry, children: /* @__PURE__ */ m(ct, {}) })
|
|
2483
1977
|
);
|
|
2484
1978
|
}
|
|
2485
1979
|
disconnectedCallback() {
|
|
@@ -2493,11 +1987,11 @@ class Ee extends HTMLElement {
|
|
|
2493
1987
|
});
|
|
2494
1988
|
}
|
|
2495
1989
|
}
|
|
2496
|
-
typeof window < "u" && window.customElements && !window.customElements.get("citadel-element") && window.customElements.define("citadel-element",
|
|
2497
|
-
const
|
|
2498
|
-
class
|
|
1990
|
+
typeof window < "u" && window.customElements && !window.customElements.get("citadel-element") && window.customElements.define("citadel-element", Ae);
|
|
1991
|
+
const ct = () => (U().displayMode ?? "panel") === "inline" ? /* @__PURE__ */ m(it, {}) : /* @__PURE__ */ m(ot, {});
|
|
1992
|
+
class lt {
|
|
2499
1993
|
constructor() {
|
|
2500
|
-
|
|
1994
|
+
y(this, "_description");
|
|
2501
1995
|
}
|
|
2502
1996
|
describe(e) {
|
|
2503
1997
|
return this._description = e, this;
|
|
@@ -2506,13 +2000,13 @@ class hn {
|
|
|
2506
2000
|
return this._description;
|
|
2507
2001
|
}
|
|
2508
2002
|
}
|
|
2509
|
-
class
|
|
2003
|
+
class dt {
|
|
2510
2004
|
constructor(e) {
|
|
2511
|
-
|
|
2005
|
+
y(this, "state");
|
|
2512
2006
|
this.state = {
|
|
2513
2007
|
path: e,
|
|
2514
2008
|
description: "",
|
|
2515
|
-
segments:
|
|
2009
|
+
segments: mt(e)
|
|
2516
2010
|
};
|
|
2517
2011
|
}
|
|
2518
2012
|
describe(e) {
|
|
@@ -2522,11 +2016,11 @@ class gn {
|
|
|
2522
2016
|
return this.state.details = e, this;
|
|
2523
2017
|
}
|
|
2524
2018
|
arg(e, n) {
|
|
2525
|
-
const
|
|
2526
|
-
return n == null || n(
|
|
2019
|
+
const s = new lt();
|
|
2020
|
+
return n == null || n(s), this.state.segments.push({
|
|
2527
2021
|
type: "argument",
|
|
2528
2022
|
name: e,
|
|
2529
|
-
description:
|
|
2023
|
+
description: s.description
|
|
2530
2024
|
}), this;
|
|
2531
2025
|
}
|
|
2532
2026
|
handle(e) {
|
|
@@ -2539,85 +2033,90 @@ class gn {
|
|
|
2539
2033
|
};
|
|
2540
2034
|
}
|
|
2541
2035
|
}
|
|
2542
|
-
function
|
|
2036
|
+
function mt(t) {
|
|
2543
2037
|
const e = t.trim();
|
|
2544
2038
|
if (!e)
|
|
2545
2039
|
throw new Error("Command path cannot be empty");
|
|
2546
2040
|
const n = e.split(".");
|
|
2547
|
-
if (n.some((
|
|
2041
|
+
if (n.some((s) => s.trim() === ""))
|
|
2548
2042
|
throw new Error(`Invalid command path "${t}". Empty segments are not allowed.`);
|
|
2549
|
-
if (n.some((
|
|
2043
|
+
if (n.some((s) => s.includes(" ")))
|
|
2550
2044
|
throw new Error(
|
|
2551
2045
|
`Invalid command path "${t}". Use dot-delimited words (e.g. "user.show").`
|
|
2552
2046
|
);
|
|
2553
|
-
return n.map((
|
|
2047
|
+
return n.map((s) => ({
|
|
2554
2048
|
type: "word",
|
|
2555
|
-
name:
|
|
2049
|
+
name: s
|
|
2556
2050
|
}));
|
|
2557
2051
|
}
|
|
2558
|
-
function
|
|
2052
|
+
function ut(t) {
|
|
2559
2053
|
return t.flatMap((e) => e.type === "argument" ? [e.name] : []);
|
|
2560
2054
|
}
|
|
2561
|
-
function
|
|
2562
|
-
const e =
|
|
2055
|
+
function pt(t) {
|
|
2056
|
+
const e = ut(t.segments);
|
|
2563
2057
|
return async (n) => {
|
|
2564
|
-
const
|
|
2058
|
+
const s = e.reduce((r, o, a) => (r[o] = n[a], r), {});
|
|
2565
2059
|
return Promise.resolve(
|
|
2566
2060
|
t.handler({
|
|
2567
2061
|
rawArgs: n,
|
|
2568
|
-
namedArgs:
|
|
2062
|
+
namedArgs: s,
|
|
2569
2063
|
commandPath: t.path
|
|
2570
2064
|
})
|
|
2571
2065
|
);
|
|
2572
2066
|
};
|
|
2573
2067
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return new
|
|
2068
|
+
function St(t) {
|
|
2069
|
+
return new dt(t);
|
|
2576
2070
|
}
|
|
2577
|
-
function
|
|
2071
|
+
function ht(t, e) {
|
|
2578
2072
|
t.addCommand(
|
|
2579
2073
|
e.segments,
|
|
2580
2074
|
e.description,
|
|
2581
|
-
|
|
2075
|
+
pt(e)
|
|
2582
2076
|
);
|
|
2583
2077
|
}
|
|
2584
|
-
function
|
|
2585
|
-
return e.forEach((n) =>
|
|
2078
|
+
function gt(t, e) {
|
|
2079
|
+
return e.forEach((n) => ht(t, n)), t;
|
|
2080
|
+
}
|
|
2081
|
+
function xt(t) {
|
|
2082
|
+
const e = new ee();
|
|
2083
|
+
return gt(e, t);
|
|
2586
2084
|
}
|
|
2587
|
-
function
|
|
2588
|
-
|
|
2589
|
-
return xn(e, t);
|
|
2085
|
+
function bt(t) {
|
|
2086
|
+
return new G(t);
|
|
2590
2087
|
}
|
|
2591
|
-
function
|
|
2592
|
-
return new
|
|
2088
|
+
function kt(t, e = "true", n = "false") {
|
|
2089
|
+
return new De(t, e, n);
|
|
2593
2090
|
}
|
|
2594
|
-
function
|
|
2595
|
-
return new
|
|
2091
|
+
function Et(t) {
|
|
2092
|
+
return new ze(t);
|
|
2596
2093
|
}
|
|
2597
|
-
function
|
|
2598
|
-
return new
|
|
2094
|
+
function Nt(t, e = "") {
|
|
2095
|
+
return new Fe(t, e);
|
|
2599
2096
|
}
|
|
2600
|
-
function
|
|
2601
|
-
return new
|
|
2097
|
+
function At(t) {
|
|
2098
|
+
return new we(t);
|
|
2602
2099
|
}
|
|
2603
2100
|
export {
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2101
|
+
De as BooleanCommandResult,
|
|
2102
|
+
vt as Citadel,
|
|
2103
|
+
ee as CommandRegistry,
|
|
2104
|
+
K as CommandResult,
|
|
2105
|
+
V as CommandStatus,
|
|
2106
|
+
Ze as DEFAULT_CURSOR_CONFIGS,
|
|
2107
|
+
we as ErrorCommandResult,
|
|
2108
|
+
Fe as ImageCommandResult,
|
|
2109
|
+
ze as JsonCommandResult,
|
|
2110
|
+
oe as OutputItem,
|
|
2111
|
+
Oe as PendingCommandResult,
|
|
2112
|
+
G as TextCommandResult,
|
|
2113
|
+
kt as bool,
|
|
2114
|
+
St as command,
|
|
2115
|
+
xt as createCommandRegistry,
|
|
2116
|
+
At as error,
|
|
2117
|
+
Nt as image,
|
|
2118
|
+
Et as json,
|
|
2119
|
+
ht as registerCommand,
|
|
2120
|
+
gt as registerCommands,
|
|
2121
|
+
bt as text
|
|
2623
2122
|
};
|