@vivix-labs/studio-workbench 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -256,6 +256,8 @@ var iconGeometry = {
256
256
  height: 15.5625,
257
257
  slot: 18
258
258
  },
259
+ "select-items": { width: 13.8681, height: 13.8667, slot: 16 },
260
+ filter: { width: 13.2, height: 13.2, slot: 16 },
259
261
  select: {
260
262
  width: 14.6298,
261
263
  height: 16.065,
@@ -331,16 +333,14 @@ var iconGeometry = {
331
333
  height: 17.0837,
332
334
  slot: 20
333
335
  },
334
- download: {
335
- width: 16,
336
- height: 16,
337
- slot: 16
338
- },
339
336
  export: {
340
337
  width: 11.8667,
341
338
  height: 13.2,
342
339
  slot: 16
343
340
  },
341
+ favorite: { width: 11.8667, height: 14.5333, slot: 16 },
342
+ download: { width: 13.2001, height: 13.1997, slot: 16 },
343
+ delete: { width: 13.2, height: 14.533, slot: 16 },
344
344
  edit: {
345
345
  width: 10.8791,
346
346
  height: 12.0459,
@@ -436,39 +436,123 @@ function ButtonFrame({ label, variant, loading = false, width, children, disable
436
436
  const buttonStyle = "width" in spec ? { ...style, "--vx-button-width": `${spec.width}px` } : style;
437
437
  return _jsxs("button", { ...props, type, className: className ? `vx-button ${className}` : "vx-button", "data-variant": variant, "data-appearance": spec.appearance, "data-shape": spec.shape, "data-size": spec.size, "data-width": width, "data-state": loading ? "loading" : disabled ? "disabled" : "default", style: buttonStyle, disabled: disabled || loading, "aria-label": label, "aria-busy": loading || void 0, children: [_jsx3("span", { className: "vx-button-content", children }), loading && _jsx3("span", { className: "vx-button-loading", "aria-hidden": "true" })] });
438
438
  }
439
- function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, ...props }) {
440
- return _jsxs(ButtonFrame, { ...props, variant, children: [leadingIcon && _jsx3(Icon, { name: leadingIcon }), _jsx3("span", { className: "vx-button-label", children: props.label }), trailingIcon && _jsx3("span", { className: "vx-button-trailing", children: _jsx3(Icon, { name: trailingIcon }) })] });
439
+ function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, badge, ...props }) {
440
+ return _jsxs(ButtonFrame, { ...props, label: badge ? `${props.label} (${badge})` : props.label, variant, children: [leadingIcon && _jsx3(Icon, { name: leadingIcon }), _jsx3("span", { className: "vx-button-label", children: props.label }), badge !== void 0 && badge > 0 && _jsx3("span", { className: "vx-button-badge", children: badge }), trailingIcon && _jsx3("span", { className: "vx-button-trailing", children: _jsx3(Icon, { name: trailingIcon }) })] });
441
441
  }
442
442
  function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
443
443
  return _jsx3(ButtonFrame, { ...props, variant, children: _jsx3(Icon, { name: icon }) });
444
444
  }
445
445
 
446
+ // packages/ui-system/dist/asset-selection-toolbar.js
447
+ import { jsxs as _jsxs2, jsx as _jsx4 } from "react/jsx-runtime";
448
+ function AssetSelectionToolbar({ count, allSelected, onSelectAll, onFavorite, onDownload, onDelete, deleteHint, onCancel, cancelRef, busy }) {
449
+ const common = { variant: "text-tonal-sm", width: "hug" };
450
+ return _jsxs2("div", { className: "vx-asset-selection", role: "group", "aria-label": "Selected asset actions", children: [_jsxs2("span", { role: "status", children: [count, " ", count === 1 ? "item" : "items", " selected"] }), _jsx4(Button, { ...common, label: "Select all", leadingIcon: "select-items", "aria-pressed": allSelected, disabled: busy || !onSelectAll, onClick: onSelectAll }), _jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, label: "Favorite", leadingIcon: "favorite", disabled: busy || !onFavorite, onClick: onFavorite }), _jsx4(Button, { ...common, label: "Download", leadingIcon: "download", disabled: busy || !onDownload, onClick: onDownload }), _jsx4(Button, { ...common, label: "Delete", leadingIcon: "delete", title: deleteHint, disabled: busy || !onDelete, onClick: onDelete }), _jsx4("i", { "aria-hidden": "true" }), _jsx4(Button, { ...common, ref: cancelRef, label: "Cancel", leadingIcon: "close", disabled: busy, onClick: onCancel })] });
451
+ }
452
+
453
+ // packages/ui-system/dist/asset-tile-caption.js
454
+ import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
455
+ function AssetTileCaption({ title, facts, status, actions, onOpen, disabled }) {
456
+ const details = facts.filter((fact) => typeof fact === "string" && Boolean(fact.trim()));
457
+ return _jsxs3("div", { className: "vx-tile-caption", children: [onOpen ? _jsx5("button", { type: "button", className: "vx-tile-title", title, onClick: onOpen, disabled, children: title }) : _jsx5("strong", { className: "vx-tile-title", title, children: title }), actions, _jsxs3("div", { className: "vx-tile-facts", title: details.join(" \xB7 "), children: [status, details.map((detail, i) => _jsx5("span", { children: detail }, i))] })] });
458
+ }
459
+
460
+ // packages/ui-system/dist/script-cover.js
461
+ import { jsx as _jsx6, jsxs as _jsxs4 } from "react/jsx-runtime";
462
+ import { useEffect, useState } from "react";
463
+ async function readTextExcerpt(response, signal, maxBytes = 1024) {
464
+ if (!response.ok || !response.body)
465
+ throw Error("The text preview could not be loaded.");
466
+ const reader = response.body.getReader();
467
+ const decoder = new TextDecoder();
468
+ let text = "", used = 0;
469
+ const cancel = () => {
470
+ void reader.cancel(signal.reason).catch(() => void 0);
471
+ };
472
+ signal.addEventListener("abort", cancel, { once: true });
473
+ try {
474
+ while (true) {
475
+ signal.throwIfAborted();
476
+ const chunk = await reader.read();
477
+ signal.throwIfAborted();
478
+ if (chunk.done)
479
+ break;
480
+ const remaining = maxBytes - used;
481
+ text += decoder.decode(chunk.value.subarray(0, remaining), { stream: true });
482
+ used += Math.min(remaining, chunk.value.byteLength);
483
+ if (chunk.value.byteLength > remaining)
484
+ break;
485
+ }
486
+ text += decoder.decode();
487
+ return text.trim();
488
+ } finally {
489
+ signal.removeEventListener("abort", cancel);
490
+ await reader.cancel().catch(() => void 0);
491
+ reader.releaseLock();
492
+ }
493
+ }
494
+ function ScriptCover({ title, synopsis, src }) {
495
+ const [excerpt, setExcerpt] = useState();
496
+ useEffect(() => {
497
+ if (!src || synopsis)
498
+ return;
499
+ const url = new URL(src, window.location.href);
500
+ if (url.origin !== window.location.origin)
501
+ return;
502
+ const controller = new AbortController();
503
+ void fetch(url, { signal: controller.signal }).then((response) => readTextExcerpt(response, controller.signal)).then((text2) => {
504
+ if (!controller.signal.aborted)
505
+ setExcerpt({ src, text: text2 });
506
+ }).catch(() => {
507
+ });
508
+ return () => controller.abort();
509
+ }, [src, synopsis]);
510
+ const text = synopsis || (src && excerpt?.src === src ? excerpt.text : "");
511
+ return _jsx6("span", { className: "vx-script-cover", "aria-label": title, children: _jsxs4("span", { className: "vx-script-sheet", children: [_jsx6("strong", { children: title }), _jsx6("span", { children: text })] }) });
512
+ }
513
+
514
+ // packages/ui-system/dist/cover-preview.js
515
+ import { jsx as _jsx7 } from "react/jsx-runtime";
516
+ import { useState as useState2 } from "react";
517
+ function CoverPreview(props) {
518
+ return _jsx7(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
519
+ }
520
+ function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize = 20, children }) {
521
+ const [mediaState, setMediaState] = useState2("loading");
522
+ const media = src && (kind2 === "image" || kind2 === "video");
523
+ const state = pending ? "loading" : media ? mediaState : children ? "ready" : "empty";
524
+ const iconKind = kind2 === "video" || kind2 === "audio" ? kind2 : kind2 === "text" ? "script" : "image";
525
+ const ready = () => setMediaState("ready");
526
+ const failed = () => setMediaState("empty");
527
+ return _jsx7("span", { ref, className: `vx-cover-preview ${className}`, "data-cover-state": state, "aria-hidden": "true", children: state === "empty" ? _jsx7(Icon, { name: `placeholder-${iconKind}`, size: iconSize }) : !pending && media ? kind2 === "video" ? _jsx7("video", { src, muted: true, playsInline: true, preload: "auto", onLoadedData: ready, onError: failed }) : _jsx7("img", { src, alt: "", loading: "lazy", onLoad: ready, onError: failed }) : state === "ready" ? children : null });
528
+ }
529
+
446
530
  // packages/ui-system/dist/checkbox.js
447
- import { jsx as _jsx4, jsxs as _jsxs2 } from "react/jsx-runtime";
531
+ import { jsx as _jsx8, jsxs as _jsxs5 } from "react/jsx-runtime";
448
532
  function Checkbox({ label, checked, onCheckedChange, hideLabel = false, appearance = "default", ...props }) {
449
- return _jsxs2("label", { className: "vx-checkbox", "data-appearance": appearance, "data-label-hidden": hideLabel || void 0, children: [_jsx4("input", { ...props, className: "vx-checkbox-input", type: "checkbox", "aria-label": hideLabel ? label : void 0, checked, onChange: (event2) => onCheckedChange(event2.currentTarget.checked) }), _jsx4("span", { className: "vx-checkbox-mark", "aria-hidden": "true", children: _jsx4(Icon, { name: appearance === "on-content" ? "check-on-content" : "check" }) }), !hideLabel && label] });
533
+ return _jsxs5("label", { className: "vx-checkbox", "data-appearance": appearance, "data-label-hidden": hideLabel || void 0, children: [_jsx8("input", { ...props, className: "vx-checkbox-input", type: "checkbox", "aria-label": hideLabel ? label : void 0, checked, onChange: (event2) => onCheckedChange(event2.currentTarget.checked) }), _jsx8("span", { className: "vx-checkbox-mark", "aria-hidden": "true", children: _jsx8(Icon, { name: appearance === "on-content" ? "check-on-content" : "check" }) }), !hideLabel && label] });
450
534
  }
451
535
 
452
536
  // packages/ui-system/dist/dropdown.js
