@ai-matrx/design-system 0.18.9 → 0.18.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/content-transfer/alchemy.svg +1 -1
  3. package/dist/content-transfer/icon.cjs +3 -1
  4. package/dist/content-transfer/icon.cjs.map +1 -1
  5. package/dist/content-transfer/icon.d.cts +3 -2
  6. package/dist/content-transfer/icon.d.ts +3 -2
  7. package/dist/content-transfer/icon.js +3 -1
  8. package/dist/content-transfer/icon.js.map +1 -1
  9. package/dist/content-transfer.cjs +442 -447
  10. package/dist/content-transfer.cjs.map +1 -1
  11. package/dist/content-transfer.css +130 -54
  12. package/dist/content-transfer.d.cts +5 -1
  13. package/dist/content-transfer.d.ts +5 -1
  14. package/dist/content-transfer.js +467 -472
  15. package/dist/content-transfer.js.map +1 -1
  16. package/dist/data-table/copy-helpers.d.cts +1 -1
  17. package/dist/data-table/copy-helpers.d.ts +1 -1
  18. package/dist/data-table/copy-types.cjs.map +1 -1
  19. package/dist/data-table/copy-types.d.cts +1 -1
  20. package/dist/data-table/copy-types.d.ts +1 -1
  21. package/dist/data-table/data-row-inspector.cjs +444 -446
  22. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  23. package/dist/data-table/data-row-inspector.js +489 -491
  24. package/dist/data-table/data-row-inspector.js.map +1 -1
  25. package/dist/data-table/data-row-window.cjs +444 -446
  26. package/dist/data-table/data-row-window.cjs.map +1 -1
  27. package/dist/data-table/data-row-window.js +489 -491
  28. package/dist/data-table/data-row-window.js.map +1 -1
  29. package/dist/data-table/filter-engine.d.cts +1 -1
  30. package/dist/data-table/filter-engine.d.ts +1 -1
  31. package/dist/data-table/host.cjs.map +1 -1
  32. package/dist/data-table/host.d.cts +17 -1
  33. package/dist/data-table/host.d.ts +17 -1
  34. package/dist/data-table/host.js.map +1 -1
  35. package/dist/data-table/index.cjs +1524 -1011
  36. package/dist/data-table/index.cjs.map +1 -1
  37. package/dist/data-table/index.d.cts +25 -4
  38. package/dist/data-table/index.d.ts +25 -4
  39. package/dist/data-table/index.js +1560 -1047
  40. package/dist/data-table/index.js.map +1 -1
  41. package/dist/data-table/infer-filter.d.cts +1 -1
  42. package/dist/data-table/infer-filter.d.ts +1 -1
  43. package/dist/data-table/layered-filters.d.cts +1 -1
  44. package/dist/data-table/layered-filters.d.ts +1 -1
  45. package/dist/data-table/pagination.cjs +5 -5
  46. package/dist/data-table/pagination.cjs.map +1 -1
  47. package/dist/data-table/pagination.js +5 -5
  48. package/dist/data-table/pagination.js.map +1 -1
  49. package/dist/data-table/query-control.d.cts +1 -1
  50. package/dist/data-table/query-control.d.ts +1 -1
  51. package/dist/data-table/types.cjs.map +1 -1
  52. package/dist/data-table/types.d.cts +1 -1
  53. package/dist/data-table/types.d.ts +1 -1
  54. package/dist/data-table/url-state.d.cts +1 -1
  55. package/dist/data-table/url-state.d.ts +1 -1
  56. package/dist/data-table/uuid-cell.cjs.map +1 -1
  57. package/dist/data-table/uuid-cell.js.map +1 -1
  58. package/dist/data-table/xlsx.d.cts +1 -1
  59. package/dist/data-table/xlsx.d.ts +1 -1
  60. package/dist/index.cjs +5 -5
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.js +5 -5
  63. package/dist/index.js.map +1 -1
  64. package/dist/styles.css +4 -0
  65. package/dist/tokens.css +2 -0
  66. package/dist/{types-cH8oLqUx.d.ts → types-BuDKVpeF.d.ts} +47 -3
  67. package/dist/{types-0CNCWvdK.d.cts → types-Dqcb7jXO.d.cts} +47 -3
  68. package/package.json +2 -2
@@ -173,48 +173,6 @@ function XIcon(props) {
173
173
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 6 12 12" })
174
174
  ] });
175
175
  }
