@designa8/vibedesign-v6 1.6.7

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 (51) hide show
  1. package/README.md +66 -0
  2. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  3. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
  4. package/dist/index.cjs +3231 -0
  5. package/dist/index.js +3201 -0
  6. package/dist/styles.css +1810 -0
  7. package/package.json +109 -0
  8. package/src/atoms/AppLayout/AppLayout.tsx +537 -0
  9. package/src/atoms/AppLayout/index.ts +2 -0
  10. package/src/atoms/AppLayout/preview.tsx +75 -0
  11. package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
  12. package/src/atoms/AppSidebar/index.ts +2 -0
  13. package/src/atoms/AppSidebar/preview.tsx +214 -0
  14. package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
  15. package/src/atoms/AuthScreen/index.ts +2 -0
  16. package/src/atoms/AuthScreen/preview.tsx +10 -0
  17. package/src/atoms/Button/Button.tsx +71 -0
  18. package/src/atoms/Button/index.ts +2 -0
  19. package/src/atoms/Button/preview.tsx +71 -0
  20. package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
  21. package/src/atoms/ChatScreen/index.ts +2 -0
  22. package/src/atoms/ChatScreen/preview.tsx +239 -0
  23. package/src/atoms/Chip/Chip.tsx +121 -0
  24. package/src/atoms/Chip/index.ts +2 -0
  25. package/src/atoms/Chip/preview.tsx +99 -0
  26. package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
  27. package/src/atoms/FilterTabBar/index.ts +2 -0
  28. package/src/atoms/FilterTabBar/preview.tsx +92 -0
  29. package/src/atoms/Input/Input.tsx +139 -0
  30. package/src/atoms/Input/index.ts +2 -0
  31. package/src/atoms/Input/preview.tsx +97 -0
  32. package/src/atoms/Modal/Modal.tsx +144 -0
  33. package/src/atoms/Modal/index.ts +2 -0
  34. package/src/atoms/Modal/preview.tsx +111 -0
  35. package/src/atoms/NavItem/NavItem.tsx +316 -0
  36. package/src/atoms/NavItem/index.ts +2 -0
  37. package/src/atoms/NavItem/preview.tsx +125 -0
  38. package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
  39. package/src/atoms/PromptInputBar/index.ts +2 -0
  40. package/src/atoms/PromptInputBar/preview.tsx +85 -0
  41. package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
  42. package/src/atoms/TopNavbar/index.ts +2 -0
  43. package/src/atoms/TopNavbar/preview.tsx +117 -0
  44. package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
  45. package/src/atoms/UpgradeCard/index.ts +2 -0
  46. package/src/atoms/UpgradeCard/preview.tsx +25 -0
  47. package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
  48. package/src/atoms/WorkspaceMenu/index.ts +2 -0
  49. package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
  50. package/src/index.ts +16 -0
  51. package/src/tokens.css +165 -0