453
- import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
454
- import { useEffect, useId, useRef, useState } from "react";
537
+ import { jsx as _jsx9, jsxs as _jsxs6 } from "react/jsx-runtime";
538
+ import { useEffect as useEffect2, useId, useRef, useState as useState3 } from "react";
455
539
  function Dropdown({ label, options, value, onValueChange, placeholder = "Select an option", size = "medium", width = "fixed", appearance = "default", textSize = 14, disabled = false }) {
456
540
  const id = useId();
457
541
  const activeOption = useRef(null);
458
542
  const search = useRef({ query: "", time: 0 });
459
- const [open, setOpen] = useState(false);
460
- const [highlighted, setHighlighted] = useState(null);
543
+ const [open, setOpen] = useState3(false);
544
+ const [highlighted, setHighlighted] = useState3(null);
461
545
  const enabled = options.filter((option) => !option.disabled);
462
546
  const canOpen = !disabled && enabled.length > 0;
463
547
  const expanded = canOpen && open;
464
548
  const selected = options.find((option) => option.value === value);
465
549
  const active = enabled.find((option) => option.value === highlighted) ?? enabled.find((option) => option.value === value) ?? enabled[0];
466
550
  const activeIndex = active ? enabled.indexOf(active) : -1;
467
- useEffect(() => {
551
+ useEffect2(() => {
468
552
  if (expanded)
469
553
  activeOption.current?.scrollIntoView({ block: "nearest" });
470
554
  }, [expanded, active?.value]);
471
- useEffect(() => {
555
+ useEffect2(() => {
472
556
  if (!canOpen) {
473
557
  setOpen(false);
474
558
  setHighlighted(null);
@@ -543,14 +627,14 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
543
627
  if (match)
544
628
  setHighlighted(match.value);
545
629
  }
546
- return _jsxs3("div", { className: "vx-dropdown", "data-size": size, "data-width": width, "data-appearance": appearance, "data-text-size": textSize, children: [_jsxs3("button", { type: "button", role: "combobox", className: "vx-dropdown-trigger", "aria-label": label, "aria-expanded": expanded, "aria-controls": `${id}-listbox`, "aria-activedescendant": expanded && active ? `${id}-option-${options.indexOf(active)}` : void 0, disabled: !canOpen, onClick: () => expanded ? close() : setOpen(true), onBlur: close, onKeyDown: handleKey, children: [_jsxs3("span", { className: "vx-dropdown-value", children: [selected?.icon && _jsx5(Icon, { name: selected.icon }), _jsx5("span", { children: selected?.label ?? placeholder })] }), _jsx5(Icon, { name: expanded ? "chevron-up" : "chevron-down" })] }), _jsx5("ul", { id: `${id}-listbox`, role: "listbox", "aria-label": label, hidden: !expanded, children: options.map((option, index) => _jsxs3("li", { id: `${id}-option-${index}`, ref: active === option ? activeOption : void 0, role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled || void 0, "data-active": active === option, onMouseDown: (event2) => event2.preventDefault(), onClick: () => {
630
+ return _jsxs6("div", { className: "vx-dropdown", "data-size": size, "data-width": width, "data-appearance": appearance, "data-text-size": textSize, children: [_jsxs6("button", { type: "button", role: "combobox", className: "vx-dropdown-trigger", "aria-label": label, "aria-expanded": expanded, "aria-controls": `${id}-listbox`, "aria-activedescendant": expanded && active ? `${id}-option-${options.indexOf(active)}` : void 0, disabled: !canOpen, onClick: () => expanded ? close() : setOpen(true), onBlur: close, onKeyDown: handleKey, children: [_jsxs6("span", { className: "vx-dropdown-value", children: [selected?.icon && _jsx9(Icon, { name: selected.icon }), _jsx9("span", { children: selected?.label ?? placeholder })] }), _jsx9(Icon, { name: expanded ? "chevron-up" : "chevron-down" })] }), _jsx9("ul", { id: `${id}-listbox`, role: "listbox", "aria-label": label, hidden: !expanded, children: options.map((option, index) => _jsxs6("li", { id: `${id}-option-${index}`, ref: active === option ? activeOption : void 0, role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled || void 0, "data-active": active === option, onMouseDown: (event2) => event2.preventDefault(), onClick: () => {
547
631
  if (!option.disabled)
548
632
  choose(option);
549
- }, children: [option.icon && _jsx5(Icon, { name: option.icon }), option.label, width === "hug" && option.value === value && _jsx5(Icon, { name: "check" })] }, option.value)) })] });
633
+ }, children: [option.icon && _jsx9(Icon, { name: option.icon }), option.label, width === "hug" && option.value === value && _jsx9(Icon, { name: "check" })] }, option.value)) })] });
550
634
  }
551
635
 
552
636
  // packages/ui-system/dist/tabs.js
553
- import { jsx as _jsx6, jsxs as _jsxs4 } from "react/jsx-runtime";
637
+ import { jsx as _jsx10, jsxs as _jsxs7 } from "react/jsx-runtime";
554
638
  import { useId as useId2 } from "react";
555
639
  function Tabs({ label, items, value, onValueChange, variant = "primary", actions }) {
556
640
  const id = useId2();
@@ -571,35 +655,35 @@ function Tabs({ label, items, value, onValueChange, variant = "primary", actions
571
655
  if (next.value !== value)
572
656
  onValueChange(next.value);
573
657
  }
574
- return _jsxs4("div", { children: [_jsxs4("div", { className: "vx-tabs", "data-variant": variant, children: [_jsx6("div", { role: "tablist", "aria-label": label, className: "vx-tab-list", children: items.map((item, index) => _jsx6("button", { type: "button", role: "tab", id: `${id}-tab-${index}`, "aria-controls": `${id}-panel-${index}`, "aria-selected": item === selected, disabled: item.disabled, tabIndex: item === selected ? 0 : -1, onClick: () => {
658
+ return _jsxs7("div", { children: [_jsxs7("div", { className: "vx-tabs", "data-variant": variant, children: [_jsx10("div", { role: "tablist", "aria-label": label, className: "vx-tab-list", children: items.map((item, index) => _jsx10("button", { type: "button", role: "tab", id: `${id}-tab-${index}`, "aria-controls": `${id}-panel-${index}`, "aria-selected": item === selected, disabled: item.disabled, tabIndex: item === selected ? 0 : -1, onClick: () => {
575
659
  if (item.value !== value)
576
660
  onValueChange(item.value);
577
- }, onKeyDown: (event2) => moveFocus(event2, item), children: item.label }, item.value)) }), actions && _jsx6("div", { className: "vx-tabs-actions", children: actions })] }), items.map((item, index) => _jsx6("div", { role: "tabpanel", id: `${id}-panel-${index}`, "aria-labelledby": `${id}-tab-${index}`, hidden: item !== selected, tabIndex: 0, children: item.panel }, item.value))] });
661
+ }, onKeyDown: (event2) => moveFocus(event2, item), children: item.label }, item.value)) }), actions && _jsx10("div", { className: "vx-tabs-actions", children: actions })] }), items.map((item, index) => _jsx10("div", { role: "tabpanel", id: `${id}-panel-${index}`, "aria-labelledby": `${id}-tab-${index}`, hidden: item !== selected, tabIndex: 0, children: item.panel }, item.value))] });
578
662
  }
579
663
 
580
664
  // packages/ui-system/dist/segmented-control.js
581
- import { jsx as _jsx7, jsxs as _jsxs5 } from "react/jsx-runtime";
665
+ import { jsx as _jsx11, jsxs as _jsxs8 } from "react/jsx-runtime";
582
666
  import { useId as useId3 } from "react";
583
667
  function SegmentedControl({ label, items, value, onValueChange, size = "medium", width = "fixed", iconOnly = false }) {
584
668
  const id = useId3();
585
- return _jsx7("div", { role: "radiogroup", "aria-label": label, className: "vx-segment", "data-size": size, "data-width": width, "data-icon-only": iconOnly, children: items.map((item) => _jsxs5("label", { children: [_jsx7("input", { type: "radio", name: id, value: item.value, disabled: item.disabled, checked: item.value === value, "aria-label": item.label, onChange: () => onValueChange(item.value) }), _jsxs5("span", { className: "vx-segment-item", children: [item.icon && _jsx7(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
669
+ return _jsx11("div", { role: "radiogroup", "aria-label": label, className: "vx-segment", "data-size": size, "data-width": width, "data-icon-only": iconOnly, children: items.map((item) => _jsxs8("label", { children: [_jsx11("input", { type: "radio", name: id, value: item.value, disabled: item.disabled, checked: item.value === value, "aria-label": item.label, onChange: () => onValueChange(item.value) }), _jsxs8("span", { className: "vx-segment-item", children: [item.icon && _jsx11(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
586
670
  }
587
671
 
588
672
  // packages/ui-system/dist/input.js
589
- import { jsx as _jsx8, jsxs as _jsxs6 } from "react/jsx-runtime";
673
+ import { jsx as _jsx12, jsxs as _jsxs9 } from "react/jsx-runtime";
590
674
  function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", ...props }) {
591
- return _jsxs6("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx8("span", { children: label }), _jsx8("input", { ...props, type: "text", value, onChange: (event2) => onValueChange(event2.currentTarget.value) })] });
675
+ return _jsxs9("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx12("span", { children: label }), _jsx12("input", { ...props, type: "text", value, onChange: (event2) => onValueChange(event2.currentTarget.value) })] });
592
676
  }
593
677
 
594
678
  // packages/ui-system/dist/tag.js
595
- import { jsx as _jsx9 } from "react/jsx-runtime";
679
+ import { jsx as _jsx13 } from "react/jsx-runtime";
596
680
  function Tag({ children, variant = "overlay", className }) {
597
- return _jsx9("span", { className: className ? `vx-tag ${className}` : "vx-tag", "data-variant": variant, children });
681
+ return _jsx13("span", { className: className ? `vx-tag ${className}` : "vx-tag", "data-variant": variant, children });
598
682
  }
599
683
 
600
684
  // packages/ui-system/dist/dialog.js
601
- import { jsx as _jsx10, jsxs as _jsxs7, Fragment as _Fragment } from "react/jsx-runtime";
602
- import { useId as useId4, useLayoutEffect, useRef as useRef2, useState as useState2 } from "react";
685
+ import { jsx as _jsx14, jsxs as _jsxs10, Fragment as _Fragment } from "react/jsx-runtime";
686
+ import { useId as useId4, useLayoutEffect, useRef as useRef2, useState as useState4 } from "react";
603
687
  import { createPortal } from "react-dom";
604
688
 
605
689
  // packages/ui-system/dist/dialog-surface.js
@@ -654,7 +738,7 @@ function createDialogSurface(anchor2) {
654
738
  function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default" }) {
655
739
  const ref = useRef2(null);
656
740
  const anchor2 = useRef2(null);
657
- const [surface, setSurface] = useState2();
741
+ const [surface, setSurface] = useState4();
658
742
  const heading = useId4();
659
743
  useLayoutEffect(() => {
660
744
  if (!open || !anchor2.current)
@@ -681,31 +765,34 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
681
765
  dialog2.close();
682
766
  };
683
767
  }, [open, surface]);
684
- const dialog = _jsxs7("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event2) => {
768
+ const dialog = _jsxs10("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event2) => {
685
769
  event2.preventDefault();
686
770
  event2.stopPropagation();
687
771
  onOpenChange(false);
688
772
  }, onClose: (event2) => {
689
773
  if (open && event2.currentTarget.isConnected && !event2.currentTarget.open)
690
774
  onOpenChange(false);
691
- }, children: [_jsxs7("header", { children: [_jsx10("h2", { id: heading, children: title }), _jsx10(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) })] }), _jsx10("div", { className: "vx-dialog-body", children }), actions && _jsx10("footer", { children: actions })] });
692
- return _jsxs7(_Fragment, { children: [_jsx10("span", { ref: anchor2, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
775
+ }, children: [_jsxs10("header", { children: [_jsx14("h2", { id: heading, children: title }), _jsx14(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) })] }), _jsx14("div", { className: "vx-dialog-body", children }), actions && _jsx14("footer", { children: actions })] });
776
+ return _jsxs10(_Fragment, { children: [_jsx14("span", { ref: anchor2, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
693
777
  }
694
778
 
695
779
  // packages/ui-system/dist/menu.js
696
- import { jsx as _jsx11, jsxs as _jsxs8 } from "react/jsx-runtime";
697
- import { useEffect as useEffect2, useId as useId5, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState3 } from "react";
780
+ import { jsx as _jsx15, jsxs as _jsxs11 } from "react/jsx-runtime";
781
+ import { useEffect as useEffect3, useId as useId5, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState5 } from "react";
698
782
  import { createPortal as createPortal2 } from "react-dom";
699
783
  function isEnabled(item) {
700
784
  return !item.disabled && item.items?.length !== 0;
701
785
  }
702
- function Menu({ label, items, triggerIcon, floating = false }) {
786
+ function Menu({ label, items, triggerIcon, floating = false, cascading = false }) {
703
787
  const id = useId5();
704
788
  const trigger = useRef3(null);
705
789
  const popup = useRef3(null);
790
+ const children = useRef3(/* @__PURE__ */ new Map());
791
+ const focusOnOpen = useRef3(true);
792
+ const cascade = floating && cascading;
706
793
  const focusIndex = useRef3(0);
707
- const [path, setPath] = useState3(null);
708
- const [placement, setPlacement] = useState3({ visibility: "hidden" });
794
+ const [path, setPath] = useState5(null);
795
+ const [placement, setPlacement] = useState5({ visibility: "hidden" });
709
796
  const portalRoot = floating ? trigger.current?.closest("dialog, [data-vx-theme]") : null;
710
797
  useLayoutEffect2(() => {
711
798
  if (!floating || !path || !portalRoot)
@@ -724,19 +811,38 @@ function Menu({ label, items, triggerIcon, floating = false }) {
724
811
  const flip = naturalHeight > below && above > below;
725
812
  const maxHeight = Math.max(0, Math.min(480, height - 16, flip ? above : below));
726
813
  const menuHeight = Math.min(naturalHeight, maxHeight);
814
+ const left = Math.max(8, Math.min(rect.right - bounds.width, width - bounds.width - 8));
815
+ const top = Math.max(8, Math.min(flip ? rect.top - menuHeight - 4 : rect.bottom + 4, height - menuHeight - 8));
727
816
  setPlacement({
728
817
  position: "fixed",
729
818
  visibility: "visible",
730
819
  insetInlineStart: "auto",
731
- left: Math.max(8, Math.min(rect.right - bounds.width, width - bounds.width - 8)),
732
- top: Math.max(8, Math.min(flip ? rect.top - menuHeight - 4 : rect.bottom + 4, height - menuHeight - 8)),
820
+ left,
821
+ top,
733
822
  maxHeight,
734
823
  zIndex: 100
735
824
  });
825
+ let parent = menu2, parentLeft = left, parentTop = top;
826
+ for (let depth = 1; cascade && depth <= path.length; depth++) {
827
+ const panel = children.current.get(depth);
828
+ const item = Array.from(parent.querySelectorAll("button")).find((b) => b.dataset.key === path[depth - 1]);
829
+ if (!panel || !item)
830
+ break;
831
+ const parentBox = parent.getBoundingClientRect(), box = panel.getBoundingClientRect();
832
+ const nextLeft = parentLeft + parentBox.width;
833
+ parentLeft = Math.max(8, Math.min(nextLeft + box.width <= width - 8 ? nextLeft : parentLeft - box.width, width - box.width - 8));
834
+ parentTop = Math.max(8, Math.min(parentTop + item.getBoundingClientRect().top - parentBox.top - 4, height - box.height - 8));
835
+ Object.assign(panel.style, {
836
+ left: parentLeft + "px",
837
+ top: parentTop + "px",
838
+ visibility: "visible"
839
+ });
840
+ parent = panel;
841
+ }
736
842
  };
737
843
  const outside = (event2) => {
738
844
  const path2 = event2.composedPath();
739
- if (!path2.includes(trigger.current) && !path2.includes(popup.current))
845
+ if (!path2.includes(trigger.current) && !path2.includes(popup.current) && ![...children.current.values()].some((panel) => path2.includes(panel)))
740
846
  setPath(null);
741
847
  };
742
848
  const document2 = portalRoot.ownerDocument;
@@ -750,21 +856,23 @@ function Menu({ label, items, triggerIcon, floating = false }) {
750
856
  window2.removeEventListener("scroll", position, true);
751
857
  document2.removeEventListener("pointerdown", outside);
752
858
  };
753
- }, [floating, path, portalRoot]);
859
+ }, [floating, path, portalRoot, cascade]);
754
860
  let entries = items;
755
861
  let menuLabel = label;
862
+ const levels = [{ entries, menuLabel }];
756
863
  for (const key3 of path ?? []) {
757
864
  const entry = entries.find((item) => item.id === key3);
758
865
  if (!entry?.items)
759
866
  break;
760
867
  menuLabel = entry.label;
761
868
  entries = entry.items;
869
+ levels.push({ entries, menuLabel });
762
870
  }
763
- function buttons() {
764
- return [...popup.current?.querySelectorAll("button:not(:disabled)") ?? []];
871
+ function buttons(panel = cascade && path?.length ? children.current.get(path.length) : popup.current) {
872
+ return [...panel?.querySelectorAll("button:not(:disabled)") ?? []];
765
873
  }
766
- useEffect2(() => {
767
- if (path && (!floating || !portalRoot || placement.visibility === "visible"))
874
+ useEffect3(() => {
875
+ if (focusOnOpen.current && path && (!floating || !portalRoot || placement.visibility === "visible"))
768
876
  buttons().at(focusIndex.current)?.focus();
769
877
  }, [path, floating && placement.visibility, portalRoot]);
770
878
  function close() {
@@ -772,6 +880,7 @@ function Menu({ label, items, triggerIcon, floating = false }) {
772
880
  trigger.current?.focus();
773
881
  }
774
882
  function back() {
883
+ focusOnOpen.current = true;
775
884
  if (!path?.length)
776
885
  return;
777
886
  const parentPath = path.slice(0, -1);
@@ -779,24 +888,27 @@ function Menu({ label, items, triggerIcon, floating = false }) {
779
888
  focusIndex.current = Math.max(0, parent.filter(isEnabled).findIndex((item) => item.id === path.at(-1)));
780
889
  setPath(parentPath);
781
890
  }
782
- function choose(item) {
891
+ function choose(item, depth) {
892
+ focusOnOpen.current = true;
783
893
  if (item.items?.length) {
784
894
  focusIndex.current = 0;
785
- setPath([...path ?? [], item.id]);
895
+ setPath([...(path ?? []).slice(0, depth), item.id]);
896
+ if (cascade && path?.[depth] === item.id)
897
+ buttons(children.current.get(depth + 1))?.at(0)?.focus();
786
898
  } else if (item.onSelect) {
787
899
  if (item.checked === void 0)
788
900
  close();
789
901
  item.onSelect();
790
902
  }
791
903
  }
792
- function handleKey(event2) {
904
+ function handleKey(event2, depth) {
793
905
  if (event2.key === "Tab" && floating && portalRoot) {
794
906
  if (event2.shiftKey)
795
907
  event2.preventDefault();
796
908
  close();
797
909
  return;
798
910
  }
799
- const available = buttons();
911
+ const available = buttons(event2.currentTarget);
800
912
  const index = available.findIndex((button) => button === event2.target);
801
913
  if (event2.key === "Escape") {
802
914
  event2.preventDefault();
@@ -813,10 +925,10 @@ function Menu({ label, items, triggerIcon, floating = false }) {
813
925
  return;
814
926
  }
815
927
  if (event2.key === "ArrowRight") {
816
- const item = entries.filter(isEnabled)[index];
928
+ const item = levels[depth]?.entries.filter(isEnabled)[index];
817
929
  if (item?.items?.length) {
818
930
  event2.preventDefault();
819
- choose(item);
931
+ choose(item, depth);
820
932
  }
821
933
  return;
822
934
  }
@@ -832,6 +944,7 @@ function Menu({ label, items, triggerIcon, floating = false }) {
832
944
  }
833
945
  }
834
946
  function open(index = 0) {
947
+ focusOnOpen.current = true;
835
948
  focusIndex.current = index;
836
949
  setPath([]);
837
950
  }
@@ -841,19 +954,98 @@ function Menu({ label, items, triggerIcon, floating = false }) {
841
954
  open(event2.key === "ArrowUp" ? -1 : 0);
842
955
  }
843
956
  }
844
- const menu = _jsx11("div", { ref: popup, className: "vx-action-menu-items", role: "menu", id, "aria-label": menuLabel, hidden: !path, onKeyDown: handleKey, "data-floating": floating || void 0, style: floating && portalRoot ? placement : void 0, children: entries.map((item) => _jsxs8("button", { type: "button", role: item.checked === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": item.checked, "aria-haspopup": item.items?.length ? "menu" : void 0, "data-size": item.size ?? "medium", disabled: !isEnabled(item), tabIndex: -1, onClick: () => choose(item), children: [item.icon && _jsx11(Icon, { name: item.icon }), _jsx11("span", { children: item.label }), item.checked && _jsx11(Icon, { name: "check" }), item.items?.length ? _jsx11(Icon, { name: "chevron-right" }) : null] }, item.id)) });
845
- return _jsxs8("div", { className: "vx-action-menu", onBlur: (event2) => {
846
- if (!event2.currentTarget.contains(event2.relatedTarget) && !(floating && popup.current?.contains(event2.relatedTarget)))
957
+ function hover(item, depth) {
958
+ if (!cascade || !path)
959
+ return;
960
+ const next = path.slice(0, depth);
961
+ if (item.items?.length && isEnabled(item))
962
+ next.push(item.id);
963
+ if (next.length === path.length && next.every((key3, i) => path[i] === key3))
964
+ return;
965
+ focusOnOpen.current = false;
966
+ setPath(next);
967
+ }
968
+ const menu = levels.map(({ entries: entries2, menuLabel: menuLabel2 }, depth) => !cascade && depth !== levels.length - 1 ? null : _jsx15("div", { ref: !cascade || depth === 0 ? popup : (el) => {
969
+ if (el)
970
+ children.current.set(depth, el);
971
+ else
972
+ children.current.delete(depth);
973
+ }, className: "vx-action-menu-items", role: "menu", id: !cascade || !depth ? id : id + "-" + depth, "aria-label": menuLabel2, hidden: !path, onKeyDown: (e) => handleKey(e, depth), "data-floating": floating || void 0, style: floating && portalRoot ? cascade && depth ? {
974
+ position: "fixed",
975
+ insetInlineStart: "auto",
976
+ visibility: "hidden",
977
+ maxHeight: "min(480px, calc(100dvh - 16px))",
978
+ zIndex: 100 + depth
979
+ } : placement : void 0, children: entries2.map((item) => _jsxs11("button", { type: "button", role: item.checked === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": item.checked, "aria-haspopup": item.items?.length ? "menu" : void 0, "data-key": item.id, "aria-expanded": cascade && item.items ? path?.[depth] === item.id : void 0, onPointerEnter: cascade ? (e) => {
980
+ if (e.pointerType !== "touch")
981
+ hover(item, depth);
982
+ } : void 0, "data-size": item.size ?? "medium", "data-tone": item.tone, disabled: !isEnabled(item), tabIndex: -1, onClick: () => choose(item, depth), children: [item.icon && _jsx15(Icon, { name: item.icon }), _jsx15("span", { children: item.label }), item.checked && _jsx15(Icon, { name: "check" }), item.items?.length ? _jsx15(Icon, { name: "chevron-right" }) : null] }, item.id)) }, depth));
983
+ return _jsxs11("div", { className: "vx-action-menu", onBlur: (event2) => {
984
+ if (!event2.currentTarget.contains(event2.relatedTarget) && !(floating && popup.current?.contains(event2.relatedTarget)) && ![...children.current.values()].some((panel) => panel.contains(event2.relatedTarget)))
847
985
  setPath(null);
848
- }, children: [triggerIcon ? _jsx11(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx11(Button, { ref: trigger, label, variant: "text-tonal-sm", trailingIcon: "chevron-down", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ? createPortal2(menu, portalRoot) : menu] });
986
+ }, children: [triggerIcon ? _jsx15(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx15(Button, { ref: trigger, label, variant: "text-tonal-sm", trailingIcon: "chevron-down", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ? createPortal2(menu, portalRoot) : menu] });
987
+ }
988
+
989
+ // packages/ui-system/dist/filter-menu.js
990
+ import { jsx as _jsx16, jsxs as _jsxs12, Fragment as _Fragment2 } from "react/jsx-runtime";
991
+ import { useId as useId6, useRef as useRef4, useState as useState6, useLayoutEffect as useLayoutEffect3 } from "react";
992
+ function FilterMenu({ label, groups, value, onValueChange, leadingIcon = "filter" }) {
993
+ const id = useId6();
994
+ const popup = useRef4(null);
995
+ const [expanded, setExpanded] = useState6(false);
996
+ const list = useRef4(null);
997
+ const [moreBelow, setMoreBelow] = useState6(false);
998
+ useLayoutEffect3(() => {
999
+ const el = list.current;
1000
+ if (!el || !expanded)
1001
+ return;
1002
+ const update = () => setMoreBelow(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
1003
+ const observer = new ResizeObserver(update);
1004
+ observer.observe(el);
1005
+ for (const section of el.children)
1006
+ observer.observe(section);
1007
+ el.addEventListener("scroll", update, { passive: true });
1008
+ update();
1009
+ return () => {
1010
+ observer.disconnect();
1011
+ el.removeEventListener("scroll", update);
1012
+ };
1013
+ }, [expanded, groups]);
1014
+ const sections = groups.map((group) => {
1015
+ const selected = value[group.id] ?? [];
1016
+ const options = new Map(group.options.map((option) => typeof option === "string" ? [option, option] : [option.value, option.label]));
1017
+ for (const option of selected)
1018
+ if (!options.has(option))
1019
+ options.set(option, option);
1020
+ return { ...group, selected, options: [...options] };
1021
+ }).filter((group) => group.options.length);
1022
+ const count = sections.reduce((sum, { selected }) => sum + selected.length, 0);
1023
+ function focusFirstGroup() {
1024
+ popup.current?.querySelector("summary")?.focus({ preventScroll: true });
1025
+ }
1026
+ return _jsxs12(_Fragment2, { children: [_jsx16(Button, { label, badge: count, className: "vx-filter-trigger", width: "hug", variant: "text-tonal-sm", leadingIcon, trailingIcon: leadingIcon ? void 0 : "chevron-down", popoverTarget: id, "aria-controls": id, "aria-expanded": expanded, "aria-haspopup": "dialog", disabled: !sections.length }), _jsxs12("div", { ref: popup, id, className: "vx-filter-menu", popover: "auto", role: "dialog", "aria-label": label, onToggle: (event2) => {
1027
+ const open = event2.currentTarget.matches(":popover-open");
1028
+ setExpanded(open);
1029
+ if (open)
1030
+ focusFirstGroup();
1031
+ }, children: [_jsx16("div", { className: "vx-filter-scroll", "data-more-below": moreBelow || void 0, children: _jsx16("div", { className: "vx-filter-groups", ref: list, children: sections.map(({ id: groupId, label: label2, options, optionLabels, selected, initiallyCollapsed }) => _jsxs12("details", { open: !initiallyCollapsed, children: [_jsxs12("summary", { children: [label2, _jsx16(Icon, { name: "chevron-down", size: 16 })] }), _jsx16("div", { className: "vx-filter-options", role: "group", "aria-label": label2, children: options.map(([option, optionLabel]) => _jsx16(Checkbox, { label: optionLabels?.[option] ?? optionLabel, checked: selected.includes(option), onCheckedChange: (checked) => onValueChange({
1032
+ ...value,
1033
+ [groupId]: checked ? [...selected, option] : selected.filter((item) => item !== option)
1034
+ }) }, option)) })] }, groupId)) }) }), _jsx16("footer", { children: _jsx16(Button, { label: "Clear Filters", variant: "text-tonal-sm", disabled: !count, onClick: () => {
1035
+ onValueChange({});
1036
+ focusFirstGroup();
1037
+ } }) })] })] });
849
1038
  }
850
1039
 
851
1040
  // packages/ui-system/dist/media.js
852
- import { jsx as _jsx12, Fragment as _Fragment2, jsxs as _jsxs9 } from "react/jsx-runtime";
853
- import { useRef as useRef4, useState as useState4 } from "react";
854
- function Media({ src, videoSrc, emptyLabel, alt, ratio = "16:9", state = "default", fit = "cover", emptyAppearance = "black", crop, label, duration, selectedLabel, selectionStyle = "outline", onSelect, onOpen }) {
855
- const [failedImage, setFailedImage] = useState4();
856
- const [failedVideo, setFailedVideo] = useState4();
1041
+ import { jsx as _jsx17, Fragment as _Fragment3, jsxs as _jsxs13 } from "react/jsx-runtime";
1042
+ import { useRef as useRef5, useState as useState7 } from "react";
1043
+ function MediaBadges({ label, duration }) {
1044
+ return _jsxs13(_Fragment3, { children: [" ", label && _jsx17("span", { className: "vx-media-label", children: _jsx17(Tag, { children: label }) }), duration && _jsx17("span", { className: "vx-media-duration", children: _jsx17(Tag, { children: duration }) })] });
1045
+ }
1046
+ function Media({ src, videoSrc, emptyLabel, script, alt, ratio: ratio2 = "16:9", state = "default", fit = "cover", emptyAppearance = "black", crop, label, duration, selectedLabel, selectionStyle = "outline", onSelect, onOpen }) {
1047
+ const [failedImage, setFailedImage] = useState7();
1048
+ const [failedVideo, setFailedVideo] = useState7();
857
1049
  const image = src !== failedImage ? src : void 0;
858
1050
  const video = videoSrc !== failedVideo ? videoSrc : void 0;
859
1051
  const selected = state === "selected";
@@ -867,57 +1059,621 @@ function Media({ src, videoSrc, emptyLabel, alt, ratio = "16:9", state = "defaul
867
1059
  transform: `rotate(${crop.rotation ?? 0}deg)`,
868
1060
  objectFit: "fill"
869
1061
  } : { objectFit: fit };
870
- const content = _jsxs9(_Fragment2, { children: [image ? _jsx12("img", { src: image, alt, style: imageStyle, onError: () => setFailedImage(image) }, image) : video ? _jsx12("video", { src: video, preload: "metadata", muted: true, playsInline: true, "aria-hidden": "true", style: { objectFit: fit }, onError: () => setFailedVideo(video) }, video) : emptyAppearance !== "black" && emptyAppearance !== "surface" ? _jsx12(Icon, { name: `placeholder-${emptyAppearance}`, size: 20 }) : emptyLabel && !busy ? _jsx12("span", { className: "vx-media-empty-label", children: emptyLabel }) : null, label && _jsx12("span", { className: "vx-media-label", children: _jsx12(Tag, { children: label }) }), duration && _jsx12("span", { className: "vx-media-duration", children: _jsx12(Tag, { children: duration }) }), selected && selectedLabel && _jsx12("span", { className: "vx-media-selected", children: _jsx12(Tag, { variant: "selected", children: "Selected" }) }), selectionStyle === "checkbox" && _jsx12("span", { className: "vx-media-marker", "aria-hidden": "true", children: selected && _jsx12(Icon, { name: "check", size: 12 }) }), busy && _jsx12("span", { className: "vx-media-progress", role: "status", children: state === "loading" ? "Loading" : "Generating" })] });
1062
+ const content = _jsxs13(_Fragment3, { children: [script ? _jsx17(ScriptCover, { ...script }) : image ? _jsx17("img", { src: image, alt, style: imageStyle, onError: () => setFailedImage(image) }, image) : video ? _jsx17("video", { src: video, preload: "metadata", muted: true, playsInline: true, "aria-hidden": "true", style: { objectFit: fit }, onError: () => setFailedVideo(video) }, video) : emptyAppearance !== "black" && emptyAppearance !== "surface" ? _jsx17(Icon, { name: `placeholder-${emptyAppearance}`, size: 20 }) : emptyLabel && !busy ? _jsx17("span", { className: "vx-media-empty-label", children: emptyLabel }) : null, _jsx17(MediaBadges, { label, duration }), selected && selectedLabel && _jsx17("span", { className: "vx-media-selected", children: _jsx17(Tag, { variant: "selected", children: "Selected" }) }), selectionStyle === "checkbox" && _jsx17("span", { className: "vx-media-marker", "aria-hidden": "true", children: selected && _jsx17(Icon, { name: "check", size: 12 }) }), busy && _jsx17("span", { className: "vx-media-progress", role: "status", children: state === "loading" ? "Loading" : "Generating" })] });
871
1063
  const props = {
872
1064
  className: "vx-media",
873
1065
  "data-state": state,
874
1066
  "data-selection": selectionStyle,
875
1067
  "data-empty": image || video ? void 0 : emptyAppearance,
876
1068
  "aria-busy": busy || void 0,
877
- style: { aspectRatio: ratio.replace(":", " / ") }
1069
+ style: { aspectRatio: ratio2.replace(":", " / ") }
878
1070
  };
879
- return onSelect || onOpen ? _jsx12("button", { ...props, type: "button", "aria-label": alt, "aria-pressed": onSelect ? selected : void 0, disabled: busy, onClick: () => onSelect ? onSelect(!selected) : onOpen?.(), children: content }) : _jsx12("div", { ...props, "aria-label": image ? void 0 : alt, children: content });
1071
+ return onSelect || onOpen ? _jsx17("button", { ...props, type: "button", "aria-label": alt, "aria-pressed": onSelect ? selected : void 0, disabled: busy, onClick: () => onSelect ? onSelect(!selected) : onOpen?.(), children: content }) : _jsx17("div", { ...props, "aria-label": image ? void 0 : alt, children: content });
1072
+ }
1073
+
1074
+ // packages/ui-system/dist/video-player.js
1075
+ import { jsx as _jsx18, jsxs as _jsxs14, Fragment as _Fragment4 } from "react/jsx-runtime";
1076
+ import { useEffect as useEffect4, useRef as useRef6, useState as useState8 } from "react";
1077
+ function timeLabel(seconds, padMinutes = false) {
1078
+ const whole = Math.floor(seconds);
1079
+ const minutes = String(Math.floor(whole / 60));
1080
+ return `${padMinutes ? minutes.padStart(2, "0") : minutes}:${String(whole % 60).padStart(2, "0")}`;
1081
+ }
1082
+ function PlaybackControls({ playing, muted, time, duration, size = "medium", disabled, onTogglePlay, onToggleMute, onSeek, onFullscreen, fullscreenLabel = "Toggle fullscreen", actions, appearance = "on-content", timeDisplay = "combined" }) {
1083
+ return _jsxs14("div", { className: "vx-playback-controls", role: "group", "aria-label": "Playback controls", "data-size": size, "data-appearance": appearance, style: {
1084
+ "--vx-playback-progress": `${duration > 0 ? Math.min(100, Math.max(0, time / duration * 100)) : 0}%`
1085
+ }, children: [_jsx18(IconButton, { icon: playing ? size === "large" ? "pause-large" : "pause" : size === "large" ? "playback-play-large" : "playback-play", label: playing ? "Pause" : "Play", disabled, onClick: onTogglePlay }), timeDisplay === "split" && _jsx18("span", { "aria-hidden": "true", "data-time": "elapsed", children: timeLabel(time, true) }), _jsx18("input", { "aria-label": "Playback position", "aria-valuetext": `${timeLabel(time)} of ${timeLabel(duration)}`, type: "range", min: 0, max: duration, value: time, step: "any", disabled: disabled || !duration, onChange: (event2) => onSeek(event2.currentTarget.valueAsNumber) }), _jsx18("span", { "aria-hidden": "true", "data-time": timeDisplay === "split" ? "duration" : void 0, children: timeDisplay === "split" ? timeLabel(duration, true) : `${timeLabel(time)} / ${timeLabel(duration)}` }), _jsx18(IconButton, { icon: muted ? size === "large" ? "mute-large" : "mute" : size === "large" ? "volume-large" : "volume", label: muted ? "Unmute" : "Mute", disabled, onClick: onToggleMute }), actions, onFullscreen && _jsx18(IconButton, { icon: size === "large" ? "fullscreen-large" : "fullscreen", label: fullscreenLabel, onClick: onFullscreen })] });
1086
+ }
1087
+ function VideoPlayer(props) {
1088
+ return _jsx18(Playback, { ...props }, JSON.stringify([props.src, props.poster, props.posterDuration]));
1089
+ }
1090
+ function Playback({ src, poster, aspectRatio, posterDuration = 0, title, version, durationLabel, sceneLabel, defaultMuted = false, controlsPlacement = "overlay", fitContent = false, controlsSize, timeDisplay, controlsActions, showFullscreen = true, fullscreenMode = "native", overlay, onBeforePlay, onStateChange, onTimeChange, onEnded, onError }) {
1091
+ const root = useRef6(null);
1092
+ const video = useRef6(null);
1093
+ const position = useRef6(0);
1094
+ const callbacks = useRef6({ onTimeChange, onStateChange, onEnded });
1095
+ const [time, setTime] = useState8(0);
1096
+ const [ratio2, setRatio] = useState8(16 / 9);
1097
+ const [metadataDuration, setMetadataDuration] = useState8(0);
1098
+ const [state, setState] = useState8("cover");
1099
+ const [muted, setMuted] = useState8(defaultMuted);
1100
+ const [expanded, setExpanded] = useState8(false);
1101
+ const [inlineHeight, setInlineHeight] = useState8();
1102
+ const restore = useRef6(void 0);
1103
+ const stillDuration = poster && Number.isFinite(posterDuration) ? Math.max(0, posterDuration) : 0;
1104
+ const duration = src ? metadataDuration : stillDuration;
1105
+ useEffect4(() => {
1106
+ const element = video.current;
1107
+ return () => {
1108
+ if (!element)
1109
+ return;
1110
+ element.pause();
1111
+ element.removeAttribute("src");
1112
+ element.load();
1113
+ };
1114
+ }, [expanded, src]);
1115
+ function updateTime(next) {
1116
+ position.current = next;
1117
+ setTime(next);
1118
+ onTimeChange?.(next);
1119
+ }
1120
+ function changeState(next) {
1121
+ setState(next);
1122
+ onStateChange?.(next);
1123
+ }
1124
+ useEffect4(() => {
1125
+ callbacks.current = { onTimeChange, onStateChange, onEnded };
1126
+ }, [onTimeChange, onStateChange, onEnded]);
1127
+ useEffect4(() => {
1128
+ if (src || state !== "playing" || !duration)
1129
+ return;
1130
+ let previous = performance.now();
1131
+ let frame = requestAnimationFrame(tick);
1132
+ function tick(now) {
1133
+ const next = Math.min(duration, position.current + (now - previous) / 1e3);
1134
+ previous = now;
1135
+ position.current = next;
1136
+ setTime(next);
1137
+ callbacks.current.onTimeChange?.(next);
1138
+ if (next < duration)
1139
+ frame = requestAnimationFrame(tick);
1140
+ else {
1141
+ setState("paused");
1142
+ callbacks.current.onStateChange?.("paused");
1143
+ callbacks.current.onEnded?.();
1144
+ }
1145
+ }
1146
+ return () => cancelAnimationFrame(frame);
1147
+ }, [src, state, duration]);
1148
+ function togglePlay() {
1149
+ if (state === "playing") {
1150
+ if (video.current)
1151
+ video.current.pause();
1152
+ else
1153
+ changeState("paused");
1154
+ return;
1155
+ }
1156
+ if (onBeforePlay?.() === false)
1157
+ return;
1158
+ if (video.current)
1159
+ void video.current.play().catch((error) => onError?.(error));
1160
+ else if (duration) {
1161
+ if (position.current >= duration)
1162
+ updateTime(0);
1163
+ changeState("playing");
1164
+ }
1165
+ }
1166
+ function seek(seconds) {
1167
+ if (video.current)
1168
+ video.current.currentTime = seconds;
1169
+ else
1170
+ updateTime(seconds);
1171
+ }
1172
+ async function toggleFullscreen() {
1173
+ if (fullscreenMode === "dialog") {
1174
+ changeExpanded(!expanded);
1175
+ return;
1176
+ }
1177
+ try {
1178
+ const player2 = root.current;
1179
+ if (!player2?.requestFullscreen)
1180
+ return;
1181
+ if (player2.ownerDocument.fullscreenElement === player2)
1182
+ await player2.ownerDocument.exitFullscreen();
1183
+ else
1184
+ await player2.requestFullscreen();
1185
+ } catch (error) {
1186
+ onError?.(error);
1187
+ }
1188
+ }
1189
+ function changeExpanded(next) {
1190
+ const element = video.current;
1191
+ restore.current = {
1192
+ time: element?.currentTime ?? position.current,
1193
+ playing: element ? !element.paused : state === "playing",
1194
+ state
1195
+ };
1196
+ if (next)
1197
+ setInlineHeight(root.current?.getBoundingClientRect().height);
1198
+ element?.pause();
1199
+ setExpanded(next);
1200
+ }
1201
+ const player = _jsxs14("section", { ref: root, className: "vx-video-player", "aria-label": title, "data-fit": fitContent ? "content" : void 0, style: fitContent ? { "--vx-video-ratio": ratio2 } : void 0, "data-placement": controlsPlacement, "data-state": state, children: [_jsxs14("div", { className: "vx-video-stage", style: aspectRatio ? { aspectRatio } : void 0, children: [src ? _jsx18("video", { ref: video, src, poster, muted, playsInline: true, preload: "metadata", onResize: (event2) => {
1202
+ const { videoWidth, videoHeight } = event2.currentTarget;
1203
+ if (fitContent && videoWidth && videoHeight)
1204
+ setRatio(videoWidth / videoHeight);
1205
+ }, onLoadedMetadata: (event2) => {
1206
+ const element = event2.currentTarget;
1207
+ const { videoWidth, videoHeight } = element;
1208
+ if (fitContent && videoWidth && videoHeight)
1209
+ setRatio(videoWidth / videoHeight);
1210
+ const previous = restore.current;
1211
+ if (!previous)
1212
+ return;
1213
+ element.currentTime = Math.min(previous.time, element.duration);
1214
+ updateTime(element.currentTime);
1215
+ restore.current = void 0;
1216
+ if (previous.playing)
1217
+ void element.play().catch(() => changeState("paused"));
1218
+ else
1219
+ changeState(previous.state);
1220
+ }, onDurationChange: (event2) => {
1221
+ const value = event2.currentTarget.duration;
1222
+ setMetadataDuration(Number.isFinite(value) ? value : 0);
1223
+ }, onPlay: () => changeState("playing"), onPause: (event2) => {
1224
+ if (restore.current)
1225
+ return;
1226
+ updateTime(event2.currentTarget.currentTime);
1227
+ changeState("paused");
1228
+ }, onTimeUpdate: (event2) => {
1229
+ if (!restore.current)
1230
+ updateTime(event2.currentTarget.currentTime);
1231
+ }, onEnded, onError: (event2) => onError?.(event2.currentTarget.error) }) : poster && _jsx18("img", { src: poster, alt: "" }), overlay, state === "cover" && !fitContent && _jsxs14("div", { className: "vx-video-cover", children: [_jsxs14("div", { className: "vx-video-info", children: [_jsxs14("div", { className: "vx-video-title", children: [_jsx18("strong", { title, children: title }), version && _jsx18(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs14("div", { className: "vx-video-meta", children: [durationLabel && _jsx18("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx18("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx18("span", { children: sceneLabel })] })] }), (src || duration > 0) && _jsx18(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx18(PlaybackControls, { playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, timeDisplay, actions: controlsActions, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen ? () => void toggleFullscreen() : void 0, fullscreenLabel: fullscreenMode === "dialog" ? expanded ? "Close expanded video" : "Expand video" : void 0 })] });
1232
+ return _jsxs14(_Fragment4, { children: [expanded ? _jsx18("div", { "aria-hidden": "true", style: { height: inlineHeight } }) : player, _jsx18(Dialog, { title, open: expanded, onOpenChange: changeExpanded, className: "vx-video-dialog", children: expanded && player })] });
880
1233
  }
881
1234
 
882
1235
  // packages/ui-system/dist/workspace-theme.js
883
- import { jsx as _jsx13, jsxs as _jsxs10 } from "react/jsx-runtime";
884
- import { useEffect as useEffect3, useState as useState5 } from "react";
1236
+ import { jsx as _jsx19, jsxs as _jsxs15 } from "react/jsx-runtime";
1237
+ import { useEffect as useEffect5, useState as useState9 } from "react";
885
1238
  var key = "vivix.studio.theme";
886
1239
  var event = "vivix-studio-theme";
887
1240
  function readPreference() {
888
1241
  try {
889
1242
  const value = localStorage.getItem(key);
890
- if (value === "light" || value === "dark")
1243
+ if (value === "light" || value === "dark" || value === "system")
891
1244
  return value;
892
1245
  } catch {
893
1246
  }
894
- return "system";
1247
+ return "light";
1248
+ }
1249
+ function useWorkspaceTheme() {
1250
+ const [preference, setPreference] = useState9(readPreference);
1251
+ const [system, setSystem] = useState9(() => globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light");
1252
+ useEffect5(() => {
1253
+ const query = globalThis.matchMedia?.("(prefers-color-scheme: dark)");
1254
+ const synchronize = () => setPreference(readPreference());
1255
+ const systemChanged = () => setSystem(query?.matches ? "dark" : "light");
1256
+ addEventListener("storage", synchronize);
1257
+ addEventListener(event, synchronize);
1258
+ query?.addEventListener("change", systemChanged);
1259
+ return () => {
1260
+ removeEventListener("storage", synchronize);
1261
+ removeEventListener(event, synchronize);
1262
+ query?.removeEventListener("change", systemChanged);
1263
+ };
1264
+ }, []);
1265
+ function update(value) {
1266
+ setPreference(value);
1267
+ try {
1268
+ localStorage.setItem(key, value);
1269
+ dispatchEvent(new Event(event));
1270
+ } catch {
1271
+ }
1272
+ }
1273
+ return { theme: preference === "system" ? system : preference, preference, update };
1274
+ }
1275
+
1276
+ // packages/studio-workbench/src/query-view.ts
1277
+ import { z as z3 } from "vivix-studio/sdk/shared";
1278
+
1279
+ // packages/studio-workbench/src/view-common.ts
1280
+ var pageSources = ["projects", "assets", "tasks"];
1281
+ var pageTitles = {
1282
+ projects: "Manage Projects",
1283
+ assets: "Global Asset",
1284
+ tasks: "Generation Queue"
1285
+ };
1286
+ function supportedImport(file) {
1287
+ return /^(image|video|audio|text)\//.test(file.type) || !file.type && /\.(txt|md|csv|srt|vtt)$/i.test(file.name);
1288
+ }
1289
+
1290
+ // packages/studio-workbench/src/query-view.ts
1291
+ var columnName = z3.string().min(1).max(200).refine((value) => !/[\u0000-\u001f]/.test(value));
1292
+ var scalar = z3.union([z3.null(), z3.string(), z3.number().finite()]);
1293
+ var customViewSchema = z3.object({
1294
+ source: z3.enum(pageSources),
1295
+ projectId: z3.uuid().optional(),
1296
+ name: z3.string().trim().min(1).max(120),
1297
+ sql: z3.string().trim().min(1).max(32e3),
1298
+ params: z3.union([z3.array(scalar), z3.record(z3.string(), scalar)]).default([]),
1299
+ columns: z3.array(
1300
+ z3.object({
1301
+ path: columnName,
1302
+ label: z3.string().min(1).max(120).optional(),
1303
+ width: z3.number().int().min(80).max(600).default(140),
1304
+ visible: z3.boolean().default(true),
1305
+ format: z3.enum(["text", "categories", "date", "json"]).default("text"),
1306
+ role: z3.enum(["name", "preview", "state", "project"]).optional()
1307
+ }).strict()
1308
+ ).min(1).max(60).refine(
1309
+ (columns) => new Set(columns.map((c) => c.path)).size === columns.length,
1310
+ "Column names must be unique."
1311
+ ),
1312
+ identity: z3.object({
1313
+ row: columnName.default("rowId"),
1314
+ project: columnName.default("projectId"),
1315
+ ref: columnName.default("ref"),
1316
+ outputs: columnName.default("outputRefs")
1317
+ }).strict().default({ row: "rowId", project: "projectId", ref: "ref", outputs: "outputRefs" })
1318
+ }).strict();
1319
+ var column = (path, label, width = 140, extra = {}) => ({ path, label, width, visible: true, format: "text", ...extra });
1320
+ var projectCategories = [
1321
+ ["short-drama", "Short Drama"],
1322
+ ["product-ad", "Product Ad"],
1323
+ ["other", "Others"]
1324
+ ];
1325
+ function projectCategoryLabel(value) {
1326
+ return projectCategories.find(([type]) => type === value)?.[1];
1327
+ }
1328
+ var assetCategories = [
1329
+ ["image", "Images", "kind", "image"],
1330
+ ["video", "Videos", "kind", "video"],
1331
+ ["audio", "Audio", "kind", "audio"],
1332
+ ["script", "Script", "purpose", "script"],
1333
+ ["character", "Characters", "subjectType", "Character"],
1334
+ ["scene", "Scenes", "subjectType", "Scene"],
1335
+ ["product", "Products", "subjectType", "Product"],
1336
+ ["model", "Models", "subjectType", "Model"]
1337
+ ];
1338
+ var projectOwnedRows = (table) => `SELECT a.*, p.name AS projectName, p.available AS projectAvailable FROM ${table} AS a LEFT JOIN studio_projects AS p ON p.projectId = a.projectId`;
1339
+ function assetBrowseQuery(viewId, filter) {
1340
+ const category = assetCategories.find(([id]) => viewId === `default:assets:${id}`);
1341
+ const conditions = [];
1342
+ const params = {};
1343
+ if (category) {
1344
+ conditions.push(`a.${category[2]} = :category`);
1345
+ params.category = category[3];
1346
+ }
1347
+ if (filter) {
1348
+ for (const [key3, field] of [
1349
+ ["project", "projectId"],
1350
+ ["format", "kind"],
1351
+ ["subject", "subjectType"]
1352
+ ]) {
1353
+ const values = filter[key3];
1354
+ if (!values?.length) continue;
1355
+ conditions.push(`a.${field} IN (SELECT value FROM json_each(:${key3}))`);
1356
+ params[key3] = JSON.stringify(typeof values === "string" ? [values] : values);
1357
+ }
1358
+ }
1359
+ const where = conditions.length ? ` WHERE ${conditions.join(" AND ")}` : "";
1360
+ const order = filter ? "p.name, a.orderKey IS NULL, a.orderKey, " : "";
1361
+ return {
1362
+ sql: `${projectOwnedRows("studio_assets")}${where} ORDER BY ${order}a.createdAt DESC, a.rowId ASC`,
1363
+ params
1364
+ };
1365
+ }
1366
+ function projectBrowseQuery(viewId, types) {
1367
+ const category = projectCategories.find(([id]) => viewId === `default:projects:${id}`)?.[0];
1368
+ return {
1369
+ sql: "SELECT * FROM studio_projects WHERE (:category = '' OR projectType = :category) AND projectType IN (SELECT value FROM json_each(:types)) ORDER BY createdAt DESC, rowId ASC",
1370
+ params: { category: category ?? "", types: JSON.stringify(types) }
1371
+ };
1372
+ }
1373
+ function defaultSql(source, favorites = false, conditions = []) {
1374
+ if (source === "projects")
1375
+ return "SELECT * FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
1376
+ const table = favorites ? "studio_asset_versions" : `studio_${source}`;
1377
+ const filters = [...favorites ? ["a.favorite = 1"] : [], ...conditions];
1378
+ return `SELECT a.*, p.name AS projectName, p.available AS projectAvailable FROM ${table} AS a LEFT JOIN studio_projects AS p ON p.projectId = a.projectId${filters.length ? " WHERE " + filters.join(" AND ") : ""} ORDER BY a.createdAt DESC, a.rowId ASC`;
1379
+ }
1380
+ function defaultView(source) {
1381
+ const columns = source === "projects" ? [
1382
+ column("previewUrl", "Preview", 120, { role: "preview" }),
1383
+ column("name", "Project title", 260, { role: "name" }),
1384
+ column("projectType", "Type", 140),
1385
+ column("assetCount", "Assets", 120),
1386
+ column("available", "Available", 120, { visible: false }),
1387
+ column("createdAt", "Created Time", 160, { format: "date" })
1388
+ ] : source === "assets" ? [
1389
+ column("previewUrl", "Preview", 136, { role: "preview" }),
1390
+ column("name", "Title", 112, { role: "name" }),
1391
+ column("subjectType", "Type", 94),
1392
+ column("kind", "Format", 112),
1393
+ column("refs", "Reference", 112),
1394
+ column("prompt", "Prompt", 128),
1395
+ column("scene", "Scene", 80),
1396
+ column("aspectRatio", "Aspect Ratio", 112),
1397
+ column("modelId", "Model", 112),
1398
+ column("createdAt", "Created Time", 116, { format: "date" }),
1399
+ column("projectName", "Project", 180, { role: "project", visible: false }),
1400
+ column("purpose", "Purpose", 140, { visible: false })
1401
+ ] : [
1402
+ column("previewUrl", "Preview", 120, { role: "preview" }),
1403
+ column("name", "Task", 260, { role: "name" }),
1404
+ column("state", "Status", 180, { role: "state" }),
1405
+ column("subjectType", "Type", 95),
1406
+ column("kind", "Format", 100),
1407
+ column("refs", "Reference", 100),
1408
+ column("prompt", "Prompt", 165),
1409
+ column("projectName", "Project", 200, { role: "project" }),
1410
+ column("aspectRatio", "Aspect Ratio", 104),
1411
+ column("modelId", "Model", 128),
1412
+ column("createdAt", "Created Time", 140, { format: "date" }),
1413
+ column("costLabel", "Actual cost", 120)
1414
+ ];
1415
+ return {
1416
+ id: `default:${source}`,
1417
+ revision: 0,
1418
+ view: customViewSchema.parse({
1419
+ source,
1420
+ name: "All",
1421
+ sql: defaultSql(source),
1422
+ columns
1423
+ })
1424
+ };
1425
+ }
1426
+ function defaultViews(source) {
1427
+ const base = defaultView(source);
1428
+ if (source === "projects") {
1429
+ return [
1430
+ base,
1431
+ ...projectCategories.map(([projectType2, name]) => ({
1432
+ ...base,
1433
+ id: `default:projects:${projectType2}`,
1434
+ view: {
1435
+ ...base.view,
1436
+ name,
1437
+ sql: "SELECT * FROM studio_projects WHERE projectType = :projectType ORDER BY createdAt DESC, rowId ASC",
1438
+ params: { projectType: projectType2 }
1439
+ }
1440
+ }))
1441
+ ];
1442
+ }
1443
+ if (source === "assets") {
1444
+ return [
1445
+ base,
1446
+ ...assetCategories.map(([category, name]) => {
1447
+ const id = `default:assets:${category}`;
1448
+ return { ...base, id, view: { ...base.view, name, ...assetBrowseQuery(id) } };
1449
+ }),
1450
+ {
1451
+ ...base,
1452
+ id: "default:favorites",
1453
+ view: { ...base.view, name: "Favorites", sql: defaultSql("assets", true) }
1454
+ }
1455
+ ];
1456
+ }
1457
+ return [base];
1458
+ }
1459
+ function decodeRef(value) {
1460
+ let item = value;
1461
+ if (typeof item === "string") {
1462
+ try {
1463
+ item = JSON.parse(item);
1464
+ } catch {
1465
+ return null;
1466
+ }
1467
+ }
1468
+ if (!item || typeof item !== "object" || Array.isArray(item)) return null;
1469
+ const ref = item;
1470
+ return ["storeId", "objectId", "versionId"].every(
1471
+ (key3) => typeof ref[key3] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key3])
1472
+ ) ? {
1473
+ storeId: ref.storeId,
1474
+ objectId: ref.objectId,
1475
+ versionId: ref.versionId
1476
+ } : null;
1477
+ }
1478
+ var refKey = (ref) => JSON.stringify([ref.storeId, ref.objectId, ref.versionId]);
1479
+ function rowRef(row, view) {
1480
+ return decodeRef(row[view.identity.ref]);
1481
+ }
1482
+ function taskCoverRef(row, view) {
1483
+ if (view.source !== "tasks") return null;
1484
+ let outputs = row[view.identity.outputs];
1485
+ if (typeof outputs === "string") {
1486
+ try {
1487
+ outputs = JSON.parse(outputs);
1488
+ } catch {
1489
+ return null;
1490
+ }
1491
+ }
1492
+ return Array.isArray(outputs) ? decodeRef(outputs[0]) : null;
1493
+ }
1494
+ function rowKey(row, view) {
1495
+ const id = row[view.identity.row];
1496
+ return (typeof id === "string" || typeof id === "number") && id !== "" ? JSON.stringify([view.source, id]) : null;
1497
+ }
1498
+ function presentationRows(rows, view) {
1499
+ const occurrences = /* @__PURE__ */ new Map();
1500
+ return rows.map((row) => {
1501
+ const content = JSON.stringify(row);
1502
+ const occurrence = occurrences.get(content) ?? 0;
1503
+ occurrences.set(content, occurrence + 1);
1504
+ return { row, renderKey: `${rowKey(row, view) ?? content}:${occurrence}` };
1505
+ });
1506
+ }
1507
+ function rowTitle(row, view) {
1508
+ const field = view.columns.find((c) => c.role === "name")?.path ?? "name";
1509
+ return String(row[field] ?? row[view.identity.row] ?? "Untitled");
1510
+ }
1511
+ function columnText(value, format = "text") {
1512
+ if (value === null || value === void 0) return "\u2014";
1513
+ if (format === "date") {
1514
+ const date2 = new Date(String(value));
1515
+ return Number.isNaN(date2.getTime()) ? String(value) : date2.toLocaleString("en-US", {
1516
+ year: "numeric",
1517
+ month: "short",
1518
+ day: "numeric",
1519
+ hour: "2-digit",
1520
+ minute: "2-digit"
1521
+ });
1522
+ }
1523
+ return typeof value === "object" ? JSON.stringify(value) : String(value);
1524
+ }
1525
+ function readRoute(url) {
1526
+ const requested = url.searchParams.get("page");
1527
+ const page = requested === "assets" || requested === "global-assets" || requested === "library" ? "assets" : requested === "tasks" || requested === "all-tasks" || requested === "generation-queue" ? "tasks" : "projects";
1528
+ const savedViewId = url.searchParams.get("view") || `default:${page}`;
1529
+ const oldCategory = projectCategories.find(
1530
+ ([, label]) => savedViewId === "default:projects:" + label
1531
+ );
1532
+ const view = oldCategory ? "default:projects:" + oldCategory[0] : savedViewId === "default:assets:text" ? "default:assets:script" : savedViewId;
1533
+ const offset = Number(url.searchParams.get("offset") ?? 0);
1534
+ const projectId = url.searchParams.get("projectId");
1535
+ const projectPage = url.searchParams.get("projectPage");
1536
+ const projectView = url.searchParams.get("projectView");
1537
+ const selected = url.searchParams.get("savedView");
1538
+ const home = !projectId && (requested === "home" || !requested && !url.searchParams.has("view"));
1539
+ return {
1540
+ ...home && {
1541
+ home: {
1542
+ mode: url.searchParams.get("tab") === "custom-views" ? "custom-views" : "dashboard",
1543
+ tab: url.searchParams.get("views") === "saved" ? "saved" : "preset",
1544
+ ...selected && { selected }
1545
+ }
1546
+ },
1547
+ page,
1548
+ view,
1549
+ layout: url.searchParams.get("layout") === "grid" ? "grid" : "list",
1550
+ offset: Number.isSafeInteger(offset) && offset >= 0 ? offset : 0,
1551
+ ref: decodeRef(url.searchParams.get("asset")),
1552
+ ...projectId ? {
1553
+ project: {
1554
+ id: projectId,
1555
+ page: projectPage === "create" || projectPage === "tasks" || projectPage === "settings" ? projectPage : "assets",
1556
+ ...projectView && { view: projectView }
1557
+ }
1558
+ } : {}
1559
+ };
1560
+ }
1561
+ function routeUrl(base, route) {
1562
+ const url = new URL(base);
1563
+ url.searchParams.set("page", route.home && !route.project ? "home" : route.page);
1564
+ for (const key3 of ["tab", "views", "savedView"]) url.searchParams.delete(key3);
1565
+ if (route.home?.mode === "custom-views" && !route.project) {
1566
+ url.searchParams.set("tab", "custom-views");
1567
+ if (route.home.tab === "saved") url.searchParams.set("views", "saved");
1568
+ if (route.home.selected !== void 0) url.searchParams.set("savedView", route.home.selected);
1569
+ }
1570
+ url.searchParams.set("view", route.view);
1571
+ url.searchParams.set("layout", route.layout);
1572
+ if (route.offset) url.searchParams.set("offset", String(route.offset));
1573
+ else url.searchParams.delete("offset");
1574
+ if (route.ref) url.searchParams.set("asset", JSON.stringify(route.ref));
1575
+ else url.searchParams.delete("asset");
1576
+ if (route.project) {
1577
+ url.searchParams.set("projectId", route.project.id);
1578
+ url.searchParams.set("projectPage", route.project.page);
1579
+ } else {
1580
+ url.searchParams.delete("projectId");
1581
+ url.searchParams.delete("projectPage");
1582
+ }
1583
+ if (route.project?.view) url.searchParams.set("projectView", route.project.view);
1584
+ else url.searchParams.delete("projectView");
1585
+ url.searchParams.delete("file");
1586
+ return url;
1587
+ }
1588
+ function projectUrl(embedUrl, origin, page = "assets", file) {
1589
+ const url = new URL(embedUrl, origin);
1590
+ if (url.origin !== origin) throw Error("Project entry must belong to this Host.");
1591
+ url.searchParams.set("page", page);
1592
+ if (file) url.searchParams.set("file", file);
1593
+ return url.pathname + url.search;
1594
+ }
1595
+
1596
+ // packages/studio-workbench/src/asset-filters.ts
1597
+ var categories = [
1598
+ ["Images", "format", "image"],
1599
+ ["Videos", "format", "video"],
1600
+ ["Audio", "format", "audio"],
1601
+ ["Script", "format", "text"],
1602
+ ["Characters", "subject", "character"],
1603
+ ["Scenes", "subject", "scene"],
1604
+ ["Products", "subject", "product"],
1605
+ ["Models", "subject", "model"]
1606
+ ];
1607
+ var ratio = "coalesce(json_extract(a.parameters, '$.aspectRatio'), json_extract(a.parameters, '$.aspect_ratio'))";
1608
+ var fields = {
1609
+ aspect: ratio,
1610
+ model: "a.modelId",
1611
+ state: "a.state",
1612
+ project: "a.projectId",
1613
+ format: "a.kind",
1614
+ subject: "lower(coalesce(json_extract(a.metadata, '$.subjectType'), json_extract(a.metadata, '$.shortDramaReferenceType'), json_extract(a.metadata, '$.category')))"
1615
+ };
1616
+ function libraryQuery(source, viewId, filters, legacy = false) {
1617
+ const expressions = { ...fields };
1618
+ if (source === "tasks") {
1619
+ expressions.subject = `lower(coalesce(json_extract(a.parameters, '$.subjectType'), (SELECT coalesce(json_extract(asset.metadata, '$.subjectType'), json_extract(asset.metadata, '$.shortDramaReferenceType'), json_extract(asset.metadata, '$.category')) FROM studio_assets AS asset WHERE asset.projectId=a.projectId AND asset.assetId=a.targetAssetId LIMIT 1)))`;
1620
+ } else {
1621
+ if (!legacy) expressions.subject = "lower(a.subjectType)";
1622
+ expressions.aspect = `coalesce(${ratio}, json_extract(a.metadata, '$.aspectRatio'), json_extract(a.metadata, '$.adSource.aspectRatio'))`;
1623
+ }
1624
+ const params = {};
1625
+ const conditions = [];
1626
+ const category = categories.find(([, , value]) => viewId === "default:" + source + ":" + value);
1627
+ if (source === "assets" && (viewId === "default:assets:script" || viewId === "default:assets:text")) {
1628
+ conditions.push(legacy ? "a.kind = :category" : "a.purpose = :category");
1629
+ params.category = legacy ? "text" : "script";
1630
+ } else if (category) {
1631
+ conditions.push(expressions[category[1]] + " = :category");
1632
+ params.category = category[2];
1633
+ }
1634
+ for (const field of ["project", "format", "subject", "aspect", "model", "state"]) {
1635
+ const values = filters[field] ?? [];
1636
+ if (!values.length) continue;
1637
+ const bindings = values.map((value, index) => {
1638
+ const key3 = field + index;
1639
+ params[key3] = field === "subject" ? value.toLowerCase() : value;
1640
+ return ":" + key3;
1641
+ });
1642
+ conditions.push(expressions[field] + " IN (" + bindings.join(", ") + ")");
1643
+ }
1644
+ const sql = defaultSql(
1645
+ source,
1646
+ source === "assets" && (viewId === "default:favorites" || !!filters.favorite?.length),
1647
+ conditions
1648
+ );
1649
+ const orderByProject = !legacy && source === "assets" && !sql.includes("studio_asset_versions") && Object.values(filters).some((values) => values?.length);
1650
+ return {
1651
+ sql: orderByProject ? sql.replace(
1652
+ "ORDER BY a.createdAt",
1653
+ "ORDER BY p.name, a.orderKey IS NULL, a.orderKey, a.createdAt"
1654
+ ) : sql,
1655
+ params
1656
+ };
895
1657
  }
896
- function useWorkspaceTheme() {
897
- const [preference, setPreference] = useState5(readPreference);
898
- const [system, setSystem] = useState5(() => globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light");
899
- useEffect3(() => {
900
- const query = globalThis.matchMedia?.("(prefers-color-scheme: dark)");
901
- const synchronize = () => setPreference(readPreference());
902
- const systemChanged = () => setSystem(query?.matches ? "dark" : "light");
903
- addEventListener("storage", synchronize);
904
- addEventListener(event, synchronize);
905
- query?.addEventListener("change", systemChanged);
906
- return () => {
907
- removeEventListener("storage", synchronize);
908
- removeEventListener(event, synchronize);
909
- query?.removeEventListener("change", systemChanged);
1658
+ var projectTypes = projectCategories.map(([value, label]) => ({ value, label }));
1659
+ function projectQuery(viewId, filters) {
1660
+ const types = filters.type?.length ? filters.type : projectCategories.map(([value]) => value);
1661
+ const q = projectBrowseQuery(viewId, types);
1662
+ if (filters.availability?.length === 1)
1663
+ return {
1664
+ sql: q.sql.replace(" ORDER BY", " AND available = :available ORDER BY"),
1665
+ params: { ...q.params, available: filters.availability[0] === "Available" ? 1 : 0 }
910
1666
  };
911
- }, []);
912
- function update(value) {
913
- setPreference(value);
914
- try {
915
- localStorage.setItem(key, value);
916
- dispatchEvent(new Event(event));
917
- } catch {
918
- }
919
- }
920
- return { theme: preference === "system" ? system : preference, preference, update };
1667
+ return q;
1668
+ }
1669
+ function categoryViews(source) {
1670
+ const base = defaultView(source);
1671
+ if (source !== "tasks")
1672
+ return defaultViews(source).slice(1).filter(({ id }) => id !== "default:favorites");
1673
+ return categories.map(([name, , value]) => {
1674
+ const id = "default:" + source + ":" + value;
1675
+ return { ...base, id, view: { ...base.view, name, ...libraryQuery(source, id, {}) } };
1676
+ });
921
1677
  }
922
1678
 
923
1679
  // packages/studio-workbench/src/global-workbench.tsx
@@ -933,48 +1689,48 @@ function taskCostLabel(task) {
933
1689
  }
934
1690
 
935
1691
  // packages/project-studio/src/shared.ts
936
- import { z as z4, defineOperation } from "vivix-studio/sdk/shared";
1692
+ import { z as z5, defineOperation } from "vivix-studio/sdk/shared";
937
1693
 
938
1694
  // packages/project-studio/src/ads-shared.ts
939
- import { z as z3 } from "vivix-studio/sdk/shared";
940
- var fixedRef = z3.object({ storeId: z3.uuid(), objectId: z3.uuid(), versionId: z3.uuid() }).strict();
941
- var copy = z3.string().max(8e3).default("");
942
- var clipScript = z3.object({
943
- title: z3.string().trim().min(1).max(200),
1695
+ import { z as z4 } from "vivix-studio/sdk/shared";
1696
+ var fixedRef = z4.object({ storeId: z4.uuid(), objectId: z4.uuid(), versionId: z4.uuid() }).strict();
1697
+ var copy = z4.string().max(8e3).default("");
1698
+ var clipScript = z4.object({
1699
+ title: z4.string().trim().min(1).max(200),
944
1700
  visual: copy,
945
1701
  voiceover: copy,
946
1702
  onScreenText: copy,
947
1703
  cta: copy,
948
- plannedDurationMs: z3.number().int().positive().nullable().default(null)
1704
+ plannedDurationMs: z4.number().int().positive().nullable().default(null)
949
1705
  }).strict();
950
- var adBrief = z3.object({
1706
+ var adBrief = z4.object({
951
1707
  product: copy,
952
1708
  category: copy,
953
1709
  audience: copy,
954
1710
  sellingPoints: copy,
955
1711
  channel: copy,
956
- aspectRatio: z3.string().max(40).nullable().default(null),
957
- targetDurationMs: z3.number().int().positive().nullable().default(null),
1712
+ aspectRatio: z4.string().max(40).nullable().default(null),
1713
+ targetDurationMs: z4.number().int().positive().nullable().default(null),
958
1714
  body: copy,
959
- productRefs: z3.array(fixedRef).max(100).default([]),
960
- modelRefs: z3.array(fixedRef).max(100).default([])
1715
+ productRefs: z4.array(fixedRef).max(100).default([]),
1716
+ modelRefs: z4.array(fixedRef).max(100).default([])
961
1717
  }).strict();
962
- var adFilm = z3.object({
963
- title: z3.string().trim().min(1).max(150),
1718
+ var adFilm = z4.object({
1719
+ title: z4.string().trim().min(1).max(150),
964
1720
  source: fixedRef,
965
- width: z3.number().int().positive().max(8192),
966
- height: z3.number().int().positive().max(8192),
967
- aspectRatio: z3.string().regex(/^\d+:\d+$/)
1721
+ width: z4.number().int().positive().max(8192),
1722
+ height: z4.number().int().positive().max(8192),
1723
+ aspectRatio: z4.string().regex(/^\d+:\d+$/)
968
1724
  }).strict();
969
- var adStoryboard = z3.object({
1725
+ var adStoryboard = z4.object({
970
1726
  brief: adBrief,
971
- films: z3.array(adFilm).max(100).optional(),
972
- clips: z3.array(
973
- z3.object({
974
- assetId: z3.uuid(),
975
- filmId: z3.uuid().optional(),
1727
+ films: z4.array(adFilm).max(100).optional(),
1728
+ clips: z4.array(
1729
+ z4.object({
1730
+ assetId: z4.uuid(),
1731
+ filmId: z4.uuid().optional(),
976
1732
  script: clipScript,
977
- edits: z3.array(z3.object({ sourceVersionId: z3.uuid(), editRef: fixedRef }).strict()).max(200)
1733
+ edits: z4.array(z4.object({ sourceVersionId: z4.uuid(), editRef: fixedRef }).strict()).max(200)
978
1734
  }).strict()
979
1735
  ).max(200)
980
1736
  }).strict().superRefine((value, context) => {
@@ -989,77 +1745,80 @@ var adStoryboard = z3.object({
989
1745
  });
990
1746
 
991
1747
  // packages/project-studio/src/shared.ts
992
- var studioConfig = z4.object({
993
- role: z4.enum(["project", "coordinator"]).default("project"),
994
- dataInstance: z4.string().min(1).default("user:data"),
995
- apiInstance: z4.string().min(1).default("api"),
996
- libraryInstance: z4.string().min(1).nullable().default(null),
997
- coordinatorInstance: z4.string().min(1).optional()
1748
+ var projectType = z5.enum(["short-drama", "product-ad", "other"]);
1749
+ var studioConfig = z5.object({
1750
+ role: z5.enum(["project", "coordinator"]).default("project"),
1751
+ projectType: projectType.optional(),
1752
+ dataInstance: z5.string().min(1).default("user:data"),
1753
+ apiInstance: z5.string().min(1).default("api"),
1754
+ libraryInstance: z5.string().min(1).nullable().default(null),
1755
+ coordinatorInstance: z5.string().min(1).optional()
998
1756
  }).strict();
999
- var versionRef = z4.object({ storeId: z4.uuid(), objectId: z4.uuid(), versionId: z4.uuid() }).strict();
1000
- var tags = z4.array(z4.string().trim().min(1).max(64)).max(50).transform((x) => [...new Set(x)]).default([]);
1001
- var kind = z4.enum(["text", "image", "video", "audio", "file"]);
1002
- var projectData = z4.object({
1003
- name: z4.string().trim().min(1).max(120),
1004
- description: z4.string().max(4e3).default(""),
1005
- status: z4.enum(["draft", "active", "archived"]).default("draft"),
1006
- aspectRatio: z4.string().nullable().default(null),
1757
+ var versionRef = z5.object({ storeId: z5.uuid(), objectId: z5.uuid(), versionId: z5.uuid() }).strict();
1758
+ var tags = z5.array(z5.string().trim().min(1).max(64)).max(50).transform((x) => [...new Set(x)]).default([]);
1759
+ var kind = z5.enum(["text", "image", "video", "audio", "file"]);
1760
+ var projectData = z5.object({
1761
+ name: z5.string().trim().min(1).max(120),
1762
+ description: z5.string().max(4e3).default(""),
1763
+ status: z5.enum(["draft", "active", "archived"]).default("draft"),
1764
+ aspectRatio: z5.string().nullable().default(null),
1765
+ projectType: projectType.optional(),
1007
1766
  coverRef: versionRef.nullable().default(null),
1008
- briefRef: z4.object({ storeId: z4.uuid(), objectId: z4.uuid() }).strict().nullable().default(null),
1767
+ briefRef: z5.object({ storeId: z5.uuid(), objectId: z5.uuid() }).strict().nullable().default(null),
1009
1768
  tags
1010
1769
  }).strict();
1011
- var assetData = z4.object({
1012
- projectId: z4.uuid(),
1013
- name: z4.string().trim().min(1).max(200),
1770
+ var assetData = z5.object({
1771
+ projectId: z5.uuid(),
1772
+ name: z5.string().trim().min(1).max(200),
1014
1773
  kind,
1015
- purpose: z4.enum(["reference", "script", "shot", "music", "voice", "subtitle", "final", "other"]).default("other"),
1016
- origin: z4.enum(["upload", "library", "generated", "authored"]),
1017
- orderKey: z4.number().int().nullable().default(null),
1774
+ purpose: z5.enum(["reference", "script", "shot", "music", "voice", "subtitle", "final", "other"]).default("other"),
1775
+ origin: z5.enum(["upload", "library", "generated", "authored"]),
1776
+ orderKey: z5.number().int().nullable().default(null),
1018
1777
  tags,
1019
- lifecycle: z4.enum(["draft", "ready", "archived"]).default("draft"),
1778
+ lifecycle: z5.enum(["draft", "ready", "archived"]).default("draft"),
1020
1779
  sourceRef: versionRef.nullable().default(null),
1021
- adoptedVersionId: z4.uuid().nullable().default(null)
1780
+ adoptedVersionId: z5.uuid().nullable().default(null)
1022
1781
  }).strict();
1023
- var anchor = z4.discriminatedUnion("kind", [
1024
- z4.object({ kind: z4.literal("whole") }).strict(),
1025
- z4.object({
1026
- kind: z4.literal("timeRange"),
1027
- startMs: z4.number().int().nonnegative(),
1028
- endMs: z4.number().int().nonnegative()
1782
+ var anchor = z5.discriminatedUnion("kind", [
1783
+ z5.object({ kind: z5.literal("whole") }).strict(),
1784
+ z5.object({
1785
+ kind: z5.literal("timeRange"),
1786
+ startMs: z5.number().int().nonnegative(),
1787
+ endMs: z5.number().int().nonnegative()
1029
1788
  }).strict()
1030
1789
  ]);
1031
- var generationInput = z4.object({
1032
- targetAssetId: z4.uuid().optional(),
1033
- taskName: z4.string().trim().min(1).max(200).optional(),
1034
- context: z4.record(z4.string().min(1).max(64), z4.string().min(1).max(200)).optional(),
1035
- expectedRevision: z4.number().int().positive().optional(),
1036
- newAsset: z4.object({
1037
- name: z4.string().trim().min(1).max(200),
1038
- kind: z4.enum(["image", "video", "audio"])
1790
+ var generationInput = z5.object({
1791
+ targetAssetId: z5.uuid().optional(),
1792
+ taskName: z5.string().trim().min(1).max(200).optional(),
1793
+ context: z5.record(z5.string().min(1).max(64), z5.string().min(1).max(200)).optional(),
1794
+ expectedRevision: z5.number().int().positive().optional(),
1795
+ newAsset: z5.object({
1796
+ name: z5.string().trim().min(1).max(200),
1797
+ kind: z5.enum(["image", "video", "audio"])
1039
1798
  }).strict().optional(),
1040
- modelId: z4.string().min(1),
1041
- capabilityId: z4.string().min(1),
1042
- prompt: z4.string().max(32e3),
1043
- parameters: z4.record(z4.string(), z4.unknown()).default({}),
1044
- outputCount: z4.number().int().min(1).max(100).default(1),
1045
- inputs: z4.array(
1046
- z4.object({
1799
+ modelId: z5.string().min(1),
1800
+ capabilityId: z5.string().min(1),
1801
+ prompt: z5.string().max(32e3),
1802
+ parameters: z5.record(z5.string(), z5.unknown()).default({}),
1803
+ outputCount: z5.number().int().min(1).max(100).default(1),
1804
+ inputs: z5.array(
1805
+ z5.object({
1047
1806
  ref: versionRef,
1048
- role: z4.string().min(1),
1049
- order: z4.number().int().nonnegative(),
1050
- weight: z4.number().finite().nullable().default(null)
1807
+ role: z5.string().min(1),
1808
+ order: z5.number().int().nonnegative(),
1809
+ weight: z5.number().finite().nullable().default(null)
1051
1810
  }).strict()
1052
1811
  ).max(100).default([]),
1053
- baseVersionId: z4.uuid().optional(),
1054
- changeRequest: z4.string().trim().min(1).max(4e3).optional(),
1055
- preserveRequest: z4.string().max(4e3).default(""),
1812
+ baseVersionId: z5.uuid().optional(),
1813
+ changeRequest: z5.string().trim().min(1).max(4e3).optional(),
1814
+ preserveRequest: z5.string().max(4e3).default(""),
1056
1815
  anchor: anchor.default({ kind: "whole" }),
1057
- retryOfTaskId: z4.uuid().optional(),
1058
- acknowledgeUnknown: z4.boolean().optional()
1816
+ retryOfTaskId: z5.uuid().optional(),
1817
+ acknowledgeUnknown: z5.boolean().optional()
1059
1818
  }).strict();
1060
- var projectSettingsInput = z4.object({
1061
- projectId: z4.uuid(),
1062
- expectedRevision: z4.number().int().positive(),
1819
+ var projectSettingsInput = z5.object({
1820
+ projectId: z5.uuid(),
1821
+ expectedRevision: z5.number().int().positive(),
1063
1822
  changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
1064
1823
  description: projectData.shape.description.unwrap(),
1065
1824
  tags: projectData.shape.tags.unwrap(),
@@ -1072,21 +1831,22 @@ var generationSubmitOperation = defineOperation({
1072
1831
  title: "Generate",
1073
1832
  description: "Submit one media generation without approval, retaining its paid request identity.",
1074
1833
  input: generationInput,
1075
- output: z4.any(),
1834
+ output: z5.any(),
1076
1835
  effects: ["write", "paid"],
1077
1836
  confirm: "none"
1078
1837
  });
1079
- var favoriteData = z4.object({ ref: versionRef }).strict();
1080
- var sqlScalar = z4.union([z4.string(), z4.number().finite(), z4.null()]);
1081
- var globalQueryInput = z4.object({
1082
- sql: z4.string().trim().min(1),
1083
- params: z4.union([z4.array(sqlScalar), z4.record(z4.string(), sqlScalar)]).optional(),
1084
- timeoutMs: z4.number().int().positive().optional(),
1085
- maxRows: z4.number().int().positive().optional(),
1086
- limit: z4.number().int().min(1).max(200).optional(),
1087
- offset: z4.number().int().nonnegative().optional(),
1088
- source: z4.enum(["projects", "assets", "tasks"]),
1089
- catalog: z4.array(z4.object({ id: z4.string().min(1), name: z4.string(), available: z4.boolean() }).strict()).optional()
1838
+ var favoriteData = z5.object({ ref: versionRef }).strict();
1839
+ var sqlScalar = z5.union([z5.string(), z5.number().finite(), z5.null()]);
1840
+ var globalQueryInput = z5.object({
1841
+ sql: z5.string().trim().min(1),
1842
+ params: z5.union([z5.array(sqlScalar), z5.record(z5.string(), sqlScalar)]).optional(),
1843
+ timeoutMs: z5.number().int().positive().optional(),
1844
+ maxRows: z5.number().int().positive().optional(),
1845
+ limit: z5.number().int().min(1).max(200).optional(),
1846
+ offset: z5.number().int().nonnegative().optional(),
1847
+ source: z5.enum(["projects", "assets", "tasks"]),
1848
+ excludeProjectIds: z5.array(z5.uuid()).optional(),
1849
+ catalog: z5.array(z5.object({ id: z5.string().min(1), name: z5.string(), available: z5.boolean() }).strict()).optional()
1090
1850
  }).strict();
1091
1851
 
1092
1852
  // packages/project-studio/src/user-actions.ts
@@ -1190,23 +1950,24 @@ function userActionsBridge(client, config) {
1190
1950
  }
1191
1951
 
1192
1952
  // packages/studio-workbench/src/shared.ts
1193
- import { z as z5 } from "vivix-studio/sdk/shared";
1194
- var uiReference = z5.object({ plugin: z5.string().regex(/^[a-z][a-z0-9-]*$/), id: z5.string().min(1) }).strict();
1195
- var savedProjectView = z5.object({ projectId: z5.uuid(), viewId: z5.string().min(1), title: z5.string().min(1) }).strict();
1196
- var Config = z5.object({
1197
- studioInstance: z5.string().min(1).nullable().default(null),
1198
- operationInstance: z5.string().min(1).default("workbench"),
1199
- mediaInstance: z5.string().min(1).nullable().default(null),
1200
- magicEditInstance: z5.string().min(1).optional(),
1201
- apiInstance: z5.string().min(1).nullable().default(null),
1202
- libraryInstance: z5.string().min(1).nullable().default(null),
1203
- libraryServiceInstance: z5.string().min(1).nullable().default(null),
1204
- views: z5.object({
1205
- assetList: uiReference.optional()
1953
+ import { z as z6 } from "vivix-studio/sdk/shared";
1954
+ var uiReference = z6.object({ plugin: z6.string().regex(/^[a-z][a-z0-9-]*$/), id: z6.string().min(1) }).strict();
1955
+ var savedProjectView = z6.object({ projectId: z6.uuid(), viewId: z6.string().min(1), title: z6.string().min(1) }).strict();
1956
+ var Config = z6.object({
1957
+ studioInstance: z6.string().min(1).nullable().default(null),
1958
+ operationInstance: z6.string().min(1).default("workbench"),
1959
+ mediaInstance: z6.string().min(1).nullable().default(null),
1960
+ magicEditInstance: z6.string().min(1).optional(),
1961
+ apiInstance: z6.string().min(1).nullable().default(null),
1962
+ libraryInstance: z6.string().min(1).nullable().default(null),
1963
+ libraryServiceInstance: z6.string().min(1).nullable().default(null),
1964
+ views: z6.object({
1965
+ assetList: uiReference.optional(),
1966
+ projectCreator: uiReference.optional()
1206
1967
  }).strict().default({}),
1207
- dashboard: z5.array(uiReference).optional(),
1208
- savedViews: z5.array(z5.union([uiReference, savedProjectView])).default([]),
1209
- dataInstance: z5.string().min(1).default("user:data")
1968
+ dashboard: z6.array(uiReference).optional(),
1969
+ savedViews: z6.array(z6.union([uiReference, savedProjectView])).default([]),
1970
+ dataInstance: z6.string().min(1).default("user:data")
1210
1971
  }).strict();
1211
1972
  var dependencies = (config) => [
1212
1973
  ...new Set(
@@ -1223,227 +1984,6 @@ var dependencies = (config) => [
1223
1984
  ];
1224
1985
  var draftKey = (workspaceId, projectId, target) => JSON.stringify(["generation-draft", 1, workspaceId, projectId, target]);
1225
1986
 
1226
- // packages/studio-workbench/src/query-view.ts
1227
- import { z as z6 } from "vivix-studio/sdk/shared";
1228
-
1229
- // packages/studio-workbench/src/view-common.ts
1230
- var pageSources = ["projects", "assets", "tasks"];
1231
- var pageTitles = {
1232
- projects: "Manage Projects",
1233
- assets: "Global Asset",
1234
- tasks: "Generation Queue"
1235
- };
1236
- function supportedImport(file) {
1237
- return /^(image|video|audio|text)\//.test(file.type) || !file.type && /\.(txt|md|csv|srt|vtt)$/i.test(file.name);
1238
- }
1239
-
1240
- // packages/studio-workbench/src/query-view.ts
1241
- var columnName = z6.string().min(1).max(200).refine((value) => !/[\u0000-\u001f]/.test(value));
1242
- var scalar = z6.union([z6.null(), z6.string(), z6.number().finite()]);
1243
- var customViewSchema = z6.object({
1244
- source: z6.enum(pageSources),
1245
- projectId: z6.uuid().optional(),
1246
- name: z6.string().trim().min(1).max(120),
1247
- sql: z6.string().trim().min(1).max(32e3),
1248
- params: z6.union([z6.array(scalar), z6.record(z6.string(), scalar)]).default([]),
1249
- columns: z6.array(
1250
- z6.object({
1251
- path: columnName,
1252
- label: z6.string().min(1).max(120).optional(),
1253
- width: z6.number().int().min(80).max(600).default(140),
1254
- visible: z6.boolean().default(true),
1255
- format: z6.enum(["text", "categories", "date", "json"]).default("text"),
1256
- role: z6.enum(["name", "preview", "state", "project"]).optional()
1257
- }).strict()
1258
- ).min(1).max(60).refine(
1259
- (columns) => new Set(columns.map((c) => c.path)).size === columns.length,
1260
- "Column names must be unique."
1261
- ),
1262
- identity: z6.object({
1263
- row: columnName.default("rowId"),
1264
- project: columnName.default("projectId"),
1265
- ref: columnName.default("ref"),
1266
- outputs: columnName.default("outputRefs")
1267
- }).strict().default({ row: "rowId", project: "projectId", ref: "ref", outputs: "outputRefs" })
1268
- }).strict();
1269
- var column = (path, label, width = 140, extra = {}) => ({ path, label, width, visible: true, format: "text", ...extra });
1270
- function defaultSql(source, favorites = false) {
1271
- if (source === "projects")
1272
- return "SELECT * FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
1273
- const table = favorites ? "studio_asset_versions" : `studio_${source}`;
1274
- return `SELECT a.*, p.name AS projectName, p.available AS projectAvailable FROM ${table} AS a LEFT JOIN studio_projects AS p ON p.projectId = a.projectId${favorites ? " WHERE a.favorite = 1" : ""} ORDER BY a.createdAt DESC, a.rowId ASC`;
1275
- }
1276
- function defaultView(source) {
1277
- const columns = source === "projects" ? [
1278
- column("previewUrl", "Preview", 120, { role: "preview" }),
1279
- column("name", "Project title", 260, { role: "name" }),
1280
- column("assetCount", "Assets", 120),
1281
- column("available", "Available", 120),
1282
- column("createdAt", "Created Time", 160, { format: "date" })
1283
- ] : source === "assets" ? [
1284
- column("previewUrl", "Preview", 120, { role: "preview" }),
1285
- column("name", "Asset", 240, { role: "name" }),
1286
- column("subjectType", "Type", 100),
1287
- column("kind", "Format", 100),
1288
- column("prompt", "Prompt", 280),
1289
- column("projectName", "Project", 180, { role: "project" }),
1290
- column("modelId", "Model", 160),
1291
- column("createdAt", "Created Time", 160, { format: "date" }),
1292
- column("purpose", "Purpose", 140, { visible: false })
1293
- ] : [
1294
- column("previewUrl", "Preview", 120, { role: "preview" }),
1295
- column("name", "Task", 260, { role: "name" }),
1296
- column("state", "Status", 180, { role: "state" }),
1297
- column("costLabel", "Actual cost", 180),
1298
- column("kind", "Format", 100),
1299
- column("prompt", "Prompt", 280),
1300
- column("projectName", "Project", 200, { role: "project" }),
1301
- column("modelId", "Model", 160),
1302
- column("createdAt", "Created Time", 160, { format: "date" })
1303
- ];
1304
- return {
1305
- id: `default:${source}`,
1306
- revision: 0,
1307
- view: customViewSchema.parse({
1308
- source,
1309
- name: "All",
1310
- sql: defaultSql(source),
1311
- columns
1312
- })
1313
- };
1314
- }
1315
- function decodeRef(value) {
1316
- let item = value;
1317
- if (typeof item === "string") {
1318
- try {
1319
- item = JSON.parse(item);
1320
- } catch {
1321
- return null;
1322
- }
1323
- }
1324
- if (!item || typeof item !== "object" || Array.isArray(item)) return null;
1325
- const ref = item;
1326
- return ["storeId", "objectId", "versionId"].every(
1327
- (key3) => typeof ref[key3] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key3])
1328
- ) ? {
1329
- storeId: ref.storeId,
1330
- objectId: ref.objectId,
1331
- versionId: ref.versionId
1332
- } : null;
1333
- }
1334
- var refKey = (ref) => JSON.stringify([ref.storeId, ref.objectId, ref.versionId]);
1335
- function rowRef(row, view) {
1336
- return decodeRef(row[view.identity.ref]);
1337
- }
1338
- function taskCoverRef(row, view) {
1339
- if (view.source !== "tasks") return null;
1340
- let outputs = row[view.identity.outputs];
1341
- if (typeof outputs === "string") {
1342
- try {
1343
- outputs = JSON.parse(outputs);
1344
- } catch {
1345
- return null;
1346
- }
1347
- }
1348
- return Array.isArray(outputs) ? decodeRef(outputs[0]) : null;
1349
- }
1350
- function rowKey(row, view) {
1351
- const id = row[view.identity.row];
1352
- return (typeof id === "string" || typeof id === "number") && id !== "" ? JSON.stringify([view.source, id]) : null;
1353
- }
1354
- function presentationRows(rows, view) {
1355
- const occurrences = /* @__PURE__ */ new Map();
1356
- return rows.map((row) => {
1357
- const content = JSON.stringify(row);
1358
- const occurrence = occurrences.get(content) ?? 0;
1359
- occurrences.set(content, occurrence + 1);
1360
- return { row, renderKey: `${rowKey(row, view) ?? content}:${occurrence}` };
1361
- });
1362
- }
1363
- function rowTitle(row, view) {
1364
- const field = view.columns.find((c) => c.role === "name")?.path ?? "name";
1365
- return String(row[field] ?? row[view.identity.row] ?? "Untitled");
1366
- }
1367
- function columnText(value, format = "text") {
1368
- if (value === null || value === void 0) return "\u2014";
1369
- if (format === "date") {
1370
- const date2 = new Date(String(value));
1371
- return Number.isNaN(date2.getTime()) ? String(value) : date2.toLocaleString("en-US", {
1372
- year: "numeric",
1373
- month: "short",
1374
- day: "numeric",
1375
- hour: "2-digit",
1376
- minute: "2-digit"
1377
- });
1378
- }
1379
- return typeof value === "object" ? JSON.stringify(value) : String(value);
1380
- }
1381
- function readRoute(url) {
1382
- const requested = url.searchParams.get("page");
1383
- const page = requested === "assets" || requested === "global-assets" || requested === "library" ? "assets" : requested === "tasks" || requested === "all-tasks" || requested === "generation-queue" ? "tasks" : "projects";
1384
- const offset = Number(url.searchParams.get("offset") ?? 0);
1385
- const projectId = url.searchParams.get("projectId");
1386
- const projectPage = url.searchParams.get("projectPage");
1387
- const projectView = url.searchParams.get("projectView");
1388
- const selected = url.searchParams.get("savedView");
1389
- const home = !projectId && (requested === "home" || !requested && !url.searchParams.has("view"));
1390
- return {
1391
- ...home && {
1392
- home: {
1393
- mode: url.searchParams.get("tab") === "custom-views" ? "custom-views" : "dashboard",
1394
- tab: url.searchParams.get("views") === "saved" ? "saved" : "preset",
1395
- ...selected && { selected }
1396
- }
1397
- },
1398
- page,
1399
- view: url.searchParams.get("view") || `default:${page}`,
1400
- layout: url.searchParams.get("layout") === "grid" ? "grid" : "list",
1401
- offset: Number.isSafeInteger(offset) && offset >= 0 ? offset : 0,
1402
- ref: decodeRef(url.searchParams.get("asset")),
1403
- ...projectId ? {
1404
- project: {
1405
- id: projectId,
1406
- page: projectPage === "create" || projectPage === "tasks" || projectPage === "settings" ? projectPage : "assets",
1407
- ...projectView && { view: projectView }
1408
- }
1409
- } : {}
1410
- };
1411
- }
1412
- function routeUrl(base, route) {
1413
- const url = new URL(base);
1414
- url.searchParams.set("page", route.home && !route.project ? "home" : route.page);
1415
- for (const key3 of ["tab", "views", "savedView"]) url.searchParams.delete(key3);
1416
- if (route.home?.mode === "custom-views" && !route.project) {
1417
- url.searchParams.set("tab", "custom-views");
1418
- if (route.home.tab === "saved") url.searchParams.set("views", "saved");
1419
- if (route.home.selected !== void 0) url.searchParams.set("savedView", route.home.selected);
1420
- }
1421
- url.searchParams.set("view", route.view);
1422
- url.searchParams.set("layout", route.layout);
1423
- if (route.offset) url.searchParams.set("offset", String(route.offset));
1424
- else url.searchParams.delete("offset");
1425
- if (route.ref) url.searchParams.set("asset", JSON.stringify(route.ref));
1426
- else url.searchParams.delete("asset");
1427
- if (route.project) {
1428
- url.searchParams.set("projectId", route.project.id);
1429
- url.searchParams.set("projectPage", route.project.page);
1430
- } else {
1431
- url.searchParams.delete("projectId");
1432
- url.searchParams.delete("projectPage");
1433
- }
1434
- if (route.project?.view) url.searchParams.set("projectView", route.project.view);
1435
- else url.searchParams.delete("projectView");
1436
- url.searchParams.delete("file");
1437
- return url;
1438
- }
1439
- function projectUrl(embedUrl, origin, page = "assets", file) {
1440
- const url = new URL(embedUrl, origin);
1441
- if (url.origin !== origin) throw Error("Project entry must belong to this Host.");
1442
- url.searchParams.set("page", page);
1443
- if (file) url.searchParams.set("file", file);
1444
- return url.pathname + url.search;
1445
- }
1446
-
1447
1987
  // packages/studio-workbench/src/query-results.tsx
1448
1988
  import * as React from "react";
1449
1989
  function QueryResults({
@@ -1464,6 +2004,7 @@ function QueryResults({
1464
2004
  renderCell,
1465
2005
  rowActions
1466
2006
  }) {
2007
+ const libraryGrid = active.id?.startsWith("default:");
1467
2008
  return /* @__PURE__ */ React.createElement("div", { className: "studio-results", "aria-busy": queryLoading }, route.layout === "list" ? /* @__PURE__ */ React.createElement("div", { className: "studio-table-scroll" }, /* @__PURE__ */ React.createElement(
1468
2009
  "table",
1469
2010
  {
@@ -1471,7 +2012,7 @@ function QueryResults({
1471
2012
  "aria-label": pageTitles[route.page]
1472
2013
  },
1473
2014
  /* @__PURE__ */ React.createElement("colgroup", null, selecting && /* @__PURE__ */ React.createElement("col", { style: { width: 48 } }), visibleColumns.map((column2) => /* @__PURE__ */ React.createElement("col", { key: column2.path, style: { width: column2.width } })), /* @__PURE__ */ React.createElement("col", { style: { width: 100 } })),
1474
- /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement("tr", null, selecting && /* @__PURE__ */ React.createElement("th", { scope: "col" }, "Select"), visibleColumns.map((column2) => /* @__PURE__ */ React.createElement("th", { key: column2.path, scope: "col" }, column2.label ?? column2.path)), /* @__PURE__ */ React.createElement("th", { scope: "col" }, "Action"))),
2015
+ /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement("tr", null, selecting && /* @__PURE__ */ React.createElement("th", { scope: "col" }, "Select"), visibleColumns.map((column2) => /* @__PURE__ */ React.createElement("th", { key: column2.path, scope: "col" }, column2.label ?? column2.path)), active.id !== "default:assets" && /* @__PURE__ */ React.createElement("th", { scope: "col" }, "Action"))),
1475
2016
  /* @__PURE__ */ React.createElement("tbody", null, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React.createElement(
1476
2017
  "tr",
1477
2018
  {
@@ -1499,18 +2040,37 @@ function QueryResults({
1499
2040
  onClick: () => selecting ? toggle(row) : openRow(row)
1500
2041
  }
1501
2042
  ) : renderCell(row, column2))),
1502
- /* @__PURE__ */ React.createElement("td", null, !selecting && rowActions(row))
2043
+ active.id !== "default:assets" && /* @__PURE__ */ React.createElement("td", null, !selecting && rowActions(row))
1503
2044
  )))
1504
- ), !rows.length && /* @__PURE__ */ React.createElement("div", { className: "studio-empty", role: "status" }, queryLoading ? "Loading\u2026" : failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")) : /* @__PURE__ */ React.createElement("div", { className: "studio-grid" }, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React.createElement(
2045
+ ), !rows.length && /* @__PURE__ */ React.createElement("div", { className: "studio-empty", role: "status" }, queryLoading ? "Loading\u2026" : failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")) : /* @__PURE__ */ React.createElement("div", { className: libraryGrid ? "studio-grid vx-asset-grid" : "studio-grid" }, presentationRows(rows, active.view).map(({ row, renderKey }) => /* @__PURE__ */ React.createElement(
1505
2046
  "article",
1506
2047
  {
1507
2048
  key: renderKey,
1508
2049
  "data-row-id": rowKey(row, active.view) ?? void 0,
1509
2050
  "data-magic-edit-project": annotationProject(row),
1510
- className: "studio-card"
2051
+ className: libraryGrid ? "studio-card vx-asset-tile" : "studio-card"
1511
2052
  },
1512
2053
  cover(row),
1513
- /* @__PURE__ */ React.createElement("div", { className: "studio-card-heading" }, /* @__PURE__ */ React.createElement(
2054
+ libraryGrid ? /* @__PURE__ */ React.createElement(
2055
+ AssetTileCaption,
2056
+ {
2057
+ title: rowTitle(row, active.view),
2058
+ onOpen: () => selecting ? toggle(row) : openRow(row),
2059
+ disabled: selecting ? !selectionKey(row) : !canOpen(row),
2060
+ actions: !selecting && rowActions(row),
2061
+ status: route.page === "tasks" ? visibleColumns.filter((c) => c.role === "state").map((c) => /* @__PURE__ */ React.createElement(React.Fragment, { key: c.path }, renderCell(row, c))) : void 0,
2062
+ facts: route.page === "tasks" ? [row.projectName, row.modelId, row.aspectRatio] : route.page === "projects" ? [
2063
+ row.projectType,
2064
+ typeof row.assetCount === "number" ? `${row.assetCount} assets` : null,
2065
+ typeof row.createdAt === "string" ? row.createdAt.slice(0, 10) : null
2066
+ ] : [
2067
+ row.modelId,
2068
+ row.aspectRatio,
2069
+ row.resolution || (row.width && row.height ? `${row.width} \xD7 ${row.height}` : null),
2070
+ !row.modelId && !row.aspectRatio && !row.resolution && !row.width ? row.kind : null
2071
+ ]
2072
+ }
2073
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "studio-card-heading" }, /* @__PURE__ */ React.createElement(
1514
2074
  Button,
1515
2075
  {
1516
2076
  className: "studio-row-name",
@@ -1519,10 +2079,9 @@ function QueryResults({
1519
2079
  disabled: selecting ? !selectionKey(row) : !canOpen(row),
1520
2080
  onClick: () => selecting ? toggle(row) : openRow(row)
1521
2081
  }
1522
- ), !selecting && rowActions(row)),
1523
- route.page === "assets" && rowRef(row, active.view) ? /* @__PURE__ */ React.createElement("div", { className: "studio-card-subtitle" }, visibleColumns.some((column2) => column2.format === "categories") ? visibleColumns.filter((column2) => column2.format === "categories").map((column2) => /* @__PURE__ */ React.createElement(React.Fragment, { key: column2.path }, renderCell(row, column2))) : columnText(row.kind)) : /* @__PURE__ */ React.createElement("dl", null, visibleColumns.filter(
2082
+ ), !selecting && rowActions(row)), route.page === "assets" && rowRef(row, active.view) ? /* @__PURE__ */ React.createElement("div", { className: "studio-card-subtitle" }, visibleColumns.some((column2) => column2.format === "categories") ? visibleColumns.filter((column2) => column2.format === "categories").map((column2) => /* @__PURE__ */ React.createElement(React.Fragment, { key: column2.path }, renderCell(row, column2))) : columnText(row.kind)) : /* @__PURE__ */ React.createElement("dl", null, visibleColumns.filter(
1524
2083
  (column2) => !column2.role || column2.role === "state" || column2.role === "project"
1525
- ).map((column2) => /* @__PURE__ */ React.createElement("div", { key: column2.path }, /* @__PURE__ */ React.createElement("dt", null, column2.label ?? column2.path), /* @__PURE__ */ React.createElement("dd", null, renderCell(row, column2)))))
2084
+ ).map((column2) => /* @__PURE__ */ React.createElement("div", { key: column2.path }, /* @__PURE__ */ React.createElement("dt", null, column2.label ?? column2.path), /* @__PURE__ */ React.createElement("dd", null, renderCell(row, column2))))))
1526
2085
  )), !rows.length && /* @__PURE__ */ React.createElement("div", { className: "studio-empty", role: "status" }, queryLoading ? "Loading\u2026" : failure ? "The query could not be loaded." : route.page === "projects" ? "No matching projects." : route.page === "tasks" ? "No matching tasks." : "No assets.")));
1527
2086
  }
1528
2087
 
@@ -1851,9 +2410,9 @@ function viewTemplatePrompt(template) {
1851
2410
  ].join("\n");
1852
2411
  }
1853
2412
  function createViewPrompt(template, source) {
1854
- const location = typeof source === "string" ? `I started in ${pageTitles[source]} in my user workspace.` : `I started in ${source.name} (project ID ${source.id}), on its ${source.page} page.`;
2413
+ const location2 = typeof source === "string" ? `I started in ${pageTitles[source]} in my user workspace.` : `I started in ${source.name} (project ID ${source.id}), on its ${source.page} page.`;
1855
2414
  return [
1856
- `Help me create a custom view based on ${template.title}. ${location}`,
2415
+ `Help me create a custom view based on ${template.title}. ${location2}`,
1857
2416
  "Ask what I want to show or change. Check whether the existing view fits. If a separate view is needed, reuse its supported data and @vivix-labs/ui-system components. Use the appropriate installed workbench for the requested scope. Keep the current views and project data intact.",
1858
2417
  viewTemplatePrompt(template),
1859
2418
  "Open the result in Studio and verify it with my data."
@@ -1873,6 +2432,7 @@ var CardBoundary = class extends React3.Component {
1873
2432
  function PromptDialog({ prompt, close }) {
1874
2433
  const [value, setValue] = React3.useState(prompt.value);
1875
2434
  const [status, setStatus] = React3.useState("");
2435
+ const fieldId = React3.useId();
1876
2436
  const text = React3.useRef(null);
1877
2437
  async function copy2() {
1878
2438
  try {
@@ -1888,12 +2448,20 @@ function PromptDialog({ prompt, close }) {
1888
2448
  Dialog,
1889
2449
  {
1890
2450
  className: "studio-home-dialog",
2451
+ variant: prompt.editable ? "edit-dashboard" : "default",
1891
2452
  title: prompt.title,
1892
2453
  open: true,
1893
2454
  onOpenChange: (open) => !open && close(),
1894
- actions: /* @__PURE__ */ React3.createElement(React3.Fragment, null, prompt.editable && /* @__PURE__ */ React3.createElement(Button, { label: "Cancel", variant: "text-tonal-sm", onClick: close }), /* @__PURE__ */ React3.createElement(Button, { label: "Copy Prompt", onClick: () => void copy2() }))
2455
+ actions: /* @__PURE__ */ React3.createElement(React3.Fragment, null, prompt.editable && /* @__PURE__ */ React3.createElement(Button, { label: "Cancel", variant: "text-tonal-lg", width: "hug", onClick: close }), /* @__PURE__ */ React3.createElement(
2456
+ Button,
2457
+ {
2458
+ label: prompt.editable ? "Copy prompt" : "Copy Prompt",
2459
+ variant: "text-filled-lg",
2460
+ width: "hug",
2461
+ onClick: () => void copy2()
2462
+ }
2463
+ ))
1895
2464
  },
1896
- prompt.description && /* @__PURE__ */ React3.createElement("p", null, prompt.description),
1897
2465
  prompt.preview !== void 0 && /* @__PURE__ */ React3.createElement(
1898
2466
  "div",
1899
2467
  {
@@ -1904,11 +2472,13 @@ function PromptDialog({ prompt, close }) {
1904
2472
  "aria-label": prompt.title + " preview"
1905
2473
  }
1906
2474
  ),
2475
+ prompt.editable && /* @__PURE__ */ React3.createElement("label", { className: "studio-dashboard-field-label", htmlFor: fieldId }, "Copy prompt and send to your agent"),
1907
2476
  /* @__PURE__ */ React3.createElement(
1908
2477
  "textarea",
1909
2478
  {
2479
+ id: fieldId,
1910
2480
  ref: text,
1911
- "aria-label": "Prompt",
2481
+ "aria-label": prompt.editable ? void 0 : "Prompt",
1912
2482
  rows: prompt.editable ? 10 : 7,
1913
2483
  value,
1914
2484
  readOnly: !prompt.editable,
@@ -1918,6 +2488,41 @@ function PromptDialog({ prompt, close }) {
1918
2488
  /* @__PURE__ */ React3.createElement("span", { role: "status" }, status)
1919
2489
  );
1920
2490
  }
2491
+ function SavedViewsEmpty({
2492
+ instance,
2493
+ showPrompt
2494
+ }) {
2495
+ const [copied, setCopied] = React3.useState(false);
2496
+ React3.useEffect(() => {
2497
+ if (!copied) return;
2498
+ const timer = window.setTimeout(() => setCopied(false), 2e3);
2499
+ return () => window.clearTimeout(timer);
2500
+ }, [copied]);
2501
+ async function copyPrompt() {
2502
+ const value = [
2503
+ "Help me create a custom view in Vivix Studio and save it to Home.",
2504
+ "The view I want: [describe its purpose, data and layout].",
2505
+ guide,
2506
+ `Inspect the existing user composition and append a compatible component or project page to the ${instance} instance\u2019s config.savedViews. Preserve its existing entries. Verify the new view opens from Home \u2192 Custom Views \u2192 Saved Views.`
2507
+ ].join("\n\n");
2508
+ try {
2509
+ await navigator.clipboard.writeText(value);
2510
+ setCopied(true);
2511
+ } catch {
2512
+ showPrompt({ title: "Create a saved view", value });
2513
+ }
2514
+ }
2515
+ return /* @__PURE__ */ React3.createElement("div", { className: "studio-saved-empty" }, /* @__PURE__ */ React3.createElement("p", null, "No saved view yet. Ask your agent to create any views."), /* @__PURE__ */ React3.createElement(
2516
+ Button,
2517
+ {
2518
+ label: copied ? "Copied" : "Copy prompt",
2519
+ "aria-live": "polite",
2520
+ variant: "text-tonal-sm",
2521
+ width: "hug",
2522
+ onClick: () => void copyPrompt()
2523
+ }
2524
+ ));
2525
+ }
1921
2526
  function StudioHome({
1922
2527
  client,
1923
2528
  route,
@@ -1972,99 +2577,109 @@ ${guide}
1972
2577
  ${"plugin" in ref ? "Use this enabled user-scope component in the Home instance config.dashboard or config.savedViews. Keep its declared dependencies enabled." : projectGuide}`
1973
2578
  })
1974
2579
  }
1975
- ));
1976
- })) : /* @__PURE__ */ React3.createElement("p", { className: "studio-home-empty" }, "Save a workspace component or a link to a project page here. One plugin can provide several views.");
1977
- return /* @__PURE__ */ React3.createElement("section", { className: "studio-home", "aria-label": "Home" }, /* @__PURE__ */ React3.createElement("div", { className: "studio-home-toolbar" }, /* @__PURE__ */ React3.createElement(
1978
- SegmentedControl,
1979
- {
1980
- label: "Dashboard mode",
1981
- value: route.mode,
1982
- items: [
1983
- { value: "dashboard", label: "Dashboard", icon: "grid" },
1984
- { value: "custom-views", label: "Custom Views", icon: "list" }
1985
- ],
1986
- onValueChange: (value) => onRoute({ ...route, mode: value === "custom-views" ? value : "dashboard" })
1987
- }
1988
- ), /* @__PURE__ */ React3.createElement("div", { className: "studio-home-actions" }, route.mode === "dashboard" && /* @__PURE__ */ React3.createElement(
1989
- Button,
1990
- {
1991
- label: "Edit layout",
1992
- variant: "text-tonal-sm",
1993
- onClick: () => setPrompt({
1994
- title: "Edit Dashboard",
1995
- editable: true,
1996
- description: "Describe the cards you want to add, remove, or change. Copy the prompt to your Agent chat.",
1997
- value: [
1998
- "Help me customize the Dashboard in Vivix Studio.",
1999
- "Current cards in order:",
2000
- ...cards.length ? cards.map(
2001
- (ref) => `- ${resolve(ref)?.title ?? ref.id} (${ref.plugin}/${ref.id})`
2002
- ) : ["- No cards configured"],
2003
- "",
2004
- "Changes I want:",
2005
- "- Add: [card name, content, and where it should appear]",
2006
- "- Remove: [card name]",
2007
- "- Modify: [card content or position]",
2008
- "",
2009
- guide,
2010
- `Inspect my user scope with vivix-studio plugin list --scope user --json. Use the workbench instance (${client.instanceId}) config.dashboard to add, remove, or reorder {plugin, id} references. Reuse existing compatible cards. For new or changed card content, use the plugin development guide and @vivix-labs/ui-system. Build and enable the provider in user scope before referencing it.`,
2011
- "Apply a copy of the existing composition with vivix-studio project configure --scope user --file <file>. Preserve unrelated settings and saved views. If active projects block the change, wait for their work to finish and restart the Host before applying it. Reopen Home and verify the requested cards and responsive layout."
2012
- ].join("\n")
2013
- })
2014
- }
2015
- ))), /* @__PURE__ */ React3.createElement(HomeBanner, { client }), route.mode === "dashboard" ? /* @__PURE__ */ React3.createElement("div", { className: "studio-home-panels" }, cards.map(mounted)) : /* @__PURE__ */ React3.createElement("section", { className: "studio-home-panel studio-home-views", "aria-label": "Custom Views" }, /* @__PURE__ */ React3.createElement(
2016
- Tabs,
2017
- {
2018
- label: "Custom view library",
2019
- value: route.tab,
2020
- onValueChange: (value) => onRoute({ ...route, tab: value === "saved" ? value : "preset", selected: void 0 }),
2021
- items: [
2022
- {
2023
- value: "preset",
2024
- label: "Preset",
2025
- panel: /* @__PURE__ */ React3.createElement("div", { className: "studio-home-grid studio-home-gallery", role: "list" }, viewTemplates.map((template) => {
2026
- const { title, project: projectName, route: view } = template;
2027
- const project = projectName ? props.projects.find(
2028
- (item) => item.available && (item.name === projectName || item.name === projectName.toLowerCase().replaceAll(" ", "-"))
2029
- ) : void 0;
2030
- return /* @__PURE__ */ React3.createElement("article", { className: "studio-home-template", key: title, role: "listitem" }, /* @__PURE__ */ React3.createElement(
2031
- "button",
2032
- {
2033
- type: "button",
2034
- className: "studio-home-tile",
2035
- "aria-label": title,
2036
- onClick: () => {
2037
- if (project) props.openProject(project.id, view);
2038
- else if (!projectName) props.openAssets();
2039
- else
2040
- setPrompt({
2041
- title,
2042
- preview: template.preview,
2043
- value: viewTemplatePrompt(template)
2044
- });
2580
+ ));
2581
+ })) : /* @__PURE__ */ React3.createElement(SavedViewsEmpty, { instance: client.instanceId, showPrompt: setPrompt });
2582
+ return /* @__PURE__ */ React3.createElement(
2583
+ "section",
2584
+ {
2585
+ className: "studio-home",
2586
+ "aria-label": "Home",
2587
+ "data-custom-views": route.mode === "custom-views" || void 0
2588
+ },
2589
+ /* @__PURE__ */ React3.createElement("div", { className: "studio-home-toolbar" }, /* @__PURE__ */ React3.createElement(
2590
+ SegmentedControl,
2591
+ {
2592
+ label: "Dashboard mode",
2593
+ value: route.mode,
2594
+ items: [
2595
+ { value: "dashboard", label: "Dashboard", icon: "grid" },
2596
+ { value: "custom-views", label: "Custom Views", icon: "list" }
2597
+ ],
2598
+ onValueChange: (value) => onRoute({ ...route, mode: value === "custom-views" ? value : "dashboard" })
2599
+ }
2600
+ ), /* @__PURE__ */ React3.createElement("div", { className: "studio-home-actions", inert: route.mode !== "dashboard" }, /* @__PURE__ */ React3.createElement(
2601
+ Button,
2602
+ {
2603
+ label: "Edit layout",
2604
+ variant: "text-tonal-sm",
2605
+ onClick: () => setPrompt({
2606
+ title: "Edit Dashboard",
2607
+ editable: true,
2608
+ value: [
2609
+ "Help me customize the Dashboard in Vivix Studio.",
2610
+ "Current cards in order:",
2611
+ ...cards.length ? cards.map(
2612
+ (ref) => `- ${resolve(ref)?.title ?? ref.id} (${ref.plugin}/${ref.id})`
2613
+ ) : ["- No cards configured"],
2614
+ "",
2615
+ "Changes I want:",
2616
+ "- Add: [card name, content, and where it should appear]",
2617
+ "- Remove: [card name]",
2618
+ "- Modify: [card content or position]",
2619
+ "",
2620
+ guide,
2621
+ `Inspect my user scope with vivix-studio plugin list --scope user --json. Use the workbench instance (${client.instanceId}) config.dashboard to add, remove, or reorder {plugin, id} references. Reuse existing compatible cards. For new or changed card content, use the plugin development guide and @vivix-labs/ui-system. Build and enable the provider in user scope before referencing it.`,
2622
+ "Apply a copy of the existing composition with vivix-studio project configure --scope user --file <file>. Preserve unrelated settings and saved views. If active projects block the change, wait for their work to finish and restart the Host before applying it. Reopen Home and verify the requested cards and responsive layout."
2623
+ ].join("\n")
2624
+ })
2625
+ }
2626
+ ))),
2627
+ /* @__PURE__ */ React3.createElement(HomeBanner, { client }),
2628
+ route.mode === "dashboard" ? /* @__PURE__ */ React3.createElement("div", { className: "studio-home-panels" }, cards.map(mounted)) : /* @__PURE__ */ React3.createElement("section", { className: "studio-home-panel studio-home-views", "aria-label": "Custom Views" }, /* @__PURE__ */ React3.createElement(
2629
+ Tabs,
2630
+ {
2631
+ label: "Custom view library",
2632
+ value: route.tab,
2633
+ onValueChange: (value) => onRoute({ ...route, tab: value === "saved" ? value : "preset", selected: void 0 }),
2634
+ items: [
2635
+ {
2636
+ value: "preset",
2637
+ label: "Preset",
2638
+ panel: /* @__PURE__ */ React3.createElement("div", { className: "studio-home-grid studio-home-gallery", role: "list" }, viewTemplates.map((template) => {
2639
+ const { title, project: projectName, route: view } = template;
2640
+ const project = projectName ? props.projects.find(
2641
+ (item) => item.available && (item.name === projectName || item.name === projectName.toLowerCase().replaceAll(" ", "-"))
2642
+ ) : void 0;
2643
+ return /* @__PURE__ */ React3.createElement("article", { className: "studio-home-template", key: title, role: "listitem" }, /* @__PURE__ */ React3.createElement(
2644
+ "button",
2645
+ {
2646
+ type: "button",
2647
+ className: "studio-home-tile",
2648
+ "aria-label": title,
2649
+ onClick: () => {
2650
+ if (project) props.openProject(project.id, view);
2651
+ else if (!projectName) props.openAssets();
2652
+ else
2653
+ setPrompt({
2654
+ title,
2655
+ preview: template.preview,
2656
+ value: viewTemplatePrompt(template)
2657
+ });
2658
+ }
2659
+ },
2660
+ /* @__PURE__ */ React3.createElement("span", { className: "studio-home-preview", "data-preview": template.preview }),
2661
+ /* @__PURE__ */ React3.createElement("span", { className: "studio-template-caption" }, /* @__PURE__ */ React3.createElement("strong", null, title), /* @__PURE__ */ React3.createElement("span", { className: "studio-home-template-summary" }, template.description))
2662
+ ), /* @__PURE__ */ React3.createElement(
2663
+ Button,
2664
+ {
2665
+ label: "View Prompt",
2666
+ variant: "text-filled-sm",
2667
+ width: "hug",
2668
+ onClick: () => setPrompt({
2669
+ title,
2670
+ preview: template.preview,
2671
+ value: viewTemplatePrompt(template)
2672
+ })
2045
2673
  }
2046
- },
2047
- /* @__PURE__ */ React3.createElement("span", { className: "studio-home-preview", "data-preview": template.preview }),
2048
- /* @__PURE__ */ React3.createElement("strong", null, title),
2049
- /* @__PURE__ */ React3.createElement("span", { className: "studio-home-template-summary" }, template.description)
2050
- ), /* @__PURE__ */ React3.createElement(
2051
- Button,
2052
- {
2053
- label: "View Prompt",
2054
- variant: "text-tonal-sm",
2055
- onClick: () => setPrompt({
2056
- title,
2057
- preview: template.preview,
2058
- value: viewTemplatePrompt(template)
2059
- })
2060
- }
2061
- ));
2062
- }))
2063
- },
2064
- { value: "saved", label: "Saved Views", panel: savedTiles }
2065
- ]
2066
- }
2067
- )), prompt && /* @__PURE__ */ React3.createElement(PromptDialog, { prompt, close: () => setPrompt(void 0) }));
2674
+ ));
2675
+ }))
2676
+ },
2677
+ { value: "saved", label: "Saved Views", panel: savedTiles }
2678
+ ]
2679
+ }
2680
+ )),
2681
+ prompt && /* @__PURE__ */ React3.createElement(PromptDialog, { prompt, close: () => setPrompt(void 0) })
2682
+ );
2068
2683
  }
2069
2684
 
2070
2685
  // packages/studio-workbench/src/custom-view-dialog.tsx
@@ -2277,6 +2892,16 @@ var parseArray = (value) => {
2277
2892
  return [];
2278
2893
  }
2279
2894
  };
2895
+ function assetMetadata(value) {
2896
+ if (typeof value === "string") {
2897
+ try {
2898
+ value = JSON.parse(value);
2899
+ } catch {
2900
+ return {};
2901
+ }
2902
+ }
2903
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
2904
+ }
2280
2905
  var previewSource = (row, view) => {
2281
2906
  const column2 = view.columns.find((item) => item.role === "preview");
2282
2907
  return column2 && typeof row[column2.path] === "string" ? row[column2.path] : void 0;
@@ -2295,6 +2920,7 @@ var fallbackFavorites = () => {
2295
2920
  };
2296
2921
  function ProjectThumbnail({
2297
2922
  cover,
2923
+ pending,
2298
2924
  resolvePreview
2299
2925
  }) {
2300
2926
  const anchor2 = React6.useRef(null);
@@ -2305,9 +2931,8 @@ function ProjectThumbnail({
2305
2931
  let active = true;
2306
2932
  const load = () => {
2307
2933
  void resolve(cover).then(
2308
- (value) => active && setPreview(value),
2309
- () => {
2310
- }
2934
+ (value) => active && setPreview(value ?? null),
2935
+ () => active && setPreview(null)
2311
2936
  );
2312
2937
  };
2313
2938
  const observer = new IntersectionObserver((entries) => {
@@ -2321,17 +2946,17 @@ function ProjectThumbnail({
2321
2946
  observer.disconnect();
2322
2947
  };
2323
2948
  }, [cover]);
2324
- const thumbnail = cover ? preview : void 0;
2325
- return /* @__PURE__ */ React6.createElement("span", { ref: anchor2, className: "studio-project-thumbnail", "aria-hidden": "true" }, thumbnail?.kind === "image" ? /* @__PURE__ */ React6.createElement("img", { src: thumbnail.url, alt: "", onError: () => setPreview(void 0) }) : thumbnail?.kind === "video" ? /* @__PURE__ */ React6.createElement(
2326
- "video",
2949
+ return /* @__PURE__ */ React6.createElement(
2950
+ CoverPreview,
2327
2951
  {
2328
- src: thumbnail.url,
2329
- muted: true,
2330
- playsInline: true,
2331
- preload: "metadata",
2332
- onError: () => setPreview(void 0)
2952
+ className: "studio-project-thumbnail",
2953
+ ref: anchor2,
2954
+ iconSize: 16,
2955
+ kind: preview?.kind,
2956
+ src: preview?.url,
2957
+ pending: pending || Boolean(cover && preview === void 0)
2333
2958
  }
2334
- ) : /* @__PURE__ */ React6.createElement(StudioGlyph, { name: "projects" }));
2959
+ );
2335
2960
  }
2336
2961
  function QueryCover({
2337
2962
  row,
@@ -2380,6 +3005,11 @@ function QueryCover({
2380
3005
  {
2381
3006
  src: image && !failed ? url : void 0,
2382
3007
  alt: rowTitle(row, view),
3008
+ script: kind2 === "text" && !poster ? {
3009
+ title: rowTitle(row, view),
3010
+ synopsis: typeof row.synopsis === "string" ? row.synopsis : void 0,
3011
+ src: url
3012
+ } : void 0,
2383
3013
  emptyAppearance: view.source === "projects" ? "surface" : kind2 === "text" ? "script" : kind2 === "video" || kind2 === "audio" ? kind2 : "image",
2384
3014
  fit: "contain",
2385
3015
  state: selected ? "selected" : "default",
@@ -2560,15 +3190,17 @@ function Detail({
2560
3190
  onClick: () => onFavorite(refValue, !item?.favorite)
2561
3191
  },
2562
3192
  /* @__PURE__ */ React6.createElement(StudioGlyph, { name: "favorite" })
2563
- )), !detail ? /* @__PURE__ */ React6.createElement("p", { role: "status" }, "Loading asset\u2026") : previewError ? /* @__PURE__ */ React6.createElement("p", { role: "alert" }, previewError) : !url ? /* @__PURE__ */ React6.createElement("p", null, "No preview available for this version.") : item?.kind === "video" ? /* @__PURE__ */ React6.createElement(
2564
- "video",
3193
+ )), !detail ? /* @__PURE__ */ React6.createElement("p", { role: "status" }, "Loading asset\u2026") : previewError ? /* @__PURE__ */ React6.createElement("p", { role: "alert" }, previewError) : !url ? /* @__PURE__ */ React6.createElement("p", null, "No preview available for this version.") : item?.kind === "video" ? /* @__PURE__ */ React6.createElement("div", { className: "studio-detail-canvas" }, /* @__PURE__ */ React6.createElement(
3194
+ VideoPlayer,
2565
3195
  {
2566
- controls: true,
3196
+ key: url,
3197
+ fitContent: true,
2567
3198
  src: url,
2568
- "aria-label": String(item.name),
3199
+ title: String(item.name),
3200
+ poster: typeof item.posterUrl === "string" ? item.posterUrl : void 0,
2569
3201
  onError: () => setPreviewError("The video preview could not be loaded.")
2570
3202
  }
2571
- ) : item?.kind === "audio" ? /* @__PURE__ */ React6.createElement(
3203
+ )) : item?.kind === "audio" ? /* @__PURE__ */ React6.createElement(
2572
3204
  "audio",
2573
3205
  {
2574
3206
  controls: true,
@@ -2664,11 +3296,16 @@ function GlobalWorkbench({ client }) {
2664
3296
  const [saved, setSaved] = React6.useState([]);
2665
3297
  const [loadedSource, setLoadedSource] = React6.useState(null);
2666
3298
  const [catalogSnapshot, setCatalog] = React6.useState(null);
3299
+ const [summariesPending, setSummariesPending] = React6.useState(true);
2667
3300
  const [projectSummaries, setProjectSummaries] = React6.useState(
2668
3301
  /* @__PURE__ */ new Map()
2669
3302
  );
2670
3303
  const [catalogRevision, refreshCatalog] = React6.useReducer((revision) => revision + 1, 0);
2671
3304
  const catalog = catalogSnapshot ?? [];
3305
+ const [legacyWorkbench, setLegacyWorkbench] = React6.useState(false);
3306
+ const [hiddenProjects, setHiddenProjects] = React6.useState([]);
3307
+ const visibleProjects = catalog.filter(({ id }) => !hiddenProjects.includes(id));
3308
+ const excludeProjectIds = route.page === "projects" ? hiddenProjects : [];
2672
3309
  const catalogReady = catalogSnapshot !== null;
2673
3310
  const [resultRows, setRows] = React6.useState([]);
2674
3311
  const recoveredRows = React6.useRef(null);
@@ -2702,7 +3339,7 @@ function GlobalWorkbench({ client }) {
2702
3339
  );
2703
3340
  const detail = detailState?.identity === detailIdentity ? detailState.value : null;
2704
3341
  const requestedProject = route.project ? catalog.find((project) => project.id === route.project.id) : void 0;
2705
- const projectEntry = route.project && loadedSource === route.page && !(loadFailure?.source === route.page && !loadFailure.query) && requestedProject?.available && client.projects ? projectUrl(
3342
+ const projectEntry = route.project && requestedProject?.available && client.projects ? projectUrl(
2706
3343
  client.projects.embedUrl(requestedProject.id),
2707
3344
  window.location.origin,
2708
3345
  route.project.page
@@ -2802,7 +3439,11 @@ function GlobalWorkbench({ client }) {
2802
3439
  const coverInput = React6.useRef(null);
2803
3440
  const coverProject = React6.useRef(null);
2804
3441
  const defaults = React6.useMemo(
2805
- () => [defaultView(route.page), ...route.page === "assets" ? [fallbackFavorites()] : []],
3442
+ () => [
3443
+ defaultView(route.page),
3444
+ ...categoryViews(route.page),
3445
+ ...route.page === "assets" ? [fallbackFavorites()] : []
3446
+ ],
2806
3447
  [route.page]
2807
3448
  );
2808
3449
  const views = [...defaults, ...saved.filter((item) => item.view.source === route.page)];
@@ -2827,26 +3468,41 @@ function GlobalWorkbench({ client }) {
2827
3468
  else window.history.pushState(null, "", url);
2828
3469
  }
2829
3470
  React6.useEffect(() => {
3471
+ const onAsset = (event2) => {
3472
+ if (event2.origin !== location.origin || !frame.current || event2.source !== frame.current.contentWindow || event2.data?.type !== "studio:open-asset")
3473
+ return;
3474
+ const ref = decodeRef(event2.data.ref);
3475
+ if (ref) navigate({ ...readRoute(new URL(location.href)), ref });
3476
+ };
3477
+ window.addEventListener("message", onAsset);
2830
3478
  const change = () => {
2831
3479
  setRoute(readRoute(new URL(window.location.href)));
2832
3480
  };
2833
3481
  window.addEventListener("popstate", change);
2834
- return () => window.removeEventListener("popstate", change);
3482
+ return () => {
3483
+ window.removeEventListener("popstate", change);
3484
+ window.removeEventListener("message", onAsset);
3485
+ };
2835
3486
  }, []);
2836
3487
  React6.useEffect(() => {
2837
3488
  let valid = true;
2838
3489
  setLoadedSource(null);
2839
- setCatalog(null);
2840
3490
  setLoadFailure(null);
2841
3491
  setLoading(true);
2842
3492
  setError("");
2843
3493
  void Promise.all([
2844
3494
  ownCall("views.list", { source: route.page }),
2845
- client.projects?.list() ?? Promise.reject(Error("The project catalog is unavailable."))
2846
- ]).then(([value, projects]) => {
3495
+ client.projects?.list() ?? Promise.reject(Error("The project catalog is unavailable.")),
3496
+ ownCall("workspace.hiddenProjects", {}).catch((error2) => {
3497
+ if (error2?.code === "OPERATION_UNAVAILABLE") return null;
3498
+ throw error2;
3499
+ })
3500
+ ]).then(([value, projects, hidden]) => {
2847
3501
  if (!valid) return;
2848
3502
  setSaved(value);
2849
3503
  setCatalog(projects);
3504
+ setLegacyWorkbench(hidden === null);
3505
+ setHiddenProjects(hidden ?? []);
2850
3506
  setLoadedSource(route.page);
2851
3507
  }).catch((error2) => {
2852
3508
  if (valid) {
@@ -2864,6 +3520,7 @@ function GlobalWorkbench({ client }) {
2864
3520
  React6.useEffect(() => {
2865
3521
  if (!client.config.studioInstance) return;
2866
3522
  let valid = true;
3523
+ setSummariesPending(true);
2867
3524
  void globalCall("global.projectSummaries", {}).catch(() => globalCall("global.projectNames", {})).catch(() => []).then((names) => {
2868
3525
  if (!valid) return;
2869
3526
  const parsed = z7.array(
@@ -2875,6 +3532,7 @@ function GlobalWorkbench({ client }) {
2875
3532
  revision: z7.number().optional()
2876
3533
  })
2877
3534
  ).safeParse(names);
3535
+ setSummariesPending(false);
2878
3536
  setProjectSummaries(
2879
3537
  new Map(
2880
3538
  parsed.success ? parsed.data.map(({ id, name, coverRef, tags: tags2, revision }) => [
@@ -2888,10 +3546,19 @@ function GlobalWorkbench({ client }) {
2888
3546
  valid = false;
2889
3547
  };
2890
3548
  }, [client, catalogRevision]);
2891
- const [assetFilter, setAssetFilter] = React6.useState({ project: "", format: "", subject: "" });
2892
- const filterAssets = active.id === "default:assets" && route.page === "assets";
2893
- const filteredAssets = filterAssets && Object.values(assetFilter).some(Boolean);
2894
- const tableVisible = !route.project && !route.home && !route.ref;
3549
+ const [filtersByPage, setFiltersByPage] = React6.useState({});
3550
+ const assetFilter = filtersByPage[route.page] ?? {};
3551
+ const setAssetFilter = (value) => setFiltersByPage((previous) => ({ ...previous, [route.page]: value }));
3552
+ const [creatingProject, setCreatingProject] = React6.useState(false);
3553
+ const projectCard = client.config.dashboard?.find((card) => card.id === "projects");
3554
+ const creatorRef = client.config.views?.projectCreator ?? (projectCard && { plugin: projectCard.plugin, id: "create-project" });
3555
+ const NewProjectDialog = route.page === "projects" && creatorRef ? client.resolveUI(creatorRef)?.component : void 0;
3556
+ const builtIn = active.id.startsWith("default:");
3557
+ const filterAssets = route.page === "assets" && active.id.startsWith("default:");
3558
+ const assetQuery = builtIn ? route.page === "projects" ? legacyWorkbench ? { sql: defaultSql("projects"), params: {} } : projectQuery(active.id, assetFilter) : libraryQuery(route.page, active.id, assetFilter, legacyWorkbench) : null;
3559
+ const favoriteView = active.id === "default:favorites";
3560
+ const visibleViews = views.filter((item) => item.id !== "default:favorites");
3561
+ const tableVisible = !route.project && !route.home;
2895
3562
  const queryIdentity = JSON.stringify([
2896
3563
  scopeIdentity,
2897
3564
  route.page,
@@ -2900,7 +3567,9 @@ function GlobalWorkbench({ client }) {
2900
3567
  active.view,
2901
3568
  route.offset,
2902
3569
  catalogSnapshot,
2903
- filteredAssets ? assetFilter : null
3570
+ excludeProjectIds,
3571
+ assetQuery,
3572
+ builtIn && route.page === "projects" ? assetFilter : null
2904
3573
  ]);
2905
3574
  const recoveryIdentity = JSON.stringify([
2906
3575
  scopeIdentity,
@@ -2908,9 +3577,16 @@ function GlobalWorkbench({ client }) {
2908
3577
  route.view,
2909
3578
  active.revision,
2910
3579
  active.view,
2911
- filteredAssets ? assetFilter : null
3580
+ excludeProjectIds,
3581
+ assetQuery,
3582
+ builtIn && route.page === "projects" ? assetFilter : null
2912
3583
  ]);
2913
- const rows = resultIdentity === queryIdentity ? resultRows : [];
3584
+ const [resultWindow, setResultWindow] = React6.useState({ identity: "", count: 50 });
3585
+ const visibleCount = resultWindow.identity === queryIdentity ? resultWindow.count : 50;
3586
+ const rows = React6.useMemo(
3587
+ () => resultIdentity !== queryIdentity ? [] : builtIn ? resultRows.slice(0, visibleCount) : resultRows,
3588
+ [resultIdentity, queryIdentity, builtIn, resultRows, visibleCount]
3589
+ );
2914
3590
  const failure = loadFailure?.source === route.page && (loadFailure.query === void 0 || loadFailure.query === queryIdentity) ? loadFailure : null;
2915
3591
  const queryLoading = loading || !failure && (loadedSource !== route.page || resultIdentity !== queryIdentity);
2916
3592
  React6.useEffect(() => {
@@ -2927,16 +3603,13 @@ function GlobalWorkbench({ client }) {
2927
3603
  "global.query",
2928
3604
  {
2929
3605
  source: route.page,
2930
- sql: filteredAssets ? `SELECT a.*, p.name AS projectName, p.available AS projectAvailable FROM studio_assets a
2931
- LEFT JOIN studio_projects p ON a.projectId = p.projectId
2932
- WHERE (:project = '' OR a.projectId = :project) AND (:format = '' OR a.kind = :format)
2933
- AND (:subject = '' OR a.subjectType = :subject)
2934
- ORDER BY p.name, a.orderKey IS NULL, a.orderKey, a.createdAt DESC, a.rowId` : active.view.sql,
2935
- params: filteredAssets ? assetFilter : active.view.params,
3606
+ sql: assetQuery?.sql ?? active.view.sql,
3607
+ params: assetQuery?.params ?? active.view.params,
2936
3608
  limit: 50,
2937
3609
  timeoutMs: 8e3,
2938
3610
  offset,
2939
- catalog
3611
+ catalog,
3612
+ ...excludeProjectIds.length && { excludeProjectIds }
2940
3613
  }
2941
3614
  );
2942
3615
  if (!valid || sequence !== querySequence.current) return;
@@ -2954,8 +3627,32 @@ function GlobalWorkbench({ client }) {
2954
3627
  cached?.client === client && cached.identity === recoveryIdentity ? cached.items : [],
2955
3628
  items
2956
3629
  );
3630
+ if (builtIn && route.page === "projects") {
3631
+ const group = projectTypes.find(({ value }) => active.id === "default:projects:" + value);
3632
+ const projected = legacyWorkbench ? await Promise.all(
3633
+ currentRows.map(async (row) => {
3634
+ const nav = row.available && client.projects?.navigation ? await client.projects.navigation(String(row.projectId)).catch(() => null) : null;
3635
+ return {
3636
+ ...row,
3637
+ projectType: nav ? nav.overview === "episode" ? "short-drama" : nav.overview === "preview" ? "product-ad" : "other" : null
3638
+ };
3639
+ })
3640
+ ) : currentRows;
3641
+ const matches = projected.filter(
3642
+ (row) => !legacyWorkbench || (!group || row.projectType === group.value) && (!assetFilter.type?.length || assetFilter.type.includes(String(row.projectType))) && (!assetFilter.availability?.length || assetFilter.availability.includes(row.available ? "Available" : "Unavailable"))
3643
+ ).map((row) => ({
3644
+ ...row,
3645
+ projectType: projectCategoryLabel(row.projectType) ?? null
3646
+ }));
3647
+ if (!valid || sequence !== querySequence.current) return;
3648
+ recoveredRows.current = { client, identity: recoveryIdentity, items: matches };
3649
+ return {
3650
+ items: matches,
3651
+ nextOffset: matches.length > route.offset + 50 ? route.offset + 50 : null
3652
+ };
3653
+ }
2957
3654
  recoveredRows.current = { client, identity: recoveryIdentity, items: currentRows };
2958
- return { items: mergeSqlRows(currentRows, visible), nextOffset: nextOffset2 };
3655
+ return { items: builtIn ? currentRows : mergeSqlRows(currentRows, visible), nextOffset: nextOffset2 };
2959
3656
  })().then((result2) => {
2960
3657
  if (!result2 || !valid || sequence !== querySequence.current) return;
2961
3658
  setResultIdentity(queryIdentity);
@@ -3118,6 +3815,15 @@ function GlobalWorkbench({ client }) {
3118
3815
  home: void 0
3119
3816
  });
3120
3817
  }
3818
+ function onProjectCreated(project) {
3819
+ setCatalog((items) => [...items ?? [], project]);
3820
+ refreshCatalog();
3821
+ navigate({
3822
+ ...route,
3823
+ home: void 0,
3824
+ project: { id: project.id, page: "assets" }
3825
+ });
3826
+ }
3121
3827
  function goHome() {
3122
3828
  setError("");
3123
3829
  setNotice("");
@@ -3322,6 +4028,20 @@ function GlobalWorkbench({ client }) {
3322
4028
  }
3323
4029
  const visibleColumns = active.view.columns.filter((column2) => column2.visible);
3324
4030
  const allSelected = rows.length > 0 && rows.every((row) => isSelected(row));
4031
+ const toggleSelectedPage = () => setSelected((prior) => {
4032
+ const next = new Map(prior);
4033
+ for (const row of rows) {
4034
+ const id = selectionKey(row);
4035
+ if (!id) continue;
4036
+ if (allSelected) next.delete(id);
4037
+ else
4038
+ next.set(id, {
4039
+ title: rowTitle(row, active.view),
4040
+ ref: rowRef(row, active.view) ?? outputRef(row)
4041
+ });
4042
+ }
4043
+ return next;
4044
+ });
3325
4045
  const selectedRefs = [...selected.values()].flatMap((item) => item.ref ? [item.ref] : []);
3326
4046
  const stopSelecting = () => {
3327
4047
  setSelecting(false);
@@ -3353,18 +4073,62 @@ function GlobalWorkbench({ client }) {
3353
4073
  }
3354
4074
  );
3355
4075
  };
3356
- const renderCell = (row, column2) => column2.role === "project" ? /* @__PURE__ */ React6.createElement(
3357
- Button,
3358
- {
3359
- className: "studio-row-name",
3360
- label: columnText(row[column2.path], column2.format),
3361
- variant: "text-tonal-sm",
3362
- disabled: !catalog.some(
3363
- (project) => project.id === row[active.view.identity.project] && project.available
3364
- ),
3365
- onClick: () => openProject(String(row[active.view.identity.project]))
4076
+ const libraryRows = recoveredRows.current?.items;
4077
+ const referenceRows = React6.useMemo(
4078
+ () => new Map((libraryRows ?? []).map((row) => [String(row.rowId), row])),
4079
+ [libraryRows]
4080
+ );
4081
+ const renderCell = (row, column2) => {
4082
+ if (builtIn && route.page !== "projects" && column2.path === "refs") {
4083
+ const refs = parseArray(row.refs).map(decodeRef).filter((ref) => ref !== null);
4084
+ return refs.length ? /* @__PURE__ */ React6.createElement("span", { className: "studio-asset-references" }, refs.map((ref, index) => {
4085
+ const item = referenceRows.get(refKey(ref));
4086
+ const preview = item?.posterUrl || item?.kind === "image" && item.previewUrl;
4087
+ return /* @__PURE__ */ React6.createElement(
4088
+ "button",
4089
+ {
4090
+ type: "button",
4091
+ key: refKey(ref) + index,
4092
+ "aria-label": "Open reference " + (item?.name ?? index + 1),
4093
+ disabled: selecting,
4094
+ onClick: () => navigate({ ...route, ref })
4095
+ },
4096
+ typeof preview === "string" ? /* @__PURE__ */ React6.createElement("img", { src: preview, alt: "", loading: "lazy" }) : /* @__PURE__ */ React6.createElement(Icon, { name: "placeholder-image" })
4097
+ );
4098
+ })) : "\u2014";
4099
+ }
4100
+ if (builtIn && (column2.path === "aspectRatio" || column2.path === "scene")) {
4101
+ const meta = assetMetadata(row.metadata);
4102
+ const source = assetMetadata(meta.adSource);
4103
+ const params = assetMetadata(row.parameters);
4104
+ const value = column2.path === "scene" ? meta.sceneTitle ?? meta.sceneNumber ?? meta.scene : params.aspect_ratio ?? params.aspectRatio ?? (source.versionId === row.versionId ? source.aspectRatio : void 0) ?? meta.aspectRatio;
4105
+ return typeof value === "string" || typeof value === "number" ? value : "\u2014";
4106
+ }
4107
+ if (builtIn && column2.path === "subjectType") {
4108
+ const value = row.subjectType ?? assetMetadata(row.metadata).subjectType ?? assetMetadata(row.parameters).subjectType;
4109
+ return typeof value === "string" ? value : "\u2014";
4110
+ }
4111
+ if (builtIn && column2.path === "createdAt" && typeof row.createdAt === "string") {
4112
+ const date2 = new Date(row.createdAt);
4113
+ if (!Number.isNaN(date2.getTime()))
4114
+ return /* @__PURE__ */ React6.createElement("time", { dateTime: row.createdAt, title: date2.toLocaleString() }, date2.getFullYear(), " ", String(date2.getMonth() + 1).padStart(2, "0"), ".", String(date2.getDate()).padStart(2, "0"));
3366
4115
  }
3367
- ) : displayCell(row, column2);
4116
+ if (builtIn && column2.path === "kind" && typeof row.kind === "string") {
4117
+ return row.kind === "text" ? "Text" : row.kind.charAt(0).toUpperCase() + row.kind.slice(1);
4118
+ }
4119
+ return column2.role === "project" ? /* @__PURE__ */ React6.createElement(
4120
+ Button,
4121
+ {
4122
+ className: "studio-row-name",
4123
+ label: columnText(row[column2.path], column2.format),
4124
+ variant: "text-tonal-sm",
4125
+ disabled: !catalog.some(
4126
+ (project) => project.id === row[active.view.identity.project] && project.available
4127
+ ),
4128
+ onClick: () => openProject(String(row[active.view.identity.project]))
4129
+ }
4130
+ ) : displayCell(row, column2);
4131
+ };
3368
4132
  function showProjectAction(id, name) {
3369
4133
  setProjectActionError("");
3370
4134
  setProjectAction({ id, name });
@@ -3394,7 +4158,23 @@ function GlobalWorkbench({ client }) {
3394
4158
  }
3395
4159
  }
3396
4160
  const Results = route.page === "assets" && client.config.views?.assetList ? client.resolveUI(client.config.views?.assetList)?.component ?? QueryResults : QueryResults;
3397
- const projectCoverActions = (projectId2) => {
4161
+ async function removeProject(project, title) {
4162
+ setError("");
4163
+ try {
4164
+ const hidden = await ownCall(
4165
+ "workspace.setProjectHidden",
4166
+ { projectId: project.id, hidden: true },
4167
+ true
4168
+ );
4169
+ setHiddenProjects(hidden);
4170
+ if (route.project?.id === project.id) go("projects");
4171
+ else if (route.page === "projects" && !route.home) navigate({ ...route, offset: 0 });
4172
+ setNotice(`\u201C${title}\u201D removed from the workbench.`);
4173
+ } catch (error2) {
4174
+ setError(message(error2));
4175
+ }
4176
+ }
4177
+ const projectCoverActions = (projectId2, includeRemove = true) => {
3398
4178
  const project = projectSummaries.get(projectId2);
3399
4179
  if (!project?.revision) return [];
3400
4180
  return [
@@ -3407,7 +4187,7 @@ function GlobalWorkbench({ client }) {
3407
4187
  coverInput.current?.click();
3408
4188
  }
3409
4189
  },
3410
- ...project.cover ? [
4190
+ ...includeRemove && project.cover ? [
3411
4191
  {
3412
4192
  id: "clear-cover",
3413
4193
  label: "Remove project cover",
@@ -3423,6 +4203,7 @@ function GlobalWorkbench({ client }) {
3423
4203
  Menu,
3424
4204
  {
3425
4205
  floating: true,
4206
+ triggerIcon: route.layout === "grid" && active.id.startsWith("default:") ? "more" : void 0,
3426
4207
  label: `Actions for ${rowTitle(row, active.view)}`,
3427
4208
  items: [
3428
4209
  {
@@ -3477,7 +4258,7 @@ function GlobalWorkbench({ client }) {
3477
4258
  className: "studio-shell",
3478
4259
  "data-project": Boolean(projectEntry) || void 0,
3479
4260
  "data-focus": menu?.layout === "focus" || void 0,
3480
- "data-detail": Boolean(route.ref && !route.project) || void 0,
4261
+ "data-detail": Boolean(route.ref) || void 0,
3481
4262
  onKeyDown: (event2) => {
3482
4263
  if (event2.key === "Escape" && selecting && !editor) {
3483
4264
  event2.preventDefault();
@@ -3512,7 +4293,7 @@ function GlobalWorkbench({ client }) {
3512
4293
  },
3513
4294
  /* @__PURE__ */ React6.createElement("span", { className: "studio-nav-icon", "data-icon": page, "aria-hidden": "true" }),
3514
4295
  /* @__PURE__ */ React6.createElement("span", null, workspaceLabels[page])
3515
- )), /* @__PURE__ */ React6.createElement("h2", null, "Projects"), catalog.map((project) => {
4296
+ )), /* @__PURE__ */ React6.createElement("h2", null, "Projects"), visibleProjects.map((project) => {
3516
4297
  const active2 = sidebarProject === project.id;
3517
4298
  const summary = projectSummaries.get(project.id);
3518
4299
  const title = summary?.name ?? project.name;
@@ -3531,7 +4312,8 @@ function GlobalWorkbench({ client }) {
3531
4312
  /* @__PURE__ */ React6.createElement(
3532
4313
  ProjectThumbnail,
3533
4314
  {
3534
- key: summary?.cover ? refKey(summary.cover) : "",
4315
+ key: project.available && summary?.cover ? refKey(summary.cover) : "",
4316
+ pending: project.available && Boolean(client.config.studioInstance) && !summary && summariesPending,
3535
4317
  cover: project.available ? summary?.cover ?? null : null,
3536
4318
  resolvePreview: async (ref) => {
3537
4319
  const { item } = await globalCall("global.asset", { ref });
@@ -3560,7 +4342,15 @@ function GlobalWorkbench({ client }) {
3560
4342
  onSelect: () => void client.projects?.reveal?.(project.id).catch((cause) => setError(message(cause)))
3561
4343
  }
3562
4344
  ] : [],
3563
- ...projectCoverActions(project.id)
4345
+ ...projectCoverActions(project.id, false),
4346
+ ...!legacyWorkbench ? [
4347
+ {
4348
+ id: "remove",
4349
+ label: "Remove project",
4350
+ tone: "danger",
4351
+ onSelect: () => void removeProject(project, title)
4352
+ }
4353
+ ] : []
3564
4354
  ]
3565
4355
  }
3566
4356
  ))), Boolean(tabs?.length) && /* @__PURE__ */ React6.createElement(
@@ -3590,7 +4380,7 @@ function GlobalWorkbench({ client }) {
3590
4380
  options: [
3591
4381
  { value: "home", label: "Home" },
3592
4382
  ...pageSources.map((page) => ({ value: page, label: workspaceLabels[page] })),
3593
- ...catalog.filter(({ available }) => available).map((project) => ({
4383
+ ...visibleProjects.filter(({ available }) => available).map((project) => ({
3594
4384
  value: "project:" + project.id,
3595
4385
  label: projectSummaries.get(project.id)?.name ?? project.name
3596
4386
  })),
@@ -3603,7 +4393,7 @@ function GlobalWorkbench({ client }) {
3603
4393
  else go(value);
3604
4394
  }
3605
4395
  }
3606
- )), !projectEntry && !route.home && /* @__PURE__ */ React6.createElement("header", { className: "studio-page-header" }, /* @__PURE__ */ React6.createElement("h1", null, route.project ? "Project workbench" : pageTitles[route.page]), route.project ? /* @__PURE__ */ React6.createElement(
4396
+ )), !projectEntry && !route.home && /* @__PURE__ */ React6.createElement("header", { className: "studio-page-header" }, /* @__PURE__ */ React6.createElement("h1", null, route.project ? "Project workbench" : route.page === "assets" ? "Assets" : pageTitles[route.page]), route.project ? /* @__PURE__ */ React6.createElement(
3607
4397
  Button,
3608
4398
  {
3609
4399
  label: "Back to workspace",
@@ -3620,7 +4410,20 @@ function GlobalWorkbench({ client }) {
3620
4410
  leadingIcon: "add",
3621
4411
  onClick: () => setCreateViewOpen(true)
3622
4412
  }
3623
- )), (error || failure) && /* @__PURE__ */ React6.createElement("div", { className: "studio-feedback studio-error", role: "alert" }, error || failure?.message, failure && " Reload the workspace to try again.", error && /* @__PURE__ */ React6.createElement(IconButton, { icon: "close", label: "Dismiss error", onClick: () => setError("") })), notice && /* @__PURE__ */ React6.createElement("div", { className: "studio-feedback", role: "status" }, notice, /* @__PURE__ */ React6.createElement(IconButton, { icon: "close", label: "Dismiss notice", onClick: () => setNotice("") })), route.project ? projectEntry ? /* @__PURE__ */ React6.createElement(
4413
+ )), (error || failure) && /* @__PURE__ */ React6.createElement("div", { className: "studio-feedback studio-error", role: "alert" }, error || failure?.message, failure && " Reload the workspace to try again.", error && /* @__PURE__ */ React6.createElement(IconButton, { icon: "close", label: "Dismiss error", onClick: () => setError("") })), notice && /* @__PURE__ */ React6.createElement("div", { className: "studio-feedback", role: "status" }, notice, /* @__PURE__ */ React6.createElement(IconButton, { icon: "close", label: "Dismiss notice", onClick: () => setNotice("") })), route.ref && /* @__PURE__ */ React6.createElement(
4414
+ Detail,
4415
+ {
4416
+ detail,
4417
+ refValue: route.ref,
4418
+ busy,
4419
+ onBack: () => navigate({ ...route, ref: null }),
4420
+ onVersion: (ref) => navigate({ ...route, ref }),
4421
+ onFavorite: (ref, enabled) => void favorite([ref], enabled),
4422
+ onDownload: (refs) => void download(refs),
4423
+ onProject: openProject,
4424
+ project: catalog.find((project) => project.id === detail?.item.projectId)
4425
+ }
4426
+ ), route.project ? projectEntry ? /* @__PURE__ */ React6.createElement(
3624
4427
  "iframe",
3625
4428
  {
3626
4429
  key: projectEntry,
@@ -3634,16 +4437,9 @@ function GlobalWorkbench({ client }) {
3634
4437
  StudioHome,
3635
4438
  {
3636
4439
  client,
3637
- onProjectCreated: (project) => {
3638
- setCatalog((items) => [...items ?? [], project]);
3639
- refreshCatalog();
3640
- navigate({
3641
- ...route,
3642
- home: void 0,
3643
- project: { id: project.id, page: "assets" }
3644
- });
3645
- },
3646
- projects: catalog.map(({ id, name, available }) => ({
4440
+ onProjectCreated,
4441
+ hiddenProjectIds: hiddenProjects,
4442
+ projects: visibleProjects.map(({ id, name, available }) => ({
3647
4443
  id,
3648
4444
  name: projectSummaries.get(id)?.name ?? name,
3649
4445
  available
@@ -3661,174 +4457,263 @@ function GlobalWorkbench({ client }) {
3661
4457
  ref
3662
4458
  }) : go("assets")
3663
4459
  }
3664
- ) : route.ref ? /* @__PURE__ */ React6.createElement(
3665
- Detail,
3666
- {
3667
- detail,
3668
- refValue: route.ref,
3669
- busy,
3670
- onBack: () => navigate({ ...route, ref: null }),
3671
- onVersion: (ref) => navigate({ ...route, ref }),
3672
- onFavorite: (ref, enabled) => void favorite([ref], enabled),
3673
- onDownload: (refs) => void download(refs),
3674
- onProject: openProject,
3675
- project: catalog.find((project) => project.id === detail?.item.projectId)
3676
- }
3677
- ) : /* @__PURE__ */ React6.createElement("section", { className: "studio-page-panel", "aria-label": pageTitles[route.page] }, /* @__PURE__ */ React6.createElement("div", { className: "studio-toolbar", "data-selection": selecting }, /* @__PURE__ */ React6.createElement("div", { className: "studio-view-tabs", role: "group", "aria-label": "Custom Views" }, views.map((view2) => /* @__PURE__ */ React6.createElement(
3678
- Button,
4460
+ ) : /* @__PURE__ */ React6.createElement(
4461
+ "section",
3679
4462
  {
3680
- key: view2.id,
3681
- label: view2.view.name,
3682
- variant: "text-tonal-sm",
3683
- "aria-pressed": active.id === view2.id,
3684
- className: active.id === view2.id ? "active" : "",
3685
- onClick: () => {
3686
- stopSelecting();
3687
- navigate({ ...route, view: view2.id, offset: 0 });
4463
+ className: "studio-page-panel",
4464
+ onScrollCapture: builtIn ? (event2) => {
4465
+ const grid = event2.target;
4466
+ if (grid instanceof HTMLElement && grid.matches(".studio-grid,.studio-table-scroll") && visibleCount < resultRows.length && grid.scrollHeight - grid.scrollTop - grid.clientHeight < 160) {
4467
+ setResultWindow({
4468
+ identity: queryIdentity,
4469
+ count: Math.min(visibleCount + 50, resultRows.length)
4470
+ });
4471
+ }
4472
+ } : void 0,
4473
+ "data-page": route.page,
4474
+ "data-asset-library": filterAssets || void 0,
4475
+ "aria-label": pageTitles[route.page]
4476
+ },
4477
+ /* @__PURE__ */ React6.createElement("div", { className: "studio-toolbar", "data-selection": selecting }, /* @__PURE__ */ React6.createElement("div", { className: "studio-view-tabs", role: "group", "aria-label": "Custom Views" }, visibleViews.map((view2) => /* @__PURE__ */ React6.createElement(
4478
+ Button,
4479
+ {
4480
+ key: view2.id,
4481
+ label: view2.view.name,
4482
+ variant: "text-tonal-sm",
4483
+ "aria-pressed": active.id === view2.id || favoriteView && view2.id === "default:assets",
4484
+ className: active.id === view2.id || favoriteView && view2.id === "default:assets" ? "active" : "",
4485
+ onClick: () => {
4486
+ stopSelecting();
4487
+ navigate({ ...route, view: view2.id, offset: 0 });
4488
+ }
3688
4489
  }
3689
- }
3690
- ))), selecting ? /* @__PURE__ */ React6.createElement("div", { className: "studio-bulk", role: "group", "aria-label": "Selected item actions" }, /* @__PURE__ */ React6.createElement("span", { role: "status" }, selected.size, " selected"), /* @__PURE__ */ React6.createElement(
3691
- Button,
3692
- {
3693
- label: allSelected ? "Deselect page" : "Select page",
3694
- variant: "text-tonal-sm",
3695
- disabled: !rows.length,
3696
- onClick: () => setSelected((prior) => {
3697
- const next = new Map(prior);
3698
- for (const row of rows) {
3699
- const id = selectionKey(row);
3700
- if (!id) continue;
3701
- if (allSelected) next.delete(id);
3702
- else
3703
- next.set(id, {
3704
- title: rowTitle(row, active.view),
3705
- ref: rowRef(row, active.view) ?? outputRef(row)
3706
- });
4490
+ ))), selecting && route.page === "assets" ? /* @__PURE__ */ React6.createElement(
4491
+ AssetSelectionToolbar,
4492
+ {
4493
+ count: selected.size,
4494
+ allSelected,
4495
+ busy,
4496
+ onSelectAll: rows.length ? toggleSelectedPage : void 0,
4497
+ onFavorite: selectedRefs.length ? () => void favorite(selectedRefs, true) : void 0,
4498
+ onDownload: selectedRefs.length && selectedRefs.length <= 100 ? () => void download(selectedRefs) : void 0,
4499
+ deleteHint: "Delete assets in their project.",
4500
+ onCancel: stopSelecting
4501
+ }
4502
+ ) : selecting ? /* @__PURE__ */ React6.createElement("div", { className: "studio-bulk", role: "group", "aria-label": "Selected item actions" }, /* @__PURE__ */ React6.createElement("span", { role: "status" }, selected.size, " selected"), /* @__PURE__ */ React6.createElement(
4503
+ Button,
4504
+ {
4505
+ label: allSelected ? "Deselect page" : "Select page",
4506
+ variant: "text-tonal-sm",
4507
+ disabled: !rows.length,
4508
+ onClick: toggleSelectedPage
4509
+ }
4510
+ ), route.page === "projects" ? /* @__PURE__ */ React6.createElement(
4511
+ Button,
4512
+ {
4513
+ label: "Copy names",
4514
+ variant: "text-tonal-sm",
4515
+ disabled: !selected.size,
4516
+ onClick: () => {
4517
+ void navigator.clipboard.writeText([...selected.values()].map((item) => item.title).join("\n")).then(
4518
+ () => setNotice("Project names copied."),
4519
+ (error2) => setError(message(error2))
4520
+ );
3707
4521
  }
3708
- return next;
3709
- })
3710
- }
3711
- ), route.page === "projects" ? /* @__PURE__ */ React6.createElement(
3712
- Button,
3713
- {
3714
- label: "Copy names",
3715
- variant: "text-tonal-sm",
3716
- disabled: !selected.size,
3717
- onClick: () => {
3718
- void navigator.clipboard.writeText([...selected.values()].map((item) => item.title).join("\n")).then(
3719
- () => setNotice("Project names copied."),
3720
- (error2) => setError(message(error2))
3721
- );
3722
4522
  }
3723
- }
3724
- ) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
3725
- Button,
3726
- {
3727
- label: "Favorite",
3728
- variant: "text-tonal-sm",
3729
- disabled: !selectedRefs.length || busy,
3730
- onClick: () => void favorite(selectedRefs, true)
3731
- }
3732
- ), /* @__PURE__ */ React6.createElement(
3733
- Button,
3734
- {
3735
- label: "Download",
3736
- variant: "text-tonal-sm",
3737
- disabled: !selectedRefs.length || busy,
3738
- onClick: () => void download(selectedRefs)
3739
- }
3740
- )), /* @__PURE__ */ React6.createElement(
3741
- Button,
3742
- {
3743
- label: "Cancel selection",
3744
- variant: "text-tonal-sm",
3745
- onClick: stopSelecting
3746
- }
3747
- )) : /* @__PURE__ */ React6.createElement("div", { className: "studio-toolbar-controls" }, !active.id.startsWith("default:") && /* @__PURE__ */ React6.createElement(
3748
- Button,
3749
- {
3750
- label: "Edit view",
3751
- variant: "text-tonal-sm",
3752
- onClick: () => setEditor(active)
3753
- }
3754
- ), /* @__PURE__ */ React6.createElement(
3755
- SegmentedControl,
3756
- {
3757
- label: "Layout",
3758
- iconOnly: true,
3759
- width: "hug",
3760
- value: route.layout,
3761
- items: [
3762
- { value: "list", label: "List", icon: "list" },
3763
- { value: "grid", label: "Grid", icon: "grid" }
3764
- ],
3765
- onValueChange: (layout) => navigate({ ...route, layout })
3766
- }
3767
- ), route.page === "assets" && /* @__PURE__ */ React6.createElement(
3768
- Button,
3769
- {
3770
- label: "Import assets",
3771
- leadingIcon: "import",
3772
- variant: "text-filled-sm",
3773
- disabled: busy,
3774
- onClick: () => importInput.current?.click()
3775
- }
3776
- ))), filterAssets && !selecting && /* @__PURE__ */ React6.createElement("div", { className: "ad-asset-toolbar" }, ["project", "format", "subject"].map((field) => {
3777
- const label = { project: "Project", format: "Format", subject: "Type" }[field];
3778
- const choices = field === "project" ? (catalog ?? []).map((item) => [
3779
- item.id,
3780
- projectSummaries.get(item.id)?.name || item.name
3781
- ]) : (field === "format" ? ["image", "video", "audio", "text"] : ["Character", "Product", "Model", "Scene"]).map((value) => [value, value]);
3782
- return /* @__PURE__ */ React6.createElement("label", { key: field }, label, " ", /* @__PURE__ */ React6.createElement(
3783
- "select",
4523
+ ) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
4524
+ Button,
4525
+ {
4526
+ label: "Favorite",
4527
+ variant: "text-tonal-sm",
4528
+ disabled: !selectedRefs.length || busy,
4529
+ onClick: () => void favorite(selectedRefs, true)
4530
+ }
4531
+ ), /* @__PURE__ */ React6.createElement(
4532
+ Button,
4533
+ {
4534
+ label: "Download",
4535
+ variant: "text-tonal-sm",
4536
+ disabled: !selectedRefs.length || busy,
4537
+ onClick: () => void download(selectedRefs)
4538
+ }
4539
+ )), /* @__PURE__ */ React6.createElement(
4540
+ Button,
4541
+ {
4542
+ label: "Cancel selection",
4543
+ variant: "text-tonal-sm",
4544
+ onClick: stopSelecting
4545
+ }
4546
+ )) : /* @__PURE__ */ React6.createElement("div", { className: "studio-toolbar-controls" }, !active.id.startsWith("default:") && /* @__PURE__ */ React6.createElement(
4547
+ Button,
3784
4548
  {
3785
- "aria-label": "Filter by " + label,
3786
- value: assetFilter[field],
3787
- onChange: (event2) => {
3788
- setAssetFilter({ ...assetFilter, [field]: event2.target.value });
3789
- navigate({ ...route, offset: 0 });
4549
+ label: "Edit view",
4550
+ variant: "text-tonal-sm",
4551
+ onClick: () => setEditor(active)
4552
+ }
4553
+ ), builtIn && /* @__PURE__ */ React6.createElement(
4554
+ Button,
4555
+ {
4556
+ label: "Selects",
4557
+ leadingIcon: "select-items",
4558
+ variant: "text-tonal-sm",
4559
+ width: "hug",
4560
+ onClick: () => setSelecting(true)
4561
+ }
4562
+ ), builtIn && /* @__PURE__ */ React6.createElement(
4563
+ FilterMenu,
4564
+ {
4565
+ label: "Filter",
4566
+ leadingIcon: "filter",
4567
+ groups: route.page === "projects" ? [
4568
+ { id: "type", label: "Project type", options: projectTypes },
4569
+ {
4570
+ id: "availability",
4571
+ label: "Availability",
4572
+ options: ["Available", "Unavailable"]
4573
+ }
4574
+ ] : [
4575
+ ...route.page === "assets" ? [
4576
+ {
4577
+ id: "favorite",
4578
+ label: "Favorites",
4579
+ options: ["Favorites"],
4580
+ optionLabels: { Favorites: "Favorited" }
4581
+ }
4582
+ ] : [
4583
+ {
4584
+ id: "state",
4585
+ label: "Status",
4586
+ options: Object.keys(taskLabels),
4587
+ optionLabels: taskLabels
4588
+ }
4589
+ ],
4590
+ {
4591
+ id: "subject",
4592
+ label: "Type",
4593
+ options: ["Character", "Scene", "Product", "Model"]
4594
+ },
4595
+ {
4596
+ id: "format",
4597
+ label: "Format",
4598
+ options: ["image", "video", "audio", "text"],
4599
+ optionLabels: {
4600
+ image: "Image",
4601
+ video: "Video",
4602
+ audio: "Audio",
4603
+ text: "Script"
4604
+ }
4605
+ },
4606
+ {
4607
+ id: "aspect",
4608
+ initiallyCollapsed: true,
4609
+ label: "Aspect ratio",
4610
+ options: ["16:9", "9:16", "1:1", "4:3", "3:4"]
4611
+ },
4612
+ {
4613
+ id: "model",
4614
+ initiallyCollapsed: true,
4615
+ label: "Generation Model",
4616
+ options: [
4617
+ ...new Set(
4618
+ (libraryRows ?? []).map((row) => row.modelId).filter(
4619
+ (id) => typeof id === "string" && !!id
4620
+ )
4621
+ )
4622
+ ]
4623
+ },
4624
+ {
4625
+ id: "project",
4626
+ initiallyCollapsed: true,
4627
+ label: "Project",
4628
+ options: catalog.map((p) => p.id),
4629
+ optionLabels: Object.fromEntries(
4630
+ catalog.map((p) => [
4631
+ p.id,
4632
+ projectSummaries.get(p.id)?.name || p.name
4633
+ ])
4634
+ )
4635
+ }
4636
+ ],
4637
+ value: favoriteView ? { ...assetFilter, favorite: ["Favorites"] } : assetFilter,
4638
+ onValueChange: (next) => {
4639
+ setAssetFilter(next);
4640
+ navigate({
4641
+ ...route,
4642
+ view: favoriteView && !next.favorite?.length ? "default:assets" : route.view,
4643
+ offset: 0
4644
+ });
3790
4645
  }
3791
- },
3792
- /* @__PURE__ */ React6.createElement("option", { value: "" }, "All"),
3793
- choices.map(([value, name]) => /* @__PURE__ */ React6.createElement("option", { key: value, value }, name))
3794
- ));
3795
- })), /* @__PURE__ */ React6.createElement(
3796
- Results,
3797
- {
3798
- route,
3799
- active,
3800
- rows,
3801
- queryLoading,
3802
- failure: !!failure,
3803
- selecting,
3804
- visibleColumns,
3805
- annotationProject,
3806
- selectionKey,
3807
- isSelected,
3808
- toggle,
3809
- cover,
3810
- canOpen,
3811
- openRow,
3812
- renderCell,
3813
- rowActions
3814
- }
3815
- ), (route.offset > 0 || nextOffset !== null) && /* @__PURE__ */ React6.createElement("footer", { className: "studio-pagination" }, /* @__PURE__ */ React6.createElement(
3816
- Button,
3817
- {
3818
- label: "Previous page",
3819
- variant: "text-tonal-sm",
3820
- disabled: route.offset === 0 || queryLoading,
3821
- onClick: () => navigate({ ...route, offset: Math.max(0, route.offset - 50) })
3822
- }
3823
- ), /* @__PURE__ */ React6.createElement("span", null, "Page ", Math.floor(route.offset / 50) + 1), /* @__PURE__ */ React6.createElement(
3824
- Button,
3825
- {
3826
- label: "Next page",
3827
- variant: "text-tonal-sm",
3828
- disabled: nextOffset === null || queryLoading,
3829
- onClick: () => navigate({ ...route, offset: nextOffset })
3830
- }
3831
- ))))
4646
+ }
4647
+ ), /* @__PURE__ */ React6.createElement(
4648
+ SegmentedControl,
4649
+ {
4650
+ label: "Layout",
4651
+ iconOnly: true,
4652
+ width: "hug",
4653
+ value: route.layout,
4654
+ items: [
4655
+ { value: "list", label: "List", icon: "list" },
4656
+ { value: "grid", label: "Grid", icon: "grid" }
4657
+ ],
4658
+ onValueChange: (layout) => navigate({ ...route, layout })
4659
+ }
4660
+ ), route.page === "projects" && NewProjectDialog && /* @__PURE__ */ React6.createElement(
4661
+ Button,
4662
+ {
4663
+ label: "Create Project",
4664
+ variant: "text-filled-sm",
4665
+ width: "hug",
4666
+ onClick: () => setCreatingProject(true)
4667
+ }
4668
+ ), route.page === "assets" && /* @__PURE__ */ React6.createElement(
4669
+ Button,
4670
+ {
4671
+ label: "Import assets",
4672
+ width: "hug",
4673
+ variant: "text-filled-sm",
4674
+ disabled: busy,
4675
+ onClick: () => importInput.current?.click()
4676
+ }
4677
+ ))),
4678
+ /* @__PURE__ */ React6.createElement(
4679
+ Results,
4680
+ {
4681
+ route,
4682
+ active,
4683
+ rows,
4684
+ queryLoading,
4685
+ failure: !!failure,
4686
+ selecting,
4687
+ visibleColumns,
4688
+ annotationProject,
4689
+ selectionKey,
4690
+ isSelected,
4691
+ toggle,
4692
+ cover,
4693
+ canOpen,
4694
+ openRow,
4695
+ renderCell,
4696
+ rowActions
4697
+ }
4698
+ ),
4699
+ !builtIn && (route.offset > 0 || nextOffset !== null) && /* @__PURE__ */ React6.createElement("footer", { className: "studio-pagination" }, /* @__PURE__ */ React6.createElement(
4700
+ Button,
4701
+ {
4702
+ label: "Previous page",
4703
+ variant: "text-tonal-sm",
4704
+ disabled: route.offset === 0 || queryLoading,
4705
+ onClick: () => navigate({ ...route, offset: Math.max(0, route.offset - 50) })
4706
+ }
4707
+ ), /* @__PURE__ */ React6.createElement("span", null, "Page ", Math.floor(route.offset / 50) + 1), /* @__PURE__ */ React6.createElement(
4708
+ Button,
4709
+ {
4710
+ label: "Next page",
4711
+ variant: "text-tonal-sm",
4712
+ disabled: nextOffset === null || queryLoading,
4713
+ onClick: () => navigate({ ...route, offset: nextOffset })
4714
+ }
4715
+ ))
4716
+ ))
3832
4717
  ),
3833
4718
  /* @__PURE__ */ React6.createElement(
3834
4719
  "input",
@@ -3960,6 +4845,7 @@ function GlobalWorkbench({ client }) {
3960
4845
  projectActionError && /* @__PURE__ */ React6.createElement("p", { role: "alert" }, projectActionError)
3961
4846
  )
3962
4847
  ),
4848
+ creatingProject && NewProjectDialog && /* @__PURE__ */ React6.createElement(NewProjectDialog, { close: () => setCreatingProject(false), onCreated: onProjectCreated }),
3963
4849
  createViewOpen && /* @__PURE__ */ React6.createElement(
3964
4850
  CreateViewDialog,
3965
4851
  {
@@ -4042,7 +4928,7 @@ var date = (value) => value ? new Date(value).toLocaleString("zh-CN", {
4042
4928
  }) : "";
4043
4929
  function FilePreview({ bridge, projectId, instance, row, version, compact = false }) {
4044
4930
  const mediaElement = React7.useRef(null);
4045
- const [location, setLocation] = React7.useState(null), [text, setText] = React7.useState(""), [error, setError] = React7.useState("");
4931
+ const [location2, setLocation] = React7.useState(null), [text, setText] = React7.useState(""), [error, setError] = React7.useState("");
4046
4932
  React7.useEffect(() => {
4047
4933
  const element = mediaElement.current;
4048
4934
  return () => {
@@ -4052,7 +4938,7 @@ function FilePreview({ bridge, projectId, instance, row, version, compact = fals
4052
4938
  element.load();
4053
4939
  }
4054
4940
  };
4055
- }, [location?.previewUrl]);
4941
+ }, [location2?.previewUrl]);
4056
4942
  React7.useEffect(() => {
4057
4943
  let active = true;
4058
4944
  setLocation(null);
@@ -4080,9 +4966,9 @@ function FilePreview({ bridge, projectId, instance, row, version, compact = fals
4080
4966
  if (error) return /* @__PURE__ */ React7.createElement("div", { className: "file-placeholder" }, error);
4081
4967
  if (row.data.kind === "text" && compact)
4082
4968
  return /* @__PURE__ */ React7.createElement("div", { className: "file-document", "aria-hidden": "true" }, /* @__PURE__ */ React7.createElement("span", null, "\u6587"), /* @__PURE__ */ React7.createElement("i", null), /* @__PURE__ */ React7.createElement("i", null), /* @__PURE__ */ React7.createElement("i", null));
4083
- if (!location) return /* @__PURE__ */ React7.createElement("div", { className: "file-placeholder" }, "\u6B63\u5728\u52A0\u8F7D\u2026");
4969
+ if (!location2) return /* @__PURE__ */ React7.createElement("div", { className: "file-placeholder" }, "\u6B63\u5728\u52A0\u8F7D\u2026");
4084
4970
  if (row.data.kind === "image")
4085
- return /* @__PURE__ */ React7.createElement("img", { loading: "lazy", src: location.previewUrl, alt: row.data.name });
4971
+ return /* @__PURE__ */ React7.createElement("img", { loading: "lazy", src: location2.previewUrl, alt: row.data.name });
4086
4972
  if (row.data.kind === "video")
4087
4973
  return /* @__PURE__ */ React7.createElement(
4088
4974
  "video",
@@ -4092,7 +4978,7 @@ function FilePreview({ bridge, projectId, instance, row, version, compact = fals
4092
4978
  controls: !compact,
4093
4979
  muted: compact,
4094
4980
  preload: "metadata",
4095
- src: location.previewUrl
4981
+ src: location2.previewUrl
4096
4982
  }
4097
4983
  );
4098
4984
  if (row.data.kind === "audio")
@@ -4102,7 +4988,7 @@ function FilePreview({ bridge, projectId, instance, row, version, compact = fals
4102
4988
  ref: mediaElement,
4103
4989
  "aria-label": row.data.name,
4104
4990
  controls: true,
4105
- src: location.previewUrl
4991
+ src: location2.previewUrl
4106
4992
  }
4107
4993
  );
4108
4994
  if (row.data.kind === "text") return /* @__PURE__ */ React7.createElement("pre", { className: "file-text" }, text);
@@ -4476,7 +5362,7 @@ function CreationResults({
4476
5362
  }
4477
5363
  function CreationResult({ row, bridge, projectId, studio, onOpen, onUse, busy }) {
4478
5364
  const version = row.versions?.at(-1);
4479
- const [location, setLocation] = React8.useState(null);
5365
+ const [location2, setLocation] = React8.useState(null);
4480
5366
  const [error, setError] = React8.useState("");
4481
5367
  React8.useEffect(() => {
4482
5368
  let current = true;
@@ -4494,7 +5380,7 @@ function CreationResult({ row, bridge, projectId, studio, onOpen, onUse, busy })
4494
5380
  current = false;
4495
5381
  };
4496
5382
  }, [projectId, studio, row.objectId, version?.versionId]);
4497
- return /* @__PURE__ */ React8.createElement("article", { className: "creation-result" }, /* @__PURE__ */ React8.createElement("div", { className: "creation-result-media" }, !location ? /* @__PURE__ */ React8.createElement("span", { className: "sub" }, error || "\u6B63\u5728\u52A0\u8F7D\u2026") : row.data.kind === "image" ? /* @__PURE__ */ React8.createElement("img", { src: location.previewUrl, alt: row.data.name }) : row.data.kind === "video" ? /* @__PURE__ */ React8.createElement("video", { controls: true, preload: "metadata", src: location.previewUrl }) : row.data.kind === "audio" ? /* @__PURE__ */ React8.createElement("audio", { controls: true, preload: "metadata", src: location.previewUrl }) : /* @__PURE__ */ React8.createElement("a", { href: location.previewUrl }, "\u6253\u5F00\u6587\u4EF6")), /* @__PURE__ */ React8.createElement("div", { className: "creation-result-caption" }, /* @__PURE__ */ React8.createElement("strong", null, row.data.name), /* @__PURE__ */ React8.createElement("span", { className: "sub" }, "v", version?.versionNumber)), /* @__PURE__ */ React8.createElement("div", { className: "actions" }, /* @__PURE__ */ React8.createElement("button", { onClick: () => onOpen(row) }, "\u6253\u5F00\u6587\u4EF6"), /* @__PURE__ */ React8.createElement("button", { disabled: busy, onClick: () => onUse(row) }, "\u7528\u4F5C\u53C2\u8003")));
5383
+ return /* @__PURE__ */ React8.createElement("article", { className: "creation-result" }, /* @__PURE__ */ React8.createElement("div", { className: "creation-result-media" }, !location2 ? /* @__PURE__ */ React8.createElement("span", { className: "sub" }, error || "\u6B63\u5728\u52A0\u8F7D\u2026") : row.data.kind === "image" ? /* @__PURE__ */ React8.createElement("img", { src: location2.previewUrl, alt: row.data.name }) : row.data.kind === "video" ? /* @__PURE__ */ React8.createElement("video", { controls: true, preload: "metadata", src: location2.previewUrl }) : row.data.kind === "audio" ? /* @__PURE__ */ React8.createElement("audio", { controls: true, preload: "metadata", src: location2.previewUrl }) : /* @__PURE__ */ React8.createElement("a", { href: location2.previewUrl }, "\u6253\u5F00\u6587\u4EF6")), /* @__PURE__ */ React8.createElement("div", { className: "creation-result-caption" }, /* @__PURE__ */ React8.createElement("strong", null, row.data.name), /* @__PURE__ */ React8.createElement("span", { className: "sub" }, "v", version?.versionNumber)), /* @__PURE__ */ React8.createElement("div", { className: "actions" }, /* @__PURE__ */ React8.createElement("button", { onClick: () => onOpen(row) }, "\u6253\u5F00\u6587\u4EF6"), /* @__PURE__ */ React8.createElement("button", { disabled: busy, onClick: () => onUse(row) }, "\u7528\u4F5C\u53C2\u8003")));
4498
5384
  }
4499
5385
 
4500
5386
  // packages/studio-workbench/src/settings.tsx
@@ -4948,7 +5834,7 @@ function FileMediaTools({
4948
5834
  }
4949
5835
 
4950
5836
  // packages/studio-workbench/src/base-styles.ts
4951
- var baseCss = `*{box-sizing:border-box}body{margin:0;background:#fff;color:#25272b;font:13px -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}button,input,select,textarea{font:inherit;color:inherit}button,a{cursor:pointer}button{background:white;border:1px solid #dedee4;border-radius:5px;padding:7px 11px;transition:background .12s}button:hover{background:#f0f0f6}button:disabled{opacity:.45;cursor:default}.primary{background:#514ee8;color:white;border-color:#514ee8}.primary:hover{background:#403dc6}a{color:#504edb;text-decoration:none}header{height:64px;border-bottom:1px solid #e7e7eb;display:flex;align-items:center;gap:30px;padding:0 28px}.brand{font-size:19px;font-weight:650;color:#23252a}.brand b{display:inline-grid;place-items:center;background:#23252a;color:white;width:30px;height:30px;border-radius:6px;margin-right:10px}header nav{display:flex;gap:22px}header nav a{color:#777;padding:22px 0;border-bottom:2px solid transparent}header nav a.active{color:#222;border-bottom:2px solid #222}.workspace{display:grid;grid-template-columns:170px minmax(500px,1fr);min-height:calc(100vh - 64px)}aside.nav{background:#f7f7f6;border-right:1px solid #e7e7e7;padding:24px 12px}.eyebrow{text-transform:uppercase;letter-spacing:1.7px;color:#84868e;font-size:10px;font-weight:650;margin:8px 0 16px}.nav button,.nav a{display:block;width:100%;text-align:left;margin:3px 0;padding:9px;border:0;background:transparent;color:#666}.nav .selected{background:#eaeaf4;color:#303249;border-radius:5px}.nav .recent{margin-top:32px}.nav small{display:block;color:#999;margin-top:40px;line-height:1.7}main{padding:28px 26px 60px;min-width:0}h1{font-size:27px;font-weight:650;letter-spacing:-.6px;margin:8px 0}h2{font-size:18px;margin:12px 0}h3{font-size:14px;margin:20px 0 12px}.sub{color:#8a8b92;font-size:12px}.heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px;gap:20px}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.tabs{display:flex;gap:24px;border-bottom:1px solid #e7e7eb;margin-bottom:20px}.tabs button{border:0;background:none;padding:12px 0;color:#888;border-radius:0}.tabs button.active{border-bottom:2px solid #25272b;color:#25272b}.toolbar{display:flex;gap:8px;align-items:center;margin-bottom:16px;flex-wrap:wrap}input,select,textarea{border:1px solid #dcdde4;background:#fff;border-radius:5px;padding:8px;max-width:100%}input:focus,textarea:focus,select:focus{outline:2px solid #d9d8ff;outline-offset:1px}textarea{min-height:86px;width:100%;resize:vertical}label{display:block;color:#70727c;font-size:11px;margin:12px 0 5px}label input,label select{display:block;width:100%;margin-top:5px}.content{display:grid;grid-template-columns:minmax(280px,1fr) 300px;gap:22px}.content.full{display:block}.table-scroll{overflow:auto}table{width:100%;border-collapse:collapse;text-align:left;table-layout:fixed}th{font-weight:400;font-size:10px;color:#999;background:#f8f8fa;position:relative}td,th{padding:13px 10px;border-bottom:1px solid #e8e8ed;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}tr[tabindex]{cursor:pointer;transition:background .1s}tr[tabindex]:hover{background:#fafaff}tr.chosen{background:#f0f0ff}tr:focus{outline:2px solid #b5b3ff;outline-offset:-2px}td strong{font-weight:550}td .sub{margin-top:5px;font-size:10px}.tag{display:inline-block;background:#f2f2f7;color:#66677d;border-radius:3px;padding:3px 5px;font-size:10px;margin:1px 3px 1px 0}.inspector{border-left:1px solid #e8e8ed;padding-left:20px;animation:reveal .12s ease-out}.inspector video,.inspector img,.compare video,.compare img{width:100%;max-height:260px;object-fit:contain;background:#f3f3f5;border-radius:5px}.inspector audio{width:100%}.text-preview{white-space:pre-wrap;max-height:280px;overflow:auto;background:#f7f7fa;padding:15px;font-size:12px}dl{display:grid;grid-template-columns:85px minmax(0,1fr);gap:12px;margin:20px 0}dt{color:#8b8c96;font-size:11px}dd{margin:0;overflow-wrap:anywhere;font-size:11px}dd pre{white-space:pre-wrap}.empty{padding:55px 15px;text-align:center;color:#999;border-bottom:1px solid #eee}.empty-preview{padding:40px 15px;background:#f6f6f8;text-align:center;color:#999}.error{background:#fff4f1;border:1px solid #f2d8cf;padding:12px;color:#914a3e;margin:12px 0;white-space:pre-wrap}.notice{background:#f7f7fc;padding:12px;color:#757586;margin:12px 0}.drawer-backdrop{position:fixed;inset:0;background:#20213535;z-index:4;display:flex;justify-content:flex-end}.drawer{width:460px;max-width:100vw;background:white;padding:26px;box-shadow:-10px 0 30px #18182412;overflow:auto;animation:reveal .15s ease-out}.drawer h2{margin-top:0}.drawer .close{float:right}.compare{display:grid;grid-template-columns:1fr 1fr;gap:25px}.candidate{padding-bottom:24px;border-bottom:1px solid #e7e7ed;margin-bottom:20px}.candidate .actions{justify-content:space-between;margin-top:15px}.version-list{display:flex;gap:5px;flex-wrap:wrap;margin:12px 0}.selected-version{border-color:#514ee8;color:#514ee8;background:#f1f0ff}.row-check{width:34px}.json{font:11px ui-monospace,monospace;white-space:pre-wrap;overflow:auto}.status{font-size:11px;color:#666d92}.split{display:grid;grid-template-columns:1fr 300px;gap:30px}.form-actions{margin-top:20px;display:flex;gap:8px}.column-options{padding:12px;background:#f8f8fa;display:flex;gap:12px;flex-wrap:wrap;margin-bottom:15px}.column-options label{display:flex;align-items:center;gap:6px;margin:0}.column-options input[type=checkbox]{width:auto}.column-options input[type=number]{width:65px}.history{border-left:2px solid #d9d8f7;padding-left:12px;margin:18px 0}.history p{margin:6px 0}.footer{display:flex;justify-content:space-between;margin-top:16px;color:#999;font-size:10px}@keyframes reveal{from{opacity:.4;transform:translateX(6px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}@media(max-width:1050px){.workspace{grid-template-columns:140px 1fr}.content,.split{grid-template-columns:1fr}.inspector{border-left:0;border-top:1px solid #eee;padding:20px 0}main{padding:20px}.compare{gap:12px}}`;
5837
+ var baseCss = `*{box-sizing:border-box}body{margin:0;background:#fff;color:#25272b;font:13px -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}button,input,select,textarea{font:inherit;color:inherit}button,a{cursor:pointer}button{background:white;border:1px solid #dedee4;border-radius:5px;padding:7px 11px;transition:background .12s}button:hover{background:#f0f0f6}button:disabled{opacity:.45;cursor:default}.primary{background:#514ee8;color:white;border-color:#514ee8}.primary:hover{background:#403dc6}a{color:#504edb;text-decoration:none}header{height:64px;border-bottom:1px solid #e7e7eb;display:flex;align-items:center;gap:30px;padding:0 28px}.brand{font-size:19px;font-weight:650;color:#23252a}.brand b{display:inline-grid;place-items:center;background:#23252a;color:white;width:30px;height:30px;border-radius:6px;margin-right:10px}header nav{display:flex;gap:22px}header nav a{color:#777;padding:22px 0;border-bottom:2px solid transparent}header nav a.active{color:#222;border-bottom:2px solid #222}.workspace{display:grid;grid-template-columns:170px minmax(500px,1fr);min-height:calc(100vh - 64px)}aside.nav{background:#f7f7f6;border-right:1px solid #e7e7e7;padding:24px 12px}.eyebrow{text-transform:uppercase;letter-spacing:1.7px;color:#84868e;font-size:10px;font-weight:650;margin:8px 0 16px}.nav button,.nav a{display:block;width:100%;text-align:left;margin:3px 0;padding:9px;border:0;background:transparent;color:#666}.nav .selected{background:#eaeaf4;color:#303249;border-radius:5px}.nav .recent{margin-top:32px}.nav small{display:block;color:#999;margin-top:40px;line-height:1.7}main{padding:28px 26px 60px;min-width:0}h1{font-size:27px;font-weight:650;letter-spacing:-.6px;margin:8px 0}h2{font-size:18px;margin:12px 0}h3{font-size:14px;margin:20px 0 12px}.sub{color:#8a8b92;font-size:12px}.heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px;gap:20px}.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.tabs{display:flex;gap:24px;border-bottom:1px solid #e7e7eb;margin-bottom:20px}.tabs button{border:0;background:none;padding:12px 0;color:#888;border-radius:0}.tabs button.active{border-bottom:2px solid #25272b;color:#25272b}.toolbar{display:flex;gap:8px;align-items:center;margin-bottom:16px;flex-wrap:wrap}input,select,textarea{border:1px solid #dcdde4;background:#fff;border-radius:5px;padding:8px;max-width:100%}input:focus,textarea:focus,select:focus{outline:2px solid #d9d8ff;outline-offset:1px}textarea{min-height:86px;width:100%;resize:vertical}label{display:block;color:#70727c;font-size:11px;margin:12px 0 5px}label input,label select{display:block;width:100%;margin-top:5px}.content{display:grid;grid-template-columns:minmax(280px,1fr) 300px;gap:22px}.content.full{display:block}.table-scroll{scrollbar-gutter: stable;overflow:scroll auto}table{width:100%;border-collapse:collapse;text-align:left;table-layout:fixed}th{font-weight:400;font-size:10px;color:#999;background:#f8f8fa;position:relative}td,th{padding:13px 10px;border-bottom:1px solid #e8e8ed;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}tr[tabindex]{cursor:pointer;transition:background .1s}tr[tabindex]:hover{background:#fafaff}tr.chosen{background:#f0f0ff}tr:focus{outline:2px solid #b5b3ff;outline-offset:-2px}td strong{font-weight:550}td .sub{margin-top:5px;font-size:10px}.tag{display:inline-block;background:#f2f2f7;color:#66677d;border-radius:3px;padding:3px 5px;font-size:10px;margin:1px 3px 1px 0}.inspector{border-left:1px solid #e8e8ed;padding-left:20px;animation:reveal .12s ease-out}.inspector video,.inspector img,.compare video,.compare img{width:100%;max-height:260px;object-fit:contain;background:#f3f3f5;border-radius:5px}.inspector audio{width:100%}.text-preview{white-space:pre-wrap;max-height:280px;scrollbar-gutter: stable;overflow:scroll auto;background:#f7f7fa;padding:15px;font-size:12px}dl{display:grid;grid-template-columns:85px minmax(0,1fr);gap:12px;margin:20px 0}dt{color:#8b8c96;font-size:11px}dd{margin:0;overflow-wrap:anywhere;font-size:11px}dd pre{white-space:pre-wrap}.empty{padding:55px 15px;text-align:center;color:#999;border-bottom:1px solid #eee}.empty-preview{padding:40px 15px;background:#f6f6f8;text-align:center;color:#999}.error{background:#fff4f1;border:1px solid #f2d8cf;padding:12px;color:#914a3e;margin:12px 0;white-space:pre-wrap}.notice{background:#f7f7fc;padding:12px;color:#757586;margin:12px 0}.drawer-backdrop{position:fixed;inset:0;background:#20213535;z-index:4;display:flex;justify-content:flex-end}.drawer{width:460px;max-width:100vw;background:white;padding:26px;box-shadow:-10px 0 30px #18182412;scrollbar-gutter: stable;overflow:scroll auto;animation:reveal .15s ease-out}.drawer h2{margin-top:0}.drawer .close{float:right}.compare{display:grid;grid-template-columns:1fr 1fr;gap:25px}.candidate{padding-bottom:24px;border-bottom:1px solid #e7e7ed;margin-bottom:20px}.candidate .actions{justify-content:space-between;margin-top:15px}.version-list{display:flex;gap:5px;flex-wrap:wrap;margin:12px 0}.selected-version{border-color:#514ee8;color:#514ee8;background:#f1f0ff}.row-check{width:34px}.json{font:11px ui-monospace,monospace;white-space:pre-wrap;scrollbar-gutter: stable;overflow:scroll auto}.status{font-size:11px;color:#666d92}.split{display:grid;grid-template-columns:1fr 300px;gap:30px}.form-actions{margin-top:20px;display:flex;gap:8px}.column-options{padding:12px;background:#f8f8fa;display:flex;gap:12px;flex-wrap:wrap;margin-bottom:15px}.column-options label{display:flex;align-items:center;gap:6px;margin:0}.column-options input[type=checkbox]{width:auto}.column-options input[type=number]{width:65px}.history{border-left:2px solid #d9d8f7;padding-left:12px;margin:18px 0}.history p{margin:6px 0}.footer{display:flex;justify-content:space-between;margin-top:16px;color:#999;font-size:10px}@keyframes reveal{from{opacity:.4;transform:translateX(6px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}@media(max-width:1050px){.workspace{grid-template-columns:140px 1fr}.content,.split{grid-template-columns:1fr}.inspector{border-left:0;border-top:1px solid #eee;padding:20px 0}main{padding:20px}.compare{gap:12px}}`;
4952
5838
 
4953
5839
  // packages/studio-workbench/src/workbench-styles.ts
4954
5840
  var workbenchCss = `
@@ -4957,7 +5843,7 @@ var workbenchCss = `
4957
5843
  .project-content-navigation [aria-current=page]{background:#eeedf9;color:#5149b9}
4958
5844
  .creation-page>.project-content-navigation{padding:14px 26px;margin:0;border-bottom:1px solid #e8e8ed}
4959
5845
  @media(min-width:851px){.project-content>.creation-page{height:100vh}}
4960
- .workspace{grid-template-columns:170px minmax(0,1fr)}main{min-width:0}.heading{align-items:flex-start}.heading>.actions{justify-content:flex-end}.nav .scope-group{margin:22px 0 9px}.nav .workspace-link{font-size:12px}.nav .project-name{padding:0 9px 8px;font-size:12px;color:#555}.nav .selected{background:#eeedf9;color:#5149b9}.nav button{white-space:normal}.creation-page{padding:0;display:flex;flex-direction:column;height:calc(100vh - 64px);overflow:hidden}.creation-page>.heading{padding:22px 26px 18px;margin:0;border-bottom:1px solid #e8e8ed;flex-shrink:0}.creation-page>.heading h1{font-size:22px}.creation-layout{display:grid;grid-template-columns:360px minmax(0,1fr);min-height:0;flex:1}.creation-controls{padding:22px 24px;overflow-y:auto;border-right:1px solid #e8e8ed;background:white}.creation-controls .generation-form{min-height:100%;display:flex;flex-direction:column;gap:18px}.generation-form>label,.generation-form .generation-fields>label{margin:0;font-size:11px;color:#77717f}.generation-form label input,.generation-form label select,.generation-form label textarea{margin-top:7px;width:100%;border-radius:7px;padding:10px 11px}.generation-form textarea{min-height:100px;line-height:1.8}.generation-fields{display:flex;flex-direction:column;gap:17px}.generation-kind-tabs{display:flex;gap:4px;padding:4px;border-radius:8px;background:#f4f3f7}.generation-kind-tabs button{flex:1;border:0;background:transparent;font-size:11px;color:#8c8797;border-radius:5px;padding:9px 6px}.generation-kind-tabs button.active{background:white;color:#5149b9;box-shadow:0 1px 3px #1612250a}.generation-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px}.generation-settings-grid label{margin:0;min-width:0;font-size:11px;color:#88818f}.generation-settings-grid input,.generation-settings-grid select{width:100%;margin-top:7px}.generation-settings-grid .sub{display:block;font-size:9px;margin-top:5px;line-height:1.5}.generation-settings-grid input[type=checkbox]{width:auto}.generation-submit{position:sticky;bottom:-22px;margin:18px -2px -2px;padding:15px 2px 3px;background:white;border-top:1px solid #eeeaf4;z-index:1}.generation-submit button{width:100%;padding:12px;font-size:12px}.generation-submit p{font-size:9px;line-height:1.8;text-align:center;margin:9px 0 0;color:#aaa3b3}.creation-results{padding:26px;overflow-y:auto;background:#fafafb;min-width:0}.creation-results-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px}.creation-results-heading h2{margin:0;font-size:16px}.creation-results-heading .sub{font-size:10px}.creation-result-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 18px}.creation-result{min-width:0}.creation-result-media{background:#f0eff4;border-radius:8px;min-height:150px;aspect-ratio:1.2;display:flex;align-items:center;justify-content:center;overflow:hidden}.creation-result-media img,.creation-result-media video{width:100%;height:100%;object-fit:contain}.creation-result-media audio{width:95%}.creation-result-caption{display:flex;justify-content:space-between;gap:12px;margin:11px 0;font-size:12px}.creation-result-caption strong{font-weight:550;overflow-wrap:anywhere}.creation-result .actions{gap:6px}.creation-result .actions button{font-size:10px;padding:6px 8px}.creation-results-empty{min-height:330px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;border:1px dashed #e0dce9;border-radius:8px;padding:30px;color:#aaa1b8}.creation-results-empty h3{font-size:14px;font-weight:500;margin:12px 0}.creation-results-empty p{font-size:11px;line-height:1.8;max-width:300px;margin:4px 0}.creation-empty-symbol{font-size:42px;color:#c0b8cf}.creation-task{width:100%;display:flex;justify-content:space-between;align-items:center;gap:10px;background:white;margin-bottom:13px;padding:14px;text-align:left;font-size:11px}.creation-task-dot{width:7px;height:7px;border-radius:50%;background:#8d80da;flex-shrink:0}.creation-task .sub{margin-left:auto}.reference-section{margin:0}.reference-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:11px}.reference-heading h3{font-size:11px;font-weight:500;margin:0;color:#77717f}.reference-heading .sub{font-size:9px}.reference-strip{display:flex;gap:9px;flex-wrap:wrap}.reference-tile{width:88px;position:relative;min-width:0}.reference-thumb{height:76px;border:1px solid #e0daed;border-radius:7px;background:#f5f3f8;overflow:hidden;display:flex;align-items:center;justify-content:center;padding:0;width:100%}.reference-thumb img,.reference-thumb video{width:100%;height:100%;object-fit:cover}.reference-thumb audio{width:100%}.reference-thumb .sub{font-size:9px;padding:5px;overflow-wrap:anywhere}.reference-caption{font-size:9px;line-height:1.7;color:#9991a6;margin-top:5px;overflow-wrap:anywhere}.reference-caption .version-button{border:0;background:none;font-size:9px;color:#8a7ca3;padding:0;text-align:left;line-height:1.6;white-space:normal}.reference-caption strong{display:block;font-weight:400;color:#777080}.reference-remove{position:absolute;right:4px;top:4px;padding:0;display:grid;place-items:center;width:17px;height:17px;border:0;border-radius:50%;background:#292330ac;color:white;font-size:13px}.reference-add{width:80px;height:76px;border:1px dashed #d8d0e4;border-radius:7px;background:#fdfcfe;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;font-size:10px;color:#a298b4}.reference-add b{font-size:24px;font-weight:300;line-height:1}.reference-actions{display:flex;gap:3px;margin-top:4px}.reference-actions button{font-size:8px;padding:2px 4px}.reference-slot-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.reference-slot>span{display:block;font-size:10px;color:#93889f;margin-bottom:7px}.reference-slot .reference-tile,.reference-slot .reference-add{width:100%}.reference-slot .reference-thumb,.reference-slot .reference-add{height:95px}.reference-picker-backdrop{position:fixed;inset:0;background:#221c2e44;z-index:12;display:flex;align-items:center;justify-content:center;padding:24px}.reference-picker{width:720px;max-width:100%;max-height:calc(100vh - 48px);overflow-y:auto;border-radius:12px;background:white;padding:25px;box-shadow:0 20px 60px #211b321f}.reference-picker-header{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:20px}.reference-picker-header h2{font-size:19px;margin:0}.reference-picker-header button{font-size:11px}.reference-picker-toolbar{display:flex;gap:9px;align-items:center;margin-bottom:18px}.reference-picker-toolbar input{flex:1;min-width:0}.reference-picker-toolbar button{font-size:11px}.reference-picker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.reference-picker-card{padding:5px;border-radius:7px;border:1px solid #e9e4ef;text-align:left;min-width:0;background:white}.reference-picker-card.chosen{border-color:#6f5dd0;box-shadow:0 0 0 1px #6f5dd0}.reference-picker-card .reference-thumb{height:110px;pointer-events:none}.reference-picker-card strong{font-size:11px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:9px 5px 4px;font-weight:500}.reference-picker-card small{font-size:9px;color:#a49aaf;margin:0 5px 5px;display:block}.reference-picker-selection{display:grid;grid-template-columns:1fr 1fr;gap:13px;margin-top:19px}.reference-picker-selection label{margin:0;font-size:11px;color:#8f839b}.reference-picker-selection select{width:100%;margin-top:7px}.reference-picker-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;border-top:1px solid #e9e4f0;margin-top:20px;padding-top:17px}.reference-picker-footer .sub{font-size:10px;line-height:1.7}.reference-picker-empty{padding:35px 10px;text-align:center;color:#aaa0b7;font-size:12px}.project-settings{max-width:1040px}.settings-section{display:grid;grid-template-columns:170px minmax(0,1fr);gap:30px;border-top:1px solid #e8e5ed;padding:24px 0}.settings-section h2{font-size:13px;margin:2px 0 9px}.settings-section .sub{font-size:11px;line-height:1.8}.settings-fields{display:flex;flex-direction:column;gap:18px;max-width:640px}.settings-fields>label{display:grid;grid-template-columns:110px minmax(0,1fr);align-items:center;gap:18px;margin:0;font-size:11px}.settings-fields label>span{color:#92889e}.settings-fields input,.settings-fields select,.settings-fields textarea{width:100%;margin:0!important;padding:10px 12px}.settings-fields textarea{min-height:70px;line-height:1.8}.settings-save-row{display:flex;align-items:center;justify-content:space-between;border-top:1px solid #e8e5ed;padding:20px 0;gap:15px}.settings-save-row button{padding:10px 14px;font-size:11px}.settings-project-actions{border-top:1px solid #e8e5ed;padding-top:20px}.settings-project-actions h3{font-size:12px;font-weight:500;margin-top:0}.settings-project-actions button{font-size:11px}.generation-form .iteration-controls{border-top:1px solid #e8e4ee;padding-top:13px}.generation-form .iteration-controls label{font-size:11px}.generation-form .iteration-controls p{line-height:1.7;font-size:10px}.reference-help{font-size:9px;color:#a499b2;line-height:1.7;margin:10px 0 0}.generation-form .sub{line-height:1.7}.generation-form .generation-notice{font-size:10px;margin:0;color:#a69cad}.generation-form .input-note{font-size:10px;color:#a69cad}.reference-upload{font-size:11px;position:relative;overflow:hidden}.reference-upload input{position:absolute;width:1px;height:1px;opacity:0}.reference-warning{font-size:10px;color:#9c6d49;line-height:1.7;margin:8px 0}.creation-page .error{margin:12px 24px;flex-shrink:0}.creation-page .eyebrow{margin:0 0 5px}
5846
+ .workspace{grid-template-columns:170px minmax(0,1fr)}main{min-width:0}.heading{align-items:flex-start}.heading>.actions{justify-content:flex-end}.nav .scope-group{margin:22px 0 9px}.nav .workspace-link{font-size:12px}.nav .project-name{padding:0 9px 8px;font-size:12px;color:#555}.nav .selected{background:#eeedf9;color:#5149b9}.nav button{white-space:normal}.creation-page{padding:0;display:flex;flex-direction:column;height:calc(100vh - 64px);overflow:hidden}.creation-page>.heading{padding:22px 26px 18px;margin:0;border-bottom:1px solid #e8e8ed;flex-shrink:0}.creation-page>.heading h1{font-size:22px}.creation-layout{display:grid;grid-template-columns:360px minmax(0,1fr);min-height:0;flex:1}.creation-controls{padding:22px 24px;scrollbar-gutter: stable;overflow-y:auto;border-right:1px solid #e8e8ed;background:white}.creation-controls .generation-form{min-height:100%;display:flex;flex-direction:column;gap:18px}.generation-form>label,.generation-form .generation-fields>label{margin:0;font-size:11px;color:#77717f}.generation-form label input,.generation-form label select,.generation-form label textarea{margin-top:7px;width:100%;border-radius:7px;padding:10px 11px}.generation-form textarea{min-height:100px;line-height:1.8}.generation-fields{display:flex;flex-direction:column;gap:17px}.generation-kind-tabs{display:flex;gap:4px;padding:4px;border-radius:8px;background:#f4f3f7}.generation-kind-tabs button{flex:1;border:0;background:transparent;font-size:11px;color:#8c8797;border-radius:5px;padding:9px 6px}.generation-kind-tabs button.active{background:white;color:#5149b9;box-shadow:0 1px 3px #1612250a}.generation-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px}.generation-settings-grid label{margin:0;min-width:0;font-size:11px;color:#88818f}.generation-settings-grid input,.generation-settings-grid select{width:100%;margin-top:7px}.generation-settings-grid .sub{display:block;font-size:9px;margin-top:5px;line-height:1.5}.generation-settings-grid input[type=checkbox]{width:auto}.generation-submit{position:sticky;bottom:-22px;margin:18px -2px -2px;padding:15px 2px 3px;background:white;border-top:1px solid #eeeaf4;z-index:1}.generation-submit button{width:100%;padding:12px;font-size:12px}.generation-submit p{font-size:9px;line-height:1.8;text-align:center;margin:9px 0 0;color:#aaa3b3}.creation-results{padding:26px;scrollbar-gutter: stable;overflow-y:auto;background:#fafafb;min-width:0}.creation-results-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px}.creation-results-heading h2{margin:0;font-size:16px}.creation-results-heading .sub{font-size:10px}.creation-result-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 18px}.creation-result{min-width:0}.creation-result-media{background:#f0eff4;border-radius:8px;min-height:150px;aspect-ratio:1.2;display:flex;align-items:center;justify-content:center;overflow:hidden}.creation-result-media img,.creation-result-media video{width:100%;height:100%;object-fit:contain}.creation-result-media audio{width:95%}.creation-result-caption{display:flex;justify-content:space-between;gap:12px;margin:11px 0;font-size:12px}.creation-result-caption strong{font-weight:550;overflow-wrap:anywhere}.creation-result .actions{gap:6px}.creation-result .actions button{font-size:10px;padding:6px 8px}.creation-results-empty{min-height:330px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;border:1px dashed #e0dce9;border-radius:8px;padding:30px;color:#aaa1b8}.creation-results-empty h3{font-size:14px;font-weight:500;margin:12px 0}.creation-results-empty p{font-size:11px;line-height:1.8;max-width:300px;margin:4px 0}.creation-empty-symbol{font-size:42px;color:#c0b8cf}.creation-task{width:100%;display:flex;justify-content:space-between;align-items:center;gap:10px;background:white;margin-bottom:13px;padding:14px;text-align:left;font-size:11px}.creation-task-dot{width:7px;height:7px;border-radius:50%;background:#8d80da;flex-shrink:0}.creation-task .sub{margin-left:auto}.reference-section{margin:0}.reference-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:11px}.reference-heading h3{font-size:11px;font-weight:500;margin:0;color:#77717f}.reference-heading .sub{font-size:9px}.reference-strip{display:flex;gap:9px;flex-wrap:wrap}.reference-tile{width:88px;position:relative;min-width:0}.reference-thumb{height:76px;border:1px solid #e0daed;border-radius:7px;background:#f5f3f8;overflow:hidden;display:flex;align-items:center;justify-content:center;padding:0;width:100%}.reference-thumb img,.reference-thumb video{width:100%;height:100%;object-fit:cover}.reference-thumb audio{width:100%}.reference-thumb .sub{font-size:9px;padding:5px;overflow-wrap:anywhere}.reference-caption{font-size:9px;line-height:1.7;color:#9991a6;margin-top:5px;overflow-wrap:anywhere}.reference-caption .version-button{border:0;background:none;font-size:9px;color:#8a7ca3;padding:0;text-align:left;line-height:1.6;white-space:normal}.reference-caption strong{display:block;font-weight:400;color:#777080}.reference-remove{position:absolute;right:4px;top:4px;padding:0;display:grid;place-items:center;width:17px;height:17px;border:0;border-radius:50%;background:#292330ac;color:white;font-size:13px}.reference-add{width:80px;height:76px;border:1px dashed #d8d0e4;border-radius:7px;background:#fdfcfe;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;font-size:10px;color:#a298b4}.reference-add b{font-size:24px;font-weight:300;line-height:1}.reference-actions{display:flex;gap:3px;margin-top:4px}.reference-actions button{font-size:8px;padding:2px 4px}.reference-slot-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.reference-slot>span{display:block;font-size:10px;color:#93889f;margin-bottom:7px}.reference-slot .reference-tile,.reference-slot .reference-add{width:100%}.reference-slot .reference-thumb,.reference-slot .reference-add{height:95px}.reference-picker-backdrop{position:fixed;inset:0;background:#221c2e44;z-index:12;display:flex;align-items:center;justify-content:center;padding:24px}.reference-picker{width:720px;max-width:100%;max-height:calc(100vh - 48px);scrollbar-gutter: stable;overflow-y:auto;border-radius:12px;background:white;padding:25px;box-shadow:0 20px 60px #211b321f}.reference-picker-header{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:20px}.reference-picker-header h2{font-size:19px;margin:0}.reference-picker-header button{font-size:11px}.reference-picker-toolbar{display:flex;gap:9px;align-items:center;margin-bottom:18px}.reference-picker-toolbar input{flex:1;min-width:0}.reference-picker-toolbar button{font-size:11px}.reference-picker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.reference-picker-card{padding:5px;border-radius:7px;border:1px solid #e9e4ef;text-align:left;min-width:0;background:white}.reference-picker-card.chosen{border-color:#6f5dd0;box-shadow:0 0 0 1px #6f5dd0}.reference-picker-card .reference-thumb{height:110px;pointer-events:none}.reference-picker-card strong{font-size:11px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:9px 5px 4px;font-weight:500}.reference-picker-card small{font-size:9px;color:#a49aaf;margin:0 5px 5px;display:block}.reference-picker-selection{display:grid;grid-template-columns:1fr 1fr;gap:13px;margin-top:19px}.reference-picker-selection label{margin:0;font-size:11px;color:#8f839b}.reference-picker-selection select{width:100%;margin-top:7px}.reference-picker-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;border-top:1px solid #e9e4f0;margin-top:20px;padding-top:17px}.reference-picker-footer .sub{font-size:10px;line-height:1.7}.reference-picker-empty{padding:35px 10px;text-align:center;color:#aaa0b7;font-size:12px}.project-settings{max-width:1040px}.settings-section{display:grid;grid-template-columns:170px minmax(0,1fr);gap:30px;border-top:1px solid #e8e5ed;padding:24px 0}.settings-section h2{font-size:13px;margin:2px 0 9px}.settings-section .sub{font-size:11px;line-height:1.8}.settings-fields{display:flex;flex-direction:column;gap:18px;max-width:640px}.settings-fields>label{display:grid;grid-template-columns:110px minmax(0,1fr);align-items:center;gap:18px;margin:0;font-size:11px}.settings-fields label>span{color:#92889e}.settings-fields input,.settings-fields select,.settings-fields textarea{width:100%;margin:0!important;padding:10px 12px}.settings-fields textarea{min-height:70px;line-height:1.8}.settings-save-row{display:flex;align-items:center;justify-content:space-between;border-top:1px solid #e8e5ed;padding:20px 0;gap:15px}.settings-save-row button{padding:10px 14px;font-size:11px}.settings-project-actions{border-top:1px solid #e8e5ed;padding-top:20px}.settings-project-actions h3{font-size:12px;font-weight:500;margin-top:0}.settings-project-actions button{font-size:11px}.generation-form .iteration-controls{border-top:1px solid #e8e4ee;padding-top:13px}.generation-form .iteration-controls label{font-size:11px}.generation-form .iteration-controls p{line-height:1.7;font-size:10px}.reference-help{font-size:9px;color:#a499b2;line-height:1.7;margin:10px 0 0}.generation-form .sub{line-height:1.7}.generation-form .generation-notice{font-size:10px;margin:0;color:#a69cad}.generation-form .input-note{font-size:10px;color:#a69cad}.reference-upload{font-size:11px;position:relative;overflow:hidden}.reference-upload input{position:absolute;width:1px;height:1px;opacity:0}.reference-warning{font-size:10px;color:#9c6d49;line-height:1.7;margin:8px 0}.creation-page .error{margin:12px 24px;flex-shrink:0}.creation-page .eyebrow{margin:0 0 5px}
4961
5847
  @media(max-width:1100px){.creation-layout{grid-template-columns:330px minmax(0,1fr)}.creation-controls{padding:20px}.creation-results{padding:22px}.creation-result-grid{grid-template-columns:1fr}.settings-section{grid-template-columns:130px minmax(0,1fr);gap:20px}}
4962
5848
  @media(max-width:850px){.creation-page{height:auto;overflow:visible}.creation-layout{display:flex;flex-direction:column}.creation-controls{overflow:visible;border-right:0;border-bottom:1px solid #e8e8ed}.creation-results{overflow:visible;min-height:300px}.generation-submit{position:static;margin-top:16px}.creation-page>.heading{padding:20px}.creation-result-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.settings-section{grid-template-columns:1fr;gap:14px}.settings-fields>label{grid-template-columns:1fr;gap:6px}.settings-save-row{align-items:flex-start;flex-direction:column}.reference-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
4963
5849
  @media(max-width:560px){.workspace{grid-template-columns:118px minmax(0,1fr)}aside.nav{padding:20px 7px}.nav .eyebrow{letter-spacing:1px;font-size:9px}.nav button{font-size:11px}.nav .recent{margin-top:24px}header{padding:0 14px;gap:18px}.brand{font-size:16px}.brand b{width:25px;height:25px;margin-right:7px}header nav{gap:14px;font-size:11px}header button{font-size:10px;padding:6px}main{padding:20px 16px}.creation-result-grid{grid-template-columns:1fr}.reference-picker-backdrop{padding:12px}.reference-picker{padding:18px;max-height:calc(100vh - 24px)}.reference-picker-selection{grid-template-columns:1fr}.reference-picker-footer{align-items:flex-start;flex-direction:column}.reference-slot .reference-thumb,.reference-slot .reference-add{height:80px}.creation-results-heading{align-items:flex-start;flex-direction:column}}
@@ -4965,7 +5851,7 @@ var workbenchCss = `
4965
5851
 
4966
5852
  // packages/studio-workbench/src/file-library-styles.ts
4967
5853
  var fileLibraryCss = `
4968
- [hidden]{display:none!important}header{justify-content:space-between}header nav{margin-right:auto}h1{font-size:26px}.workspace{grid-template-columns:180px minmax(0,1fr)}.nav .eyebrow{letter-spacing:1px}.nav .recent{margin-top:30px}.nav button{padding:10px}.upload-button{display:inline-flex;align-items:center;min-height:34px;border-radius:6px;padding:10px 16px;cursor:pointer;font-size:12px;color:white;margin:0}.file-toolbar{display:flex;align-items:center;gap:20px;margin:24px 0}.file-toolbar>input{width:200px}.file-toolbar>select{margin-left:auto;font-size:11px;border:0;color:#777}.file-type-tabs{display:flex;gap:4px}.file-type-tabs button{border:0;color:#85828e;font-size:12px;padding:8px 11px}.file-type-tabs button.active{color:#5046b8;background:#efedf9}.file-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(185px,1fr));gap:28px 20px}.file-tile{border:0;padding:0;text-align:left;background:transparent;min-width:0;border-radius:8px}.file-tile:hover{background:transparent}.file-tile-preview{height:168px;border-radius:8px;background:#f5f4f8;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background .15s,transform .15s}.file-tile:hover .file-tile-preview{background:#eeecf5;transform:translateY(-2px)}.file-tile-preview img,.file-tile-preview video{width:100%;height:100%;object-fit:cover}.file-tile>strong{font-size:12px;font-weight:550;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:12px 0 6px}.file-tile>span{font-size:10px;color:#92909c;display:flex;justify-content:space-between}.file-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}.file-tags small{font-size:10px;background:#f1f0f6;color:#85808f;padding:3px 6px;border-radius:4px}.file-document{width:65px;height:83px;background:white;border:1px solid #e1deea;border-radius:5px;padding:13px;box-shadow:0 5px 10px #27213405}.file-document span{font-size:19px;color:#a69db7}.file-document i{display:block;height:2px;background:#e4e0eb;margin-top:8px}.file-symbol{font-size:26px;color:#a399b5}.file-placeholder{font-size:11px;color:#aaa1b5;text-align:center;padding:20px}.files-empty{padding:80px 20px;text-align:center;color:#a49baa}.files-empty>span{font-size:35px}.files-empty h2{font-size:17px;color:#6b6375;font-weight:500}.files-empty p{font-size:12px}.file-overlay{position:fixed;inset:0;background:#24202c5c;z-index:9;display:grid;place-items:center;padding:32px;animation:fileFade .16s ease}.file-viewer{background:white;border-radius:12px;width:min(1100px,100%);height:min(740px,calc(100vh - 64px));overflow:hidden;position:relative;box-shadow:0 25px 100px #16102022}.file-viewer-header{height:76px;padding:0 23px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ece9f1;gap:18px}.file-viewer-header>div:first-child{min-width:0}.file-viewer-header strong{display:block;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-viewer-header span{display:block;font-size:10px;color:#a29aa9;margin-top:5px}.file-viewer-header .actions{flex-wrap:nowrap}.file-viewer-header button,.button{font-size:11px;white-space:nowrap}.button{border:1px solid #dedee4;border-radius:5px;padding:8px 12px;color:#4f4859}.file-close{font-size:23px!important;border:0;padding:4px 8px;color:#8d829a}.file-viewer-notice{position:absolute;top:78px;left:22px;z-index:1;background:#f0eaf8;color:#6c5c84;padding:9px 14px;border-radius:5px;font-size:11px;margin:8px 0}.file-viewer-body{display:grid;grid-template-columns:minmax(0,1fr) 230px;height:calc(100% - 76px)}.file-stage{background:#f7f6fa;display:flex;align-items:center;justify-content:center;overflow:auto;padding:28px}.file-stage>img,.file-stage>video{max-width:100%;max-height:100%;object-fit:contain;border-radius:5px}.file-stage>audio{width:min(400px,100%)}.file-text{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.9 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;align-self:flex-start;background:white;padding:30px;min-height:100%;width:100%;margin:0}.file-details{padding:22px;border-left:1px solid #edeaf2;overflow:auto}.file-details h3{font-size:11px;font-weight:550;margin:4px 0 16px;color:#7b6f88}.file-details p{font-size:11px;color:#8b8194;margin:10px 0;line-height:1.8}.file-details h3:not(:first-child){border-top:1px solid #eeeaf3;margin-top:26px;padding-top:23px}.file-history{display:flex;flex-direction:column;gap:8px}.file-history button{display:flex;justify-content:space-between;align-items:center;gap:8px;border:0;background:#f7f6fa;text-align:left;font-size:11px;padding:12px}.file-history button b{font-weight:500}.file-history button span{font-size:9px;color:#9c92a8}.file-history button.active{background:#eeebfa;color:#5947af}.file-more{position:relative}.file-menu{position:absolute;right:0;top:calc(100% + 7px);background:white;box-shadow:0 10px 40px #24163020;border:1px solid #eee9f3;border-radius:8px;padding:5px;min-width:150px;z-index:2;animation:fileFade .1s ease}.file-menu button{display:block;text-align:left;border:0;width:100%;padding:11px 12px;background:white}.file-menu button:hover{background:#f7f4fb}.file-menu .danger{color:#a05a64}.file-edit-overlay,.simple-backdrop{position:fixed;inset:0;display:grid;place-items:center;background:#211b3445;z-index:12;padding:20px}.file-edit,.simple-dialog{background:white;padding:28px;border-radius:12px;width:min(440px,100%);box-shadow:0 18px 70px #1e11331c}.file-edit h2,.simple-dialog h2{font-size:18px;margin:0 0 23px}.file-edit label,.simple-dialog label{font-size:12px;margin:16px 0}.file-edit input,.file-edit textarea,.file-edit select,.simple-dialog input,.simple-dialog textarea{width:100%;margin-top:8px;padding:10px}.file-edit textarea{min-height:230px}.file-edit .actions,.simple-dialog .actions{margin-top:22px}.file-notice{background:#f4f1fa;color:#74648b;padding:11px 15px;font-size:11px;line-height:1.6;border-radius:5px;margin:14px 0}.creation-page>.file-notice{margin:8px 24px}.project-files-list>button{display:flex;align-items:center;width:100%;padding:22px 5px;border:0;border-bottom:1px solid #eeebf3;border-radius:0;text-align:left;gap:22px}.project-files-list>button:hover{background:#faf8fd}.project-files-list strong{font-size:14px;font-weight:550}.project-files-list p{font-size:11px;color:#9c92a5;margin:7px 0 0}.project-files-list>button>span:last-child{margin-left:auto;font-size:11px;color:#a393b0}.project-folder{font-size:32px;color:#c8bddc}.task-history>article{padding:22px 0;border-bottom:1px solid #eeeaf3;display:flex;align-items:center;gap:18px}.task-history strong{font-size:13px;font-weight:500}.task-history p{margin:7px 0 0;font-size:11px}.task-history .actions{margin-left:auto}.task-history .actions button{font-size:11px}.task-history-icon{width:36px;height:36px;border-radius:50%;background:#f3effa;color:#a18ac0;display:grid;place-items:center}.load-files{margin:30px 0;font-size:12px}.creation-page>.heading h1{font-size:24px}.generation-notice{line-height:1.7}.generation-form .reference-help{line-height:1.8}.generation-submit p{font-size:10px}.creation-results-empty p{line-height:1.8}.error button{margin-left:15px;font-size:10px}.error{font-size:12px;line-height:1.8}@keyframes fileFade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}@media(max-width:900px){.file-viewer-body{grid-template-columns:minmax(0,1fr) 190px}.file-details{padding:18px}.file-toolbar{flex-wrap:wrap;gap:12px}.file-toolbar>input{width:180px}.file-type-tabs{order:3;flex-basis:100%}.file-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}}@media(max-width:560px){.workspace{grid-template-columns:118px minmax(0,1fr)}.file-grid{grid-template-columns:1fr}.file-toolbar>input{width:100%}.file-toolbar>select{margin-left:0}.file-type-tabs{gap:0;flex-wrap:wrap}.file-type-tabs button{padding:7px}.file-overlay{padding:0}.file-viewer{height:100dvh;width:100%;border-radius:0}.file-viewer-header{padding:0 12px;height:68px}.file-viewer-header .actions{gap:4px}.file-viewer-header .actions button,.file-viewer-header .button{font-size:10px;padding:7px}.file-viewer-header strong{font-size:12px;max-width:110px}.file-viewer-body{display:flex;flex-direction:column;height:calc(100% - 68px)}.file-stage{flex:1;min-height:0;padding:15px}.file-details{height:170px;flex-shrink:0;border-left:0;border-top:1px solid #eee;display:grid;grid-template-columns:1fr 1fr;gap:10px;overflow:auto}.file-details h3{margin:0}.file-details h3:not(:first-child){border:0;margin:0;padding:0}.file-history{gap:5px}.file-text{padding:17px;font-size:12px}.heading .actions{gap:6px}.upload-button{display:inline-flex;align-items:center;min-height:34px;padding:9px;font-size:11px}.task-history>article{flex-wrap:wrap}.task-history .actions{margin-left:54px}.project-files-list>button{gap:12px}.project-files-list>button>span:last-child{display:none}}@media(prefers-reduced-motion:reduce){.file-overlay,.file-menu{animation:none}.file-tile-preview{transition:none}}
5854
+ [hidden]{display:none!important}header{justify-content:space-between}header nav{margin-right:auto}h1{font-size:26px}.workspace{grid-template-columns:180px minmax(0,1fr)}.nav .eyebrow{letter-spacing:1px}.nav .recent{margin-top:30px}.nav button{padding:10px}.upload-button{display:inline-flex;align-items:center;min-height:34px;border-radius:6px;padding:10px 16px;cursor:pointer;font-size:12px;color:white;margin:0}.file-toolbar{display:flex;align-items:center;gap:20px;margin:24px 0}.file-toolbar>input{width:200px}.file-toolbar>select{margin-left:auto;font-size:11px;border:0;color:#777}.file-type-tabs{display:flex;gap:4px}.file-type-tabs button{border:0;color:#85828e;font-size:12px;padding:8px 11px}.file-type-tabs button.active{color:#5046b8;background:#efedf9}.file-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(185px,1fr));gap:28px 20px}.file-tile{border:0;padding:0;text-align:left;background:transparent;min-width:0;border-radius:8px}.file-tile:hover{background:transparent}.file-tile-preview{height:168px;border-radius:8px;background:#f5f4f8;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background .15s,transform .15s}.file-tile:hover .file-tile-preview{background:#eeecf5;transform:translateY(-2px)}.file-tile-preview img,.file-tile-preview video{width:100%;height:100%;object-fit:cover}.file-tile>strong{font-size:12px;font-weight:550;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:12px 0 6px}.file-tile>span{font-size:10px;color:#92909c;display:flex;justify-content:space-between}.file-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}.file-tags small{font-size:10px;background:#f1f0f6;color:#85808f;padding:3px 6px;border-radius:4px}.file-document{width:65px;height:83px;background:white;border:1px solid #e1deea;border-radius:5px;padding:13px;box-shadow:0 5px 10px #27213405}.file-document span{font-size:19px;color:#a69db7}.file-document i{display:block;height:2px;background:#e4e0eb;margin-top:8px}.file-symbol{font-size:26px;color:#a399b5}.file-placeholder{font-size:11px;color:#aaa1b5;text-align:center;padding:20px}.files-empty{padding:80px 20px;text-align:center;color:#a49baa}.files-empty>span{font-size:35px}.files-empty h2{font-size:17px;color:#6b6375;font-weight:500}.files-empty p{font-size:12px}.file-overlay{position:fixed;inset:0;background:#24202c5c;z-index:9;display:grid;place-items:center;padding:32px;animation:fileFade .16s ease}.file-viewer{background:white;border-radius:12px;width:min(1100px,100%);height:min(740px,calc(100vh - 64px));overflow:hidden;position:relative;box-shadow:0 25px 100px #16102022}.file-viewer-header{height:76px;padding:0 23px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ece9f1;gap:18px}.file-viewer-header>div:first-child{min-width:0}.file-viewer-header strong{display:block;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-viewer-header span{display:block;font-size:10px;color:#a29aa9;margin-top:5px}.file-viewer-header .actions{flex-wrap:nowrap}.file-viewer-header button,.button{font-size:11px;white-space:nowrap}.button{border:1px solid #dedee4;border-radius:5px;padding:8px 12px;color:#4f4859}.file-close{font-size:23px!important;border:0;padding:4px 8px;color:#8d829a}.file-viewer-notice{position:absolute;top:78px;left:22px;z-index:1;background:#f0eaf8;color:#6c5c84;padding:9px 14px;border-radius:5px;font-size:11px;margin:8px 0}.file-viewer-body{display:grid;grid-template-columns:minmax(0,1fr) 230px;height:calc(100% - 76px)}.file-stage{background:#f7f6fa;display:flex;align-items:center;justify-content:center;scrollbar-gutter: stable;overflow:scroll auto;padding:28px}.file-stage>img,.file-stage>video{max-width:100%;max-height:100%;object-fit:contain;border-radius:5px}.file-stage>audio{width:min(400px,100%)}.file-text{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.9 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;align-self:flex-start;background:white;padding:30px;min-height:100%;width:100%;margin:0}.file-details{padding:22px;border-left:1px solid #edeaf2;scrollbar-gutter: stable;overflow:scroll auto}.file-details h3{font-size:11px;font-weight:550;margin:4px 0 16px;color:#7b6f88}.file-details p{font-size:11px;color:#8b8194;margin:10px 0;line-height:1.8}.file-details h3:not(:first-child){border-top:1px solid #eeeaf3;margin-top:26px;padding-top:23px}.file-history{display:flex;flex-direction:column;gap:8px}.file-history button{display:flex;justify-content:space-between;align-items:center;gap:8px;border:0;background:#f7f6fa;text-align:left;font-size:11px;padding:12px}.file-history button b{font-weight:500}.file-history button span{font-size:9px;color:#9c92a8}.file-history button.active{background:#eeebfa;color:#5947af}.file-more{position:relative}.file-menu{position:absolute;right:0;top:calc(100% + 7px);background:white;box-shadow:0 10px 40px #24163020;border:1px solid #eee9f3;border-radius:8px;padding:5px;min-width:150px;z-index:2;animation:fileFade .1s ease}.file-menu button{display:block;text-align:left;border:0;width:100%;padding:11px 12px;background:white}.file-menu button:hover{background:#f7f4fb}.file-menu .danger{color:#a05a64}.file-edit-overlay,.simple-backdrop{position:fixed;inset:0;display:grid;place-items:center;background:#211b3445;z-index:12;padding:20px}.file-edit,.simple-dialog{background:white;padding:28px;border-radius:12px;width:min(440px,100%);box-shadow:0 18px 70px #1e11331c}.file-edit h2,.simple-dialog h2{font-size:18px;margin:0 0 23px}.file-edit label,.simple-dialog label{font-size:12px;margin:16px 0}.file-edit input,.file-edit textarea,.file-edit select,.simple-dialog input,.simple-dialog textarea{width:100%;margin-top:8px;padding:10px}.file-edit textarea{min-height:230px}.file-edit .actions,.simple-dialog .actions{margin-top:22px}.file-notice{background:#f4f1fa;color:#74648b;padding:11px 15px;font-size:11px;line-height:1.6;border-radius:5px;margin:14px 0}.creation-page>.file-notice{margin:8px 24px}.project-files-list>button{display:flex;align-items:center;width:100%;padding:22px 5px;border:0;border-bottom:1px solid #eeebf3;border-radius:0;text-align:left;gap:22px}.project-files-list>button:hover{background:#faf8fd}.project-files-list strong{font-size:14px;font-weight:550}.project-files-list p{font-size:11px;color:#9c92a5;margin:7px 0 0}.project-files-list>button>span:last-child{margin-left:auto;font-size:11px;color:#a393b0}.project-folder{font-size:32px;color:#c8bddc}.task-history>article{padding:22px 0;border-bottom:1px solid #eeeaf3;display:flex;align-items:center;gap:18px}.task-history strong{font-size:13px;font-weight:500}.task-history p{margin:7px 0 0;font-size:11px}.task-history .actions{margin-left:auto}.task-history .actions button{font-size:11px}.task-history-icon{width:36px;height:36px;border-radius:50%;background:#f3effa;color:#a18ac0;display:grid;place-items:center}.load-files{margin:30px 0;font-size:12px}.creation-page>.heading h1{font-size:24px}.generation-notice{line-height:1.7}.generation-form .reference-help{line-height:1.8}.generation-submit p{font-size:10px}.creation-results-empty p{line-height:1.8}.error button{margin-left:15px;font-size:10px}.error{font-size:12px;line-height:1.8}@keyframes fileFade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}@media(max-width:900px){.file-viewer-body{grid-template-columns:minmax(0,1fr) 190px}.file-details{padding:18px}.file-toolbar{flex-wrap:wrap;gap:12px}.file-toolbar>input{width:180px}.file-type-tabs{order:3;flex-basis:100%}.file-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}}@media(max-width:560px){.workspace{grid-template-columns:118px minmax(0,1fr)}.file-grid{grid-template-columns:1fr}.file-toolbar>input{width:100%}.file-toolbar>select{margin-left:0}.file-type-tabs{gap:0;flex-wrap:wrap}.file-type-tabs button{padding:7px}.file-overlay{padding:0}.file-viewer{height:100dvh;width:100%;border-radius:0}.file-viewer-header{padding:0 12px;height:68px}.file-viewer-header .actions{gap:4px}.file-viewer-header .actions button,.file-viewer-header .button{font-size:10px;padding:7px}.file-viewer-header strong{font-size:12px;max-width:110px}.file-viewer-body{display:flex;flex-direction:column;height:calc(100% - 68px)}.file-stage{flex:1;min-height:0;padding:15px}.file-details{height:170px;flex-shrink:0;border-left:0;border-top:1px solid #eee;display:grid;grid-template-columns:1fr 1fr;gap:10px;scrollbar-gutter: stable;overflow:scroll auto}.file-details h3{margin:0}.file-details h3:not(:first-child){border:0;margin:0;padding:0}.file-history{gap:5px}.file-text{padding:17px;font-size:12px}.heading .actions{gap:6px}.upload-button{display:inline-flex;align-items:center;min-height:34px;padding:9px;font-size:11px}.task-history>article{flex-wrap:wrap}.task-history .actions{margin-left:54px}.project-files-list>button{gap:12px}.project-files-list>button>span:last-child{display:none}}@media(prefers-reduced-motion:reduce){.file-overlay,.file-menu{animation:none}.file-tile-preview{transition:none}}
4969
5855
  `;
4970
5856
 
4971
5857
  // packages/studio-workbench/src/client.tsx