176
- function radixProps(props) {
177
- return {
178
- xmlns: "http://www.w3.org/2000/svg",
179
- viewBox: "0 0 15 15",
180
- width: 15,
181
- height: 15,
182
- fill: "none",
183
- "aria-hidden": true,
184
- ...props
185
- };
186
- }
187
- function CheckIcon(props) {
188
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
189
- "path",
190
- {
191
- d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
192
- fill: "currentColor",
193
- fillRule: "evenodd",
194
- clipRule: "evenodd"
195
- }
196
- ) });
197
- }
198
- function DotFilledIcon(props) {
199
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
200
- "path",
201
- {
202
- d: "M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",
203
- fill: "currentColor"
204
- }
205
- ) });
206
- }
207
- function RadixChevronRightIcon(props) {
208
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
209
- "path",
210
- {
211
- d: "M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",
212
- fill: "currentColor",
213
- fillRule: "evenodd",
214
- clipRule: "evenodd"
215
- }
216
- ) });
217
- }
218
176
 
219
177
  // src/portal-container.tsx
220
178
  var React2 = __toESM(require("react"), 1);
@@ -478,141 +436,54 @@ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @
478
436
  ));
479
437
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
480
438
 
481
- // src/dropdown-menu.tsx
482
- var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
439
+ // src/popover.tsx
440
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
483
441
  var React6 = __toESM(require("react"), 1);
484
442
  var import_jsx_runtime6 = require("react/jsx-runtime");
485
- var DropdownMenu = DropdownMenuPrimitive.Root;
486
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
487
- var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
488
- var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
489
- var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
490
- var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
491
- DropdownMenuPrimitive.SubTrigger,
492
- {
493
- ref,
494
- "data-slot": "dropdown-menu-sub-trigger",
495
- className: cn(
496
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
497
- inset && "pl-8",
498
- className
499
- ),
500
- ...props,
501
- children: [
502
- children,
503
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
504
- ]
505
- }
506
- ));
507
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
508
- var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
509
- DropdownMenuPrimitive.SubContent,
510
- {
511
- ref,
512
- "data-slot": "dropdown-menu-sub-content",
513
- className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
514
- ...props
515
- }
516
- ));
517
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
518
- var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
519
- const portalContainer = usePortalContainer(container);
520
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
521
- DropdownMenuPrimitive.Content,
522
- {
523
- ref,
524
- "data-slot": "dropdown-menu-content",
525
- sideOffset,
526
- className: cn(
527
- MENU_SURFACE_CLASS,
528
- "shadow-md",
529
- MOTION_POPPER,
530
- className
531
- ),
532
- ...props
533
- }
534
- ) });
535
- });
536
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
537
- var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
538
- DropdownMenuPrimitive.Item,
539
- {
540
- ref,
541
- "data-slot": "dropdown-menu-item",
542
- className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
543
- ...props
544
- }
545
- ));
546
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
547
- var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
548
- DropdownMenuPrimitive.CheckboxItem,
549
- {
550
- ref,
551
- "data-slot": "dropdown-menu-checkbox-item",
552
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
553
- ...props,
554
- children: [
555
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
556
- children
557
- ]
558
- }
559
- ));
560
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
561
- var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
562
- DropdownMenuPrimitive.RadioItem,
563
- {
564
- ref,
565
- "data-slot": "dropdown-menu-radio-item",
566
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
567
- ...props,
568
- children: [
569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
570
- children
571
- ]
572
- }
573
- ));
574
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
575
- var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
576
- DropdownMenuPrimitive.Label,
577
- {
578
- ref,
579
- "data-slot": "dropdown-menu-label",
580
- className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
581
- ...props
582
- }
583
- ));
584
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
585
- var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
586
- DropdownMenuPrimitive.Separator,
587
- {
588
- ref,
589
- "data-slot": "dropdown-menu-separator",
590
- className: cn("-mx-1 my-1 h-px bg-muted", className),
591
- ...props
592
- }
593
- ));
594
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
595
- var DropdownMenuShortcut = ({
596
- className,
597
- ...props
598
- }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
599
- "span",
600
- {
601
- "data-slot": "dropdown-menu-shortcut",
602
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
443
+ var Popover = PopoverPrimitive.Root;
444
+ var PopoverTrigger = PopoverPrimitive.Trigger;
445
+ var PopoverContent = React6.forwardRef(
446
+ ({
447
+ className,
448
+ align = "center",
449
+ sideOffset = 4,
450
+ container,
451
+ animated = true,
603
452
  ...props
453
+ }, ref) => {
454
+ const portalContainer = usePortalContainer(container);
455
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
456
+ PopoverPrimitive.Content,
457
+ {
458
+ ref,
459
+ align,
460
+ sideOffset,
461
+ className: cn(
462
+ // Cap to the viewport space Radix measured and scroll — a popover taller
463
+ // than the screen must never trap the user with unreachable content.
464
+ // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
465
+ // z, DOM portal order decides, so a dialog opened FROM a popover stacks
466
+ // above it, and a popover opened from a dialog still stacks above the
467
+ // dialog. z-[10001] buried dialogs behind fullscreen popovers.
468
+ "z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
469
+ animated && MOTION_POPPER,
470
+ className
471
+ ),
472
+ ...props
473
+ }
474
+ ) });
604
475
  }
605
476
  );
