@omg-dev/app 0.1.320 → 0.1.321

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omg-dev/app",
3
- "version": "0.1.320",
3
+ "version": "0.1.321",
4
4
  "description": "The full OMG application surface for React hosts.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://omg.dev",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "type": "module",
26
26
  "dependencies": {
27
- "@omg-dev/client": "0.1.320",
27
+ "@omg-dev/client": "0.1.321",
28
28
  "@ai-sdk/react": "^4.0.19",
29
29
  "@base-ui/react": "^1.3.0",
30
30
  "@number-flow/react": "^0.6.2",
@@ -1,650 +0,0 @@
1
- import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
- import { useRef as _, useState as f, useCallback as o, useLayoutEffect as me, useEffect as W } from "react";
3
- import { c as E, Z, ad as y, B as m, R as he, L as U, X as pe, k as J, ae as fe, af as Y, ag as ge, T as ye, H as be } from "./embedded-DdwkOHs-.js";
4
- import { B as xe } from "./badge-9CxnDp-1.js";
5
- import { C as ve } from "./clipboard-paste-CENdB6NY.js";
6
- /**
7
- * @license lucide-react v0.577.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
12
- const we = [
13
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
14
- ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
15
- ["path", { d: "m9 9 6 6", key: "z0biqf" }]
16
- ], ke = E("circle-x", we);
17
- /**
18
- * @license lucide-react v0.577.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */
23
- const Ne = [
24
- ["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }],
25
- ["path", { d: "m9 10-5 5 5 5", key: "1kshq7" }]
26
- ], Ce = E("corner-down-left", Ne);
27
- /**
28
- * @license lucide-react v0.577.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */
33
- const ze = [
34
- [
35
- "path",
36
- {
37
- d: "M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",
38
- key: "1yo7s0"
39
- }
40
- ],
41
- ["path", { d: "m12 9 6 6", key: "anjzzh" }],
42
- ["path", { d: "m18 9-6 6", key: "1fp51s" }]
43
- ], Me = E("delete", ze);
44
- /**
45
- * @license lucide-react v0.577.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */
50
- const Se = [
51
- ["path", { d: "m10 17 5-5-5-5", key: "1bsop3" }],
52
- ["path", { d: "M15 12H3", key: "6jk70r" }],
53
- ["path", { d: "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4", key: "u53s6r" }]
54
- ], Ee = E("log-in", Se);
55
- /**
56
- * @license lucide-react v0.577.0 - ISC
57
- *
58
- * This source code is licensed under the ISC license.
59
- * See the LICENSE file in the root directory of this source tree.
60
- */
61
- const Ie = [
62
- ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
63
- ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
64
- ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
65
- ], Le = E("monitor", Ie);
66
- /**
67
- * @license lucide-react v0.577.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */
72
- const Te = [
73
- [
74
- "path",
75
- {
76
- d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
77
- key: "1c8476"
78
- }
79
- ],
80
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
81
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
82
- ], De = E("save", Te);
83
- /**
84
- * @license lucide-react v0.577.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */
89
- const Re = [
90
- [
91
- "path",
92
- { d: "M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3", key: "1ub6xw" }
93
- ],
94
- ["path", { d: "m16 2 6 6", key: "1gw87d" }],
95
- ["path", { d: "M12 16H4", key: "1cjfip" }]
96
- ], $e = E("test-tube-diagonal", Re);
97
- function Pe(h) {
98
- const { sessionId: g, onClose: p, onSaved: d } = h, L = Z(), N = _(null), z = _(null), T = _(null), b = _({ w: 1280, h: 800 }), [I, M] = f("connecting"), [v, D] = f({}), [w, j] = f(null), [k, R] = f(""), [O, $] = f(!1), [S, V] = f(""), P = _(null), t = o((e) => {
99
- const n = z.current;
100
- n && n.readyState === WebSocket.OPEN && n.send(JSON.stringify(e));
101
- }, []);
102
- me(() => {
103
- let e = !1;
104
- const i = `${location.protocol === "https:" ? "wss:" : "ws:"}//${location.host}/api/browser/sessions/${encodeURIComponent(
105
- g
106
- )}/stream`, c = new WebSocket(i);
107
- return z.current = c, M("connecting"), c.onopen = () => {
108
- e || M("open");
109
- }, c.onmessage = (C) => {
110
- if (e || typeof C.data != "string") return;
111
- let u;
112
- try {
113
- u = JSON.parse(C.data);
114
- } catch {
115
- return;
116
- }
117
- switch (u.type) {
118
- case "frame":
119
- r(u);
120
- break;
121
- case "status":
122
- D({ state: u.state, url: u.url, title: u.title }), u.url && R((F) => F || (u.url ?? ""));
123
- break;
124
- case "saved":
125
- $(!1), y.success("Profile saved"), d == null || d(u.profileId);
126
- break;
127
- case "error":
128
- $(!1), j(u.message), y.error(u.message || "Browser session error");
129
- break;
130
- }
131
- }, c.onerror = () => {
132
- e || (M("error"), j("Connection error"));
133
- }, c.onclose = () => {
134
- e || M("closed");
135
- }, () => {
136
- e = !0, z.current = null;
137
- try {
138
- c.close();
139
- } catch {
140
- }
141
- };
142
- }, [g]);
143
- const r = o((e) => {
144
- const n = N.current;
145
- if (!n) return;
146
- e.w && e.h && (b.current = { w: e.w, h: e.h }, n.width !== e.w && (n.width = e.w), n.height !== e.h && (n.height = e.h));
147
- let i = T.current;
148
- if (i || (i = n.getContext("2d"), T.current = i), !i) return;
149
- const c = new Image();
150
- c.onload = () => {
151
- const C = N.current, u = T.current;
152
- !C || !u || u.drawImage(c, 0, 0, C.width, C.height);
153
- }, c.src = `data:image/jpeg;base64,${e.dataB64}`;
154
- }, []), l = o((e) => {
155
- const n = N.current;
156
- if (!n) return { x: 0, y: 0 };
157
- const i = n.getBoundingClientRect(), { w: c, h: C } = b.current, u = i.width > 0 ? c / i.width : 1, F = i.height > 0 ? C / i.height : 1, de = Math.round((e.clientX - i.left) * u), ue = Math.round((e.clientY - i.top) * F);
158
- return { x: de, y: ue };
159
- }, []), x = o(
160
- (e) => {
161
- const { x: n, y: i } = l(e);
162
- t({ type: "input", kind: "mousemove", x: n, y: i });
163
- },
164
- [t, l]
165
- ), Q = o(
166
- (e) => {
167
- var c;
168
- (c = N.current) == null || c.focus();
169
- const { x: n, y: i } = l(e);
170
- t({ type: "input", kind: "mousedown", x: n, y: i, button: e.button });
171
- },
172
- [t, l]
173
- ), ee = o(
174
- (e) => {
175
- const { x: n, y: i } = l(e);
176
- t({ type: "input", kind: "mouseup", x: n, y: i, button: e.button });
177
- },
178
- [t, l]
179
- ), te = o(
180
- (e) => {
181
- const { x: n, y: i } = l(e);
182
- t({ type: "input", kind: "wheel", x: n, y: i, deltaY: e.deltaY });
183
- },
184
- [t, l]
185
- ), se = o(
186
- (e) => {
187
- e.preventDefault(), t({ type: "input", kind: "keydown", key: e.key }), e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && t({ type: "input", kind: "char", text: e.key });
188
- },
189
- [t]
190
- ), ne = o(
191
- (e) => {
192
- e.preventDefault(), t({ type: "input", kind: "keyup", key: e.key });
193
- },
194
- [t]
195
- ), ae = o(
196
- (e) => {
197
- e.preventDefault();
198
- const n = e.clipboardData.getData("text/plain");
199
- n && t({ type: "input", kind: "char", text: n });
200
- },
201
- [t]
202
- ), A = o(
203
- (e) => {
204
- e && t({ type: "input", kind: "char", text: e });
205
- },
206
- [t]
207
- ), K = o(
208
- (e) => {
209
- t({ type: "input", kind: "keydown", key: e }), t({ type: "input", kind: "keyup", key: e });
210
- },
211
- [t]
212
- ), H = o(() => {
213
- var e;
214
- S && (A(S), V(""), (e = P.current) == null || e.focus());
215
- }, [S, A]), re = o(async () => {
216
- var e, n, i;
217
- try {
218
- const c = await ((n = (e = navigator.clipboard) == null ? void 0 : e.readText) == null ? void 0 : n.call(e));
219
- if (c) {
220
- A(c), y.success("Pasted into page");
221
- return;
222
- }
223
- if (c === "") {
224
- y.message("Clipboard is empty");
225
- return;
226
- }
227
- throw new Error("no clipboard api");
228
- } catch {
229
- (i = P.current) == null || i.focus(), y.message("Paste into the text box, then tap Send");
230
- }
231
- }, [A]), ie = o(
232
- (e) => {
233
- e.preventDefault();
234
- const n = k.trim();
235
- if (!n) return;
236
- const i = /^[a-z]+:\/\//i.test(n) ? n : `https://${n}`;
237
- t({ type: "navigate", url: i });
238
- },
239
- [k, t]
240
- ), oe = o(async () => {
241
- const e = await L.prompt({
242
- title: "Save browser profile",
243
- description: "Name this saved login so agents can find it later.",
244
- defaultValue: v.title || "",
245
- inputLabel: "Profile name",
246
- confirmLabel: "Save profile"
247
- });
248
- if (e == null) return;
249
- const n = e.trim();
250
- n && ($(!0), t({ type: "save", name: n }));
251
- }, [L, t, v.title]), le = o(() => {
252
- t({ type: "reload" });
253
- }, [t]), ce = o(() => {
254
- var e;
255
- try {
256
- (e = z.current) == null || e.close();
257
- } catch {
258
- }
259
- p();
260
- }, [p]);
261
- return /* @__PURE__ */ a("div", { className: "flex h-full min-h-0 flex-col gap-1.5 bg-background text-foreground", children: [
262
- /* @__PURE__ */ a("div", { className: "flex shrink-0 flex-col gap-1.5 border-b border-border px-3 py-2", children: [
263
- /* @__PURE__ */ a("form", { onSubmit: ie, className: "flex min-w-0 items-center gap-2", children: [
264
- /* @__PURE__ */ s(
265
- "input",
266
- {
267
- type: "url",
268
- "aria-label": "Browser address",
269
- inputMode: "url",
270
- value: k,
271
- onChange: (e) => R(e.target.value),
272
- placeholder: "Enter a URL to navigate",
273
- autoCapitalize: "off",
274
- autoCorrect: "off",
275
- spellCheck: !1,
276
- className: "min-w-0 flex-1 rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground outline-none focus:border-primary"
277
- }
278
- ),
279
- /* @__PURE__ */ s(m, { type: "submit", size: "sm", variant: "outline", children: "Go" })
280
- ] }),
281
- /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
282
- /* @__PURE__ */ a(m, { size: "sm", variant: "outline", onClick: le, title: "Reload page", "aria-label": "Reload", children: [
283
- /* @__PURE__ */ s(he, { className: "size-4" }),
284
- /* @__PURE__ */ s("span", { className: "ml-1 hidden sm:inline", children: "Reload" })
285
- ] }),
286
- /* @__PURE__ */ a(m, { size: "sm", variant: "brand", onClick: oe, disabled: O, title: "Save profile", "aria-label": "Save profile", children: [
287
- O ? /* @__PURE__ */ s(U, { className: "size-4 animate-spin" }) : /* @__PURE__ */ s(De, { className: "size-4" }),
288
- /* @__PURE__ */ s("span", { className: "ml-1 hidden sm:inline", children: "Save profile" })
289
- ] }),
290
- /* @__PURE__ */ a(m, { size: "sm", variant: "ghost", onClick: ce, className: "ml-auto", title: "Close", "aria-label": "Close", children: [
291
- /* @__PURE__ */ s(pe, { className: "size-4" }),
292
- /* @__PURE__ */ s("span", { className: "ml-1 hidden sm:inline", children: "Close" })
293
- ] })
294
- ] })
295
- ] }),
296
- /* @__PURE__ */ a("div", { className: "flex shrink-0 flex-wrap items-center gap-2 px-3", children: [
297
- /* @__PURE__ */ s(
298
- "input",
299
- {
300
- ref: P,
301
- type: "text",
302
- "aria-label": "Remote browser keyboard input",
303
- value: S,
304
- onChange: (e) => V(e.target.value),
305
- onKeyDown: (e) => {
306
- e.key === "Enter" && (e.preventDefault(), H());
307
- },
308
- placeholder: "Type or paste, then Send",
309
- autoCapitalize: "off",
310
- autoCorrect: "off",
311
- autoComplete: "off",
312
- spellCheck: !1,
313
- className: "min-w-0 flex-1 basis-44 rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground outline-none focus:border-primary"
314
- }
315
- ),
316
- /* @__PURE__ */ s(m, { size: "sm", variant: "brand", onClick: H, disabled: !S, children: "Send" }),
317
- /* @__PURE__ */ a(m, { size: "sm", variant: "outline", onClick: re, title: "Paste from clipboard", "aria-label": "Paste", children: [
318
- /* @__PURE__ */ s(ve, { className: "size-4" }),
319
- /* @__PURE__ */ s("span", { className: "ml-1 hidden sm:inline", children: "Paste" })
320
- ] }),
321
- /* @__PURE__ */ s(m, { size: "sm", variant: "outline", onClick: () => K("Enter"), title: "Press Enter in page", "aria-label": "Enter", children: /* @__PURE__ */ s(Ce, { className: "size-4" }) }),
322
- /* @__PURE__ */ s(m, { size: "sm", variant: "outline", onClick: () => K("Tab"), title: "Press Tab in page", "aria-label": "Tab", className: "hidden sm:inline-flex", children: /* @__PURE__ */ s("span", { className: "text-xs font-medium", children: "Tab" }) }),
323
- /* @__PURE__ */ s(m, { size: "sm", variant: "outline", onClick: () => K("Backspace"), title: "Backspace in page", "aria-label": "Backspace", children: /* @__PURE__ */ s(Me, { className: "size-4" }) })
324
- ] }),
325
- /* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-2 px-3 text-xs text-muted-foreground", children: [
326
- /* @__PURE__ */ s(
327
- "span",
328
- {
329
- className: "inline-block size-2 shrink-0 rounded-full " + (I === "open" ? "bg-emerald-500" : I === "connecting" ? "bg-amber-500" : "bg-destructive"),
330
- title: I
331
- }
332
- ),
333
- /* @__PURE__ */ s("span", { className: "min-w-0 max-w-[50%] shrink-0 truncate", children: v.title ? v.title : v.state || I }),
334
- v.url ? /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-muted-foreground/70", children: [
335
- "· ",
336
- v.url
337
- ] }) : null
338
- ] }),
339
- w ? /* @__PURE__ */ s("div", { className: "mx-3 shrink-0 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive", children: w }) : null,
340
- /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black/80 p-2", children: /* @__PURE__ */ s(
341
- "canvas",
342
- {
343
- ref: N,
344
- tabIndex: 0,
345
- width: b.current.w,
346
- height: b.current.h,
347
- onMouseMove: x,
348
- onMouseDown: Q,
349
- onMouseUp: ee,
350
- onWheel: te,
351
- onContextMenu: (e) => e.preventDefault(),
352
- onKeyDown: se,
353
- onKeyUp: ne,
354
- onPaste: ae,
355
- className: "max-h-full max-w-full cursor-crosshair rounded-md shadow-lg outline-none",
356
- style: { touchAction: "none" }
357
- }
358
- ) })
359
- ] });
360
- }
361
- async function B(h, g) {
362
- const p = await be(h, g), d = await p.json().catch(() => ({}));
363
- if (!p.ok)
364
- throw new Error((d == null ? void 0 : d.error) || `${p.status} ${p.statusText}`);
365
- return d;
366
- }
367
- const q = {
368
- fit: "Fit my screen",
369
- desktop: "Desktop",
370
- mobile: "Mobile"
371
- };
372
- function X(h) {
373
- return h === "mobile" ? { width: 390, height: 844, deviceScaleFactor: 2, isMobile: !0 } : h === "desktop" ? { width: 1440, height: 900, deviceScaleFactor: 1, isMobile: !1 } : {
374
- width: Math.round(window.innerWidth) || 1280,
375
- height: Math.round(window.innerHeight) || 800,
376
- deviceScaleFactor: 1,
377
- isMobile: !1
378
- };
379
- }
380
- const G = "lfg_browser_viewport_mode";
381
- function _e(h) {
382
- if (!h) return "never";
383
- const g = Math.max(0, Math.round((Date.now() - h) / 1e3));
384
- if (g < 60) return `${g}s ago`;
385
- const p = Math.round(g / 60);
386
- if (p < 60) return `${p}m ago`;
387
- const d = Math.round(p / 60);
388
- return d < 48 ? `${d}h ago` : `${Math.round(d / 24)}d ago`;
389
- }
390
- function Fe() {
391
- const h = Z(), [g, p] = f([]), [d, L] = f(!0), [N, z] = f(null), [T, b] = f(null), [I, M] = f({}), [v, D] = f(null), [w, j] = f(() => {
392
- const t = localStorage.getItem(G);
393
- return t === "desktop" || t === "mobile" || t === "fit" ? t : "fit";
394
- });
395
- W(() => {
396
- localStorage.setItem(G, w);
397
- }, [w]);
398
- const k = o(async () => {
399
- L(!0), z(null);
400
- try {
401
- const t = await B("/api/browser/profiles");
402
- p(Array.isArray(t) ? t : []);
403
- } catch (t) {
404
- z(t instanceof Error ? t.message : "Failed to load profiles");
405
- } finally {
406
- L(!1);
407
- }
408
- }, []);
409
- W(() => {
410
- k();
411
- }, [k]);
412
- const R = o(async () => {
413
- const t = await h.prompt({
414
- title: "New browser login",
415
- description: "Enter the site you want to log in to.",
416
- defaultValue: "https://",
417
- inputLabel: "Website URL",
418
- confirmLabel: "Open login"
419
- });
420
- if (t == null) return;
421
- const r = t.trim();
422
- if (!r || r === "https://") return;
423
- const l = /^[a-z]+:\/\//i.test(r) ? r : `https://${r}`;
424
- try {
425
- const { sessionId: x } = await B("/api/browser/profiles", {
426
- method: "POST",
427
- headers: { "Content-Type": "application/json" },
428
- body: JSON.stringify({ url: l, viewport: X(w) })
429
- });
430
- D({ sessionId: x, profileId: null });
431
- } catch (x) {
432
- y.error(x instanceof Error ? x.message : "Failed to start session");
433
- }
434
- }, [h, w]), O = o(
435
- async (t) => {
436
- b(t);
437
- try {
438
- const { sessionId: r } = await B(
439
- `/api/browser/profiles/${encodeURIComponent(t)}/reauth`,
440
- {
441
- method: "POST",
442
- headers: { "Content-Type": "application/json" },
443
- body: JSON.stringify({ viewport: X(w) })
444
- }
445
- );
446
- D({ sessionId: r, profileId: t });
447
- } catch (r) {
448
- y.error(r instanceof Error ? r.message : "Failed to start re-auth");
449
- } finally {
450
- b(null);
451
- }
452
- },
453
- [w]
454
- ), $ = o(async (t) => {
455
- b(t);
456
- try {
457
- const r = await B(
458
- `/api/browser/profiles/${encodeURIComponent(t)}/test`,
459
- { method: "POST" }
460
- );
461
- M((l) => ({ ...l, [t]: r })), r.loggedIn ? y.success(`Logged in${r.title ? ` — ${r.title}` : ""}`) : y.error("Not logged in");
462
- } catch (r) {
463
- y.error(r instanceof Error ? r.message : "Test failed");
464
- } finally {
465
- b(null);
466
- }
467
- }, []), S = o(async (t) => {
468
- if (await h.confirm({
469
- title: `Delete profile “${t.name}”?`,
470
- description: "This saved login will be permanently removed. This cannot be undone.",
471
- confirmLabel: "Delete profile",
472
- destructive: !0
473
- })) {
474
- b(t.id);
475
- try {
476
- await B(`/api/browser/profiles/${encodeURIComponent(t.id)}`, { method: "DELETE" }), p((l) => l.filter((x) => x.id !== t.id)), M((l) => {
477
- const x = { ...l };
478
- return delete x[t.id], x;
479
- }), y.success("Profile deleted");
480
- } catch (l) {
481
- y.error(l instanceof Error ? l.message : "Delete failed");
482
- } finally {
483
- b(null);
484
- }
485
- }
486
- }, [h]), V = o(() => D(null), []), P = o(
487
- (t) => {
488
- k();
489
- },
490
- [k]
491
- );
492
- return /* @__PURE__ */ a("div", { className: "flex h-full min-h-0 flex-col bg-background text-foreground", children: [
493
- /* @__PURE__ */ a("header", { className: "flex shrink-0 flex-wrap items-center gap-x-2 gap-y-2 border-b border-border px-4 py-3", children: [
494
- /* @__PURE__ */ s(J, { className: "size-5 shrink-0 text-primary" }),
495
- /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
496
- /* @__PURE__ */ s("div", { className: "truncate text-sm font-semibold", children: "Browser profiles" }),
497
- /* @__PURE__ */ s("div", { className: "truncate text-xs text-muted-foreground", children: "Saved logins agents can reuse to act as you" })
498
- ] }),
499
- /* @__PURE__ */ a("div", { className: "flex w-full items-center justify-end gap-2 sm:w-auto", children: [
500
- /* @__PURE__ */ a("label", { className: "flex min-w-0 items-center gap-1 text-xs text-muted-foreground", children: [
501
- /* @__PURE__ */ s(Le, { className: "size-3.5 shrink-0" }),
502
- /* @__PURE__ */ s(
503
- "select",
504
- {
505
- value: w,
506
- onChange: (t) => j(t.target.value),
507
- "aria-label": "Login browser size",
508
- title: "Size of the live login browser",
509
- className: "min-w-0 rounded-md border border-border bg-card px-1.5 py-1 text-xs text-foreground outline-none focus:border-primary",
510
- children: Object.keys(q).map((t) => /* @__PURE__ */ s("option", { value: t, children: q[t] }, t))
511
- }
512
- )
513
- ] }),
514
- /* @__PURE__ */ s(
515
- m,
516
- {
517
- size: "sm",
518
- variant: "outline",
519
- onClick: () => void k(),
520
- disabled: d,
521
- className: "shrink-0",
522
- children: /* @__PURE__ */ s(fe, { className: "size-4" + (d ? " animate-spin" : "") })
523
- }
524
- ),
525
- /* @__PURE__ */ a(
526
- m,
527
- {
528
- size: "sm",
529
- variant: "brand",
530
- onClick: () => void R(),
531
- className: "shrink-0",
532
- children: [
533
- /* @__PURE__ */ s(Y, { className: "size-4" }),
534
- /* @__PURE__ */ s("span", { className: "ml-1", children: "New login" })
535
- ]
536
- }
537
- )
538
- ] })
539
- ] }),
540
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-4", children: [
541
- N ? /* @__PURE__ */ s("div", { className: "mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: N }) : null,
542
- d && g.length === 0 ? /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground", children: [
543
- /* @__PURE__ */ s(U, { className: "size-4 animate-spin" }),
544
- "Loading profiles…"
545
- ] }) : g.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center gap-2 py-12 text-center text-sm text-muted-foreground", children: [
546
- /* @__PURE__ */ s(J, { className: "size-8 opacity-40" }),
547
- /* @__PURE__ */ s("div", { children: "No saved profiles yet." }),
548
- /* @__PURE__ */ a(m, { size: "sm", variant: "brand", onClick: () => void R(), children: [
549
- /* @__PURE__ */ s(Y, { className: "size-4" }),
550
- /* @__PURE__ */ s("span", { className: "ml-1", children: "New login" })
551
- ] })
552
- ] }) : /* @__PURE__ */ s("ul", { className: "flex flex-col gap-2", children: g.map((t) => {
553
- const r = I[t.id], l = T === t.id;
554
- return /* @__PURE__ */ a(
555
- "li",
556
- {
557
- className: "rounded-xl border border-border bg-card px-3.5 py-3 shadow-sm",
558
- children: [
559
- /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
560
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
561
- /* @__PURE__ */ s("span", { className: "min-w-0 truncate text-sm font-semibold", children: t.name }),
562
- /* @__PURE__ */ s(
563
- xe,
564
- {
565
- variant: t.status === "active" ? "default" : "destructive",
566
- className: "shrink-0",
567
- children: t.status
568
- }
569
- )
570
- ] }),
571
- /* @__PURE__ */ s("div", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: t.origins.length ? t.origins.join(", ") : "no origins" }),
572
- /* @__PURE__ */ a("div", { className: "mt-0.5 text-xs text-muted-foreground/80", children: [
573
- "Last used ",
574
- _e(t.lastUsedAt)
575
- ] }),
576
- r ? /* @__PURE__ */ a(
577
- "div",
578
- {
579
- className: "mt-1.5 flex items-center gap-1.5 text-xs " + (r.loggedIn ? "text-emerald-600" : "text-destructive"),
580
- children: [
581
- r.loggedIn ? /* @__PURE__ */ s(ge, { className: "size-3.5" }) : /* @__PURE__ */ s(ke, { className: "size-3.5" }),
582
- /* @__PURE__ */ a("span", { className: "min-w-0 truncate", children: [
583
- r.loggedIn ? "Logged in" : "Not logged in",
584
- r.title ? ` — ${r.title}` : ""
585
- ] })
586
- ]
587
- }
588
- ) : null
589
- ] }) }),
590
- /* @__PURE__ */ a("div", { className: "mt-2.5 flex flex-wrap items-center gap-2", children: [
591
- /* @__PURE__ */ a(
592
- m,
593
- {
594
- size: "sm",
595
- variant: "outline",
596
- onClick: () => void O(t.id),
597
- disabled: l,
598
- children: [
599
- l ? /* @__PURE__ */ s(U, { className: "size-4 animate-spin" }) : /* @__PURE__ */ s(Ee, { className: "size-4" }),
600
- /* @__PURE__ */ s("span", { className: "ml-1", children: "Re-auth" })
601
- ]
602
- }
603
- ),
604
- /* @__PURE__ */ a(
605
- m,
606
- {
607
- size: "sm",
608
- variant: "ghost",
609
- onClick: () => void $(t.id),
610
- disabled: l,
611
- children: [
612
- /* @__PURE__ */ s($e, { className: "size-4" }),
613
- /* @__PURE__ */ s("span", { className: "ml-1", children: "Test" })
614
- ]
615
- }
616
- ),
617
- /* @__PURE__ */ a(
618
- m,
619
- {
620
- size: "sm",
621
- variant: "ghost",
622
- onClick: () => void S(t),
623
- disabled: l,
624
- className: "text-destructive hover:text-destructive",
625
- children: [
626
- /* @__PURE__ */ s(ye, { className: "size-4" }),
627
- /* @__PURE__ */ s("span", { className: "ml-1", children: "Delete" })
628
- ]
629
- }
630
- )
631
- ] })
632
- ]
633
- },
634
- t.id
635
- );
636
- }) })
637
- ] }),
638
- v ? /* @__PURE__ */ s("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-2 sm:p-6", children: /* @__PURE__ */ s("div", { className: "flex h-full max-h-[92dvh] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-border bg-background shadow-2xl", children: /* @__PURE__ */ s(
639
- Pe,
640
- {
641
- sessionId: v.sessionId,
642
- onClose: V,
643
- onSaved: P
644
- }
645
- ) }) }) : null
646
- ] });
647
- }
648
- export {
649
- Fe as default
650
- };