package/dist/index.js ADDED
@@ -0,0 +1,3201 @@
1
+ // virtual-pkg:src/index.ts
2
+ import "../dist/styles.css";
3
+
4
+ // virtual-pkg:src/atoms/AppLayout/AppLayout.tsx
5
+ import React7 from "react";
6
+
7
+ // virtual-pkg:src/atoms/TopNavbar/TopNavbar.tsx
8
+ import React2 from "react";
9
+
10
+ // virtual-pkg:src/atoms/Button/Button.tsx
11
+ import React from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var variantClasses = {
14
+ primary: "bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active disabled:bg-primary-disabled disabled:text-on-primary disabled:cursor-not-allowed border border-transparent",
15
+ secondary: "bg-canvas text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-hairline",
16
+ ghost: "bg-transparent text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-transparent",
17
+ destructive: "bg-semantic-error text-on-primary hover:brightness-90 active:brightness-75 disabled:opacity-50 disabled:cursor-not-allowed border border-transparent"
18
+ };
19
+ var sizeClasses = {
20
+ sm: "px-md py-xs text-body-sm rounded-md",
21
+ md: "px-lg py-sm text-body-md rounded-xl",
22
+ lg: "px-xl py-md text-body-lg rounded-xl"
23
+ };
24
+ var Button = React.forwardRef(
25
+ ({
26
+ variant = "primary",
27
+ size = "md",
28
+ loading = false,
29
+ disabled,
30
+ children,
31
+ className,
32
+ ...rest
33
+ }, ref) => {
34
+ const isDisabled = disabled || loading;
35
+ const base = "inline-flex items-center justify-center gap-sm font-weight-heading-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2 select-none whitespace-nowrap";
36
+ const classes = [base, variantClasses[variant], sizeClasses[size], className].filter(Boolean).join(" ");
37
+ return /* @__PURE__ */ jsxs("button", { ref, disabled: isDisabled, className: classes, ...rest, children: [
38
+ loading && /* @__PURE__ */ jsxs(
39
+ "svg",
40
+ {
41
+ "aria-hidden": "true",
42
+ className: "size-4 animate-spin",
43
+ viewBox: "0 0 24 24",
44
+ fill: "none",
45
+ children: [
46
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
47
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })
48
+ ]
49
+ }
50
+ ),
51
+ children
52
+ ] });
53
+ }
54
+ );
55
+ Button.displayName = "Button";
56
+
57
+ // virtual-pkg:src/atoms/TopNavbar/TopNavbar.tsx
58
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
59
+ function relativeTime(isoDate) {
60
+ const then = new Date(isoDate).getTime();
61
+ if (isNaN(then)) return isoDate;
62
+ const diffMs = Date.now() - then;
63
+ const diffSec = Math.round(diffMs / 1e3);
64
+ if (diffSec < 45) return "just now";
65
+ const diffMin = Math.round(diffSec / 60);
66
+ if (diffMin < 60) return diffMin === 1 ? "1 minute ago" : `${diffMin} minutes ago`;
67
+ const diffHr = Math.round(diffMin / 60);
68
+ if (diffHr < 24) return diffHr === 1 ? "1 hour ago" : `${diffHr} hours ago`;
69
+ const diffDay = Math.round(diffHr / 24);
70
+ if (diffDay < 30) return diffDay === 1 ? "1 day ago" : `${diffDay} days ago`;
71
+ const diffMonth = Math.round(diffDay / 30);
72
+ if (diffMonth < 12) return diffMonth === 1 ? "1 month ago" : `${diffMonth} months ago`;
73
+ const diffYear = Math.round(diffMonth / 12);
74
+ return diffYear === 1 ? "1 year ago" : `${diffYear} years ago`;
75
+ }
76
+ function getVersionLabel(item) {
77
+ return typeof item === "string" ? item : item.version;
78
+ }
79
+ var ChevronIcon = ({ open }) => /* @__PURE__ */ jsx2(
80
+ "svg",
81
+ {
82
+ "aria-hidden": "true",
83
+ viewBox: "0 0 24 24",
84
+ fill: "none",
85
+ stroke: "currentColor",
86
+ strokeWidth: "2.5",
87
+ strokeLinecap: "round",
88
+ strokeLinejoin: "round",
89
+ style: {
90
+ width: "13px",
91
+ height: "13px",
92
+ flexShrink: 0,
93
+ transition: "transform 150ms ease",
94
+ transform: open ? "rotate(180deg)" : "rotate(0deg)"
95
+ },
96
+ children: /* @__PURE__ */ jsx2("polyline", { points: "6 9 12 15 18 9" })
97
+ }
98
+ );
99
+ var SunIcon = () => /* @__PURE__ */ jsxs2(
100
+ "svg",
101
+ {
102
+ "aria-hidden": "true",
103
+ viewBox: "0 0 24 24",
104
+ fill: "none",
105
+ stroke: "currentColor",
106
+ strokeWidth: "2",
107
+ strokeLinecap: "round",
108
+ strokeLinejoin: "round",
109
+ width: "16",
110
+ height: "16",
111
+ children: [
112
+ /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "5" }),
113
+ /* @__PURE__ */ jsx2("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
114
+ /* @__PURE__ */ jsx2("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
115
+ /* @__PURE__ */ jsx2("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
116
+ /* @__PURE__ */ jsx2("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
117
+ /* @__PURE__ */ jsx2("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
118
+ /* @__PURE__ */ jsx2("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
119
+ /* @__PURE__ */ jsx2("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
120
+ /* @__PURE__ */ jsx2("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
121
+ ]
122
+ }
123
+ );
124
+ var MoonIcon = () => /* @__PURE__ */ jsx2(
125
+ "svg",
126
+ {
127
+ "aria-hidden": "true",
128
+ viewBox: "0 0 24 24",
129
+ fill: "none",
130
+ stroke: "currentColor",
131
+ strokeWidth: "2",
132
+ strokeLinecap: "round",
133
+ strokeLinejoin: "round",
134
+ width: "16",
135
+ height: "16",
136
+ children: /* @__PURE__ */ jsx2("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
137
+ }
138
+ );
139
+ var VersionDropdown = ({
140
+ versions,
141
+ selected,
142
+ onSelect
143
+ }) => {
144
+ const [open, setOpen] = React2.useState(false);
145
+ const containerRef = React2.useRef(null);
146
+ React2.useEffect(() => {
147
+ if (!open) return;
148
+ const handler = (e) => {
149
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
150
+ setOpen(false);
151
+ }
152
+ };
153
+ document.addEventListener("mousedown", handler);
154
+ return () => document.removeEventListener("mousedown", handler);
155
+ }, [open]);
156
+ React2.useEffect(() => {
157
+ if (!open) return;
158
+ const handler = (e) => {
159
+ if (e.key === "Escape") setOpen(false);
160
+ };
161
+ document.addEventListener("keydown", handler);
162
+ return () => document.removeEventListener("keydown", handler);
163
+ }, [open]);
164
+ return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "relative inline-block", style: { zIndex: 50 }, children: [
165
+ /* @__PURE__ */ jsxs2(
166
+ Button,
167
+ {
168
+ type: "button",
169
+ variant: "secondary",
170
+ size: "sm",
171
+ "aria-haspopup": "listbox",
172
+ "aria-expanded": open,
173
+ "aria-label": `Select version: ${selected}`,
174
+ onClick: () => setOpen((v) => !v),
175
+ className: "!gap-sm !pr-sm",
176
+ style: { minWidth: "120px" },
177
+ children: [
178
+ /* @__PURE__ */ jsx2("span", { className: "flex-1 text-left truncate text-body-sm font-weight-heading-sm", children: selected }),
179
+ /* @__PURE__ */ jsx2(ChevronIcon, { open })
180
+ ]
181
+ }
182
+ ),
183
+ open && /* @__PURE__ */ jsx2(
184
+ "ul",
185
+ {
186
+ role: "listbox",
187
+ "aria-label": "Select version",
188
+ className: [
189
+ "absolute right-0 mt-xs rounded-xl",
190
+ "bg-surface border border-hairline-soft shadow-card",
191
+ "py-xs overflow-y-auto overflow-x-hidden",
192
+ "z-50"
193
+ ].join(" "),
194
+ style: { minWidth: "220px", maxHeight: "350px" },
195
+ children: versions.map((item) => {
196
+ const label = getVersionLabel(item);
197
+ const entry = typeof item === "object" ? item : null;
198
+ const hasMetadata = entry && (entry.publishedAt || entry.publishedBy);
199
+ let metaLine = null;
200
+ if (hasMetadata) {
201
+ const parts = [];
202
+ if (entry.publishedAt) parts.push(relativeTime(entry.publishedAt));
203
+ if (entry.publishedBy) parts.push(entry.publishedBy);
204
+ metaLine = parts.join(" \xB7 ");
205
+ }
206
+ const isSelected = label === selected;
207
+ return /* @__PURE__ */ jsxs2(
208
+ "li",
209
+ {
210
+ role: "option",
211
+ "aria-selected": isSelected,
212
+ tabIndex: 0,
213
+ onClick: () => {
214
+ onSelect(label);
215
+ setOpen(false);
216
+ },
217
+ onKeyDown: (e) => {
218
+ if (e.key === "Enter" || e.key === " ") {
219
+ onSelect(label);
220
+ setOpen(false);
221
+ }
222
+ },
223
+ className: [
224
+ "flex flex-col px-md cursor-pointer select-none",
225
+ "transition-colors duration-100",
226
+ metaLine ? "py-sm" : "py-xs",
227
+ isSelected ? "bg-surface-soft text-primary" : "text-ink hover:bg-surface-soft"
228
+ ].join(" "),
229
+ children: [
230
+ /* @__PURE__ */ jsx2("span", { className: ["text-body-sm", isSelected ? "font-weight-heading-sm" : ""].join(" ").trim(), children: label }),
231
+ metaLine && /* @__PURE__ */ jsx2("span", { className: "text-caption text-muted mt-xxs", children: metaLine })
232
+ ]
233
+ },
234
+ label
235
+ );
236
+ })
237
+ }
238
+ )
239
+ ] });
240
+ };
241
+ var TopNavbar = React2.forwardRef(
242
+ ({
243
+ avatarInitials = "DU",
244
+ version = "Latest",
245
+ versions = ["Latest", "v1.2", "v1.1", "v1.0"],
246
+ onExport,
247
+ onPublish,
248
+ onShare,
249
+ onVersionChange,
250
+ darkMode = false,
251
+ onToggleDarkMode,
252
+ className,
253
+ ...rest
254
+ }, ref) => {
255
+ const [selected, setSelected] = React2.useState(version);
256
+ return /* @__PURE__ */ jsxs2(
257
+ "header",
258
+ {
259
+ ref,
260
+ className: [
261
+ "w-full bg-canvas border-b border-hairline",
262
+ "flex items-center justify-end gap-sm px-lg py-sm",
263
+ className
264
+ ].filter(Boolean).join(" "),
265
+ ...rest,
266
+ children: [
267
+ onExport && /* @__PURE__ */ jsxs2(Button, { variant: "secondary", size: "sm", onClick: onExport, "aria-label": "Export DESIGN.md", children: [
268
+ /* @__PURE__ */ jsxs2(
269
+ "svg",
270
+ {
271
+ "aria-hidden": "true",
272
+ width: "15",
273
+ height: "15",
274
+ viewBox: "0 0 24 24",
275
+ fill: "none",
276
+ stroke: "currentColor",
277
+ strokeWidth: "2",
278
+ strokeLinecap: "round",
279
+ strokeLinejoin: "round",
280
+ className: "shrink-0",
281
+ children: [
282
+ /* @__PURE__ */ jsx2("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
283
+ /* @__PURE__ */ jsx2("polyline", { points: "14 2 14 8 20 8" }),
284
+ /* @__PURE__ */ jsx2("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
285
+ /* @__PURE__ */ jsx2("line", { x1: "16", y1: "17", x2: "8", y2: "17" })
286
+ ]
287
+ }
288
+ ),
289
+ "Export DESIGN.md"
290
+ ] }),
291
+ onPublish && /* @__PURE__ */ jsxs2(Button, { variant: "secondary", size: "sm", onClick: onPublish, "aria-label": "Publish", children: [
292
+ /* @__PURE__ */ jsxs2(
293
+ "svg",
294
+ {
295
+ "aria-hidden": "true",
296
+ width: "15",
297
+ height: "15",
298
+ viewBox: "0 0 24 24",
299
+ fill: "none",
300
+ stroke: "currentColor",
301
+ strokeWidth: "2",
302
+ strokeLinecap: "round",
303
+ strokeLinejoin: "round",
304
+ className: "shrink-0",
305
+ children: [
306
+ /* @__PURE__ */ jsx2("polyline", { points: "16 16 12 12 8 16" }),
307
+ /* @__PURE__ */ jsx2("line", { x1: "12", y1: "12", x2: "12", y2: "21" }),
308
+ /* @__PURE__ */ jsx2("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })
309
+ ]
310
+ }
311
+ ),
312
+ "Publish"
313
+ ] }),
314
+ /* @__PURE__ */ jsx2(
315
+ VersionDropdown,
316
+ {
317
+ versions,
318
+ selected,
319
+ onSelect: (v) => {
320
+ setSelected(v);
321
+ onVersionChange?.(v);
322
+ }
323
+ }
324
+ ),
325
+ onToggleDarkMode && /* @__PURE__ */ jsx2(
326
+ Button,
327
+ {
328
+ type: "button",
329
+ variant: "ghost",
330
+ size: "sm",
331
+ onClick: onToggleDarkMode,
332
+ "aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
333
+ "aria-pressed": darkMode,
334
+ className: "!px-xs !py-xs",
335
+ children: darkMode ? /* @__PURE__ */ jsx2(SunIcon, {}) : /* @__PURE__ */ jsx2(MoonIcon, {})
336
+ }
337
+ ),
338
+ onShare && /* @__PURE__ */ jsx2(Button, { variant: "primary", size: "sm", onClick: onShare, children: "Share" }),
339
+ /* @__PURE__ */ jsx2(
340
+ "span",
341
+ {
342
+ role: "button",
343
+ tabIndex: 0,
344
+ "aria-label": `User menu \u2014 ${avatarInitials}`,
345
+ onKeyDown: (e) => {
346
+ if (e.key === "Enter" || e.key === " ") e.currentTarget.click();
347
+ },
348
+ className: [
349
+ "inline-flex items-center justify-center shrink-0 cursor-pointer select-none",
350
+ "size-8 rounded-full bg-primary text-on-primary",
351
+ "text-caption font-weight-heading-sm uppercase",
352
+ "hover:bg-primary-hover active:bg-primary-active",
353
+ "transition-colors duration-150",
354
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2"
355
+ ].join(" "),
356
+ children: avatarInitials.slice(0, 2)
357
+ }
358
+ )
359
+ ]
360
+ }
361
+ );
362
+ }
363
+ );
364
+ TopNavbar.displayName = "TopNavbar";
365
+
366
+ // virtual-pkg:src/atoms/ChatScreen/ChatScreen.tsx
367
+ import React5 from "react";
368
+
369
+ // virtual-pkg:src/atoms/PromptInputBar/PromptInputBar.tsx
370
+ import React4 from "react";
371
+
372
+ // virtual-pkg:src/atoms/Input/Input.tsx
373
+ import React3 from "react";
374
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
375
+ var sizeClasses2 = {
376
+ sm: {
377
+ input: "h-8 px-sm text-body-sm",
378
+ icon: "w-4 h-4",
379
+ label: "text-body-sm"
380
+ },
381
+ md: {
382
+ input: "h-10 px-md text-body-md",
383
+ icon: "w-4 h-4",
384
+ label: "text-body-sm"
385
+ },
386
+ lg: {
387
+ input: "h-12 px-base text-body-lg",
388
+ icon: "w-5 h-5",
389
+ label: "text-body-md"
390
+ }
391
+ };
392
+ var Input = React3.forwardRef(
393
+ ({
394
+ label,
395
+ helperText,
396
+ error,
397
+ size = "md",
398
+ leadingIcon,
399
+ trailingIcon,
400
+ fullWidth = false,
401
+ disabled,
402
+ id,
403
+ className = "",
404
+ ...rest
405
+ }, ref) => {
406
+ const generatedId = React3.useId();
407
+ const inputId = id ?? generatedId;
408
+ const helperId = `${inputId}-helper`;
409
+ const hasError = Boolean(error);
410
+ const { input: inputSize, icon: iconSize, label: labelSize } = sizeClasses2[size];
411
+ const borderColor = hasError ? "border-semantic-error focus:ring-semantic-error/30 focus:border-semantic-error" : "border-hairline focus:ring-primary-focus/20 focus:border-primary-focus";
412
+ return /* @__PURE__ */ jsxs3("div", { className: `flex flex-col gap-xs ${fullWidth ? "w-full" : "w-fit"}`, children: [
413
+ label && /* @__PURE__ */ jsx3(
414
+ "label",
415
+ {
416
+ htmlFor: inputId,
417
+ className: `${labelSize} font-medium text-ink`,
418
+ children: label
419
+ }
420
+ ),
421
+ /* @__PURE__ */ jsxs3("div", { className: "relative flex items-center", children: [
422
+ leadingIcon && /* @__PURE__ */ jsx3(
423
+ "span",
424
+ {
425
+ "aria-hidden": "true",
426
+ className: `absolute left-md flex items-center text-muted ${iconSize}`,
427
+ children: leadingIcon
428
+ }
429
+ ),
430
+ /* @__PURE__ */ jsx3(
431
+ "input",
432
+ {
433
+ ref,
434
+ id: inputId,
435
+ disabled,
436
+ "aria-invalid": hasError ? "true" : void 0,
437
+ "aria-describedby": error ? helperId : helperText ? helperId : void 0,
438
+ className: [
439
+ "w-full rounded-md border bg-surface text-ink placeholder:text-muted-soft",
440
+ "outline-none ring-0",
441
+ "transition-colors duration-150",
442
+ "focus:ring-2",
443
+ inputSize,
444
+ borderColor,
445
+ leadingIcon ? "pl-9" : "",
446
+ trailingIcon ? "pr-9" : "",
447
+ disabled ? "cursor-not-allowed bg-surface-soft text-muted opacity-60" : "",
448
+ className
449
+ ].filter(Boolean).join(" "),
450
+ ...rest
451
+ }
452
+ ),
453
+ trailingIcon && /* @__PURE__ */ jsx3(
454
+ "span",
455
+ {
456
+ "aria-hidden": "true",
457
+ className: `absolute right-md flex items-center text-muted ${iconSize}`,
458
+ children: trailingIcon
459
+ }
460
+ )
461
+ ] }),
462
+ (error || helperText) && /* @__PURE__ */ jsx3(
463
+ "p",
464
+ {
465
+ id: helperId,
466
+ className: `text-body-sm ${hasError ? "text-semantic-error" : "text-muted"}`,
467
+ children: error ?? helperText
468
+ }
469
+ )
470
+ ] });
471
+ }
472
+ );
473
+ Input.displayName = "Input";
474
+
475
+ // virtual-pkg:src/atoms/PromptInputBar/PromptInputBar.tsx
476
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
477
+ var MODES = ["Build", "Chat", "Design"];
478
+ var XIcon = () => /* @__PURE__ */ jsxs4(
479
+ "svg",
480
+ {
481
+ viewBox: "0 0 16 16",
482
+ fill: "none",
483
+ stroke: "currentColor",
484
+ strokeWidth: 2.5,
485
+ strokeLinecap: "round",
486
+ className: "w-2.5 h-2.5",
487
+ "aria-hidden": "true",
488
+ children: [
489
+ /* @__PURE__ */ jsx4("line", { x1: "4", y1: "4", x2: "12", y2: "12" }),
490
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "4", x2: "4", y2: "12" })
491
+ ]
492
+ }
493
+ );
494
+ function useClickOutside(ref, onClose, enabled) {
495
+ React4.useEffect(() => {
496
+ if (!enabled) return;
497
+ const handler = (e) => {
498
+ if (ref.current && !ref.current.contains(e.target)) {
499
+ onClose();
500
+ }
501
+ };
502
+ document.addEventListener("mousedown", handler);
503
+ document.addEventListener("touchstart", handler);
504
+ return () => {
505
+ document.removeEventListener("mousedown", handler);
506
+ document.removeEventListener("touchstart", handler);
507
+ };
508
+ }, [ref, onClose, enabled]);
509
+ }
510
+ var PromptInputBar = React4.forwardRef(
511
+ ({
512
+ placeholder = "Ask Lovable...",
513
+ value,
514
+ onChange,
515
+ mode = "Build",
516
+ onModeChange,
517
+ onSend,
518
+ onAttach,
519
+ onFilesSelected,
520
+ onVisualEdits,
521
+ onMic,
522
+ disabled = false,
523
+ isStreaming = false,
524
+ onStop,
525
+ models,
526
+ selectedModelId,
527
+ onModelChange,
528
+ pastedImages,
529
+ onImagesChange,
530
+ className
531
+ }, ref) => {
532
+ const [internalValue, setInternalValue] = React4.useState("");
533
+ const [internalImages, setInternalImages] = React4.useState([]);
534
+ const [modeOpen, setModeOpen] = React4.useState(false);
535
+ const [modelOpen, setModelOpen] = React4.useState(false);
536
+ const fileInputRef = React4.useRef(null);
537
+ const modeRef = React4.useRef(null);
538
+ const modelRef = React4.useRef(null);
539
+ useClickOutside(modeRef, React4.useCallback(() => setModeOpen(false), []), modeOpen);
540
+ useClickOutside(modelRef, React4.useCallback(() => setModelOpen(false), []), modelOpen);
541
+ const textValue = value !== void 0 ? value : internalValue;
542
+ const images = pastedImages !== void 0 ? pastedImages : internalImages;
543
+ const selectedModel = models?.find((m) => m.id === selectedModelId) ?? models?.[0];
544
+ const addImageFiles = React4.useCallback(
545
+ (files) => {
546
+ const next = files.filter((f) => f.type.startsWith("image/")).map((f) => ({
547
+ id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
548
+ url: URL.createObjectURL(f),
549
+ name: f.name || "image"
550
+ }));
551
+ if (next.length === 0) return;
552
+ const updated = [...images, ...next];
553
+ if (pastedImages !== void 0) {
554
+ onImagesChange?.(updated);
555
+ } else {
556
+ setInternalImages(updated);
557
+ onImagesChange?.(updated);
558
+ }
559
+ },
560
+ [images, pastedImages, onImagesChange]
561
+ );
562
+ const removeImage = React4.useCallback(
563
+ (id) => {
564
+ const target = images.find((img) => img.id === id);
565
+ if (target) URL.revokeObjectURL(target.url);
566
+ const updated = images.filter((img) => img.id !== id);
567
+ if (pastedImages !== void 0) {
568
+ onImagesChange?.(updated);
569
+ } else {
570
+ setInternalImages(updated);
571
+ onImagesChange?.(updated);
572
+ }
573
+ },
574
+ [images, pastedImages, onImagesChange]
575
+ );
576
+ const handleChange = (e) => {
577
+ if (value === void 0) setInternalValue(e.target.value);
578
+ onChange?.(e.target.value);
579
+ };
580
+ const handleSend = () => {
581
+ if (!textValue.trim() && images.length === 0) return;
582
+ onSend?.(textValue, images);
583
+ if (value === void 0) setInternalValue("");
584
+ if (pastedImages !== void 0) {
585
+ onImagesChange?.([]);
586
+ } else {
587
+ internalImages.forEach((img) => URL.revokeObjectURL(img.url));
588
+ setInternalImages([]);
589
+ onImagesChange?.([]);
590
+ }
591
+ };
592
+ const handleKeyDown = (e) => {
593
+ if (e.key === "Enter" && !e.shiftKey) {
594
+ e.preventDefault();
595
+ handleSend();
596
+ }
597
+ };
598
+ const handlePaste = (e) => {
599
+ const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
600
+ if (files.length > 0) {
601
+ e.preventDefault();
602
+ addImageFiles(files);
603
+ }
604
+ };
605
+ const handleAttachClick = () => {
606
+ if (onFilesSelected) {
607
+ fileInputRef.current?.click();
608
+ } else {
609
+ onAttach?.();
610
+ }
611
+ };
612
+ const handleFileInputChange = (e) => {
613
+ if (e.target.files && e.target.files.length > 0) {
614
+ onFilesSelected?.(e.target.files);
615
+ e.target.value = "";
616
+ }
617
+ };
618
+ const canSend = (textValue.trim().length > 0 || images.length > 0) && !disabled && !isStreaming;
619
+ const textareaDisabled = disabled || isStreaming;
620
+ return /* @__PURE__ */ jsxs4("div", { ref, className: ["w-full", className].filter(Boolean).join(" "), children: [
621
+ onFilesSelected && /* @__PURE__ */ jsx4(
622
+ Input,
623
+ {
624
+ ref: fileInputRef,
625
+ type: "file",
626
+ multiple: true,
627
+ "aria-hidden": "true",
628
+ tabIndex: -1,
629
+ className: "sr-only",
630
+ onChange: handleFileInputChange
631
+ }
632
+ ),
633
+ /* @__PURE__ */ jsxs4("div", { className: "w-full rounded-xl bg-canvas shadow-card border border-hairline px-lg pt-lg pb-md flex flex-col gap-md", children: [
634
+ images.length > 0 && /* @__PURE__ */ jsx4(
635
+ "div",
636
+ {
637
+ role: "list",
638
+ "aria-label": "Attached images",
639
+ className: "flex flex-wrap gap-sm",
640
+ children: images.map((img) => /* @__PURE__ */ jsxs4(
641
+ "div",
642
+ {
643
+ role: "listitem",
644
+ className: "relative group flex-shrink-0",
645
+ children: [
646
+ /* @__PURE__ */ jsx4("div", { className: "w-16 h-16 rounded-md overflow-hidden border border-hairline bg-surface-soft", children: /* @__PURE__ */ jsx4(
647
+ "img",
648
+ {
649
+ src: img.url,
650
+ alt: img.name,
651
+ className: "w-full h-full object-cover"
652
+ }
653
+ ) }),
654
+ /* @__PURE__ */ jsx4(
655
+ Button,
656
+ {
657
+ variant: "ghost",
658
+ size: "sm",
659
+ onClick: () => removeImage(img.id),
660
+ "aria-label": `Remove image ${img.name}`,
661
+ className: "absolute -top-1.5 -right-1.5 !p-0 !w-5 !h-5 !min-w-0 !rounded-full bg-ink text-on-primary hover:bg-body opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity duration-150 shadow-sm flex items-center justify-center",
662
+ children: /* @__PURE__ */ jsx4(XIcon, {})
663
+ }
664
+ )
665
+ ]
666
+ },
667
+ img.id
668
+ ))
669
+ }
670
+ ),
671
+ /* @__PURE__ */ jsx4(
672
+ "textarea",
673
+ {
674
+ "aria-label": "Prompt input",
675
+ placeholder,
676
+ value: textValue,
677
+ onChange: handleChange,
678
+ onKeyDown: handleKeyDown,
679
+ onPaste: handlePaste,
680
+ disabled: textareaDisabled,
681
+ rows: 2,
682
+ className: "w-full resize-none bg-transparent text-body-md text-ink placeholder:text-muted-soft outline-none border-none leading-relaxed disabled:opacity-50"
683
+ }
684
+ ),
685
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-sm", children: [
686
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-sm", children: [
687
+ /* @__PURE__ */ jsx4(
688
+ "span",
689
+ {
690
+ role: "button",
691
+ tabIndex: 0,
692
+ onClick: handleAttachClick,
693
+ onKeyDown: (e) => e.key === "Enter" && handleAttachClick(),
694
+ "aria-label": "Attach",
695
+ className: "flex items-center justify-center size-8 rounded-full bg-surface-soft border border-hairline text-ink hover:bg-surface-strong active:bg-surface-strong transition-colors duration-150 flex-shrink-0 cursor-pointer",
696
+ children: /* @__PURE__ */ jsxs4(
697
+ "svg",
698
+ {
699
+ xmlns: "http://www.w3.org/2000/svg",
700
+ viewBox: "0 0 24 24",
701
+ fill: "none",
702
+ stroke: "currentColor",
703
+ strokeWidth: "2",
704
+ strokeLinecap: "round",
705
+ strokeLinejoin: "round",
706
+ className: "size-4",
707
+ "aria-hidden": "true",
708
+ children: [
709
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
710
+ /* @__PURE__ */ jsx4("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
711
+ ]
712
+ }
713
+ )
714
+ }
715
+ ),
716
+ onVisualEdits !== void 0 && /* @__PURE__ */ jsxs4(
717
+ Button,
718
+ {
719
+ variant: "primary",
720
+ size: "sm",
721
+ onClick: onVisualEdits,
722
+ "aria-label": "Visual edits",
723
+ className: "rounded-full px-md gap-xs",
724
+ children: [
725
+ /* @__PURE__ */ jsxs4(
726
+ "svg",
727
+ {
728
+ xmlns: "http://www.w3.org/2000/svg",
729
+ viewBox: "0 0 24 24",
730
+ fill: "none",
731
+ stroke: "currentColor",
732
+ strokeWidth: "2",
733
+ strokeLinecap: "round",
734
+ strokeLinejoin: "round",
735
+ className: "size-4 flex-shrink-0",
736
+ "aria-hidden": "true",
737
+ children: [
738
+ /* @__PURE__ */ jsx4("path", { d: "M17 1l4 4-4 4" }),
739
+ /* @__PURE__ */ jsx4("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }),
740
+ /* @__PURE__ */ jsx4("path", { d: "M7 23l-4-4 4-4" }),
741
+ /* @__PURE__ */ jsx4("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })
742
+ ]
743
+ }
744
+ ),
745
+ "Visual edits"
746
+ ]
747
+ }
748
+ ),
749
+ models && models.length > 0 && /* @__PURE__ */ jsxs4("div", { ref: modelRef, className: "relative", children: [
750
+ /* @__PURE__ */ jsxs4(
751
+ "span",
752
+ {
753
+ role: "button",
754
+ tabIndex: 0,
755
+ onClick: () => setModelOpen((o) => !o),
756
+ onKeyDown: (e) => {
757
+ if (e.key === "Enter") setModelOpen((o) => !o);
758
+ if (e.key === "Escape") setModelOpen(false);
759
+ },
760
+ "aria-haspopup": "listbox",
761
+ "aria-expanded": modelOpen,
762
+ "aria-label": "Select model",
763
+ className: "flex items-center gap-xs text-body-sm font-weight-heading-sm text-muted hover:text-ink transition-colors duration-150 cursor-pointer select-none rounded-sm px-xs py-xxs",
764
+ children: [
765
+ (models.find((m) => m.id === selectedModelId) ?? models[0])?.name ?? "Model",
766
+ /* @__PURE__ */ jsx4(
767
+ "svg",
768
+ {
769
+ xmlns: "http://www.w3.org/2000/svg",
770
+ viewBox: "0 0 24 24",
771
+ fill: "none",
772
+ stroke: "currentColor",
773
+ strokeWidth: "2.5",
774
+ strokeLinecap: "round",
775
+ strokeLinejoin: "round",
776
+ className: "size-3",
777
+ "aria-hidden": "true",
778
+ children: /* @__PURE__ */ jsx4("polyline", { points: "6 9 12 15 18 9" })
779
+ }
780
+ )
781
+ ]
782
+ }
783
+ ),
784
+ modelOpen && /* @__PURE__ */ jsx4(
785
+ "ul",
786
+ {
787
+ role: "listbox",
788
+ "aria-label": "Model options",
789
+ className: "absolute bottom-full mb-xs left-0 bg-canvas border border-hairline rounded-md shadow-md min-w-[12rem] max-h-[250px] overflow-y-auto",
790
+ style: { zIndex: "var(--z-dropdown, 50)" },
791
+ children: models.map((m) => /* @__PURE__ */ jsx4("li", { role: "option", "aria-selected": m.id === selectedModelId, children: /* @__PURE__ */ jsxs4(
792
+ "span",
793
+ {
794
+ role: "button",
795
+ tabIndex: 0,
796
+ onClick: () => {
797
+ onModelChange?.(m.id);
798
+ setModelOpen(false);
799
+ },
800
+ onKeyDown: (e) => {
801
+ if (e.key === "Enter") {
802
+ onModelChange?.(m.id);
803
+ setModelOpen(false);
804
+ }
805
+ if (e.key === "Escape") setModelOpen(false);
806
+ },
807
+ className: [
808
+ "flex flex-col w-full text-left px-md py-sm transition-colors duration-100 cursor-pointer",
809
+ m.id === selectedModelId ? "bg-surface-soft" : "hover:bg-surface-soft"
810
+ ].join(" "),
811
+ children: [
812
+ /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-xs", children: [
813
+ /* @__PURE__ */ jsx4(
814
+ "span",
815
+ {
816
+ className: [
817
+ "text-body-sm",
818
+ m.id === selectedModelId ? "font-weight-heading-sm text-ink" : "text-body"
819
+ ].join(" "),
820
+ children: m.name
821
+ }
822
+ ),
823
+ m.tier && /* @__PURE__ */ jsx4("span", { className: "text-caption text-muted bg-surface-strong rounded-xs px-xs py-xxs leading-none", children: m.tier })
824
+ ] }),
825
+ m.description && /* @__PURE__ */ jsx4("span", { className: "text-caption text-muted mt-xxs", children: m.description })
826
+ ]
827
+ }
828
+ ) }, m.id))
829
+ }
830
+ )
831
+ ] })
832
+ ] }),
833
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-sm", children: [
834
+ /* @__PURE__ */ jsxs4("div", { ref: modeRef, className: "relative", children: [
835
+ /* @__PURE__ */ jsxs4(
836
+ "span",
837
+ {
838
+ role: "button",
839
+ tabIndex: 0,
840
+ onClick: () => setModeOpen((o) => !o),
841
+ onKeyDown: (e) => {
842
+ if (e.key === "Enter") setModeOpen((o) => !o);
843
+ if (e.key === "Escape") setModeOpen(false);
844
+ },
845
+ "aria-haspopup": "listbox",
846
+ "aria-expanded": modeOpen,
847
+ className: "flex items-center gap-xs text-body-md font-weight-heading-sm text-ink hover:text-muted transition-colors duration-150 cursor-pointer select-none",
848
+ children: [
849
+ mode,
850
+ /* @__PURE__ */ jsx4(
851
+ "svg",
852
+ {
853
+ xmlns: "http://www.w3.org/2000/svg",
854
+ viewBox: "0 0 24 24",
855
+ fill: "none",
856
+ stroke: "currentColor",
857
+ strokeWidth: "2.5",
858
+ strokeLinecap: "round",
859
+ strokeLinejoin: "round",
860
+ className: "size-4",
861
+ "aria-hidden": "true",
862
+ children: /* @__PURE__ */ jsx4("polyline", { points: "6 9 12 15 18 9" })
863
+ }
864
+ )
865
+ ]
866
+ }
867
+ ),
868
+ modeOpen && /* @__PURE__ */ jsx4(
869
+ "ul",
870
+ {
871
+ role: "listbox",
872
+ className: "absolute bottom-full mb-xs right-0 bg-canvas border border-hairline rounded-md shadow-md py-xs min-w-[8rem]",
873
+ style: { zIndex: "var(--z-dropdown, 50)" },
874
+ children: MODES.map((m) => /* @__PURE__ */ jsx4("li", { role: "option", "aria-selected": m === mode, children: /* @__PURE__ */ jsx4(
875
+ "span",
876
+ {
877
+ role: "button",
878
+ tabIndex: 0,
879
+ onClick: () => {
880
+ onModeChange?.(m);
881
+ setModeOpen(false);
882
+ },
883
+ onKeyDown: (e) => {
884
+ if (e.key === "Enter") {
885
+ onModeChange?.(m);
886
+ setModeOpen(false);
887
+ }
888
+ if (e.key === "Escape") setModeOpen(false);
889
+ },
890
+ className: [
891
+ "block w-full text-left px-md py-xs text-body-sm transition-colors duration-100 cursor-pointer",
892
+ m === mode ? "text-ink font-weight-heading-sm bg-surface-soft" : "text-muted hover:bg-surface-soft"
893
+ ].join(" "),
894
+ children: m
895
+ }
896
+ ) }, m))
897
+ }
898
+ )
899
+ ] }),
900
+ /* @__PURE__ */ jsx4(
901
+ "span",
902
+ {
903
+ role: "button",
904
+ tabIndex: 0,
905
+ onClick: onMic,
906
+ onKeyDown: (e) => e.key === "Enter" && onMic?.(),
907
+ "aria-label": "Voice input",
908
+ className: "flex items-center justify-center size-9 rounded-full bg-surface-soft border border-hairline text-ink hover:bg-surface-strong active:bg-surface-strong transition-colors duration-150 flex-shrink-0 cursor-pointer",
909
+ children: /* @__PURE__ */ jsxs4(
910
+ "svg",
911
+ {
912
+ xmlns: "http://www.w3.org/2000/svg",
913
+ viewBox: "0 0 24 24",
914
+ fill: "none",
915
+ stroke: "currentColor",
916
+ strokeWidth: "1.75",
917
+ strokeLinecap: "round",
918
+ strokeLinejoin: "round",
919
+ className: "size-4",
920
+ "aria-hidden": "true",
921
+ children: [
922
+ /* @__PURE__ */ jsx4("rect", { x: "9", y: "2", width: "6", height: "11", rx: "3" }),
923
+ /* @__PURE__ */ jsx4("path", { d: "M19 10a7 7 0 0 1-14 0" }),
924
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "19", x2: "12", y2: "22" }),
925
+ /* @__PURE__ */ jsx4("line", { x1: "8", y1: "22", x2: "16", y2: "22" })
926
+ ]
927
+ }
928
+ )
929
+ }
930
+ ),
931
+ isStreaming ? /* @__PURE__ */ jsx4(
932
+ "span",
933
+ {
934
+ role: "button",
935
+ tabIndex: 0,
936
+ onClick: onStop,
937
+ onKeyDown: (e) => e.key === "Enter" && onStop?.(),
938
+ "aria-label": "Stop generation",
939
+ className: "flex items-center justify-center size-9 rounded-full bg-ink text-on-primary hover:bg-body transition-colors duration-150 flex-shrink-0 cursor-pointer",
940
+ children: /* @__PURE__ */ jsx4(
941
+ "svg",
942
+ {
943
+ xmlns: "http://www.w3.org/2000/svg",
944
+ viewBox: "0 0 24 24",
945
+ fill: "currentColor",
946
+ className: "size-4",
947
+ "aria-hidden": "true",
948
+ children: /* @__PURE__ */ jsx4("rect", { x: "5", y: "5", width: "14", height: "14", rx: "2" })
949
+ }
950
+ )
951
+ }
952
+ ) : /* @__PURE__ */ jsx4(
953
+ "span",
954
+ {
955
+ role: "button",
956
+ tabIndex: 0,
957
+ onClick: canSend ? handleSend : void 0,
958
+ onKeyDown: (e) => e.key === "Enter" && canSend && handleSend(),
959
+ "aria-label": "Send",
960
+ "aria-disabled": !canSend,
961
+ className: [
962
+ "flex items-center justify-center size-9 rounded-full transition-colors duration-150 flex-shrink-0",
963
+ canSend ? "bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active cursor-pointer" : "bg-surface-strong text-muted-soft cursor-not-allowed"
964
+ ].join(" "),
965
+ children: /* @__PURE__ */ jsxs4(
966
+ "svg",
967
+ {
968
+ xmlns: "http://www.w3.org/2000/svg",
969
+ viewBox: "0 0 24 24",
970
+ fill: "none",
971
+ stroke: "currentColor",
972
+ strokeWidth: "2.25",
973
+ strokeLinecap: "round",
974
+ strokeLinejoin: "round",
975
+ className: "size-4",
976
+ "aria-hidden": "true",
977
+ children: [
978
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "19", x2: "12", y2: "5" }),
979
+ /* @__PURE__ */ jsx4("polyline", { points: "5 12 12 5 19 12" })
980
+ ]
981
+ }
982
+ )
983
+ }
984
+ )
985
+ ] })
986
+ ] })
987
+ ] })
988
+ ] });
989
+ }
990
+ );
991
+ PromptInputBar.displayName = "PromptInputBar";
992
+
993
+ // virtual-pkg:src/atoms/ChatScreen/ChatScreen.tsx
994
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
995
+ var ChatEmptyIllustration = () => (
996
+ // 112px container — stable width regardless of Tailwind spacing scale.
997
+ /* @__PURE__ */ jsxs5(
998
+ "div",
999
+ {
1000
+ className: "relative flex-shrink-0",
1001
+ "aria-hidden": "true",
1002
+ style: { width: 112 },
1003
+ children: [
1004
+ /* @__PURE__ */ jsx5(
1005
+ "svg",
1006
+ {
1007
+ viewBox: "0 0 160 140",
1008
+ width: "112",
1009
+ height: "98",
1010
+ className: "text-primary",
1011
+ fill: "currentColor",
1012
+ style: { opacity: 0.15, display: "block" },
1013
+ children: /* @__PURE__ */ jsx5("path", { d: "M78 8c28-6 52 10 58 34 6 24-6 44-4 62 2 16-14 30-36 32-26 2-48-8-62-28-12-18-22-42-10-58C36 30 52 14 78 8z" })
1014
+ }
1015
+ ),
1016
+ /* @__PURE__ */ jsx5("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs5(
1017
+ "div",
1018
+ {
1019
+ className: "relative flex items-center justify-center rounded-full bg-primary shadow-sm",
1020
+ style: { width: 64, height: 64 },
1021
+ children: [
1022
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", style: { width: 32, gap: 6 }, children: [
1023
+ /* @__PURE__ */ jsx5(
1024
+ "span",
1025
+ {
1026
+ className: "rounded-full bg-on-primary",
1027
+ style: { height: 6, width: "100%" }
1028
+ }
1029
+ ),
1030
+ /* @__PURE__ */ jsx5(
1031
+ "span",
1032
+ {
1033
+ className: "rounded-full bg-on-primary",
1034
+ style: { height: 6, width: "66%" }
1035
+ }
1036
+ )
1037
+ ] }),
1038
+ /* @__PURE__ */ jsx5(
1039
+ "span",
1040
+ {
1041
+ className: "absolute bg-primary",
1042
+ style: {
1043
+ width: 12,
1044
+ height: 12,
1045
+ bottom: -2,
1046
+ right: 8,
1047
+ transform: "rotate(45deg)",
1048
+ borderRadius: 2
1049
+ }
1050
+ }
1051
+ )
1052
+ ]
1053
+ }
1054
+ ) }),
1055
+ /* @__PURE__ */ jsx5(
1056
+ "svg",
1057
+ {
1058
+ viewBox: "0 0 24 24",
1059
+ width: "12",
1060
+ height: "12",
1061
+ className: "absolute text-primary",
1062
+ fill: "currentColor",
1063
+ "aria-hidden": "true",
1064
+ style: { left: 8, top: 16 },
1065
+ children: /* @__PURE__ */ jsx5("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ jsx5(
1069
+ "svg",
1070
+ {
1071
+ viewBox: "0 0 24 24",
1072
+ width: "10",
1073
+ height: "10",
1074
+ className: "absolute text-primary",
1075
+ fill: "currentColor",
1076
+ "aria-hidden": "true",
1077
+ style: { right: 12, top: 32 },
1078
+ children: /* @__PURE__ */ jsx5("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
1079
+ }
1080
+ ),
1081
+ /* @__PURE__ */ jsx5(
1082
+ "svg",
1083
+ {
1084
+ viewBox: "0 0 24 24",
1085
+ width: "8",
1086
+ height: "8",
1087
+ className: "absolute text-primary",
1088
+ fill: "currentColor",
1089
+ "aria-hidden": "true",
1090
+ style: { left: 24, bottom: 24 },
1091
+ children: /* @__PURE__ */ jsx5("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
1092
+ }
1093
+ ),
1094
+ /* @__PURE__ */ jsx5(
1095
+ "svg",
1096
+ {
1097
+ viewBox: "0 0 24 24",
1098
+ width: "14",
1099
+ height: "14",
1100
+ className: "absolute text-primary",
1101
+ fill: "currentColor",
1102
+ "aria-hidden": "true",
1103
+ style: { right: 8, bottom: 32 },
1104
+ children: /* @__PURE__ */ jsx5("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
1105
+ }
1106
+ )
1107
+ ]
1108
+ }
1109
+ )
1110
+ );
1111
+ var ChatEmptyStateContent = ({
1112
+ title,
1113
+ description
1114
+ }) => (
1115
+ // Use inline gap so the layout is robust when gap-lg is absent in the consumer theme.
1116
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center px-lg", style: { gap: 24 }, children: [
1117
+ /* @__PURE__ */ jsx5(ChatEmptyIllustration, {}),
1118
+ /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-xs", children: [
1119
+ /* @__PURE__ */ jsx5("h2", { className: "text-heading-sm font-weight-heading-sm text-ink", children: title }),
1120
+ /* @__PURE__ */ jsx5("p", { className: "text-body-sm text-muted", style: { maxWidth: "24rem" }, children: description })
1121
+ ] })
1122
+ ] })
1123
+ );
1124
+ var ChevronIcon2 = ({ expanded }) => /* @__PURE__ */ jsx5(
1125
+ "svg",
1126
+ {
1127
+ xmlns: "http://www.w3.org/2000/svg",
1128
+ viewBox: "0 0 24 24",
1129
+ fill: "none",
1130
+ stroke: "currentColor",
1131
+ strokeWidth: "2",
1132
+ strokeLinecap: "round",
1133
+ strokeLinejoin: "round",
1134
+ className: "size-4 text-muted flex-shrink-0 transition-transform duration-200",
1135
+ style: { transform: expanded ? "rotate(180deg)" : "rotate(0deg)" },
1136
+ "aria-hidden": "true",
1137
+ children: /* @__PURE__ */ jsx5("polyline", { points: "6 9 12 15 18 9" })
1138
+ }
1139
+ );
1140
+ var PlanCardBlock = ({ plan }) => {
1141
+ const [titleExpanded, setTitleExpanded] = React5.useState(false);
1142
+ const titleRef = React5.useRef(null);
1143
+ const [isOverflowing, setIsOverflowing] = React5.useState(false);
1144
+ React5.useEffect(() => {
1145
+ const el = titleRef.current;
1146
+ if (!el) return;
1147
+ const check = () => {
1148
+ if (el) {
1149
+ setIsOverflowing(el.scrollHeight > el.clientHeight + 2);
1150
+ }
1151
+ };
1152
+ check();
1153
+ const ro = new ResizeObserver(check);
1154
+ ro.observe(el);
1155
+ return () => ro.disconnect();
1156
+ }, [plan.title]);
1157
+ const hasActivity = plan.tasks.some(
1158
+ (t) => t.status === "in_progress" || t.status === "done" || t.status === "failed"
1159
+ );
1160
+ const visibleTasks = plan.tasks.filter(
1161
+ (t) => t.status === "in_progress" || t.status === "done" || t.status === "failed"
1162
+ );
1163
+ return /* @__PURE__ */ jsxs5("div", { className: "mt-md rounded-xl border border-hairline bg-canvas shadow-sm overflow-hidden", children: [
1164
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-sm px-lg py-md border-b border-hairline-soft", children: [
1165
+ /* @__PURE__ */ jsxs5(
1166
+ "svg",
1167
+ {
1168
+ xmlns: "http://www.w3.org/2000/svg",
1169
+ viewBox: "0 0 24 24",
1170
+ fill: "none",
1171
+ stroke: "currentColor",
1172
+ strokeWidth: "2",
1173
+ strokeLinecap: "round",
1174
+ strokeLinejoin: "round",
1175
+ className: "size-4 text-primary flex-shrink-0 mt-xs",
1176
+ "aria-hidden": "true",
1177
+ children: [
1178
+ /* @__PURE__ */ jsx5("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
1179
+ /* @__PURE__ */ jsx5("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
1180
+ /* @__PURE__ */ jsx5("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
1181
+ /* @__PURE__ */ jsx5("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }),
1182
+ /* @__PURE__ */ jsx5("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }),
1183
+ /* @__PURE__ */ jsx5("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" })
1184
+ ]
1185
+ }
1186
+ ),
1187
+ /* @__PURE__ */ jsxs5("div", { className: "flex-1 min-w-0 flex items-start gap-xs", children: [
1188
+ /* @__PURE__ */ jsx5(
1189
+ "span",
1190
+ {
1191
+ ref: titleRef,
1192
+ className: "text-body-sm font-weight-heading-sm text-primary flex-1 min-w-0",
1193
+ style: titleExpanded ? void 0 : {
1194
+ display: "-webkit-box",
1195
+ WebkitLineClamp: 2,
1196
+ WebkitBoxOrient: "vertical",
1197
+ overflow: "hidden"
1198
+ },
1199
+ children: plan.title
1200
+ }
1201
+ ),
1202
+ isOverflowing && /* @__PURE__ */ jsx5(
1203
+ Button,
1204
+ {
1205
+ variant: "ghost",
1206
+ size: "sm",
1207
+ type: "button",
1208
+ onClick: () => setTitleExpanded((prev) => !prev),
1209
+ "aria-label": titleExpanded ? "Collapse plan title" : "Expand plan title",
1210
+ className: "flex-shrink-0 !p-xxs !rounded-xs",
1211
+ children: /* @__PURE__ */ jsx5(ChevronIcon2, { expanded: titleExpanded })
1212
+ }
1213
+ )
1214
+ ] })
1215
+ ] }),
1216
+ hasActivity && visibleTasks.length > 0 && /* @__PURE__ */ jsx5("ol", { className: "flex flex-col divide-y divide-hairline-soft", children: visibleTasks.map((task) => /* @__PURE__ */ jsxs5(
1217
+ "li",
1218
+ {
1219
+ className: "flex items-center gap-md px-lg py-md",
1220
+ children: [
1221
+ task.status === "in_progress" && /* @__PURE__ */ jsx5(
1222
+ "span",
1223
+ {
1224
+ className: "flex-shrink-0 size-3 rounded-full bg-primary animate-pulse",
1225
+ "aria-label": "In progress"
1226
+ }
1227
+ ),
1228
+ task.status === "done" && /* @__PURE__ */ jsx5("span", { className: "flex-shrink-0", "aria-label": "Done", children: /* @__PURE__ */ jsx5(
1229
+ "svg",
1230
+ {
1231
+ xmlns: "http://www.w3.org/2000/svg",
1232
+ viewBox: "0 0 24 24",
1233
+ fill: "none",
1234
+ stroke: "currentColor",
1235
+ strokeWidth: "2.5",
1236
+ strokeLinecap: "round",
1237
+ strokeLinejoin: "round",
1238
+ className: "size-4 text-semantic-success",
1239
+ "aria-hidden": "true",
1240
+ children: /* @__PURE__ */ jsx5("polyline", { points: "20 6 9 17 4 12" })
1241
+ }
1242
+ ) }),
1243
+ task.status === "failed" && /* @__PURE__ */ jsx5("span", { className: "flex-shrink-0", "aria-label": "Failed", children: /* @__PURE__ */ jsxs5(
1244
+ "svg",
1245
+ {
1246
+ xmlns: "http://www.w3.org/2000/svg",
1247
+ viewBox: "0 0 24 24",
1248
+ fill: "none",
1249
+ stroke: "currentColor",
1250
+ strokeWidth: "2.5",
1251
+ strokeLinecap: "round",
1252
+ strokeLinejoin: "round",
1253
+ className: "size-4 text-semantic-error",
1254
+ "aria-hidden": "true",
1255
+ children: [
1256
+ /* @__PURE__ */ jsx5("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1257
+ /* @__PURE__ */ jsx5("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1258
+ ]
1259
+ }
1260
+ ) }),
1261
+ /* @__PURE__ */ jsx5(
1262
+ "span",
1263
+ {
1264
+ className: [
1265
+ "text-body-sm",
1266
+ task.status === "in_progress" ? "font-weight-heading-sm text-ink" : task.status === "done" ? "line-through text-muted" : task.status === "failed" ? "text-semantic-error" : "text-ink"
1267
+ ].filter(Boolean).join(" "),
1268
+ children: task.label
1269
+ }
1270
+ ),
1271
+ task.status === "in_progress" && task.currentTool && /* @__PURE__ */ jsx5("span", { className: "ml-auto text-caption text-muted flex-shrink-0", children: task.currentTool })
1272
+ ]
1273
+ },
1274
+ task.id
1275
+ )) })
1276
+ ] });
1277
+ };
1278
+ var AIAvatar = () => /* @__PURE__ */ jsx5(
1279
+ "span",
1280
+ {
1281
+ "aria-hidden": "true",
1282
+ className: "flex-shrink-0 flex items-center justify-center size-8 rounded-full bg-primary text-on-primary text-caption font-weight-heading-sm select-none mt-1",
1283
+ children: "AI"
1284
+ }
1285
+ );
1286
+ var UserAvatar = ({ initials = "U" }) => /* @__PURE__ */ jsx5(
1287
+ "span",
1288
+ {
1289
+ "aria-hidden": "true",
1290
+ className: "flex-shrink-0 flex items-center justify-center size-8 rounded-full bg-surface-strong text-muted text-caption font-weight-heading-sm select-none",
1291
+ children: initials
1292
+ }
1293
+ );
1294
+ var SpinnerIcon = () => /* @__PURE__ */ jsx5(
1295
+ "svg",
1296
+ {
1297
+ xmlns: "http://www.w3.org/2000/svg",
1298
+ viewBox: "0 0 24 24",
1299
+ fill: "none",
1300
+ stroke: "currentColor",
1301
+ strokeWidth: "2.5",
1302
+ strokeLinecap: "round",
1303
+ strokeLinejoin: "round",
1304
+ className: "size-4 text-primary animate-spin flex-shrink-0",
1305
+ "aria-hidden": "true",
1306
+ children: /* @__PURE__ */ jsx5("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
1307
+ }
1308
+ );
1309
+ var AiMessage = ({ message }) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-md w-full", children: [
1310
+ /* @__PURE__ */ jsx5(AIAvatar, {}),
1311
+ /* @__PURE__ */ jsxs5("div", { className: "flex-1 min-w-0", children: [
1312
+ message.inFlight && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-xs mb-sm min-h-8", role: "status", "aria-live": "polite", children: [
1313
+ /* @__PURE__ */ jsx5(SpinnerIcon, {}),
1314
+ /* @__PURE__ */ jsx5("span", { className: "text-body-sm text-primary", children: message.currentToolLabel ?? "Working\u2026" })
1315
+ ] }),
1316
+ /* @__PURE__ */ jsx5("p", { className: "text-body-sm text-body leading-relaxed", children: message.content }),
1317
+ message.plan && /* @__PURE__ */ jsx5(PlanCardBlock, { plan: message.plan }),
1318
+ message.postContent && /* @__PURE__ */ jsx5("p", { className: "text-body-sm text-body leading-relaxed mt-md", children: message.postContent })
1319
+ ] })
1320
+ ] });
1321
+ var UserMessage = ({ message }) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-md w-full justify-end", children: [
1322
+ /* @__PURE__ */ jsx5("div", { className: "max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md", children: /* @__PURE__ */ jsx5("p", { className: "text-body-sm text-ink", children: message.content }) }),
1323
+ /* @__PURE__ */ jsx5(UserAvatar, { initials: message.userInitials ?? "U" })
1324
+ ] });
1325
+ var DEFAULT_EMPTY_TITLE = "Start the conversation";
1326
+ var DEFAULT_EMPTY_DESCRIPTION = "Ask about atoms, tokens, components, or anything in your design system.";
1327
+ var ChatScreen = React5.forwardRef(
1328
+ ({
1329
+ messages: initialMessages,
1330
+ placeholder = "Ask Lovable...",
1331
+ onSend,
1332
+ children,
1333
+ renderFooter,
1334
+ models,
1335
+ selectedModelId,
1336
+ onModelChange,
1337
+ className,
1338
+ emptyTitle = DEFAULT_EMPTY_TITLE,
1339
+ emptyDescription = DEFAULT_EMPTY_DESCRIPTION,
1340
+ emptyState
1341
+ }, ref) => {
1342
+ const defaultMessages = [
1343
+ {
1344
+ id: "1",
1345
+ role: "user",
1346
+ content: "Build a `PromptInputBar` Molecule that reproduces the Lovable-style prompt bar with placeholder and the bottom toolbar.",
1347
+ userInitials: "DU"
1348
+ },
1349
+ {
1350
+ id: "2",
1351
+ role: "ai",
1352
+ content: "I'll build the `PromptInputBar` Molecule to match the Lovable-style prompt bar. It will include a soft surface background, large rounded container, textarea with placeholder, and the bottom toolbar with `+`, `Visual edits`, `Build` mode dropdown, mic, and send buttons.\n\nHere's my plan for building this component:",
1353
+ plan: {
1354
+ title: "Plan: Build the PromptInputBar Molecule with all toolbar controls, placeholder text, and mode-switching behaviour for the Lovable editor canvas",
1355
+ tasks: [
1356
+ { id: "p1", label: "Create the PromptInputBar structure and styling", status: "done" },
1357
+ { id: "p2", label: "Add textarea with placeholder", status: "done" },
1358
+ { id: "p3", label: "Build bottom toolbar with all button elements", status: "done" },
1359
+ { id: "p4", label: "Add interactions and states" },
1360
+ { id: "p5", label: "Create stories and tests" }
1361
+ ]
1362
+ },
1363
+ postContent: "The plan above outlines all the steps. Let me start building the component now."
1364
+ },
1365
+ {
1366
+ id: "3",
1367
+ role: "ai",
1368
+ content: "Let me start building the `PromptInputBar` Molecule."
1369
+ }
1370
+ ];
1371
+ const [messages, setMessages] = React5.useState(
1372
+ initialMessages !== void 0 ? initialMessages : defaultMessages
1373
+ );
1374
+ const [mode, setMode] = React5.useState("Build");
1375
+ const threadRef = React5.useRef(null);
1376
+ const lastMessageCountRef = React5.useRef(messages.length);
1377
+ React5.useEffect(() => {
1378
+ if (initialMessages !== void 0) {
1379
+ setMessages(initialMessages);
1380
+ }
1381
+ }, [initialMessages]);
1382
+ React5.useLayoutEffect(() => {
1383
+ const thread = threadRef.current;
1384
+ if (!thread) return;
1385
+ const previousCount = lastMessageCountRef.current;
1386
+ const currentCount = messages.length;
1387
+ const didGrow = currentCount > previousCount;
1388
+ if (previousCount === currentCount) {
1389
+ thread.scrollTop = thread.scrollHeight;
1390
+ } else if (didGrow) {
1391
+ thread.scrollTop = thread.scrollHeight;
1392
+ }
1393
+ lastMessageCountRef.current = currentCount;
1394
+ }, [messages]);
1395
+ const handleSend = (value) => {
1396
+ if (!children) {
1397
+ const newMsg = {
1398
+ id: String(Date.now()),
1399
+ role: "user",
1400
+ content: value
1401
+ };
1402
+ setMessages((prev) => [...prev, newMsg]);
1403
+ }
1404
+ onSend?.(value);
1405
+ };
1406
+ const showEmptyState = children === void 0 && initialMessages !== void 0 && initialMessages.length === 0;
1407
+ return /* @__PURE__ */ jsxs5(
1408
+ "div",
1409
+ {
1410
+ ref,
1411
+ className: [
1412
+ "w-full flex flex-col bg-surface-soft",
1413
+ className
1414
+ ].filter(Boolean).join(" "),
1415
+ style: { height: "100%" },
1416
+ children: [
1417
+ children !== void 0 ? /* @__PURE__ */ jsx5("div", { className: "flex-1 flex flex-col min-h-0", children }) : showEmptyState ? /* @__PURE__ */ jsx5("div", { className: "flex-1 flex items-center justify-center overflow-y-auto px-lg py-xl", children: emptyState !== void 0 ? emptyState : /* @__PURE__ */ jsx5(ChatEmptyStateContent, { title: emptyTitle, description: emptyDescription }) }) : /* @__PURE__ */ jsx5("div", { ref: threadRef, className: "flex-1 overflow-y-auto px-lg py-xl", children: /* @__PURE__ */ jsx5("div", { className: "w-full max-w-2xl mx-auto flex flex-col gap-xl", children: messages.map(
1418
+ (msg) => msg.role === "user" ? /* @__PURE__ */ jsx5(UserMessage, { message: msg }, msg.id) : /* @__PURE__ */ jsx5(AiMessage, { message: msg }, msg.id)
1419
+ ) }) }),
1420
+ renderFooter !== void 0 ? renderFooter : /* @__PURE__ */ jsx5("div", { className: "w-full px-lg pb-lg pt-sm border-t border-hairline-soft bg-canvas", children: /* @__PURE__ */ jsx5("div", { className: "w-full max-w-2xl mx-auto", children: /* @__PURE__ */ jsx5(
1421
+ PromptInputBar,
1422
+ {
1423
+ placeholder,
1424
+ mode,
1425
+ onModeChange: setMode,
1426
+ onSend: handleSend,
1427
+ models,
1428
+ selectedModelId,
1429
+ onModelChange
1430
+ }
1431
+ ) }) })
1432
+ ]
1433
+ }
1434
+ );
1435
+ }
1436
+ );
1437
+ ChatScreen.displayName = "ChatScreen";
1438
+
1439
+ // virtual-pkg:src/atoms/WorkspaceMenu/WorkspaceMenu.tsx
1440
+ import React6 from "react";
1441
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1442
+ var RenameIcon = () => /* @__PURE__ */ jsxs6(
1443
+ "svg",
1444
+ {
1445
+ "aria-hidden": "true",
1446
+ xmlns: "http://www.w3.org/2000/svg",
1447
+ viewBox: "0 0 24 24",
1448
+ fill: "none",
1449
+ stroke: "currentColor",
1450
+ strokeWidth: "2",
1451
+ strokeLinecap: "round",
1452
+ strokeLinejoin: "round",
1453
+ style: { width: "16px", height: "16px", flexShrink: 0 },
1454
+ children: [
1455
+ /* @__PURE__ */ jsx6("path", { d: "M12 20h9" }),
1456
+ /* @__PURE__ */ jsx6("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z" })
1457
+ ]
1458
+ }
1459
+ );
1460
+ var DeleteIcon = () => /* @__PURE__ */ jsxs6(
1461
+ "svg",
1462
+ {
1463
+ "aria-hidden": "true",
1464
+ xmlns: "http://www.w3.org/2000/svg",
1465
+ viewBox: "0 0 24 24",
1466
+ fill: "none",
1467
+ stroke: "currentColor",
1468
+ strokeWidth: "2",
1469
+ strokeLinecap: "round",
1470
+ strokeLinejoin: "round",
1471
+ style: { width: "16px", height: "16px", flexShrink: 0 },
1472
+ children: [
1473
+ /* @__PURE__ */ jsx6("polyline", { points: "3 6 5 6 21 6" }),
1474
+ /* @__PURE__ */ jsx6("path", { d: "M19 6l-1 14H6L5 6" }),
1475
+ /* @__PURE__ */ jsx6("path", { d: "M10 11v6" }),
1476
+ /* @__PURE__ */ jsx6("path", { d: "M14 11v6" }),
1477
+ /* @__PURE__ */ jsx6("path", { d: "M9 6V4h6v2" })
1478
+ ]
1479
+ }
1480
+ );
1481
+ var ChevronIcon3 = ({ open }) => /* @__PURE__ */ jsx6(
1482
+ "svg",
1483
+ {
1484
+ "aria-hidden": "true",
1485
+ xmlns: "http://www.w3.org/2000/svg",
1486
+ viewBox: "0 0 24 24",
1487
+ fill: "none",
1488
+ stroke: "currentColor",
1489
+ strokeWidth: "2",
1490
+ strokeLinecap: "round",
1491
+ strokeLinejoin: "round",
1492
+ style: {
1493
+ width: "16px",
1494
+ height: "16px",
1495
+ flexShrink: 0,
1496
+ transition: "transform 180ms ease-in-out",
1497
+ transform: open ? "rotate(180deg)" : "rotate(0deg)"
1498
+ },
1499
+ children: /* @__PURE__ */ jsx6("polyline", { points: "6 9 12 15 18 9" })
1500
+ }
1501
+ );
1502
+ var WorkspaceMenu = React6.forwardRef(
1503
+ ({
1504
+ workspaceName = "Plasma Design System",
1505
+ onRename,
1506
+ onDelete,
1507
+ defaultOpen = false,
1508
+ className,
1509
+ ...rest
1510
+ }, ref) => {
1511
+ const [open, setOpen] = React6.useState(defaultOpen);
1512
+ const [mounted, setMounted] = React6.useState(defaultOpen);
1513
+ const [visible, setVisible] = React6.useState(false);
1514
+ const containerRef = React6.useRef(null);
1515
+ const setRefs = React6.useCallback(
1516
+ (node) => {
1517
+ containerRef.current = node;
1518
+ if (typeof ref === "function") ref(node);
1519
+ else if (ref)
1520
+ ref.current = node;
1521
+ },
1522
+ [ref]
1523
+ );
1524
+ React6.useEffect(() => {
1525
+ if (open) {
1526
+ setMounted(true);
1527
+ const raf = requestAnimationFrame(() => {
1528
+ requestAnimationFrame(() => setVisible(true));
1529
+ });
1530
+ return () => cancelAnimationFrame(raf);
1531
+ }
1532
+ setVisible(false);
1533
+ const timer = window.setTimeout(() => setMounted(false), 220);
1534
+ return () => window.clearTimeout(timer);
1535
+ }, [open]);
1536
+ React6.useEffect(() => {
1537
+ if (!open) return;
1538
+ const handler = (e) => {
1539
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
1540
+ setOpen(false);
1541
+ }
1542
+ };
1543
+ document.addEventListener("mousedown", handler);
1544
+ return () => document.removeEventListener("mousedown", handler);
1545
+ }, [open]);
1546
+ React6.useEffect(() => {
1547
+ if (!open) return;
1548
+ const handler = (e) => {
1549
+ if (e.key === "Escape") setOpen(false);
1550
+ };
1551
+ document.addEventListener("keydown", handler);
1552
+ return () => document.removeEventListener("keydown", handler);
1553
+ }, [open]);
1554
+ return /* @__PURE__ */ jsxs6(
1555
+ "div",
1556
+ {
1557
+ ref: setRefs,
1558
+ className: ["relative inline-block", className].filter(Boolean).join(" "),
1559
+ ...rest,
1560
+ children: [
1561
+ /* @__PURE__ */ jsxs6(
1562
+ Button,
1563
+ {
1564
+ type: "button",
1565
+ variant: "secondary",
1566
+ size: "sm",
1567
+ "aria-haspopup": "menu",
1568
+ "aria-expanded": open,
1569
+ "aria-label": `Workspace options: ${workspaceName}`,
1570
+ onClick: () => setOpen((v) => !v),
1571
+ className: "!gap-sm !pr-sm",
1572
+ style: { minWidth: "200px" },
1573
+ children: [
1574
+ /* @__PURE__ */ jsx6("span", { className: "flex-1 text-left truncate text-body-sm font-weight-heading-sm", children: workspaceName }),
1575
+ /* @__PURE__ */ jsx6(ChevronIcon3, { open })
1576
+ ]
1577
+ }
1578
+ ),
1579
+ mounted && /* @__PURE__ */ jsxs6(
1580
+ "div",
1581
+ {
1582
+ role: "menu",
1583
+ "aria-label": "Workspace actions",
1584
+ "aria-hidden": !open,
1585
+ className: [
1586
+ "absolute left-0 mt-xs origin-top rounded-xl bg-surface border border-hairline-soft shadow-card z-10 py-xs overflow-hidden",
1587
+ "transition-all duration-200 ease-in-out will-change-transform",
1588
+ visible ? "pointer-events-auto opacity-100 translate-y-0 scale-y-100" : "pointer-events-none opacity-0 -translate-y-1 scale-y-95"
1589
+ ].join(" "),
1590
+ style: { minWidth: "200px" },
1591
+ children: [
1592
+ /* @__PURE__ */ jsxs6(
1593
+ Button,
1594
+ {
1595
+ role: "menuitem",
1596
+ type: "button",
1597
+ variant: "ghost",
1598
+ size: "sm",
1599
+ onClick: () => {
1600
+ setOpen(false);
1601
+ onRename?.();
1602
+ },
1603
+ className: "!w-full !justify-start !rounded-none !px-md !gap-sm text-muted",
1604
+ children: [
1605
+ /* @__PURE__ */ jsx6(RenameIcon, {}),
1606
+ /* @__PURE__ */ jsx6("span", { className: "text-ink", children: "Rename" })
1607
+ ]
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ jsxs6(
1611
+ Button,
1612
+ {
1613
+ role: "menuitem",
1614
+ type: "button",
1615
+ variant: "ghost",
1616
+ size: "sm",
1617
+ onClick: () => {
1618
+ setOpen(false);
1619
+ onDelete?.();
1620
+ },
1621
+ className: "!w-full !justify-start !rounded-none !px-md !gap-sm",
1622
+ style: { color: "var(--color-semantic-error)" },
1623
+ children: [
1624
+ /* @__PURE__ */ jsx6(DeleteIcon, {}),
1625
+ /* @__PURE__ */ jsx6("span", { children: "Delete" })
1626
+ ]
1627
+ }
1628
+ )
1629
+ ]
1630
+ }
1631
+ )
1632
+ ]
1633
+ }
1634
+ );
1635
+ }
1636
+ );
1637
+ WorkspaceMenu.displayName = "WorkspaceMenu";
1638
+
1639
+ // virtual-pkg:src/atoms/AppLayout/AppLayout.tsx
1640
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1641
+ var TOPBAR_HEIGHT = 48;
1642
+ var CURVE_R = 16;
1643
+ var MIN_CHAT_WIDTH = 260;
1644
+ var MAX_CHAT_WIDTH = 600;
1645
+ var COLLAPSE_DURATION = 250;
1646
+ var COLLAPSED_RAIL_WIDTH = 12;
1647
+ var PANEL_GAP_RIGHT = CURVE_R;
1648
+ var LayoutPanelIcon = () => /* @__PURE__ */ jsxs7(
1649
+ "svg",
1650
+ {
1651
+ width: "16",
1652
+ height: "16",
1653
+ viewBox: "0 0 24 24",
1654
+ fill: "none",
1655
+ stroke: "currentColor",
1656
+ strokeWidth: "2",
1657
+ strokeLinecap: "round",
1658
+ strokeLinejoin: "round",
1659
+ "aria-hidden": "true",
1660
+ children: [
1661
+ /* @__PURE__ */ jsx7("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
1662
+ /* @__PURE__ */ jsx7("path", { d: "M9 3v18" })
1663
+ ]
1664
+ }
1665
+ );
1666
+ var ArrowLeftIcon = () => /* @__PURE__ */ jsxs7(
1667
+ "svg",
1668
+ {
1669
+ width: "16",
1670
+ height: "16",
1671
+ viewBox: "0 0 24 24",
1672
+ fill: "none",
1673
+ stroke: "currentColor",
1674
+ strokeWidth: "2",
1675
+ strokeLinecap: "round",
1676
+ strokeLinejoin: "round",
1677
+ "aria-hidden": "true",
1678
+ children: [
1679
+ /* @__PURE__ */ jsx7("path", { d: "M19 12H5" }),
1680
+ /* @__PURE__ */ jsx7("path", { d: "m12 19-7-7 7-7" })
1681
+ ]
1682
+ }
1683
+ );
1684
+ var HomeIcon = () => /* @__PURE__ */ jsxs7(
1685
+ "svg",
1686
+ {
1687
+ width: "16",
1688
+ height: "16",
1689
+ viewBox: "0 0 24 24",
1690
+ fill: "none",
1691
+ stroke: "currentColor",
1692
+ strokeWidth: "2",
1693
+ strokeLinecap: "round",
1694
+ strokeLinejoin: "round",
1695
+ "aria-hidden": "true",
1696
+ children: [
1697
+ /* @__PURE__ */ jsx7("path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
1698
+ /* @__PURE__ */ jsx7("polyline", { points: "9 22 9 12 15 12 15 22" })
1699
+ ]
1700
+ }
1701
+ );
1702
+ var ChevronDownIcon = () => /* @__PURE__ */ jsx7(
1703
+ "svg",
1704
+ {
1705
+ width: "12",
1706
+ height: "12",
1707
+ viewBox: "0 0 24 24",
1708
+ fill: "none",
1709
+ stroke: "currentColor",
1710
+ strokeWidth: "2.5",
1711
+ strokeLinecap: "round",
1712
+ strokeLinejoin: "round",
1713
+ "aria-hidden": "true",
1714
+ children: /* @__PURE__ */ jsx7("polyline", { points: "6 9 12 15 18 9" })
1715
+ }
1716
+ );
1717
+ function applyWidth(els, px) {
1718
+ for (const el of els) {
1719
+ if (el) el.style.width = `${px}px`;
1720
+ }
1721
+ }
1722
+ function restoreTransition(els, transition) {
1723
+ requestAnimationFrame(() => {
1724
+ for (const el of els) {
1725
+ if (el) el.style.transition = transition;
1726
+ }
1727
+ });
1728
+ }
1729
+ var AvatarNav = ({ initials, onBackToProjects, onHome }) => {
1730
+ const [open, setOpen] = React7.useState(false);
1731
+ const containerRef = React7.useRef(null);
1732
+ React7.useEffect(() => {
1733
+ if (!open) return;
1734
+ const handler = (e) => {
1735
+ if (containerRef.current && !containerRef.current.contains(e.target))
1736
+ setOpen(false);
1737
+ };
1738
+ document.addEventListener("mousedown", handler);
1739
+ return () => document.removeEventListener("mousedown", handler);
1740
+ }, [open]);
1741
+ React7.useEffect(() => {
1742
+ if (!open) return;
1743
+ const handler = (e) => {
1744
+ if (e.key === "Escape") setOpen(false);
1745
+ };
1746
+ document.addEventListener("keydown", handler);
1747
+ return () => document.removeEventListener("keydown", handler);
1748
+ }, [open]);
1749
+ return /* @__PURE__ */ jsxs7("div", { ref: containerRef, className: "relative flex-shrink-0", style: { zIndex: 1e3 }, children: [
1750
+ /* @__PURE__ */ jsxs7(
1751
+ Button,
1752
+ {
1753
+ type: "button",
1754
+ variant: "ghost",
1755
+ size: "sm",
1756
+ "aria-label": "Open navigation menu",
1757
+ "aria-haspopup": "menu",
1758
+ "aria-expanded": open,
1759
+ onClick: () => setOpen((v) => !v),
1760
+ className: "!p-0 !gap-xxs !rounded-xl !bg-transparent !border-0 flex items-center",
1761
+ children: [
1762
+ /* @__PURE__ */ jsx7(
1763
+ "span",
1764
+ {
1765
+ className: "flex items-center justify-center rounded-full bg-primary text-on-primary select-none font-weight-heading-sm",
1766
+ style: { width: 32, height: 32, fontSize: 13, flexShrink: 0 },
1767
+ children: initials
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ jsx7("span", { className: "text-muted", style: { lineHeight: 0 }, children: /* @__PURE__ */ jsx7(ChevronDownIcon, {}) })
1771
+ ]
1772
+ }
1773
+ ),
1774
+ open && /* @__PURE__ */ jsxs7(
1775
+ "div",
1776
+ {
1777
+ role: "menu",
1778
+ "aria-label": "Navigation",
1779
+ className: "absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs",
1780
+ style: { minWidth: 200, zIndex: 1e3, top: "100%" },
1781
+ children: [
1782
+ /* @__PURE__ */ jsxs7(
1783
+ Button,
1784
+ {
1785
+ role: "menuitem",
1786
+ type: "button",
1787
+ variant: "ghost",
1788
+ size: "sm",
1789
+ onClick: () => {
1790
+ setOpen(false);
1791
+ onBackToProjects?.();
1792
+ },
1793
+ className: "!w-full !justify-start !rounded-none !px-md !gap-md !text-ink",
1794
+ children: [
1795
+ /* @__PURE__ */ jsx7("span", { className: "text-muted", children: /* @__PURE__ */ jsx7(ArrowLeftIcon, {}) }),
1796
+ "Back to projects"
1797
+ ]
1798
+ }
1799
+ ),
1800
+ /* @__PURE__ */ jsxs7(
1801
+ Button,
1802
+ {
1803
+ role: "menuitem",
1804
+ type: "button",
1805
+ variant: "ghost",
1806
+ size: "sm",
1807
+ onClick: () => {
1808
+ setOpen(false);
1809
+ onHome?.();
1810
+ },
1811
+ className: "!w-full !justify-start !rounded-none !px-md !gap-md !text-ink",
1812
+ children: [
1813
+ /* @__PURE__ */ jsx7("span", { className: "text-muted", children: /* @__PURE__ */ jsx7(HomeIcon, {}) }),
1814
+ "Home"
1815
+ ]
1816
+ }
1817
+ )
1818
+ ]
1819
+ }
1820
+ )
1821
+ ] });
1822
+ };
1823
+ var ConcaveCorner = () => /* @__PURE__ */ jsx7(
1824
+ "div",
1825
+ {
1826
+ "aria-hidden": "true",
1827
+ style: {
1828
+ position: "absolute",
1829
+ top: -1,
1830
+ // cover the 1px border exactly
1831
+ left: -1,
1832
+ width: CURVE_R + 1,
1833
+ height: CURVE_R + 1,
1834
+ pointerEvents: "none",
1835
+ zIndex: 2,
1836
+ // above the border
1837
+ overflow: "hidden"
1838
+ },
1839
+ children: /* @__PURE__ */ jsxs7(
1840
+ "svg",
1841
+ {
1842
+ width: CURVE_R + 1,
1843
+ height: CURVE_R + 1,
1844
+ viewBox: `0 0 ${CURVE_R + 1} ${CURVE_R + 1}`,
1845
+ fill: "none",
1846
+ children: [
1847
+ /* @__PURE__ */ jsx7("rect", { width: CURVE_R + 1, height: CURVE_R + 1, fill: "var(--color-surface-soft)" }),
1848
+ /* @__PURE__ */ jsx7(
1849
+ "path",
1850
+ {
1851
+ d: `M${CURVE_R + 1} 0 L${CURVE_R + 1} ${CURVE_R + 1} Q0 ${CURVE_R + 1} 0 0 Z`,
1852
+ fill: "var(--color-canvas)"
1853
+ }
1854
+ )
1855
+ ]
1856
+ }
1857
+ )
1858
+ }
1859
+ );
1860
+ var RightPanelPlaceholder = () => /* @__PURE__ */ jsxs7("div", { className: "flex-1 flex flex-col items-center justify-center", style: { minHeight: "100%" }, children: [
1861
+ /* @__PURE__ */ jsxs7("svg", { width: "64", height: "64", viewBox: "0 0 72 72", fill: "none", className: "text-hairline-strong mb-lg", "aria-hidden": "true", children: [
1862
+ /* @__PURE__ */ jsx7("rect", { x: "4", y: "4", width: "64", height: "64", rx: "10", stroke: "currentColor", strokeWidth: "2.5", strokeDasharray: "6 4" }),
1863
+ /* @__PURE__ */ jsx7("rect", { x: "14", y: "14", width: "20", height: "20", rx: "4", fill: "currentColor", opacity: "0.15" }),
1864
+ /* @__PURE__ */ jsx7("rect", { x: "38", y: "14", width: "20", height: "20", rx: "4", fill: "currentColor", opacity: "0.1" }),
1865
+ /* @__PURE__ */ jsx7("rect", { x: "14", y: "38", width: "44", height: "12", rx: "4", fill: "currentColor", opacity: "0.08" })
1866
+ ] }),
1867
+ /* @__PURE__ */ jsx7("p", { className: "text-body-sm text-muted-soft", children: "Preview will appear here" })
1868
+ ] });
1869
+ var PromptFooter = ({ chatProps }) => {
1870
+ const [mode, setMode] = React7.useState("Build");
1871
+ return /* @__PURE__ */ jsx7("div", { className: "w-full px-md pb-md pt-sm", style: { background: "var(--color-surface-soft)" }, children: /* @__PURE__ */ jsx7(
1872
+ PromptInputBar,
1873
+ {
1874
+ placeholder: chatProps?.placeholder ?? "Ask Lovable\u2026",
1875
+ mode,
1876
+ onModeChange: setMode,
1877
+ onSend: chatProps?.onSend,
1878
+ models: chatProps?.models,
1879
+ selectedModelId: chatProps?.selectedModelId,
1880
+ onModelChange: chatProps?.onModelChange
1881
+ }
1882
+ ) });
1883
+ };
1884
+ var AppLayout = React7.forwardRef(
1885
+ ({
1886
+ navbarProps,
1887
+ chatProps,
1888
+ rightPanel,
1889
+ rightPanelTabs = [],
1890
+ rightPanelActiveTab = 0,
1891
+ onRightPanelTabChange,
1892
+ defaultChatWidth = 340,
1893
+ projectName = "My Project",
1894
+ onRenameProject,
1895
+ onBackToProjects,
1896
+ onHome,
1897
+ avatarInitials = "A",
1898
+ className
1899
+ }, ref) => {
1900
+ const [activeTab, setActiveTab] = React7.useState(rightPanelActiveTab);
1901
+ const [chatWidth, setChatWidth] = React7.useState(defaultChatWidth);
1902
+ const [chatCollapsed, setChatCollapsed] = React7.useState(false);
1903
+ const topChatColRef = React7.useRef(null);
1904
+ const bodyChatColRef = React7.useRef(null);
1905
+ const topDividerRef = React7.useRef(null);
1906
+ const bodyDividerRef = React7.useRef(null);
1907
+ const isDragging = React7.useRef(false);
1908
+ const startX = React7.useRef(0);
1909
+ const startWidth = React7.useRef(defaultChatWidth);
1910
+ const currentWidth = React7.useRef(defaultChatWidth);
1911
+ const collapseTransition = `width ${COLLAPSE_DURATION}ms cubic-bezier(0.4,0,0.2,1)`;
1912
+ const opacityTransition = `opacity ${COLLAPSE_DURATION}ms ease`;
1913
+ React7.useEffect(() => {
1914
+ setActiveTab(rightPanelActiveTab);
1915
+ }, [rightPanelActiveTab]);
1916
+ const handleTabChange = (i) => {
1917
+ setActiveTab(i);
1918
+ onRightPanelTabChange?.(i);
1919
+ };
1920
+ const onDividerMouseDown = (e) => {
1921
+ if (chatCollapsed) return;
1922
+ e.preventDefault();
1923
+ isDragging.current = true;
1924
+ startX.current = e.clientX;
1925
+ startWidth.current = currentWidth.current;
1926
+ const colNodes = [topChatColRef.current, bodyChatColRef.current];
1927
+ const divNodes = [topDividerRef.current, bodyDividerRef.current];
1928
+ for (const el of [...colNodes, ...divNodes]) {
1929
+ if (el) el.style.transition = "none";
1930
+ }
1931
+ document.body.style.cursor = "col-resize";
1932
+ document.body.style.userSelect = "none";
1933
+ const onMove = (ev) => {
1934
+ if (!isDragging.current) return;
1935
+ const next = Math.min(
1936
+ MAX_CHAT_WIDTH,
1937
+ Math.max(MIN_CHAT_WIDTH, startWidth.current + ev.clientX - startX.current)
1938
+ );
1939
+ currentWidth.current = next;
1940
+ applyWidth(colNodes, next);
1941
+ applyWidth(divNodes, 6);
1942
+ };
1943
+ const onUp = () => {
1944
+ if (!isDragging.current) return;
1945
+ isDragging.current = false;
1946
+ document.body.style.cursor = "";
1947
+ document.body.style.userSelect = "";
1948
+ window.removeEventListener("mousemove", onMove);
1949
+ window.removeEventListener("mouseup", onUp);
1950
+ setChatWidth(currentWidth.current);
1951
+ restoreTransition([...colNodes, ...divNodes], collapseTransition);
1952
+ };
1953
+ window.addEventListener("mousemove", onMove);
1954
+ window.addEventListener("mouseup", onUp);
1955
+ };
1956
+ const renderedWidth = chatCollapsed ? COLLAPSED_RAIL_WIDTH : chatWidth;
1957
+ const hasTabs = Array.isArray(rightPanelTabs) && rightPanelTabs.length > 0;
1958
+ return /* @__PURE__ */ jsxs7(
1959
+ "div",
1960
+ {
1961
+ ref,
1962
+ className: ["w-full flex flex-col overflow-hidden", className].filter(Boolean).join(" "),
1963
+ style: { height: "100vh", background: "var(--color-surface-soft)" },
1964
+ children: [
1965
+ /* @__PURE__ */ jsxs7(
1966
+ "div",
1967
+ {
1968
+ className: "w-full flex flex-shrink-0 items-center",
1969
+ style: { height: TOPBAR_HEIGHT, background: "var(--color-surface-soft)" },
1970
+ children: [
1971
+ /* @__PURE__ */ jsx7(
1972
+ "div",
1973
+ {
1974
+ ref: topChatColRef,
1975
+ className: "flex-shrink-0 h-full",
1976
+ style: {
1977
+ width: renderedWidth,
1978
+ minWidth: 0,
1979
+ transition: collapseTransition,
1980
+ position: "relative",
1981
+ zIndex: 500
1982
+ },
1983
+ children: /* @__PURE__ */ jsxs7(
1984
+ "div",
1985
+ {
1986
+ className: "flex items-center px-sm gap-sm h-full",
1987
+ style: {
1988
+ opacity: chatCollapsed ? 0 : 1,
1989
+ transition: opacityTransition,
1990
+ pointerEvents: chatCollapsed ? "none" : "auto"
1991
+ },
1992
+ children: [
1993
+ /* @__PURE__ */ jsx7(
1994
+ AvatarNav,
1995
+ {
1996
+ initials: avatarInitials,
1997
+ onBackToProjects,
1998
+ onHome
1999
+ }
2000
+ ),
2001
+ /* @__PURE__ */ jsx7("div", { className: "flex-1 min-w-0", style: { position: "relative", zIndex: 1e3 }, children: /* @__PURE__ */ jsx7(
2002
+ WorkspaceMenu,
2003
+ {
2004
+ workspaceName: projectName,
2005
+ onRename: onRenameProject,
2006
+ className: "w-full"
2007
+ }
2008
+ ) })
2009
+ ]
2010
+ }
2011
+ )
2012
+ }
2013
+ ),
2014
+ /* @__PURE__ */ jsx7(
2015
+ "div",
2016
+ {
2017
+ ref: topDividerRef,
2018
+ className: "flex-shrink-0",
2019
+ style: {
2020
+ width: chatCollapsed ? 0 : 6,
2021
+ overflow: "hidden",
2022
+ transition: collapseTransition
2023
+ }
2024
+ }
2025
+ ),
2026
+ /* @__PURE__ */ jsxs7(
2027
+ "div",
2028
+ {
2029
+ className: "flex-1 flex items-center px-sm h-full gap-xs overflow-visible",
2030
+ style: { background: "var(--color-surface-soft)" },
2031
+ children: [
2032
+ /* @__PURE__ */ jsx7(
2033
+ Button,
2034
+ {
2035
+ variant: "ghost",
2036
+ size: "sm",
2037
+ "aria-label": chatCollapsed ? "Expand chat panel" : "Collapse chat panel",
2038
+ onClick: () => setChatCollapsed((v) => !v),
2039
+ className: "!p-xs !rounded-md flex-shrink-0",
2040
+ children: /* @__PURE__ */ jsx7(LayoutPanelIcon, {})
2041
+ }
2042
+ ),
2043
+ hasTabs && /* @__PURE__ */ jsx7("nav", { "aria-label": "Panel tabs", className: "flex items-center gap-xs ml-xs overflow-x-auto", children: rightPanelTabs.map((tab, i) => /* @__PURE__ */ jsx7(
2044
+ Button,
2045
+ {
2046
+ type: "button",
2047
+ variant: i === activeTab ? "secondary" : "ghost",
2048
+ size: "sm",
2049
+ onClick: () => handleTabChange(i),
2050
+ "aria-selected": i === activeTab,
2051
+ className: i === activeTab ? "!bg-surface-strong !text-ink !border-hairline flex-shrink-0" : "!text-muted hover:!text-ink flex-shrink-0",
2052
+ children: tab
2053
+ },
2054
+ tab
2055
+ )) }),
2056
+ /* @__PURE__ */ jsx7("div", { className: "flex-1" }),
2057
+ /* @__PURE__ */ jsx7("div", { className: "flex-shrink-0", style: { minWidth: "fit-content" }, children: /* @__PURE__ */ jsx7(
2058
+ TopNavbar,
2059
+ {
2060
+ ...navbarProps,
2061
+ className: "!border-0 !py-0 !px-0 !bg-transparent w-auto"
2062
+ }
2063
+ ) })
2064
+ ]
2065
+ }
2066
+ )
2067
+ ]
2068
+ }
2069
+ ),
2070
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 min-h-0 overflow-hidden", children: [
2071
+ /* @__PURE__ */ jsx7(
2072
+ "div",
2073
+ {
2074
+ ref: bodyChatColRef,
2075
+ className: "flex flex-col flex-shrink-0 overflow-hidden",
2076
+ style: {
2077
+ width: renderedWidth,
2078
+ minWidth: 0,
2079
+ background: "var(--color-surface-soft)",
2080
+ transition: collapseTransition
2081
+ },
2082
+ children: /* @__PURE__ */ jsx7(
2083
+ "div",
2084
+ {
2085
+ className: "flex flex-col flex-1 min-h-0 overflow-hidden",
2086
+ style: {
2087
+ opacity: chatCollapsed ? 0 : 1,
2088
+ transition: opacityTransition,
2089
+ pointerEvents: chatCollapsed ? "none" : "auto"
2090
+ },
2091
+ children: /* @__PURE__ */ jsx7(
2092
+ ChatScreen,
2093
+ {
2094
+ ...chatProps,
2095
+ className: ["flex-1 min-h-0", chatProps?.className].filter(Boolean).join(" "),
2096
+ renderFooter: chatProps?.renderFooter ?? /* @__PURE__ */ jsx7(PromptFooter, { chatProps })
2097
+ }
2098
+ )
2099
+ }
2100
+ )
2101
+ }
2102
+ ),
2103
+ /* @__PURE__ */ jsx7(
2104
+ "div",
2105
+ {
2106
+ ref: bodyDividerRef,
2107
+ role: "separator",
2108
+ "aria-label": "Resize chat panel",
2109
+ "aria-orientation": "vertical",
2110
+ onMouseDown: onDividerMouseDown,
2111
+ className: "flex-shrink-0 flex items-center justify-center group",
2112
+ style: {
2113
+ width: chatCollapsed ? 0 : 6,
2114
+ cursor: chatCollapsed ? "default" : "col-resize",
2115
+ transition: collapseTransition,
2116
+ overflow: "hidden",
2117
+ position: "relative",
2118
+ zIndex: 10,
2119
+ background: "transparent"
2120
+ },
2121
+ children: /* @__PURE__ */ jsx7(
2122
+ "div",
2123
+ {
2124
+ className: "rounded-full bg-hairline-strong group-hover:bg-primary transition-colors duration-150",
2125
+ style: { width: 3, height: 40, opacity: 0.4, flexShrink: 0 }
2126
+ }
2127
+ )
2128
+ }
2129
+ ),
2130
+ /* @__PURE__ */ jsxs7(
2131
+ "div",
2132
+ {
2133
+ className: "flex-1 min-w-0 flex flex-col overflow-hidden",
2134
+ style: {
2135
+ background: "var(--color-canvas)",
2136
+ borderRadius: `${CURVE_R}px ${CURVE_R}px 0 0`,
2137
+ marginRight: PANEL_GAP_RIGHT,
2138
+ border: "1px solid var(--color-hairline)",
2139
+ borderBottom: "none",
2140
+ position: "relative"
2141
+ },
2142
+ children: [
2143
+ /* @__PURE__ */ jsx7(ConcaveCorner, {}),
2144
+ /* @__PURE__ */ jsx7(
2145
+ "div",
2146
+ {
2147
+ className: "flex-1 min-h-0 overflow-auto flex flex-col",
2148
+ style: { position: "relative", zIndex: 0 },
2149
+ children: rightPanel !== void 0 ? /* @__PURE__ */ jsx7("div", { className: "w-full flex-1", children: rightPanel }) : /* @__PURE__ */ jsx7(RightPanelPlaceholder, {})
2150
+ }
2151
+ )
2152
+ ]
2153
+ }
2154
+ )
2155
+ ] })
2156
+ ]
2157
+ }
2158
+ );
2159
+ }
2160
+ );
2161
+ AppLayout.displayName = "AppLayout";
2162
+
2163
+ // virtual-pkg:src/atoms/AppSidebar/AppSidebar.tsx
2164
+ import React10 from "react";
2165
+
2166
+ // virtual-pkg:src/atoms/NavItem/NavItem.tsx
2167
+ import React8 from "react";
2168
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2169
+ var ChevronDownIcon2 = () => /* @__PURE__ */ jsx8(
2170
+ "svg",
2171
+ {
2172
+ viewBox: "0 0 24 24",
2173
+ fill: "none",
2174
+ stroke: "currentColor",
2175
+ strokeWidth: "2",
2176
+ strokeLinecap: "round",
2177
+ strokeLinejoin: "round",
2178
+ "aria-hidden": "true",
2179
+ style: { width: "14px", height: "14px", flexShrink: 0 },
2180
+ children: /* @__PURE__ */ jsx8("polyline", { points: "6 9 12 15 18 9" })
2181
+ }
2182
+ );
2183
+ var TrashIcon = () => /* @__PURE__ */ jsxs8(
2184
+ "svg",
2185
+ {
2186
+ viewBox: "0 0 24 24",
2187
+ fill: "none",
2188
+ stroke: "currentColor",
2189
+ strokeWidth: "1.75",
2190
+ strokeLinecap: "round",
2191
+ strokeLinejoin: "round",
2192
+ "aria-hidden": "true",
2193
+ style: { width: "14px", height: "14px", flexShrink: 0 },
2194
+ children: [
2195
+ /* @__PURE__ */ jsx8("polyline", { points: "3 6 5 6 21 6" }),
2196
+ /* @__PURE__ */ jsx8("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }),
2197
+ /* @__PURE__ */ jsx8("path", { d: "M10 11v6M14 11v6" }),
2198
+ /* @__PURE__ */ jsx8("path", { d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" })
2199
+ ]
2200
+ }
2201
+ );
2202
+ var SubItemRow = ({ item }) => {
2203
+ const [hovered, setHovered] = React8.useState(false);
2204
+ return /* @__PURE__ */ jsxs8(
2205
+ "li",
2206
+ {
2207
+ className: "list-none flex items-center gap-xs",
2208
+ onMouseEnter: () => setHovered(true),
2209
+ onMouseLeave: () => setHovered(false),
2210
+ children: [
2211
+ item.onClick ? /* @__PURE__ */ jsx8(
2212
+ Button,
2213
+ {
2214
+ variant: "ghost",
2215
+ size: "sm",
2216
+ className: "!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !text-body !rounded-sm !cursor-pointer hover:!text-ink",
2217
+ onClick: () => item.onClick(item.id),
2218
+ children: item.label
2219
+ }
2220
+ ) : /* @__PURE__ */ jsx8("span", { className: "flex-1 truncate px-sm py-xxs text-body-sm text-body rounded-sm cursor-default select-none", children: item.label }),
2221
+ item.onDelete && /* @__PURE__ */ jsx8(
2222
+ Button,
2223
+ {
2224
+ variant: "ghost",
2225
+ size: "sm",
2226
+ "aria-label": `Delete ${item.label}`,
2227
+ onClick: (e) => {
2228
+ e.stopPropagation();
2229
+ item.onDelete(item.id);
2230
+ },
2231
+ className: [
2232
+ "!p-xxs !rounded-xs !text-muted !min-w-0 transition-opacity duration-200 ease-in-out",
2233
+ "hover:!text-semantic-error",
2234
+ hovered ? "opacity-100" : "opacity-0"
2235
+ ].join(" "),
2236
+ tabIndex: hovered ? 0 : -1,
2237
+ children: /* @__PURE__ */ jsx8(TrashIcon, {})
2238
+ }
2239
+ )
2240
+ ]
2241
+ }
2242
+ );
2243
+ };
2244
+ var NavItem = React8.forwardRef(
2245
+ ({
2246
+ icon,
2247
+ label,
2248
+ active = false,
2249
+ shortcut,
2250
+ subItems,
2251
+ children,
2252
+ expanded,
2253
+ onExpandToggle,
2254
+ iconOnly = false,
2255
+ onClick,
2256
+ className,
2257
+ ...rest
2258
+ }, ref) => {
2259
+ const hasSubItems = subItems && subItems.length > 0;
2260
+ const hasChildren = React8.Children.count(children) > 0;
2261
+ const isExpandable = hasSubItems || hasChildren;
2262
+ const contentRef = React8.useRef(null);
2263
+ const [mounted, setMounted] = React8.useState(Boolean(expanded));
2264
+ const [visible, setVisible] = React8.useState(Boolean(expanded));
2265
+ const [contentHeight, setContentHeight] = React8.useState(0);
2266
+ React8.useEffect(() => {
2267
+ if (expanded) {
2268
+ setMounted(true);
2269
+ const raf = requestAnimationFrame(() => {
2270
+ if (contentRef.current) {
2271
+ setContentHeight(contentRef.current.scrollHeight);
2272
+ }
2273
+ requestAnimationFrame(() => setVisible(true));
2274
+ });
2275
+ return () => cancelAnimationFrame(raf);
2276
+ }
2277
+ if (contentRef.current) {
2278
+ setContentHeight(contentRef.current.scrollHeight);
2279
+ }
2280
+ setVisible(false);
2281
+ const timer = window.setTimeout(() => setMounted(false), 220);
2282
+ return () => window.clearTimeout(timer);
2283
+ }, [expanded, subItems, children]);
2284
+ React8.useEffect(() => {
2285
+ if (!mounted || !contentRef.current) return;
2286
+ const measure = () => setContentHeight(contentRef.current?.scrollHeight ?? 0);
2287
+ measure();
2288
+ if (typeof ResizeObserver === "undefined") return;
2289
+ const observer = new ResizeObserver(measure);
2290
+ observer.observe(contentRef.current);
2291
+ return () => observer.disconnect();
2292
+ }, [mounted, subItems, children]);
2293
+ const handleClick = (e) => {
2294
+ if (isExpandable && onExpandToggle) {
2295
+ onExpandToggle();
2296
+ }
2297
+ onClick?.(e);
2298
+ };
2299
+ return /* @__PURE__ */ jsxs8(
2300
+ "li",
2301
+ {
2302
+ ref,
2303
+ className: ["list-none", className].filter(Boolean).join(" "),
2304
+ ...rest,
2305
+ children: [
2306
+ /* @__PURE__ */ jsxs8(
2307
+ Button,
2308
+ {
2309
+ variant: "ghost",
2310
+ size: "sm",
2311
+ "aria-current": active ? "page" : void 0,
2312
+ "aria-expanded": isExpandable ? expanded : void 0,
2313
+ "aria-label": iconOnly ? label : void 0,
2314
+ title: iconOnly ? label : void 0,
2315
+ onClick: handleClick,
2316
+ className: [
2317
+ iconOnly ? "!w-full !justify-center !px-xs !py-xs !rounded-md" : "!w-full !justify-start !px-sm !py-xs !rounded-md !gap-sm !font-weight-body-md",
2318
+ active ? "!bg-primary-disabled !text-primary" : ""
2319
+ ].filter(Boolean).join(" "),
2320
+ children: [
2321
+ icon && /* @__PURE__ */ jsx8(
2322
+ "span",
2323
+ {
2324
+ "aria-hidden": "true",
2325
+ className: [
2326
+ "flex-shrink-0",
2327
+ active ? "text-primary" : "text-muted"
2328
+ ].join(" "),
2329
+ style: {
2330
+ width: "18px",
2331
+ height: "18px",
2332
+ display: "flex",
2333
+ alignItems: "center",
2334
+ justifyContent: "center"
2335
+ },
2336
+ children: icon
2337
+ }
2338
+ ),
2339
+ !iconOnly && /* @__PURE__ */ jsx8(
2340
+ "span",
2341
+ {
2342
+ className: [
2343
+ "flex-1 text-left text-body-sm",
2344
+ active ? "text-primary" : "text-ink"
2345
+ ].join(" "),
2346
+ children: label
2347
+ }
2348
+ ),
2349
+ !iconOnly && shortcut && !isExpandable && /* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-xs ml-auto", "aria-hidden": "true", children: [
2350
+ shortcut.modifier && /* @__PURE__ */ jsx8(
2351
+ "kbd",
2352
+ {
2353
+ className: "inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft",
2354
+ style: { minWidth: "22px", height: "22px" },
2355
+ children: shortcut.modifier
2356
+ }
2357
+ ),
2358
+ /* @__PURE__ */ jsx8(
2359
+ "kbd",
2360
+ {
2361
+ className: "inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft",
2362
+ style: { minWidth: "22px", height: "22px" },
2363
+ children: shortcut.key
2364
+ }
2365
+ )
2366
+ ] }),
2367
+ !iconOnly && isExpandable && /* @__PURE__ */ jsx8(
2368
+ "span",
2369
+ {
2370
+ "aria-hidden": "true",
2371
+ className: [
2372
+ "ml-auto text-muted transition-transform duration-200 ease-in-out",
2373
+ expanded ? "rotate-180" : "rotate-0"
2374
+ ].join(" "),
2375
+ children: /* @__PURE__ */ jsx8(ChevronDownIcon2, {})
2376
+ }
2377
+ )
2378
+ ]
2379
+ }
2380
+ ),
2381
+ !iconOnly && mounted && (hasSubItems || hasChildren) && /* @__PURE__ */ jsx8(
2382
+ "div",
2383
+ {
2384
+ className: "overflow-hidden transition-[max-height,opacity,transform,margin] duration-220 ease-in-out",
2385
+ style: {
2386
+ maxHeight: visible ? `${contentHeight}px` : "0px",
2387
+ opacity: visible ? 1 : 0,
2388
+ transform: visible ? "translateY(0)" : "translateY(-4px)",
2389
+ marginTop: visible ? "var(--spacing-xxs)" : "0px"
2390
+ },
2391
+ children: /* @__PURE__ */ jsxs8("div", { ref: contentRef, children: [
2392
+ hasSubItems && /* @__PURE__ */ jsx8(
2393
+ "ul",
2394
+ {
2395
+ className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
2396
+ role: "list",
2397
+ children: subItems.map((item) => /* @__PURE__ */ jsx8(SubItemRow, { item }, item.id))
2398
+ }
2399
+ ),
2400
+ hasChildren && /* @__PURE__ */ jsx8(
2401
+ "ul",
2402
+ {
2403
+ className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
2404
+ role: "list",
2405
+ children
2406
+ }
2407
+ )
2408
+ ] })
2409
+ }
2410
+ )
2411
+ ]
2412
+ }
2413
+ );
2414
+ }
2415
+ );
2416
+ NavItem.displayName = "NavItem";
2417
+
2418
+ // virtual-pkg:src/atoms/UpgradeCard/UpgradeCard.tsx
2419
+ import React9 from "react";
2420
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
2421
+ var UpgradeCard = React9.forwardRef(
2422
+ ({
2423
+ eyebrow = "Card \u2013 Upgrade",
2424
+ title = "Upgrade to Pro",
2425
+ subtitle = "Unlock more features",
2426
+ className,
2427
+ ...rest
2428
+ }, ref) => /* @__PURE__ */ jsxs9(
2429
+ "div",
2430
+ {
2431
+ ref,
2432
+ className: ["w-full", className].filter(Boolean).join(" "),
2433
+ ...rest,
2434
+ children: [
2435
+ eyebrow && /* @__PURE__ */ jsx9("p", { className: "text-caption text-muted mb-md", children: eyebrow }),
2436
+ /* @__PURE__ */ jsxs9("div", { className: "rounded-xl bg-surface shadow-card px-md py-sm flex items-center justify-between gap-sm", children: [
2437
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-xxs min-w-0", children: [
2438
+ /* @__PURE__ */ jsx9("span", { className: "text-body-sm font-weight-heading-sm text-ink truncate", children: title }),
2439
+ /* @__PURE__ */ jsx9("span", { className: "text-caption text-muted truncate", children: subtitle })
2440
+ ] }),
2441
+ /* @__PURE__ */ jsx9(
2442
+ "span",
2443
+ {
2444
+ "aria-hidden": "true",
2445
+ className: "flex-shrink-0 flex items-center justify-center rounded-full",
2446
+ style: {
2447
+ width: "40px",
2448
+ height: "40px",
2449
+ backgroundColor: "color-mix(in srgb, var(--color-primary) 15%, transparent)"
2450
+ },
2451
+ children: /* @__PURE__ */ jsx9(
2452
+ "svg",
2453
+ {
2454
+ xmlns: "http://www.w3.org/2000/svg",
2455
+ viewBox: "0 0 24 24",
2456
+ fill: "currentColor",
2457
+ "aria-hidden": "true",
2458
+ style: { width: "18px", height: "18px", color: "var(--color-ink)" },
2459
+ children: /* @__PURE__ */ jsx9("path", { d: "M13 2 3 14h9l-1 8 10-12h-9l1-8z" })
2460
+ }
2461
+ )
2462
+ }
2463
+ )
2464
+ ] })
2465
+ ]
2466
+ }
2467
+ )
2468
+ );
2469
+ UpgradeCard.displayName = "UpgradeCard";
2470
+
2471
+ // virtual-pkg:src/atoms/AppSidebar/AppSidebar.tsx
2472
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
2473
+ var LogoIcon = () => /* @__PURE__ */ jsxs10("svg", { width: "32", height: "32", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2474
+ /* @__PURE__ */ jsx10("path", { d: "M12 36C12 36 8 28 16 22C20 19 26 20 26 20C26 20 22 26 18 30C16 32 12 36 12 36Z", style: { fill: "var(--color-logo-orange)" } }),
2475
+ /* @__PURE__ */ jsx10("path", { d: "M24 8C24 8 36 12 36 24C36 30 32 36 26 38C26 38 28 30 26 24C25 20 24 8 24 8Z", style: { fill: "var(--color-logo-violet)" } }),
2476
+ /* @__PURE__ */ jsx10("path", { d: "M12 36C12 36 16 24 24 20C28 18 36 20 36 20C36 20 30 28 26 32C22 36 12 36 12 36Z", style: { fill: "var(--color-logo-pink)", opacity: 0.7 } })
2477
+ ] });
2478
+ var GiftIcon = () => /* @__PURE__ */ jsxs10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "20px", height: "20px" }, children: [
2479
+ /* @__PURE__ */ jsx10("polyline", { points: "20 12 20 22 4 22 4 12" }),
2480
+ /* @__PURE__ */ jsx10("rect", { x: "2", y: "7", width: "20", height: "5" }),
2481
+ /* @__PURE__ */ jsx10("line", { x1: "12", y1: "22", x2: "12", y2: "7" }),
2482
+ /* @__PURE__ */ jsx10("path", { d: "M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z" }),
2483
+ /* @__PURE__ */ jsx10("path", { d: "M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z" })
2484
+ ] });
2485
+ var InboxIcon = () => /* @__PURE__ */ jsxs10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "20px", height: "20px" }, children: [
2486
+ /* @__PURE__ */ jsx10("polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12" }),
2487
+ /* @__PURE__ */ jsx10("path", { d: "M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
2488
+ ] });
2489
+ var SidebarIcon = () => /* @__PURE__ */ jsxs10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: [
2490
+ /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2491
+ /* @__PURE__ */ jsx10("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
2492
+ ] });
2493
+ var AppSidebar = React10.forwardRef(
2494
+ ({
2495
+ brandName,
2496
+ entries,
2497
+ activeId,
2498
+ onSelect,
2499
+ activeSubId,
2500
+ onSubSelect,
2501
+ // footer opt-in props
2502
+ workspaceName,
2503
+ showShareCard = false,
2504
+ showUpgradeCard = false,
2505
+ userInitials,
2506
+ onInboxClick,
2507
+ // legacy compat
2508
+ activeItem,
2509
+ collapsed: collapsedProp,
2510
+ onCollapsedChange,
2511
+ children,
2512
+ className,
2513
+ ...rest
2514
+ }, ref) => {
2515
+ const [internalCollapsed, setInternalCollapsed] = React10.useState(false);
2516
+ const isControlled = collapsedProp !== void 0;
2517
+ const collapsed = isControlled ? collapsedProp : internalCollapsed;
2518
+ const handleCollapse = () => {
2519
+ const next = !collapsed;
2520
+ if (!isControlled) setInternalCollapsed(next);
2521
+ onCollapsedChange?.(next);
2522
+ };
2523
+ const [expandedIds, setExpandedIds] = React10.useState(/* @__PURE__ */ new Set());
2524
+ const toggleExpanded = (id) => {
2525
+ setExpandedIds((prev) => {
2526
+ const next = new Set(prev);
2527
+ if (next.has(id)) next.delete(id);
2528
+ else next.add(id);
2529
+ return next;
2530
+ });
2531
+ };
2532
+ const resolvedActiveId = activeId ?? activeItem ?? "";
2533
+ const hasEntries = entries && entries.length > 0;
2534
+ const hasFooterPromoContent = showShareCard || showUpgradeCard;
2535
+ const hasFooterBottomContent = !!(userInitials || onInboxClick);
2536
+ const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
2537
+ return /* @__PURE__ */ jsxs10(
2538
+ "nav",
2539
+ {
2540
+ ref,
2541
+ "aria-label": brandName ?? "Application",
2542
+ className: [
2543
+ "flex flex-col bg-canvas border-r border-hairline h-full overflow-hidden",
2544
+ "transition-all duration-300 ease-in-out",
2545
+ collapsed ? "w-14" : "w-64",
2546
+ className
2547
+ ].filter(Boolean).join(" "),
2548
+ ...rest,
2549
+ children: [
2550
+ /* @__PURE__ */ jsxs10(
2551
+ "div",
2552
+ {
2553
+ className: [
2554
+ "flex items-center px-md pt-md pb-sm flex-shrink-0 transition-all duration-300",
2555
+ collapsed ? "justify-center" : "justify-between"
2556
+ ].join(" "),
2557
+ children: [
2558
+ /* @__PURE__ */ jsxs10(
2559
+ "div",
2560
+ {
2561
+ className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0 flex items-center gap-sm min-w-0",
2562
+ style: { maxWidth: collapsed ? "0px" : "180px", opacity: collapsed ? 0 : 1 },
2563
+ children: [
2564
+ /* @__PURE__ */ jsx10(LogoIcon, {}),
2565
+ brandName && /* @__PURE__ */ jsx10("span", { className: "text-body-sm font-weight-heading-sm text-ink truncate", children: brandName })
2566
+ ]
2567
+ }
2568
+ ),
2569
+ /* @__PURE__ */ jsx10(
2570
+ Button,
2571
+ {
2572
+ variant: "ghost",
2573
+ size: "sm",
2574
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
2575
+ onClick: handleCollapse,
2576
+ className: [
2577
+ "!p-xs !rounded-md flex-shrink-0 transition-all duration-200",
2578
+ collapsed ? "!text-primary ring-2 ring-primary !bg-transparent hover:!bg-surface-soft" : ""
2579
+ ].filter(Boolean).join(" "),
2580
+ children: /* @__PURE__ */ jsx10(SidebarIcon, {})
2581
+ }
2582
+ )
2583
+ ]
2584
+ }
2585
+ ),
2586
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 overflow-y-auto overflow-x-hidden px-sm space-y-xxs pb-sm", children: [
2587
+ workspaceName && /* @__PURE__ */ jsx10(
2588
+ "div",
2589
+ {
2590
+ className: "overflow-hidden transition-all duration-300 ease-in-out",
2591
+ style: {
2592
+ maxHeight: collapsed ? "0px" : "60px",
2593
+ opacity: collapsed ? 0 : 1,
2594
+ marginBottom: collapsed ? "0px" : "8px"
2595
+ },
2596
+ children: /* @__PURE__ */ jsx10(WorkspaceMenu, { workspaceName, initials: workspaceName.charAt(0).toUpperCase() })
2597
+ }
2598
+ ),
2599
+ hasEntries && /* @__PURE__ */ jsx10("ul", { className: "space-y-xxs", role: "list", children: entries.map((entry) => {
2600
+ const isActive = resolvedActiveId === entry.id;
2601
+ const hasSubItems = !!(entry.subItems && entry.subItems.length > 0);
2602
+ const isExpanded = expandedIds.has(entry.id);
2603
+ const mappedSubItems = hasSubItems ? entry.subItems.map((sub) => ({
2604
+ id: sub.id,
2605
+ label: sub.label,
2606
+ onDelete: sub.onDelete,
2607
+ onClick: onSubSelect ? (_id) => onSubSelect(_id) : void 0
2608
+ })) : void 0;
2609
+ return /* @__PURE__ */ jsx10(
2610
+ NavItem,
2611
+ {
2612
+ icon: entry.icon,
2613
+ label: entry.label,
2614
+ active: isActive,
2615
+ iconOnly: collapsed,
2616
+ subItems: !collapsed ? mappedSubItems : void 0,
2617
+ expanded: hasSubItems ? isExpanded : void 0,
2618
+ onExpandToggle: hasSubItems ? () => toggleExpanded(entry.id) : void 0,
2619
+ onClick: (e) => {
2620
+ onSelect?.(entry.id);
2621
+ if (hasSubItems) {
2622
+ e.preventDefault();
2623
+ }
2624
+ }
2625
+ },
2626
+ entry.id
2627
+ );
2628
+ }) }),
2629
+ children && /* @__PURE__ */ jsx10(
2630
+ "div",
2631
+ {
2632
+ className: "overflow-hidden transition-all duration-300 ease-in-out",
2633
+ style: { maxHeight: collapsed ? "0px" : "600px", opacity: collapsed ? 0 : 1 },
2634
+ children
2635
+ }
2636
+ )
2637
+ ] }),
2638
+ hasFooterContent && /* @__PURE__ */ jsxs10("div", { className: "flex-shrink-0 px-sm pb-md space-y-sm", children: [
2639
+ hasFooterPromoContent && /* @__PURE__ */ jsxs10(
2640
+ "div",
2641
+ {
2642
+ className: "overflow-hidden transition-all duration-300 ease-in-out space-y-sm",
2643
+ style: { maxHeight: collapsed ? "0px" : "300px", opacity: collapsed ? 0 : 1 },
2644
+ children: [
2645
+ showShareCard && /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md", children: [
2646
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-xxs min-w-0", children: [
2647
+ /* @__PURE__ */ jsx10("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share Lovable" }),
2648
+ /* @__PURE__ */ jsx10("span", { className: "text-caption text-muted", children: "100 credits per paid referral" })
2649
+ ] }),
2650
+ /* @__PURE__ */ jsx10(
2651
+ "span",
2652
+ {
2653
+ className: "flex-shrink-0 flex items-center justify-center rounded-full bg-surface-strong",
2654
+ style: { width: "36px", height: "36px" },
2655
+ children: /* @__PURE__ */ jsx10(GiftIcon, {})
2656
+ }
2657
+ )
2658
+ ] }),
2659
+ showUpgradeCard && /* @__PURE__ */ jsx10(UpgradeCard, { eyebrow: "", title: "Upgrade to Pro", subtitle: "Unlock more features" })
2660
+ ]
2661
+ }
2662
+ ),
2663
+ hasFooterBottomContent && /* @__PURE__ */ jsxs10(
2664
+ "div",
2665
+ {
2666
+ className: [
2667
+ "flex items-center pt-xs transition-all duration-300",
2668
+ collapsed ? "justify-center" : "justify-between"
2669
+ ].join(" "),
2670
+ children: [
2671
+ userInitials && /* @__PURE__ */ jsx10(
2672
+ "span",
2673
+ {
2674
+ className: "flex items-center justify-center rounded-full bg-primary text-on-primary text-body-sm font-weight-heading-sm cursor-pointer hover:bg-primary-hover transition-colors duration-150 flex-shrink-0",
2675
+ style: { width: "36px", height: "36px" },
2676
+ "aria-label": "User profile",
2677
+ children: userInitials
2678
+ }
2679
+ ),
2680
+ onInboxClick && /* @__PURE__ */ jsx10(
2681
+ "div",
2682
+ {
2683
+ className: "overflow-hidden transition-all duration-300 ease-in-out",
2684
+ style: { maxWidth: collapsed ? "0px" : "40px", opacity: collapsed ? 0 : 1 },
2685
+ children: /* @__PURE__ */ jsxs10(
2686
+ Button,
2687
+ {
2688
+ variant: "ghost",
2689
+ size: "sm",
2690
+ "aria-label": "Inbox",
2691
+ onClick: onInboxClick,
2692
+ className: "!p-xs !rounded-sm relative",
2693
+ children: [
2694
+ /* @__PURE__ */ jsx10(InboxIcon, {}),
2695
+ /* @__PURE__ */ jsx10(
2696
+ "span",
2697
+ {
2698
+ className: "absolute top-1 right-1 rounded-full bg-semantic-error",
2699
+ "aria-label": "New notifications",
2700
+ style: { width: "8px", height: "8px" }
2701
+ }
2702
+ )
2703
+ ]
2704
+ }
2705
+ )
2706
+ }
2707
+ )
2708
+ ]
2709
+ }
2710
+ )
2711
+ ] })
2712
+ ]
2713
+ }
2714
+ );
2715
+ }
2716
+ );
2717
+ AppSidebar.displayName = "AppSidebar";
2718
+
2719
+ // virtual-pkg:src/atoms/AuthScreen/AuthScreen.tsx
2720
+ import React11, { useState, useId } from "react";
2721
+ import { Fragment, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
2722
+ var AuthScreen = React11.forwardRef(
2723
+ ({ defaultTab = "login", onLogin, onSignup, loading = false }, ref) => {
2724
+ const [tab, setTab] = useState(defaultTab);
2725
+ const [name, setName] = useState("");
2726
+ const [email, setEmail] = useState("");
2727
+ const [password, setPassword] = useState("");
2728
+ const [confirm, setConfirm] = useState("");
2729
+ const [error, setError] = useState(null);
2730
+ const nameId = useId();
2731
+ const emailId = useId();
2732
+ const passwordId = useId();
2733
+ const confirmId = useId();
2734
+ const switchTab = (t) => {
2735
+ setTab(t);
2736
+ setError(null);
2737
+ };
2738
+ const handleSubmit = (e) => {
2739
+ e.preventDefault();
2740
+ setError(null);
2741
+ if (tab === "signup") {
2742
+ if (password !== confirm) {
2743
+ setError("Passwords do not match.");
2744
+ return;
2745
+ }
2746
+ onSignup?.({ name, email, password });
2747
+ } else {
2748
+ onLogin?.({ email, password });
2749
+ }
2750
+ };
2751
+ const labelCls = "block text-body-sm text-body mb-xs font-weight-heading-sm";
2752
+ return (
2753
+ /* Full-width page background — no height constraint */
2754
+ /* @__PURE__ */ jsx11("div", { ref, className: "w-full bg-surface p-xl", children: /* @__PURE__ */ jsx11("div", { className: "w-full max-w-3xl mx-auto flex justify-center", children: /* @__PURE__ */ jsxs11(
2755
+ "div",
2756
+ {
2757
+ style: { width: "min(100%, 22rem)" },
2758
+ className: "rounded-xl border border-hairline-soft bg-canvas px-xl py-xxl shadow-card",
2759
+ children: [
2760
+ /* @__PURE__ */ jsx11("div", { className: "mb-lg flex justify-center", children: /* @__PURE__ */ jsx11("div", { className: "flex h-14 w-10 items-center justify-center rounded-full bg-primary", children: /* @__PURE__ */ jsx11("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(
2761
+ "path",
2762
+ {
2763
+ d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5",
2764
+ stroke: "white",
2765
+ strokeWidth: "2",
2766
+ strokeLinecap: "round",
2767
+ strokeLinejoin: "round"
2768
+ }
2769
+ ) }) }) }),
2770
+ /* @__PURE__ */ jsx11("h1", { className: "mb-xs text-heading-sm text-ink", children: tab === "login" ? "Welcome back" : "Create an account" }),
2771
+ /* @__PURE__ */ jsx11("p", { className: "mb-xl text-body-sm text-muted", children: tab === "login" ? "Sign in to continue to your workspace." : "Start your journey \u2014 it only takes a minute." }),
2772
+ /* @__PURE__ */ jsx11(
2773
+ "div",
2774
+ {
2775
+ role: "tablist",
2776
+ "aria-label": "Auth mode",
2777
+ className: "mb-xl flex rounded-lg bg-surface-soft p-xs gap-xs",
2778
+ children: ["login", "signup"].map((t) => /* @__PURE__ */ jsx11(
2779
+ Button,
2780
+ {
2781
+ role: "tab",
2782
+ type: "button",
2783
+ "aria-selected": tab === t,
2784
+ onClick: () => switchTab(t),
2785
+ variant: "ghost",
2786
+ size: "sm",
2787
+ style: { flex: 1, whiteSpace: "normal" },
2788
+ className: [
2789
+ "min-w-0 rounded-md py-sm transition-colors",
2790
+ tab === t ? "bg-canvas text-ink shadow-sm font-weight-heading-sm" : "text-muted hover:text-ink bg-transparent border-transparent"
2791
+ ].join(" "),
2792
+ children: t === "login" ? "Log in" : "Sign up"
2793
+ },
2794
+ t
2795
+ ))
2796
+ }
2797
+ ),
2798
+ /* @__PURE__ */ jsxs11("form", { onSubmit: handleSubmit, noValidate: true, className: "space-y-base", children: [
2799
+ tab === "signup" && /* @__PURE__ */ jsxs11("div", { children: [
2800
+ /* @__PURE__ */ jsx11("label", { htmlFor: nameId, className: labelCls, children: "Full name" }),
2801
+ /* @__PURE__ */ jsx11(
2802
+ Input,
2803
+ {
2804
+ id: nameId,
2805
+ type: "text",
2806
+ autoComplete: "name",
2807
+ required: true,
2808
+ placeholder: "Jane Doe",
2809
+ value: name,
2810
+ onChange: (e) => setName(e.target.value),
2811
+ fullWidth: true
2812
+ }
2813
+ )
2814
+ ] }),
2815
+ /* @__PURE__ */ jsxs11("div", { children: [
2816
+ /* @__PURE__ */ jsx11("label", { htmlFor: emailId, className: labelCls, children: "Email address" }),
2817
+ /* @__PURE__ */ jsx11(
2818
+ Input,
2819
+ {
2820
+ id: emailId,
2821
+ type: "email",
2822
+ autoComplete: "email",
2823
+ required: true,
2824
+ placeholder: "you@example.com",
2825
+ value: email,
2826
+ onChange: (e) => setEmail(e.target.value),
2827
+ fullWidth: true
2828
+ }
2829
+ )
2830
+ ] }),
2831
+ /* @__PURE__ */ jsxs11("div", { children: [
2832
+ /* @__PURE__ */ jsxs11("div", { className: "mb-xs flex items-center justify-between", children: [
2833
+ /* @__PURE__ */ jsx11("label", { htmlFor: passwordId, className: labelCls + " mb-0", children: "Password" }),
2834
+ tab === "login" && /* @__PURE__ */ jsx11("a", { href: "#", className: "text-body-sm text-primary hover:underline", children: "Forgot password?" })
2835
+ ] }),
2836
+ /* @__PURE__ */ jsx11(
2837
+ Input,
2838
+ {
2839
+ id: passwordId,
2840
+ type: "password",
2841
+ required: true,
2842
+ autoComplete: tab === "login" ? "current-password" : "new-password",
2843
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
2844
+ value: password,
2845
+ onChange: (e) => setPassword(e.target.value),
2846
+ fullWidth: true
2847
+ }
2848
+ )
2849
+ ] }),
2850
+ tab === "signup" && /* @__PURE__ */ jsxs11("div", { children: [
2851
+ /* @__PURE__ */ jsx11("label", { htmlFor: confirmId, className: labelCls, children: "Confirm password" }),
2852
+ /* @__PURE__ */ jsx11(
2853
+ Input,
2854
+ {
2855
+ id: confirmId,
2856
+ type: "password",
2857
+ autoComplete: "new-password",
2858
+ required: true,
2859
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
2860
+ value: confirm,
2861
+ onChange: (e) => setConfirm(e.target.value),
2862
+ fullWidth: true
2863
+ }
2864
+ )
2865
+ ] }),
2866
+ error && /* @__PURE__ */ jsx11(
2867
+ "p",
2868
+ {
2869
+ role: "alert",
2870
+ className: "rounded-md border border-semantic-error px-base py-sm text-body-sm text-semantic-error",
2871
+ children: error
2872
+ }
2873
+ ),
2874
+ /* @__PURE__ */ jsx11(Button, { type: "submit", variant: "primary", size: "lg", disabled: loading, className: "w-full", children: loading ? "Please wait\u2026" : tab === "login" ? "Sign in" : "Create account" })
2875
+ ] }),
2876
+ /* @__PURE__ */ jsxs11("div", { className: "my-xl flex items-center gap-base", children: [
2877
+ /* @__PURE__ */ jsx11("div", { className: "h-px flex-1 bg-hairline" }),
2878
+ /* @__PURE__ */ jsx11("span", { className: "text-caption text-muted-soft", children: "OR" }),
2879
+ /* @__PURE__ */ jsx11("div", { className: "h-px flex-1 bg-hairline" })
2880
+ ] }),
2881
+ /* @__PURE__ */ jsxs11(Button, { type: "button", variant: "secondary", size: "md", className: "w-full", children: [
2882
+ /* @__PURE__ */ jsxs11("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", className: "shrink-0", children: [
2883
+ /* @__PURE__ */ jsx11("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z", fill: "var(--color-google-blue)" }),
2884
+ /* @__PURE__ */ jsx11("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z", fill: "var(--color-google-green)" }),
2885
+ /* @__PURE__ */ jsx11("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z", fill: "var(--color-google-yellow)" }),
2886
+ /* @__PURE__ */ jsx11("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "var(--color-google-red)" })
2887
+ ] }),
2888
+ "Continue with Google"
2889
+ ] }),
2890
+ /* @__PURE__ */ jsx11("p", { className: "mt-xl text-center text-body-sm text-muted", children: tab === "login" ? /* @__PURE__ */ jsxs11(Fragment, { children: [
2891
+ "Don\u2019t have an account?",
2892
+ " ",
2893
+ /* @__PURE__ */ jsx11(
2894
+ Button,
2895
+ {
2896
+ type: "button",
2897
+ variant: "ghost",
2898
+ size: "sm",
2899
+ onClick: () => switchTab("signup"),
2900
+ style: { whiteSpace: "normal" },
2901
+ className: "text-primary hover:underline bg-transparent border-transparent p-0 h-auto",
2902
+ children: "Sign up"
2903
+ }
2904
+ )
2905
+ ] }) : /* @__PURE__ */ jsxs11(Fragment, { children: [
2906
+ "Already have an account?",
2907
+ " ",
2908
+ /* @__PURE__ */ jsx11(
2909
+ Button,
2910
+ {
2911
+ type: "button",
2912
+ variant: "ghost",
2913
+ size: "sm",
2914
+ onClick: () => switchTab("login"),
2915
+ style: { whiteSpace: "normal" },
2916
+ className: "text-primary hover:underline bg-transparent border-transparent p-0 h-auto",
2917
+ children: "Log in"
2918
+ }
2919
+ )
2920
+ ] }) })
2921
+ ]
2922
+ }
2923
+ ) }) })
2924
+ );
2925
+ }
2926
+ );
2927
+ AuthScreen.displayName = "AuthScreen";
2928
+
2929
+ // virtual-pkg:src/atoms/Chip/Chip.tsx
2930
+ import React12 from "react";
2931
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
2932
+ var variantClasses2 = {
2933
+ default: "bg-surface-strong text-body border border-hairline",
2934
+ primary: "bg-primary text-on-primary border border-primary",
2935
+ success: "bg-[var(--color-semantic-success-soft)] text-[var(--color-semantic-success)] border border-[var(--color-semantic-success)]",
2936
+ warning: "bg-[var(--color-semantic-warning-soft)] text-[var(--color-semantic-warning)] border border-[var(--color-semantic-warning)]",
2937
+ error: "bg-[var(--color-semantic-error-soft)] text-[var(--color-semantic-error)] border border-[var(--color-semantic-error)]"
2938
+ };
2939
+ var sizeClasses3 = {
2940
+ sm: { chip: "h-6 px-xs gap-xs rounded-xs", text: "text-caption", icon: "w-3 h-3", dismissSize: "sm" },
2941
+ md: { chip: "h-8 px-sm gap-xs rounded-sm", text: "text-body-sm", icon: "w-4 h-4", dismissSize: "sm" },
2942
+ lg: { chip: "h-10 px-md gap-sm rounded-md", text: "text-body-md", icon: "w-5 h-5", dismissSize: "sm" }
2943
+ };
2944
+ var CloseIcon = ({ className }) => /* @__PURE__ */ jsxs12(
2945
+ "svg",
2946
+ {
2947
+ viewBox: "0 0 16 16",
2948
+ fill: "none",
2949
+ stroke: "currentColor",
2950
+ strokeWidth: 2.5,
2951
+ strokeLinecap: "round",
2952
+ className,
2953
+ "aria-hidden": "true",
2954
+ children: [
2955
+ /* @__PURE__ */ jsx12("line", { x1: "4", y1: "4", x2: "12", y2: "12" }),
2956
+ /* @__PURE__ */ jsx12("line", { x1: "12", y1: "4", x2: "4", y2: "12" })
2957
+ ]
2958
+ }
2959
+ );
2960
+ var Chip = React12.forwardRef(
2961
+ ({
2962
+ label,
2963
+ variant = "default",
2964
+ size = "md",
2965
+ icon,
2966
+ onDismiss,
2967
+ disabled = false,
2968
+ className = "",
2969
+ ...props
2970
+ }, ref) => {
2971
+ const sz = sizeClasses3[size];
2972
+ const vr = variantClasses2[variant];
2973
+ const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
2974
+ return /* @__PURE__ */ jsxs12(
2975
+ "span",
2976
+ {
2977
+ ref,
2978
+ role: "status",
2979
+ "aria-label": label,
2980
+ className: [
2981
+ "inline-flex items-center font-medium whitespace-nowrap transition-colors",
2982
+ sz.chip,
2983
+ vr,
2984
+ disabledStyles,
2985
+ className
2986
+ ].filter(Boolean).join(" "),
2987
+ ...props,
2988
+ children: [
2989
+ icon && /* @__PURE__ */ jsx12(
2990
+ "span",
2991
+ {
2992
+ className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
2993
+ "aria-hidden": "true",
2994
+ children: icon
2995
+ }
2996
+ ),
2997
+ /* @__PURE__ */ jsx12("span", { className: sz.text, children: label }),
2998
+ onDismiss && /* @__PURE__ */ jsx12(
2999
+ Button,
3000
+ {
3001
+ variant: "ghost",
3002
+ size: sz.dismissSize,
3003
+ onClick: onDismiss,
3004
+ disabled,
3005
+ "aria-label": `Remove ${label}`,
3006
+ className: "!p-0 !h-4 !w-4 !min-w-0 opacity-60 hover:opacity-100 rounded-full flex-shrink-0",
3007
+ children: /* @__PURE__ */ jsx12(CloseIcon, { className: "w-3 h-3" })
3008
+ }
3009
+ )
3010
+ ]
3011
+ }
3012
+ );
3013
+ }
3014
+ );
3015
+ Chip.displayName = "Chip";
3016
+
3017
+ // virtual-pkg:src/atoms/FilterTabBar/FilterTabBar.tsx
3018
+ import React13 from "react";
3019
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
3020
+ var FilterTabBar = React13.forwardRef(
3021
+ ({ tabs, value, onChange, className = "", ...rest }, ref) => {
3022
+ return /* @__PURE__ */ jsx13(
3023
+ "div",
3024
+ {
3025
+ ref,
3026
+ role: "tablist",
3027
+ "aria-label": "Filter tabs",
3028
+ className: [
3029
+ "inline-flex items-center gap-xs p-xs",
3030
+ "bg-surface border border-hairline rounded-xl shadow-sm",
3031
+ className
3032
+ ].filter(Boolean).join(" "),
3033
+ ...rest,
3034
+ children: tabs.map((tab) => {
3035
+ const isActive = tab.value === value;
3036
+ const iconOnly = !!tab.icon && !tab.label;
3037
+ return /* @__PURE__ */ jsxs13(
3038
+ Button,
3039
+ {
3040
+ role: "tab",
3041
+ "aria-selected": isActive,
3042
+ "aria-label": tab["aria-label"],
3043
+ variant: isActive ? "primary" : "ghost",
3044
+ size: "sm",
3045
+ onClick: () => onChange(tab.value),
3046
+ className: [
3047
+ "transition-[background-color,color,box-shadow] duration-200 ease-in-out",
3048
+ iconOnly ? "!px-xs aspect-square" : ""
3049
+ ].filter(Boolean).join(" "),
3050
+ children: [
3051
+ tab.icon && /* @__PURE__ */ jsx13("span", { className: "inline-flex items-center justify-center size-4 shrink-0", children: tab.icon }),
3052
+ tab.label && /* @__PURE__ */ jsx13("span", { children: tab.label }),
3053
+ tab.count !== void 0 && /* @__PURE__ */ jsx13(
3054
+ "span",
3055
+ {
3056
+ className: [
3057
+ "inline-flex items-center justify-center",
3058
+ "min-w-[1.25rem] h-5 px-xs rounded-sm",
3059
+ "text-caption leading-none",
3060
+ "transition-[background-color,color] duration-200 ease-in-out",
3061
+ isActive ? "bg-primary-active text-on-primary" : "bg-surface-strong text-muted"
3062
+ ].filter(Boolean).join(" "),
3063
+ "aria-label": `${tab.count} items`,
3064
+ children: tab.count
3065
+ }
3066
+ )
3067
+ ]
3068
+ },
3069
+ tab.value
3070
+ );
3071
+ })
3072
+ }
3073
+ );
3074
+ }
3075
+ );
3076
+ FilterTabBar.displayName = "FilterTabBar";
3077
+
3078
+ // virtual-pkg:src/atoms/Modal/Modal.tsx
3079
+ import React14, { useEffect, useRef, useState as useState2 } from "react";
3080
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
3081
+ var sizeMap = {
3082
+ sm: "max-w-sm",
3083
+ md: "max-w-lg",
3084
+ lg: "max-w-2xl"
3085
+ };
3086
+ var Modal = React14.forwardRef(
3087
+ ({ isOpen, onClose, title, children, footer, size = "md" }, ref) => {
3088
+ const [mounted, setMounted] = useState2(false);
3089
+ const [visible, setVisible] = useState2(false);
3090
+ const overlayRef = useRef(null);
3091
+ useEffect(() => {
3092
+ if (isOpen) {
3093
+ setMounted(true);
3094
+ const raf = requestAnimationFrame(() => {
3095
+ requestAnimationFrame(() => setVisible(true));
3096
+ });
3097
+ return () => cancelAnimationFrame(raf);
3098
+ } else {
3099
+ setVisible(false);
3100
+ const timer = setTimeout(() => setMounted(false), 250);
3101
+ return () => clearTimeout(timer);
3102
+ }
3103
+ }, [isOpen]);
3104
+ useEffect(() => {
3105
+ if (!mounted) return;
3106
+ const handleKey = (e) => {
3107
+ if (e.key === "Escape") onClose();
3108
+ };
3109
+ document.addEventListener("keydown", handleKey);
3110
+ return () => document.removeEventListener("keydown", handleKey);
3111
+ }, [mounted, onClose]);
3112
+ if (!mounted) return null;
3113
+ const handleBackdropClick = (e) => {
3114
+ if (e.target === overlayRef.current) onClose();
3115
+ };
3116
+ return /* @__PURE__ */ jsx14(
3117
+ "div",
3118
+ {
3119
+ ref: overlayRef,
3120
+ role: "dialog",
3121
+ "aria-modal": "true",
3122
+ "aria-labelledby": title ? "modal-title" : void 0,
3123
+ onClick: handleBackdropClick,
3124
+ className: [
3125
+ "fixed inset-0 flex items-center justify-center p-base",
3126
+ "bg-[var(--color-scrim)]/50",
3127
+ "transition-opacity duration-250 ease-in-out",
3128
+ visible ? "opacity-100" : "opacity-0"
3129
+ ].join(" "),
3130
+ style: { zIndex: "var(--z-modal, 1000)" },
3131
+ children: /* @__PURE__ */ jsxs14(
3132
+ "div",
3133
+ {
3134
+ ref,
3135
+ className: [
3136
+ "relative w-full bg-canvas rounded-lg",
3137
+ "shadow-[0_8px_40px_0_rgba(0,0,0,0.18)]",
3138
+ "flex flex-col overflow-hidden",
3139
+ sizeMap[size],
3140
+ "transition-all duration-250 ease-in-out",
3141
+ visible ? "opacity-100 translate-y-0 scale-100" : "opacity-0 translate-y-2 scale-95"
3142
+ ].join(" "),
3143
+ children: [
3144
+ title && /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between px-lg py-base border-b border-hairline", children: [
3145
+ /* @__PURE__ */ jsx14("h2", { id: "modal-title", className: "text-heading-sm text-ink", children: title }),
3146
+ /* @__PURE__ */ jsx14(
3147
+ Button,
3148
+ {
3149
+ variant: "ghost",
3150
+ size: "sm",
3151
+ "aria-label": "Close modal",
3152
+ onClick: onClose,
3153
+ className: "!px-xs !py-xs",
3154
+ children: /* @__PURE__ */ jsxs14(
3155
+ "svg",
3156
+ {
3157
+ xmlns: "http://www.w3.org/2000/svg",
3158
+ width: "16",
3159
+ height: "16",
3160
+ viewBox: "0 0 24 24",
3161
+ fill: "none",
3162
+ stroke: "currentColor",
3163
+ strokeWidth: "2",
3164
+ strokeLinecap: "round",
3165
+ strokeLinejoin: "round",
3166
+ "aria-hidden": "true",
3167
+ children: [
3168
+ /* @__PURE__ */ jsx14("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
3169
+ /* @__PURE__ */ jsx14("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
3170
+ ]
3171
+ }
3172
+ )
3173
+ }
3174
+ )
3175
+ ] }),
3176
+ /* @__PURE__ */ jsx14("div", { className: "flex-1 px-lg py-base text-body-md text-body overflow-y-auto", children }),
3177
+ footer && /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-end gap-sm px-lg py-base border-t border-hairline", children: footer })
3178
+ ]
3179
+ }
3180
+ )
3181
+ }
3182
+ );
3183
+ }
3184
+ );
3185
+ Modal.displayName = "Modal";
3186
+ export {
3187
+ AppLayout,
3188
+ AppSidebar,
3189
+ AuthScreen,
3190
+ Button,
3191
+ ChatScreen,
3192
+ Chip,
3193
+ FilterTabBar,
3194
+ Input,
3195
+ Modal,
3196
+ NavItem,
3197
+ PromptInputBar,
3198
+ TopNavbar,
3199
+ UpgradeCard,
3200
+ WorkspaceMenu
3201
+ };