606
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
477
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
478
+
479
+ // src/content-transfer/icon.ts
480
+ var ALCHEMY_GLYPH_PATHS = ["M9 3h6", "M10 3v6l-5.2 8.7A2 2 0 0 0 6.5 21h11a2 2 0 0 0 1.7-3.3L14 9V3", "M8 15h8"];
481
+ var ALCHEMY_GLYPH_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${ALCHEMY_GLYPH_PATHS.map((d) => `<path d="${d}"/>`).join("")}</svg>`;
607
482
 
608
483
  // src/content-transfer/index.tsx
609
484
  var import_jsx_runtime7 = require("react/jsx-runtime");
610
485
  function AlchemyGlyph(props) {
611
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
612
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4.5 5.5h8v11h-8z" }),
613
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8.5 9.5h8v9h-8z" }),
614
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
615
- ] });
486
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: ALCHEMY_GLYPH_PATHS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d }, d)) });
616
487
  }
617
488
  var CapabilityContext = React7.createContext({});
618
489
  var useContentTransferCapabilities = () => React7.useContext(CapabilityContext);
@@ -626,6 +497,62 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
626
497
  ] })
627
498
  ] });
628
499
  }
500
+ function PaletteGlyph({ format, ai = false, file = false, kind }) {
501
+ if (kind === "ai-copy") return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
502
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
503
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
504
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
505
+ ] });
506
+ if (kind === "sliders") return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
507
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 6h16M4 12h16M4 18h16" }),
508
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8 3v6M16 9v6M10 15v6" })
509
+ ] });
510
+ if (ai) return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
511
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 5a3 3 0 1 0-5.997.125A4 4 0 0 0 3.5 10.9a4 4 0 0 0 .556 6.588A4 4 0 0 0 12 19" }),
512
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.503 5.775 4 4 0 0 1-.556 6.588A4 4 0 0 1 12 19" }),
513
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
514
+ ] });
515
+ if (file) return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
516
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
517
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
518
+ ] });
519
+ const path = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
520
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
521
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
522
+ ] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m14 10 7-7" }),
524
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M20 10h-6V4" }),
525
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m3 21 7-7" }),
526
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 14h6v6" })
527
+ ] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
528
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
529
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 10h16M10 4v16" })
530
+ ] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
531
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
532
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
533
+ ] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
534
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
535
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
536
+ ] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
537
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
538
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
539
+ ] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
540
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: path });
541
+ }
542
+ function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
543
+ if (!items.length && !extra) return null;
544
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: title }),
546
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
547
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
548
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
549
+ item.copyLabel ?? item.label,
550
+ item.hint ?? fallbackHint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "matrx-alchemy-menu-hint", children: item.hint ?? fallbackHint }) : null
551
+ ] })
552
+ ] }, item.id)),
553
+ extra
554
+ ] });
555
+ }
629
556
  var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
630
557
  var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
631
558
  var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
@@ -714,7 +641,7 @@ function ContentTransferMenu(props) {
714
641
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
715
642
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
716
643
  }
717
- function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
644
+ function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
718
645
  const triggerRef = React7.useRef(null);
719
646
  const inherited = React7.useContext(CapabilityContext);
720
647
  const nearestSurface = React7.useContext(SurfaceContext);
@@ -727,6 +654,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
727
654
  const workspaceCaptures = React7.useRef(/* @__PURE__ */ new Map());
728
655
  const externalWorkspaceKeys = React7.useRef(/* @__PURE__ */ new Set());
729
656
  const [notice, setNotice] = React7.useState(null);
657
+ const [paletteOpen, setPaletteOpen] = React7.useState(false);
658
+ const [mode, setMode] = React7.useState("copy");
730
659
  const scopes = React7.useMemo(() => table?.availableScopes ?? ["target"], [table]);
731
660
  const initialScope = table?.initialScope ?? "target";
732
661
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
@@ -978,48 +907,96 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
978
907
  }, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
979
908
  if (!enabled) return null;
980
909
  const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
981
- const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section).map((v) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { "aria-label": v.ariaLabel, onSelect: () => void transfer("markdown", false, v), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...v, label: v.copyLabel }) }, `copy:${v.id}`));
982
- const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
983
- const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
984
- const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
910
+ const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
911
+ const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
912
+ const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
913
+ const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
985
914
  const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
915
+ const downloadActions = visibleActions.filter((action) => action.placement === "download");
916
+ const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
917
+ const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
918
+ const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
919
+ const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
920
+ const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
921
+ const closePalette = () => setPaletteOpen(false);
922
+ const tile = (id, label2, onClick, options = {}) => {
923
+ const presentation = options.action;
924
+ const Icon2 = presentation?.icon;
925
+ const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
926
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
927
+ closePalette();
928
+ onClick();
929
+ }, children: [
930
+ Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
931
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
932
+ label2,
933
+ presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
934
+ ] })
935
+ ] }, id);
936
+ };
986
937
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
987
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu, { onOpenChange: (open) => {
988
- if (open) void preflight();
938
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
939
+ setPaletteOpen(open);
940
+ if (open) {
941
+ setMode("copy");
942
+ void preflight();
943
+ }
989
944
  }, children: [
990
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlchemyGlyph, {}) }) }),
991
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuContent, { align: "end", className: "matrx-alchemy-menu", children: [
992
- menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { disabled: true, children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { disabled: true, children: menuStatus }) : null,
993
- !hide.includes("copy") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
994
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuLabel, { children: "Copy" }),
995
- quickVariants("copy"),
996
- visibleCopies.map((format) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
997
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
998
- "Copy ",
999
- adapter.label
1000
- ] }, adapter.id))
1001
- ] }) : null,
1002
- !hide.includes("prepare") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1003
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}),
1004
- quickVariants("ai"),
1005
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
1006
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
1007
- variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
945
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlchemyGlyph, {}) }) }),
946
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
947
+ menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
948
+ copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "matrx-alchemy-output", children: [
949
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
950
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
951
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
952
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
953
+ ] }) : null,
954
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
955
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
956
+ visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
957
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
958
+ ] }),
959
+ quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
960
+ closePalette();
961
+ void transfer("markdown", false, variant);
962
+ } }) : null
963
+ ] }) : null,
964
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
965
+ visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
966
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
967
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
968
+ ] }) }) : null
1008
969
  ] }) : null,
1009
- !hide.includes("download") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1010
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}),
1011
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuLabel, { children: "Download" }),
1012
- visibleDownloads.map((format) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(format, true), children: [
1013
- "Download ",
1014
- LABEL[format]
1015
- ] }, format)),
1016
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, true), children: [
1017
- "Download ",
1018
- adapter.label
1019
- ] }, `download:${adapter.id}`))
970
+ prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
971
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", items: quickVariants("ai"), onRun: (variant) => {
972
+ closePalette();
973
+ void transfer("markdown", false, variant);
974
+ } }),
975
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
976
+ closePalette();
977
+ void openWorkspace();
978
+ }, children: [
979
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { kind: "sliders" }),
980
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
981
+ "Prepare for AI",
982
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
983
+ ] })
984
+ ] }) })
1020
985
  ] }) : null,
1021
- visibleActions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}) : null,
1022
- visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { "aria-label": action.ariaLabel, onSelect: () => void runAction(action), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id))
986
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
987
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
988
+ closePalette();
989
+ void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
990
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Prepare this surface" }) }) : null,
991
+ variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
992
+ closePalette();
993
+ void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
994
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
995
+ ] }) }) : null,
996
+ ordinaryActions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
997
+ closePalette();
998
+ void runAction(action);
999
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
1023
1000
  ] })
1024
1001
  ] }),
1025
1002
  notice ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
@@ -1292,137 +1269,138 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1292
1269
  state.snapshot.label
1293
1270
  ] }),
1294
1271
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DialogDescription, { children: [
1295
- "Captured ",
1296
- state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
1297
- ". Your source is never edited."
1272
+ state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
1273
+ "Review and edit this copy. Your original stays unchanged."
1298
1274
  ] })
1299
1275
  ] }),
1300
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-workspace-grid", children: [
1301
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "matrx-alchemy-main", children: [
1302
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1303
- scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1304
- "Scope",
1305
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1306
- ] }) : null,
1307
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1308
- "Detail",
1309
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "full", children: "Full" }),
1311
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "compact", children: "Compact" }),
1312
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "brief", children: "Brief" }),
1313
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "custom", children: "Custom" })
1314
- ] })
1315
- ] }),
1316
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1317
- setBufferError(null);
1318
- if (controlsHistory.length) {
1319
- const next = controlsHistory[controlsHistory.length - 1];
1276
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
1277
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-workspace-grid", children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "matrx-alchemy-main", children: [
1279
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1280
+ scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1281
+ "Scope",
1282
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1283
+ ] }) : null,
1284
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1285
+ "Detail",
1286
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1287
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "full", children: "Full" }),
1288
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "compact", children: "Compact" }),
1289
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "brief", children: "Brief" }),
1290
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "custom", children: "Custom" })
1291
+ ] })
1292
+ ] }),
1293
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1294
+ setBufferError(null);
1295
+ if (controlsHistory.length) {
1296
+ const next = controlsHistory[controlsHistory.length - 1];
1297
+ setControls(next);
1298
+ setControlsHistory((history) => history.slice(0, -1));
1299
+ onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1300
+ } else onChange({ ...state, draft: (0, import_content_transfer.undoDraft)(state.draft), error: void 0 });
1301
+ }, children: "Undo" }),
1302
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1303
+ const next = initialControls(state);
1320
1304
  setControls(next);
1321
- setControlsHistory((history) => history.slice(0, -1));
1305
+ setControlsHistory([]);
1306
+ setPendingControls(null);
1307
+ setBufferError(null);
1322
1308
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1323
- } else onChange({ ...state, draft: (0, import_content_transfer.undoDraft)(state.draft), error: void 0 });
1324
- }, children: "Undo" }),
1325
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => {
1326
- const next = initialControls(state);
1327
- setControls(next);
1328
- setControlsHistory([]);
1329
- setPendingControls(null);
1330
- setBufferError(null);
1331
- onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1332
- }, children: "Reset" }),
1333
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1334
- ] }),
1335
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1336
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "JSON limits" }),
1337
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1338
- text,
1339
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1340
- ] }, key))
1341
- ] }) : null,
1342
- rows ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RowControls, { rows, controls, change: changeControls }) : null,
1343
- state.snapshot.sections.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1344
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "Sections" }),
1345
- state.snapshot.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1346
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1347
- " ",
1348
- section.label
1349
- ] }, section.id))
1350
- ] }) : null,
1351
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-coverage", children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
1353
- state.snapshot.coverage.included.toLocaleString(),
1354
- " included",
1355
- state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1356
- " \xB7 ",
1357
- state.snapshot.coverage.status
1309
+ }, children: "Reset" }),
1310
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1358
1311
  ] }),
1359
- state.snapshot.coverage.reason ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: state.snapshot.coverage.reason }) : null,
1360
- limitText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
1361
- "Limits: ",
1362
- limitText
1312
+ controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1313
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "JSON limits" }),
1314
+ [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1315
+ text,
1316
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1317
+ ] }, key))
1363
1318
  ] }) : null,
1364
- displayedOmissions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { children: [
1365
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
1366
- displayedOmissions.length,
1367
- " omissions or adjustments"
1319
+ rows ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RowControls, { rows, controls, change: changeControls }) : null,
1320
+ state.snapshot.sections.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1321
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "Sections" }),
1322
+ state.snapshot.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1323
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1324
+ " ",
1325
+ section.label
1326
+ ] }, section.id))
1327
+ ] }) : null,
1328
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-coverage", children: [
1329
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
1330
+ state.snapshot.coverage.included.toLocaleString(),
1331
+ " included",
1332
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1333
+ " \xB7 ",
1334
+ state.snapshot.coverage.status
1368
1335
  ] }),
1369
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
1370
- o.path || "/",
1371
- ": ",
1372
- o.reason,
1373
- o.count == null ? "" : ` (${o.count})`
1374
- ] }, `${o.path}-${o.reason}-${i}`)) })
1375
- ] }) : null
1376
- ] }),
1377
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "matrx-alchemy-preview-label", children: [
1378
- "Output format",
1379
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1380
- formats.map((f) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: f, children: LABEL[f] }, f)),
1381
- state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "xlsx", children: "Excel workbook" }) : null,
1382
- workspaceAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: adapter.id, children: adapter.label }, adapter.id))
1383
- ] })
1336
+ state.snapshot.coverage.reason ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: state.snapshot.coverage.reason }) : null,
1337
+ limitText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
1338
+ "Limits: ",
1339
+ limitText
1340
+ ] }) : null,
1341
+ displayedOmissions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { children: [
1342
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
1343
+ displayedOmissions.length,
1344
+ " omissions or adjustments"
1345
+ ] }),
1346
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
1347
+ o.path || "/",
1348
+ ": ",
1349
+ o.reason,
1350
+ o.count == null ? "" : ` (${o.count})`
1351
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1352
+ ] }) : null
1353
+ ] }),
1354
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "matrx-alchemy-preview-label", children: [
1355
+ "Output format",
1356
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1357
+ formats.map((f) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: f, children: LABEL[f] }, f)),
1358
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "xlsx", children: "Excel workbook" }) : null,
1359
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: adapter.id, children: adapter.label }, adapter.id))
1360
+ ] })
1361
+ ] }),
1362
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1363
+ bufferError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1364
+ formatError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1365
+ bufferError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1366
+ const fallback = (0, import_content_transfer.editDraft)(state.draft, { kind: "text", text: buffer });
1367
+ setBufferError(null);
1368
+ onChange({ ...state, draft: fallback, error: void 0 });
1369
+ setFormat("plain");
1370
+ }, children: "Use invalid JSON as plain text" }) : null
1384
1371
  ] }),
1385
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1386
- bufferError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1387
- formatError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1388
- bufferError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1389
- const fallback = (0, import_content_transfer.editDraft)(state.draft, { kind: "text", text: buffer });
1390
- setBufferError(null);
1391
- onChange({ ...state, draft: fallback, error: void 0 });
1392
- setFormat("plain");
1393
- }, children: "Use invalid JSON as plain text" }) : null
1372
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("aside", { children: [
1373
+ ai ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1375
+ "AI instruction",
1376
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1377
+ ] }),
1378
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1379
+ busy === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1380
+ ] }) : null,
1381
+ busy === "capture" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1382
+ activeCapture.current?.abort();
1383
+ activeCapture.current = null;
1384
+ setBusy(null);
1385
+ }, children: "Stop loading rows" }) : null,
1386
+ ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1387
+ ai ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-meta", children: "AI updates the preview; copy it when you are ready. Closing this window lets the AI run continue." }) : null,
1388
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1389
+ ] }) : null
1394
1390
  ] }),
1395
- ai || busy === "capture" || state.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("aside", { children: [
1396
- ai ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1397
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1398
- "AI instruction",
1399
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1400
- ] }),
1401
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1402
- busy === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1403
- ] }) : null,
1404
- busy === "capture" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: () => {
1405
- activeCapture.current?.abort();
1406
- activeCapture.current = null;
1407
- setBusy(null);
1408
- }, children: "Stop loading rows" }) : null,
1409
- ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1410
- ai ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-meta", children: "AI creates a preview. It never copies automatically. Closing detaches this view without cancelling server work." }) : null,
1411
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1412
- ] }) : null
1391
+ pendingControls ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1392
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "This control would replace your manual edit." }),
1393
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1394
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1395
+ ] }) : null,
1396
+ state.sourceStale ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1397
+ state.pending ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1398
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "A fresh source snapshot is ready." }),
1399
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1400
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1401
+ ] }) : null,
1402
+ deliveryNotice ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1413
1403
  ] }),
1414
- pendingControls ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1415
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "This control would replace your manual edit." }),
1416
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1417
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1418
- ] }) : null,
1419
- state.sourceStale ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1420
- state.pending ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1421
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "A fresh source snapshot is ready." }),
1422
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1423
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1424
- ] }) : null,
1425
- deliveryNotice ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
1426
1404
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DialogFooter, { children: [
1427
1405
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "matrx-alchemy-meta", children: [
1428
1406
  buffer.length.toLocaleString(),
@@ -1430,13 +1408,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1430
1408
  estimateTokens(buffer).toLocaleString(),
1431
1409
  " tokens"
1432
1410
  ] }),
1433
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", onClick: close, children: "Close" }),
1434
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download prepared output" }),
1435
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy prepared output" })
1411
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1412
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", "aria-label": "Download prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download" }),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { type: "button", className: "matrx-alchemy-workspace-primary", "aria-label": "Copy prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy" })
1436
1414
  ] })
1437
1415
  ] }) });
1438
1416
  }
1439
1417
  function RowControls({ rows, controls, change }) {
1418
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1419
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1420
+ const dataSummary = [controls.search ? "search active" : "", controls.sort ? `sorted by ${rows.columns.find((column) => column.id === controls.sort)?.label ?? controls.sort}` : "", filterCount ? `${filterCount} filter${filterCount === 1 ? "" : "s"}` : ""].filter(Boolean).join(" \xB7 ");
1440
1421
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1441
1422
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1442
1423
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
@@ -1462,32 +1443,40 @@ function RowControls({ rows, controls, change }) {
1462
1443
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1463
1444
  ] })
1464
1445
  ] }),
1465
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1466
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "Columns and filters" }),
1467
- rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-column", children: [
1446
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "matrx-alchemy-options", children: [
1447
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
1448
+ "Columns and filters",
1449
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1450
+ ] }),
1451
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-column", children: [
1468
1452
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1469
1453
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.visibleColumns.includes(column.id), onChange: (e) => change({ ...controls, visibleColumns: e.target.checked ? [...controls.visibleColumns, column.id] : controls.visibleColumns.filter((id) => id !== column.id) }) }),
1470
1454
  " ",
1471
1455
  column.label
1472
1456
  ] }),
1473
1457
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { "aria-label": `Filter ${column.label}`, placeholder: "Filter", value: controls.filters[column.id] ?? "", onChange: (e) => change({ ...controls, filters: { ...controls.filters, [column.id]: e.target.value } }) })
1474
- ] }, column.id))
1458
+ ] }, column.id)) })
1475
1459
  ] }),
1476
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1477
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { children: "Rows" }),
1478
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1479
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1480
- " Only selected rows"
1460
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "matrx-alchemy-options", children: [
1461
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
1462
+ "Rows \u2014 ",
1463
+ selectionSummary
1481
1464
  ] }),
1482
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1483
- const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String((0, import_content_transfer.readTransferCell)(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1484
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1485
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1486
- " Row ",
1487
- index + 1,
1488
- summary ? ` \u2014 ${summary}` : ""
1489
- ] }, index);
1490
- }) })
1465
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { "aria-label": "Row selection", children: [
1466
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1467
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1468
+ " Only selected rows"
1469
+ ] }),
1470
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1471
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String((0, import_content_transfer.readTransferCell)(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1472
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { children: [
1473
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1474
+ " Row ",
1475
+ index + 1,
1476
+ summary ? ` \u2014 ${summary}` : ""
1477
+ ] }, index);
1478
+ }) })
1479
+ ] })
1491
1480
  ] })
1492
1481
  ] });
1493
1482
  }
@@ -1639,7 +1628,7 @@ function MatrxCopyMenuSession(props) {
1639
1628
  if (aiVisible && props.aiCustom)
1640
1629
  actions.push({
1641
1630
  id: "configure-source",
1642
- label: props.aiCustom.label ?? "Customize source\u2026",
1631
+ label: props.aiCustom.label ?? "Customize source",
1643
1632
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1644
1633
  supports: () => true,
1645
1634
  run: async () => {
@@ -1650,7 +1639,7 @@ function MatrxCopyMenuSession(props) {
1650
1639
  if (aiVisible && props.groomer)
1651
1640
  actions.push({
1652
1641
  id: "groom-source",
1653
- label: "Customize sections\u2026",
1642
+ label: "Customize sections",
1654
1643
  supports: () => true,
1655
1644
  run: async () => {
1656
1645
  setConfiguration({ groomer: props.groomer() });
@@ -1664,6 +1653,7 @@ function MatrxCopyMenuSession(props) {
1664
1653
  label: item.label,
1665
1654
  supports: () => true,
1666
1655
  ...item.build && !item.onSelect ? {
1656
+ placement: "download",
1667
1657
  source: make(
1668
1658
  `export:${item.id}`,
1669
1659
  async () => {
@@ -1744,10 +1734,11 @@ function MatrxCopyMenuSession(props) {
1744
1734
  label: props.label,
1745
1735
  variants,
1746
1736
  actions,
1737
+ sourceFormats: Boolean(source),
1747
1738
  hide: [
1748
1739
  ...!copyVisible || !source ? ["copy"] : [],
1749
1740
  ...!aiVisible || !source ? ["prepare"] : [],
1750
- ...!exportVisible || !source ? ["download"] : []
1741
+ ...!exportVisible ? ["download"] : []
1751
1742
  ],
1752
1743
  formatSources: {
1753
1744
  ...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
@@ -1758,7 +1749,8 @@ function MatrxCopyMenuSession(props) {
1758
1749
  className: cn(
1759
1750
  props.className,
1760
1751
  props.size === "xs" && "matrx-alchemy-xs",
1761
- props.size === "sm" && "matrx-alchemy-sm"
1752
+ props.size === "sm" && "matrx-alchemy-sm",
1753
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1762
1754
  ),
1763
1755
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1764
1756
  }
@@ -1863,127 +1855,132 @@ function SourceConfiguration({
1863
1855
  event.preventDefault();
1864
1856
  if (!handingOff.current) restoreFocus();
1865
1857
  },
1866
- className: "matrx-alchemy-workspace",
1858
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1867
1859
  children: [
1868
1860
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DialogHeader, { children: [
1869
1861
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogTitle, { children: title }),
1870
1862
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1871
1863
  ] }),
1872
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1873
- custom?.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
1874
- option.label,
1875
- "hint" in option && option.hint ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { children: option.hint }) : null,
1876
- option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1877
- "input",
1878
- {
1879
- type: "checkbox",
1880
- checked: Boolean(values[option.key]),
1881
- onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1882
- }
1883
- ) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1884
- "select",
1885
- {
1886
- value: Number(values[option.key]),
1887
- onChange: (event) => setValues({
1888
- ...values,
1889
- [option.key]: Number(event.target.value)
1890
- }),
1891
- children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: choice.value, children: choice.label }, choice.value))
1892
- }
1893
- ) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1894
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1864
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
1865
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1866
+ custom?.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
1867
+ option.label,
1868
+ "hint" in option && option.hint ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { children: option.hint }) : null,
1869
+ option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1895
1870
  "input",
1896
1871
  {
1897
- type: "range",
1898
- min: 0,
1899
- max: Math.max(0, option.stops.length - 1),
1900
- step: 1,
1901
- value: option.stops.indexOf(Number(values[option.key])),
1902
- onChange: (event) => setValues({
1903
- ...values,
1904
- [option.key]: option.stops[Number(event.target.value)]
1905
- })
1872
+ type: "checkbox",
1873
+ checked: Boolean(values[option.key]),
1874
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1906
1875
  }
1907
- ),
1908
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: option.formatValue(Number(values[option.key])) })
1909
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1910
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1911
- "input",
1876
+ ) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1877
+ "select",
1912
1878
  {
1913
- type: "number",
1914
- min: option.min,
1915
- step: option.step,
1916
1879
  value: Number(values[option.key]),
1917
1880
  onChange: (event) => setValues({
1918
1881
  ...values,
1919
1882
  [option.key]: Number(event.target.value)
1920
- })
1883
+ }),
1884
+ children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: choice.value, children: choice.label }, choice.value))
1921
1885
  }
1922
- ),
1923
- option.presets?.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1886
+ ) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1887
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1888
+ "input",
1889
+ {
1890
+ type: "range",
1891
+ min: 0,
1892
+ max: Math.max(0, option.stops.length - 1),
1893
+ step: 1,
1894
+ value: option.stops.indexOf(Number(values[option.key])),
1895
+ onChange: (event) => setValues({
1896
+ ...values,
1897
+ [option.key]: option.stops[Number(event.target.value)]
1898
+ })
1899
+ }
1900
+ ),
1901
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: option.formatValue(Number(values[option.key])) })
1902
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1903
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1904
+ "input",
1905
+ {
1906
+ type: "number",
1907
+ min: option.min,
1908
+ step: option.step,
1909
+ value: Number(values[option.key]),
1910
+ onChange: (event) => setValues({
1911
+ ...values,
1912
+ [option.key]: Number(event.target.value)
1913
+ })
1914
+ }
1915
+ ),
1916
+ option.presets?.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1917
+ Button,
1918
+ {
1919
+ type: "button",
1920
+ variant: "ghost",
1921
+ className: "matrx-alchemy-workspace-secondary",
1922
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1923
+ children: preset.label
1924
+ },
1925
+ preset.value
1926
+ ))
1927
+ ] })
1928
+ ] }, option.key)),
1929
+ groomer ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1930
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1924
1931
  Button,
1925
1932
  {
1926
1933
  type: "button",
1927
1934
  variant: "ghost",
1928
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1929
- children: preset.label
1935
+ className: "matrx-alchemy-workspace-secondary",
1936
+ onClick: () => setSections(
1937
+ Object.fromEntries(
1938
+ groomer.sections.map((section) => [
1939
+ section.id,
1940
+ level === "brief" && section.cuttable ? "off" : level
1941
+ ])
1942
+ )
1943
+ ),
1944
+ children: level
1930
1945
  },
1931
- preset.value
1932
- ))
1933
- ] })
1934
- ] }, option.key)),
1935
- groomer ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1936
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1937
- Button,
1938
- {
1939
- type: "button",
1940
- variant: "ghost",
1941
- onClick: () => setSections(
1942
- Object.fromEntries(
1943
- groomer.sections.map((section) => [
1944
- section.id,
1945
- level === "brief" && section.cuttable ? "off" : level
1946
- ])
1947
- )
1946
+ level
1947
+ )) }),
1948
+ groomer.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
1949
+ section.title,
1950
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1951
+ "select",
1952
+ {
1953
+ value: sections[section.id],
1954
+ onChange: (event) => setSections({
1955
+ ...sections,
1956
+ [section.id]: event.target.value
1957
+ }),
1958
+ children: [
1959
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1960
+ section.cuttable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "off", children: "Exclude" }) : null
1961
+ ]
1962
+ }
1948
1963
  ),
1949
- children: level
1950
- },
1951
- level
1952
- )) }),
1953
- groomer.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
1954
- section.title,
1955
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1956
- "select",
1957
- {
1958
- value: sections[section.id],
1959
- onChange: (event) => setSections({
1960
- ...sections,
1961
- [section.id]: event.target.value
1962
- }),
1963
- children: [
1964
- ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1965
- section.cuttable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "off", children: "Exclude" }) : null
1966
- ]
1967
- }
1968
- ),
1969
- section.description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: section.description }) : null
1970
- ] }, section.id))
1971
- ] }) : null
1972
- ] }),
1973
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
1974
- text.length.toLocaleString(),
1975
- " characters \xB7 approximately",
1976
- " ",
1977
- Math.ceil(text.length / 4).toLocaleString(),
1978
- " tokens"
1964
+ section.description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: section.description }) : null
1965
+ ] }, section.id))
1966
+ ] }) : null
1967
+ ] }),
1968
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
1969
+ text.length.toLocaleString(),
1970
+ " characters \xB7 approximately",
1971
+ " ",
1972
+ Math.ceil(text.length / 4).toLocaleString(),
1973
+ " tokens"
1974
+ ] }),
1975
+ error || buildError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", children: error ?? buildError }) : null
1979
1976
  ] }),
1980
- error || buildError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", children: error ?? buildError }) : null,
1981
1977
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DialogFooter, { children: [
1982
1978
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1983
1979
  Button,
1984
1980
  {
1985
1981
  type: "button",
1986
1982
  variant: "ghost",
1983
+ className: "matrx-alchemy-workspace-secondary",
1987
1984
  disabled: busy,
1988
1985
  onClick: onClose,
1989
1986
  children: "Cancel"
@@ -1993,6 +1990,7 @@ function SourceConfiguration({
1993
1990
  Button,
1994
1991
  {
1995
1992
  type: "button",
1993
+ className: "matrx-alchemy-workspace-primary",
1996
1994
  disabled: busy || !prepared || Boolean(buildError),
1997
1995
  onClick: async () => {
1998
1996
  if (!prepared) return;