@av-pi-studio/workbench 0.0.122 → 0.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +16 -4
  2. package/dist/chunks/{BinaryFallbackViewer-EznEIpRC.js → BinaryFallbackViewer-ua5VmtNP.js} +1 -1
  3. package/dist/chunks/{ChatPanel-DgJlK-yP.js → ChatPanel-9mV7jLOD.js} +3 -3
  4. package/dist/chunks/{CodeView-klpk8qD0.js → CodeView--Yo9YYpl.js} +2 -2
  5. package/dist/chunks/{FilePanel-Beg5Fs8X.js → FilePanel-CBNc1csX.js} +2 -2
  6. package/dist/chunks/HtmlViewer-BjvrS29T.js +539 -0
  7. package/dist/chunks/{ImageViewer-BLrsKWwI.js → ImageViewer-DQFVe58O.js} +1 -1
  8. package/dist/chunks/{MarkdownFileViewer-DxJJlrsv.js → MarkdownFileViewer-BEaGxGyd.js} +4 -4
  9. package/dist/chunks/{ModelProvidersPanel-C3TXoq1L.js → ModelProvidersPanel-CUdM6FMu.js} +2 -2
  10. package/dist/chunks/{MoleculeViewerPanel-BAWs5F2j.js → MoleculeViewerPanel-DhkadYBP.js} +3 -3
  11. package/dist/chunks/{PdfViewer-B_kiY-Tw.js → PdfViewer-PKAEVwco.js} +2 -2
  12. package/dist/chunks/{SaveFileButton-Bsz3wG4a.js → SaveFileButton-qwf_ewMX.js} +1 -1
  13. package/dist/chunks/SettingsDialog-ChDFOPih.js +454 -0
  14. package/dist/chunks/{SkillsPanel-BB5_yrcx.js → SkillsPanel-DP72YesV.js} +1 -1
  15. package/dist/chunks/{TerminalPanel-DgH4re05.js → TerminalPanel-BKnfLGNl.js} +1 -1
  16. package/dist/chunks/{TextViewer-BiwFYLLc.js → TextViewer-ZT99BjEP.js} +2 -2
  17. package/dist/chunks/{VideoViewer-BSGjTTQR.js → VideoViewer-C_gj8A0b.js} +1 -1
  18. package/dist/chunks/{ViewersPanel-BYHmKfOh.js → ViewersPanel-CTRov7NQ.js} +1 -1
  19. package/dist/chunks/external-link-BsgjS-QP.js +24 -0
  20. package/dist/chunks/{href-resolution-AtzN0oCd.js → href-resolution-AG-Co7Sm.js} +1 -1
  21. package/dist/chunks/index-CitLJdIo.js +7415 -0
  22. package/dist/chunks/{markdown-CypQ7TkY.js → markdown-CVWWeRbe.js} +97 -90
  23. package/dist/chunks/{use-file-download-zheHRdGQ.js → use-file-download-DbQCEsRG.js} +1 -1
  24. package/dist/chunks/{use-file-watch-CyVeSj2A.js → use-file-watch-CrgiCMCF.js} +1 -1
  25. package/dist/chunks/{use-provider-auth-list-jNjjSAD_.js → use-provider-auth-list-Bcdz9-zE.js} +1 -1
  26. package/dist/features/connection/ConnectionBar.d.ts +4 -0
  27. package/dist/features/connection/DaemonSwitcher.d.ts +16 -0
  28. package/dist/features/connection/daemon-switcher-presentation.d.ts +69 -0
  29. package/dist/features/connection/outdated-daemon.d.ts +17 -0
  30. package/dist/features/connection/use-outdated-daemon-notice.d.ts +26 -0
  31. package/dist/features/daemons/DaemonForm.d.ts +18 -0
  32. package/dist/features/daemons/DaemonsScreen.d.ts +17 -0
  33. package/dist/features/daemons/connect-current.d.ts +19 -0
  34. package/dist/features/daemons/daemon-form-actions.d.ts +27 -0
  35. package/dist/features/daemons/daemon-form.d.ts +103 -0
  36. package/dist/features/daemons/daemon-lifecycle.d.ts +58 -0
  37. package/dist/features/daemons/daemon-presentation.d.ts +46 -0
  38. package/dist/features/daemons/daemons-screen-actions.d.ts +37 -0
  39. package/dist/features/daemons/daemons-screen-view.d.ts +62 -0
  40. package/dist/features/daemons/daemons-store.d.ts +30 -0
  41. package/dist/features/daemons/use-daemon-lifecycle.d.ts +3 -0
  42. package/dist/features/daemons/use-daemons.d.ts +8 -0
  43. package/dist/features/files/preview-mounts.d.ts +25 -0
  44. package/dist/features/sessions/RenameSessionDialog.d.ts +8 -0
  45. package/dist/features/sessions/rename-title.d.ts +6 -0
  46. package/dist/features/sessions/session-actions.d.ts +6 -5
  47. package/dist/hooks/use-connection.d.ts +17 -5
  48. package/dist/host/browser-files.d.ts +2 -2
  49. package/dist/host/browser-host.d.ts +6 -1
  50. package/dist/host/types.d.ts +149 -2
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/lib/connection/connect-failure.d.ts +14 -0
  54. package/dist/lib/connection/connection-store.d.ts +7 -1
  55. package/dist/stores/session-rename-store.d.ts +13 -0
  56. package/dist/styles.css +1 -1
  57. package/dist/timeline/FileLink.d.ts +4 -2
  58. package/dist/timeline/external-href.d.ts +9 -0
  59. package/package.json +4 -4
  60. package/dist/chunks/HtmlViewer-KGQcSEm3.js +0 -490
  61. package/dist/chunks/SettingsDialog-AHnoT7nN.js +0 -471
  62. package/dist/chunks/index-QzeFcHmH.js +0 -6261
@@ -1,471 +0,0 @@
1
- import { jsx as t, jsxs as a, Fragment as x } from "react/jsx-runtime";
2
- import { useState as f, useEffect as w, useCallback as X, useReducer as J, useRef as y, Suspense as W } from "react";
3
- import { clsx as ee } from "clsx";
4
- import { Dialog as K, Button as k, Spinner as E, TextInput as ne, IconButton as te, Icon as oe, EmptyState as T } from "@av-pi-studio/ui-library";
5
- import { g as q, u as B, r as Q, b as ie, S as re } from "./index-QzeFcHmH.js";
6
- import { useQueryClient as se } from "@tanstack/react-query";
7
- import { ExternalLink as O, Check as ae, Copy as ce } from "lucide-react";
8
- import le from "qrcode";
9
- import { u as L } from "./provider-auth-store-C1GaLTlw.js";
10
- function ue(e, n) {
11
- const o = q().links.openExternal;
12
- o && (e.preventDefault(), o(n));
13
- }
14
- function P({ href: e, onClick: n, ...o }) {
15
- return /* @__PURE__ */ t(
16
- "a",
17
- {
18
- ...o,
19
- href: e,
20
- target: "_blank",
21
- rel: "noreferrer",
22
- onClick: (r) => {
23
- n?.(r), r.defaultPrevented || ue(r, e);
24
- }
25
- }
26
- );
27
- }
28
- function pe(e, n) {
29
- return {
30
- provider: e,
31
- authType: n,
32
- phase: "starting",
33
- statusLines: []
34
- };
35
- }
36
- function de(e, n, o) {
37
- return {
38
- ...e,
39
- phase: e.phase === "starting" ? "waiting" : e.phase,
40
- statusLines: [...e.statusLines, { kind: "info", message: n, links: o }]
41
- };
42
- }
43
- function ge(e, n) {
44
- const o = e.statusLines.filter((r) => r.kind !== "progress");
45
- return {
46
- ...e,
47
- phase: e.phase === "starting" ? "waiting" : e.phase,
48
- statusLines: [...o, { kind: "progress", message: n }]
49
- };
50
- }
51
- function he(e, n, o) {
52
- return { ...e, authUrl: { url: n, instructions: o } };
53
- }
54
- function me(e, n, o, r, d) {
55
- return { ...e, deviceCode: { userCode: n, verificationUri: o, intervalSeconds: r, expiresInSeconds: d } };
56
- }
57
- function fe(e, n) {
58
- return { ...e, phase: "prompt", prompt: n };
59
- }
60
- function _e(e, n) {
61
- return e.prompt?.promptId !== n ? e : { ...e, phase: "waiting", prompt: void 0 };
62
- }
63
- function ve(e, n, o) {
64
- return { ...e, phase: "done", result: { ok: n, error: o } };
65
- }
66
- function be(e, n) {
67
- if (e.phase === "done") return e;
68
- switch (n.kind) {
69
- case "info":
70
- return de(e, n.message, n.links);
71
- case "progress":
72
- return ge(e, n.message);
73
- case "auth_url":
74
- return he(e, n.url, n.instructions);
75
- case "device_code":
76
- return me(
77
- e,
78
- n.userCode,
79
- n.verificationUri,
80
- n.intervalSeconds,
81
- n.expiresInSeconds
82
- );
83
- case "prompt":
84
- return fe(e, n);
85
- case "prompt_cancelled":
86
- return _e(e, n.promptId);
87
- case "done":
88
- return ve(e, n.ok, n.error);
89
- }
90
- }
91
- const Le = "piwb-QrCode_qr_URoLM", we = "piwb-QrCode_placeholder_TxqZK", U = {
92
- qr: Le,
93
- placeholder: we
94
- }, Ce = 320;
95
- function z({ value: e, label: n }) {
96
- const [o, r] = f(null), [d, c] = f(!1);
97
- return w(() => {
98
- let p = !0;
99
- return r(null), c(!1), le.toDataURL(e, { width: Ce, margin: 1, errorCorrectionLevel: "M" }).then((g) => {
100
- p && r(g);
101
- }).catch(() => {
102
- p && c(!0);
103
- }), () => {
104
- p = !1;
105
- };
106
- }, [e]), d ? null : o ? /* @__PURE__ */ t("img", { className: U.qr, src: o, alt: n }) : /* @__PURE__ */ t("div", { className: U.placeholder, "aria-hidden": "true" });
107
- }
108
- const De = "piwb-LoginDialog_body_GIlGl", Se = "piwb-LoginDialog_status_rqfrD", Ne = "piwb-LoginDialog_statusLine_Hh0Xn", Ie = "piwb-LoginDialog_statusLineProgress_khvrx", ke = "piwb-LoginDialog_statusText_m5xDP", ye = "piwb-LoginDialog_prompt__-xfG", xe = "piwb-LoginDialog_promptMessage_DY8Sq", Ee = "piwb-LoginDialog_options_yZXpb", Pe = "piwb-LoginDialog_option_ZdMmQ", Ae = "piwb-LoginDialog_optionLabel__CA8q", Me = "piwb-LoginDialog_optionDescription_ha4A3", Re = "piwb-LoginDialog_success_zLKu2", Te = "piwb-LoginDialog_error_SAY5b", Qe = "piwb-LoginDialog_oauth_kwBPZ", Ue = "piwb-LoginDialog_oauthInstructions_qewUJ", Ke = "piwb-LoginDialog_oauthMain_jEuW3", qe = "piwb-LoginDialog_oauthActions_NC3y_", Be = "piwb-LoginDialog_openButton_iwdTY", Oe = "piwb-LoginDialog_urlRow_jEnPI", ze = "piwb-LoginDialog_oauthUrl_cCSag", Fe = "piwb-LoginDialog_oauthQr_v6BwP", $e = "piwb-LoginDialog_oauthQrCaption_Mc-ho", je = "piwb-LoginDialog_deviceCode__RauS", Ge = "piwb-LoginDialog_countdown_gYTuP", i = {
109
- body: De,
110
- status: Se,
111
- statusLine: Ne,
112
- statusLineProgress: Ie,
113
- statusText: ke,
114
- prompt: ye,
115
- promptMessage: xe,
116
- options: Ee,
117
- option: Pe,
118
- optionLabel: Ae,
119
- optionDescription: Me,
120
- success: Re,
121
- error: Te,
122
- oauth: Qe,
123
- oauthInstructions: Ue,
124
- oauthMain: Ke,
125
- oauthActions: qe,
126
- openButton: Be,
127
- urlRow: Oe,
128
- oauthUrl: ze,
129
- oauthQr: Fe,
130
- oauthQrCaption: $e,
131
- deviceCode: je,
132
- countdown: Ge
133
- }, Ye = 1200, F = "provider-auth-prompt-form";
134
- function Ze() {
135
- const e = L((g) => g.pendingLogin), n = L((g) => g.cancelLogin), o = L((g) => g.clearLogin), r = L((g) => g.retryLogin), d = B((g) => g.client), c = se(), p = X(() => {
136
- c.invalidateQueries({ queryKey: Q.providerAuthList() }), c.invalidateQueries({ queryKey: Q.providerModelsAll() });
137
- }, [c]);
138
- return !e || !d ? null : /* @__PURE__ */ t(
139
- He,
140
- {
141
- provider: e.provider,
142
- providerName: e.providerName,
143
- authType: e.authType,
144
- controller: e.controller,
145
- client: d,
146
- onCancel: n,
147
- onClear: o,
148
- onRetry: r,
149
- onSuccess: p
150
- },
151
- `${e.provider}:${e.authType}:${e.attempt}`
152
- );
153
- }
154
- function He({
155
- provider: e,
156
- providerName: n,
157
- authType: o,
158
- controller: r,
159
- client: d,
160
- onCancel: c,
161
- onClear: p,
162
- onRetry: g,
163
- onSuccess: C
164
- }) {
165
- const [u, m] = J(
166
- be,
167
- pe(e, o)
168
- ), h = y(null), I = y(!1), _ = y(!1), [s, v] = f(""), [j, G] = f(null);
169
- w(() => (_.current = !0, I.current || (I.current = !0, d.loginProvider(
170
- e,
171
- o,
172
- {
173
- prompt: (l) => new Promise((S, V) => {
174
- h.current = { promptId: l.promptId, resolve: S, reject: V }, m({ kind: "prompt", ...l }), l.signal?.addEventListener(
175
- "abort",
176
- () => {
177
- h.current?.promptId === l.promptId && (h.current = null), v(""), m({ kind: "prompt_cancelled", promptId: l.promptId });
178
- },
179
- { once: !0 }
180
- );
181
- }),
182
- onEvent: (l) => m(l)
183
- },
184
- { signal: r.signal }
185
- ).then((l) => {
186
- _.current && m({ kind: "done", ok: l.ok, error: l.error });
187
- }).catch((l) => {
188
- _.current && m({
189
- kind: "done",
190
- ok: !1,
191
- error: l instanceof Error ? l.message : String(l)
192
- });
193
- })), () => {
194
- _.current = !1, h.current?.reject(new Error("login dialog closed")), h.current = null;
195
- }), []), w(() => {
196
- if (u.phase !== "done" || !u.result?.ok) return;
197
- C();
198
- const l = setTimeout(p, Ye);
199
- return () => clearTimeout(l);
200
- }, [u.phase, u.result?.ok, C, p]);
201
- function A(l) {
202
- const S = h.current;
203
- S && (h.current = null, G(S.promptId), v(""), S.resolve(l));
204
- }
205
- function Y(l) {
206
- l.preventDefault(), A(s);
207
- }
208
- function Z(l) {
209
- l || (u.phase === "done" ? p() : c());
210
- }
211
- const b = u.phase === "done", H = b && u.result?.ok === !0, M = b && u.result?.ok === !1, D = u.phase === "prompt" && u.prompt && u.prompt.promptId !== j ? u.prompt : void 0, R = D && D.promptKind !== "select" ? D : void 0;
212
- return /* @__PURE__ */ t(
213
- K,
214
- {
215
- open: !0,
216
- onOpenChange: Z,
217
- title: `Log in to ${n}`,
218
- width: 480,
219
- footer: b ? /* @__PURE__ */ a(x, { children: [
220
- /* @__PURE__ */ t(k, { variant: "ghost", onClick: p, children: "Close" }),
221
- M && /* @__PURE__ */ t(k, { onClick: g, children: "Try again" })
222
- ] }) : /* @__PURE__ */ a(x, { children: [
223
- /* @__PURE__ */ t(k, { variant: "ghost", onClick: c, children: "Cancel" }),
224
- R && // Associated with the body's form by id, so Enter-in-the-input and this click are
225
- // the same submit path while both actions still sit in the footer's action row.
226
- //
227
- // Deliberately NOT disabled on an empty input: blank is a meaningful answer to some
228
- // prompts — GitHub Copilot opens with "GitHub Enterprise URL/domain (blank for
229
- // github.com)", and gating on length made that flow impossible to advance. The
230
- // provider decides what it accepts, exactly as `pi-studio auth login` does (its
231
- // `@inquirer/prompts` input carries no non-empty validation either).
232
- /* @__PURE__ */ t(k, { type: "submit", form: F, children: "Submit" })
233
- ] }),
234
- children: /* @__PURE__ */ a("div", { className: i.body, children: [
235
- /* @__PURE__ */ t(Ve, { state: u }),
236
- !b && u.authUrl && /* @__PURE__ */ t(We, { authUrl: u.authUrl, showInstructions: !R }),
237
- !b && u.deviceCode && /* @__PURE__ */ t(nn, { deviceCode: u.deviceCode, stopped: b }),
238
- D && /* @__PURE__ */ t(
239
- Xe,
240
- {
241
- prompt: D,
242
- inputValue: s,
243
- onInputChange: v,
244
- onTextSubmit: Y,
245
- onSelect: A
246
- }
247
- ),
248
- H && /* @__PURE__ */ t("p", { className: i.success, children: "Signed in. Closing…" }),
249
- M && /* @__PURE__ */ t("p", { className: i.error, children: u.result?.error ?? "Login failed." })
250
- ] })
251
- }
252
- );
253
- }
254
- function Ve({ state: e }) {
255
- return e.statusLines.length === 0 && e.phase !== "starting" ? null : /* @__PURE__ */ a("div", { className: i.status, children: [
256
- e.phase === "starting" && /* @__PURE__ */ a("div", { className: i.statusLine, children: [
257
- /* @__PURE__ */ t(E, { size: "sm" }),
258
- " Starting…"
259
- ] }),
260
- e.statusLines.map((n, o) => /* @__PURE__ */ a(
261
- "div",
262
- {
263
- className: n.kind === "progress" ? i.statusLineProgress : i.statusLine,
264
- children: [
265
- n.kind === "progress" && /* @__PURE__ */ t(E, { size: "sm" }),
266
- /* @__PURE__ */ a("span", { className: i.statusText, children: [
267
- /* @__PURE__ */ t("span", { children: n.message }),
268
- n.links?.map((r) => /* @__PURE__ */ t(P, { href: r.url, children: r.label ?? r.url }, r.url))
269
- ] })
270
- ]
271
- },
272
- o
273
- ))
274
- ] });
275
- }
276
- function Xe({
277
- prompt: e,
278
- inputValue: n,
279
- onInputChange: o,
280
- onTextSubmit: r,
281
- onSelect: d
282
- }) {
283
- return e.promptKind === "select" ? /* @__PURE__ */ a("div", { className: i.prompt, children: [
284
- /* @__PURE__ */ t("p", { className: i.promptMessage, children: e.message }),
285
- /* @__PURE__ */ t("div", { className: i.options, children: e.options?.map((c) => /* @__PURE__ */ a(
286
- "button",
287
- {
288
- type: "button",
289
- className: i.option,
290
- onClick: () => d(c.id),
291
- children: [
292
- /* @__PURE__ */ t("span", { className: i.optionLabel, children: c.label }),
293
- c.description && /* @__PURE__ */ t("span", { className: i.optionDescription, children: c.description })
294
- ]
295
- },
296
- c.id
297
- )) })
298
- ] }) : /* @__PURE__ */ a("form", { id: F, className: i.prompt, onSubmit: r, children: [
299
- /* @__PURE__ */ t("label", { className: i.promptMessage, htmlFor: "login-prompt-input", children: e.message }),
300
- /* @__PURE__ */ t(
301
- ne,
302
- {
303
- id: "login-prompt-input",
304
- autoFocus: !0,
305
- type: e.promptKind === "secret" ? "password" : "text",
306
- autoComplete: e.promptKind === "secret" ? "off" : void 0,
307
- "data-1p-ignore": e.promptKind === "secret" ? "true" : void 0,
308
- "data-lpignore": e.promptKind === "secret" ? "true" : void 0,
309
- "data-bwignore": e.promptKind === "secret" ? "true" : void 0,
310
- placeholder: e.placeholder,
311
- value: n,
312
- onChange: (c) => o(c.target.value)
313
- }
314
- )
315
- ] });
316
- }
317
- const Je = 1800;
318
- function $({ value: e, label: n }) {
319
- const [o, r] = f(!1);
320
- return w(() => {
321
- if (!o) return;
322
- const d = setTimeout(() => r(!1), Je);
323
- return () => clearTimeout(d);
324
- }, [o]), /* @__PURE__ */ t(
325
- te,
326
- {
327
- size: "sm",
328
- "aria-label": o ? "Copied" : n,
329
- title: o ? "Copied" : n,
330
- onClick: () => {
331
- q().clipboard.writeText(e).then(
332
- () => r(!0),
333
- () => r(!1)
334
- );
335
- },
336
- children: o ? /* @__PURE__ */ t(ae, { size: 14 }) : /* @__PURE__ */ t(ce, { size: 14 })
337
- }
338
- );
339
- }
340
- function We({
341
- authUrl: e,
342
- showInstructions: n
343
- }) {
344
- return /* @__PURE__ */ a("div", { className: i.oauth, children: [
345
- n && e.instructions && /* @__PURE__ */ t("p", { className: i.oauthInstructions, children: e.instructions }),
346
- /* @__PURE__ */ a("div", { className: i.oauthMain, children: [
347
- /* @__PURE__ */ a("div", { className: i.oauthActions, children: [
348
- /* @__PURE__ */ a(P, { className: i.openButton, href: e.url, children: [
349
- /* @__PURE__ */ t(O, { size: 14 }),
350
- "Open login page"
351
- ] }),
352
- /* @__PURE__ */ a("div", { className: i.urlRow, children: [
353
- /* @__PURE__ */ t("span", { className: i.oauthUrl, children: e.url }),
354
- /* @__PURE__ */ t($, { value: e.url, label: "Copy link" })
355
- ] })
356
- ] }),
357
- /* @__PURE__ */ a("div", { className: i.oauthQr, children: [
358
- /* @__PURE__ */ t(z, { value: e.url, label: "QR code for the provider's login page" }),
359
- /* @__PURE__ */ t("span", { className: i.oauthQrCaption, children: "Scan on another device" })
360
- ] })
361
- ] })
362
- ] });
363
- }
364
- function en(e) {
365
- const n = Math.max(0, e), o = Math.floor(n / 60), r = n % 60;
366
- return `${o}:${String(r).padStart(2, "0")}`;
367
- }
368
- function nn({
369
- deviceCode: e,
370
- stopped: n
371
- }) {
372
- const [o, r] = f(e.expiresInSeconds);
373
- return w(() => {
374
- if (n || e.expiresInSeconds === void 0) return;
375
- r(e.expiresInSeconds);
376
- const d = setInterval(() => {
377
- r((c) => c === void 0 ? void 0 : Math.max(0, c - 1));
378
- }, 1e3);
379
- return () => clearInterval(d);
380
- }, [e.expiresInSeconds, n]), /* @__PURE__ */ t("div", { className: i.oauth, children: /* @__PURE__ */ a("div", { className: i.oauthMain, children: [
381
- /* @__PURE__ */ a("div", { className: i.oauthActions, children: [
382
- /* @__PURE__ */ t("span", { className: i.oauthInstructions, children: "Enter this code at the verification page" }),
383
- /* @__PURE__ */ a("div", { className: i.urlRow, children: [
384
- /* @__PURE__ */ t("span", { className: i.deviceCode, children: e.userCode }),
385
- /* @__PURE__ */ t($, { value: e.userCode, label: "Copy code" })
386
- ] }),
387
- /* @__PURE__ */ a(P, { className: i.openButton, href: e.verificationUri, children: [
388
- /* @__PURE__ */ t(O, { size: 14 }),
389
- "Open verification page"
390
- ] }),
391
- o !== void 0 && /* @__PURE__ */ t("span", { className: i.countdown, children: o > 0 ? `Expires in ${en(o)}` : "Code expired" })
392
- ] }),
393
- /* @__PURE__ */ a("div", { className: i.oauthQr, children: [
394
- /* @__PURE__ */ t(z, { value: e.verificationUri, label: "QR code for the verification page" }),
395
- /* @__PURE__ */ t("span", { className: i.oauthQrCaption, children: "Scan on another device" })
396
- ] })
397
- ] }) });
398
- }
399
- const tn = "piwb-SettingsDialog_shell_N_xAE", on = "piwb-SettingsDialog_sidebar_1dH3S", rn = "piwb-SettingsDialog_category__q-DM", sn = "piwb-SettingsDialog_categoryActive_zc7nw", an = "piwb-SettingsDialog_content_opjtv", N = {
400
- shell: tn,
401
- sidebar: on,
402
- category: rn,
403
- categoryActive: sn,
404
- content: an
405
- };
406
- function _n({ open: e, onOpenChange: n }) {
407
- const o = B((s) => s.serverInfo), r = L((s) => s.pendingLogin), d = L((s) => s.cancelLogin), c = ie(o?.features), p = re.filter((s) => s.available(c)), [g, C] = f(p[0]?.id);
408
- w(() => {
409
- p.some((s) => s.id === g) || C(p[0]?.id);
410
- }, [p.map((s) => s.id).join(",")]);
411
- const u = p.find((s) => s.id === g) ?? p[0], m = u?.component;
412
- function h(s) {
413
- !s && r && d(), n(s);
414
- }
415
- function I(s) {
416
- if (r) {
417
- s.preventDefault();
418
- return;
419
- }
420
- const v = s.detail.originalEvent.target;
421
- v instanceof Node && !v.isConnected && s.preventDefault();
422
- }
423
- function _(s) {
424
- r && s.preventDefault();
425
- }
426
- return /* @__PURE__ */ a(x, { children: [
427
- /* @__PURE__ */ t(
428
- K,
429
- {
430
- open: e,
431
- onOpenChange: h,
432
- title: "Settings",
433
- width: 900,
434
- onInteractOutside: I,
435
- onEscapeKeyDown: _,
436
- children: /* @__PURE__ */ a("div", { className: N.shell, children: [
437
- /* @__PURE__ */ t("nav", { className: N.sidebar, children: p.map((s) => /* @__PURE__ */ a(
438
- "button",
439
- {
440
- type: "button",
441
- className: ee(
442
- N.category,
443
- s.id === u?.id && N.categoryActive
444
- ),
445
- onClick: () => C(s.id),
446
- children: [
447
- /* @__PURE__ */ t(oe, { icon: s.icon, size: "sm" }),
448
- s.label
449
- ]
450
- },
451
- s.id
452
- )) }),
453
- /* @__PURE__ */ t("div", { className: N.content, children: m ? /* @__PURE__ */ t(
454
- W,
455
- {
456
- fallback: /* @__PURE__ */ a(T, { children: [
457
- /* @__PURE__ */ t(E, { size: "sm" }),
458
- " Loading…"
459
- ] }),
460
- children: /* @__PURE__ */ t(m, {})
461
- }
462
- ) : /* @__PURE__ */ t(T, { children: "No settings categories available." }) })
463
- ] })
464
- }
465
- ),
466
- /* @__PURE__ */ t(Ze, {})
467
- ] });
468
- }
469
- export {
470
- _n as SettingsDialog
471
- };