@vantageos/mosaic-blocks 0.5.34-alpha → 0.5.36-alpha

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 (149) hide show
  1. package/README.md +9 -8
  2. package/dist/index.cjs +1517 -101
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1283 -15
  5. package/dist/index.d.ts +1283 -15
  6. package/dist/index.js +1487 -102
  7. package/dist/index.js.map +1 -1
  8. package/dist/styles.css +18 -0
  9. package/package.json +38 -26
  10. package/r/mosaic-accordion.json +18 -0
  11. package/r/mosaic-activity-feed.json +16 -0
  12. package/r/mosaic-adaptive-grid.json +18 -0
  13. package/r/mosaic-adaptive-modal.json +18 -0
  14. package/r/mosaic-adaptive-navigation.json +18 -0
  15. package/r/mosaic-add-memory-form.json +25 -0
  16. package/r/mosaic-admin-only-guard.json +18 -0
  17. package/r/mosaic-agent-builder-modal.json +23 -0
  18. package/r/mosaic-agent-card.json +16 -0
  19. package/r/mosaic-agent-chat.json +26 -0
  20. package/r/mosaic-agent-composer.json +28 -0
  21. package/r/mosaic-agent-editor.json +25 -0
  22. package/r/mosaic-agent-list.json +21 -0
  23. package/r/mosaic-agent-preview.json +21 -0
  24. package/r/mosaic-alert-dialog.json +23 -0
  25. package/r/mosaic-animated-list.json +16 -0
  26. package/r/mosaic-api-key-panel.json +21 -0
  27. package/r/mosaic-app-sidebar.json +18 -0
  28. package/r/mosaic-approval-prompt.json +21 -0
  29. package/r/mosaic-artifact-canvas-adapter.json +26 -0
  30. package/r/mosaic-artifact-chart.json +18 -0
  31. package/r/mosaic-artifact-checklist.json +18 -0
  32. package/r/mosaic-artifact-data-table.json +18 -0
  33. package/r/mosaic-artifact-document.json +16 -0
  34. package/r/mosaic-artifact-library.json +18 -0
  35. package/r/mosaic-artifact-save-as-memory-form.json +24 -0
  36. package/r/mosaic-artifact-version-history.json +16 -0
  37. package/r/mosaic-avatar.json +18 -0
  38. package/r/mosaic-badge.json +23 -0
  39. package/r/mosaic-blurred-orb.json +16 -0
  40. package/r/mosaic-button.json +24 -0
  41. package/r/mosaic-callout.json +23 -0
  42. package/r/mosaic-card.json +16 -0
  43. package/r/mosaic-chat-composer.json +21 -0
  44. package/r/mosaic-chat-message.json +23 -0
  45. package/r/mosaic-chat-sidebar.json +21 -0
  46. package/r/mosaic-chat-thread.json +21 -0
  47. package/r/mosaic-checkbox.json +18 -0
  48. package/r/mosaic-clerk-org-switcher.json +18 -0
  49. package/r/mosaic-clerk-webhook-handler.json +18 -0
  50. package/r/mosaic-collapsible.json +18 -0
  51. package/r/mosaic-combobox.json +18 -0
  52. package/r/mosaic-counter.json +16 -0
  53. package/r/mosaic-dashboard-content.json +18 -0
  54. package/r/mosaic-dashboard-header.json +18 -0
  55. package/r/mosaic-dashboard-layout.json +20 -0
  56. package/r/mosaic-data-table.json +16 -0
  57. package/r/mosaic-delete-confirmation-dialog.json +18 -0
  58. package/r/mosaic-device-provider.json +16 -0
  59. package/r/mosaic-document-table.json +52 -0
  60. package/r/mosaic-document-upload.json +21 -0
  61. package/r/mosaic-drawer.json +23 -0
  62. package/r/mosaic-dropdown-menu.json +18 -0
  63. package/r/mosaic-edit-memory-dialog.json +27 -0
  64. package/r/mosaic-edit-session-dialog.json +25 -0
  65. package/r/mosaic-editable-cell.json +23 -0
  66. package/r/mosaic-empty-state.json +16 -0
  67. package/r/mosaic-falling-pattern.json +16 -0
  68. package/r/mosaic-feature-3col.json +16 -0
  69. package/r/mosaic-feature-centered-media.json +16 -0
  70. package/r/mosaic-field.json +18 -0
  71. package/r/mosaic-filter-bar.json +18 -0
  72. package/r/mosaic-filter-sidebar.json +18 -0
  73. package/r/mosaic-footer-simple.json +16 -0
  74. package/r/mosaic-hero-split.json +16 -0
  75. package/r/mosaic-input-group.json +16 -0
  76. package/r/mosaic-input.json +18 -0
  77. package/r/mosaic-integrations-badge.json +16 -0
  78. package/r/mosaic-kanban-board.json +21 -0
  79. package/r/mosaic-logos-grid.json +16 -0
  80. package/r/mosaic-main-nav.json +18 -0
  81. package/r/mosaic-markdown.json +21 -0
  82. package/r/mosaic-marketplace-card.json +24 -0
  83. package/r/mosaic-marketplace-list.json +20 -0
  84. package/r/mosaic-match-input.json +23 -0
  85. package/r/mosaic-memory-card.json +21 -0
  86. package/r/mosaic-memory-dashboard.json +23 -0
  87. package/r/mosaic-memory-grid.json +21 -0
  88. package/r/mosaic-memory-list.json +21 -0
  89. package/r/mosaic-memory-search.json +23 -0
  90. package/r/mosaic-mention-input.json +23 -0
  91. package/r/mosaic-message-card.json +16 -0
  92. package/r/mosaic-message-list.json +19 -0
  93. package/r/mosaic-message-search.json +18 -0
  94. package/r/mosaic-model-selector.json +23 -0
  95. package/r/mosaic-module-card.json +16 -0
  96. package/r/mosaic-module-library.json +18 -0
  97. package/r/mosaic-multi-tenant-provider.json +19 -0
  98. package/r/mosaic-navbar.json +16 -0
  99. package/r/mosaic-org-context-display.json +18 -0
  100. package/r/mosaic-org-panel.json +19 -0
  101. package/r/mosaic-org-profile-page.json +18 -0
  102. package/r/mosaic-org-switcher.json +16 -0
  103. package/r/mosaic-pdf-viewer.json +23 -0
  104. package/r/mosaic-popover.json +23 -0
  105. package/r/mosaic-preferences-panel.json +18 -0
  106. package/r/mosaic-pricing-card.json +16 -0
  107. package/r/mosaic-profile-panel.json +18 -0
  108. package/r/mosaic-progress.json +18 -0
  109. package/r/mosaic-quick-action-card.json +16 -0
  110. package/r/mosaic-quick-actions-menu.json +18 -0
  111. package/r/mosaic-quick-agent-selector.json +19 -0
  112. package/r/mosaic-radio-group.json +18 -0
  113. package/r/mosaic-reply-input.json +21 -0
  114. package/r/mosaic-resizable-split-pane.json +23 -0
  115. package/r/mosaic-save-chat-as-memory-form.json +25 -0
  116. package/r/mosaic-save-template-modal.json +27 -0
  117. package/r/mosaic-scroll-area.json +18 -0
  118. package/r/mosaic-select.json +18 -0
  119. package/r/mosaic-selector-modal.json +18 -0
  120. package/r/mosaic-separator.json +18 -0
  121. package/r/mosaic-session-card.json +24 -0
  122. package/r/mosaic-session-list.json +21 -0
  123. package/r/mosaic-sign-in-layout.json +18 -0
  124. package/r/mosaic-sign-up-layout.json +18 -0
  125. package/r/mosaic-skeleton.json +23 -0
  126. package/r/mosaic-slider.json +18 -0
  127. package/r/mosaic-stats-grid.json +16 -0
  128. package/r/mosaic-step-pipeline.json +21 -0
  129. package/r/mosaic-switch.json +18 -0
  130. package/r/mosaic-tabs.json +18 -0
  131. package/r/mosaic-tag-input.json +23 -0
  132. package/r/mosaic-template-agent-card.json +21 -0
  133. package/r/mosaic-template-category-chips.json +21 -0
  134. package/r/mosaic-template-gallery.json +20 -0
  135. package/r/mosaic-template-list.json +21 -0
  136. package/r/mosaic-template-management-panel.json +25 -0
  137. package/r/mosaic-testimonials-grid.json +16 -0
  138. package/r/mosaic-textarea.json +16 -0
  139. package/r/mosaic-theme-provider.json +18 -0
  140. package/r/mosaic-theme-toggle.json +16 -0
  141. package/r/mosaic-thread-indicator.json +21 -0
  142. package/r/mosaic-thread-view.json +21 -0
  143. package/r/mosaic-toast.json +28 -0
  144. package/r/mosaic-tool-toggle-list.json +23 -0
  145. package/r/mosaic-tooltip.json +18 -0
  146. package/r/mosaic-url-scraper.json +21 -0
  147. package/r/mosaic-user-button.json +18 -0
  148. package/r/use-effective-workspace-id.json +18 -0
  149. package/registry.json +179 -130
package/dist/index.cjs CHANGED
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
48
48
  var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
49
49
 
50
50
  // src/version.ts
51
- var version = "0.5.34-alpha";
51
+ var version = "0.5.36-alpha";
52
52
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
53
53
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
54
54
  }
@@ -815,7 +815,9 @@ function MosaicThemeToggle({
815
815
  "aria-pressed": isDark,
816
816
  onClick: handleToggle,
817
817
  className: cn12(
818
- "inline-flex size-9 items-center justify-center rounded-full border border-[oklch(0.9_0.005_250)] bg-[oklch(var(--mosaic-surface,1_0_0))] transition-colors hover:bg-[oklch(0.95_0.005_250)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[oklch(0.5_0.15_250)]",
818
+ "inline-flex size-9 items-center justify-center rounded-full border border-border",
819
+ "bg-secondary text-foreground transition-colors hover:bg-accent",
820
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
819
821
  className
820
822
  ),
821
823
  children: isDark ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2217,7 +2219,11 @@ function MosaicCombobox({
2217
2219
  disabled,
2218
2220
  name,
2219
2221
  emptyMessage,
2220
- className
2222
+ className,
2223
+ side,
2224
+ align,
2225
+ collisionBoundary,
2226
+ collisionPadding
2221
2227
  }) {
2222
2228
  const [inputValue, setInputValue] = React30__namespace.useState("");
2223
2229
  const filter = combobox.Combobox.useFilter({ sensitivity: "base" });
@@ -2249,39 +2255,46 @@ function MosaicCombobox({
2249
2255
  )
2250
2256
  }
2251
2257
  ),
2252
- /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
2253
- combobox.Combobox.Popup,
2258
+ /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2259
+ combobox.Combobox.Positioner,
2254
2260
  {
2255
- className: cn35(
2256
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border",
2257
- "bg-popover p-1 text-popover-foreground shadow-md",
2258
- "origin-[var(--transform-origin)]",
2259
- "transition-[transform,scale,opacity]",
2260
- "data-[open]:scale-100 data-[open]:opacity-100",
2261
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2262
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2263
- ),
2264
- children: /* @__PURE__ */ jsxRuntime.jsxs(combobox.Combobox.List, { children: [
2265
- filteredItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
2266
- combobox.Combobox.Item,
2267
- {
2268
- value: item.value,
2269
- disabled: item.disabled,
2270
- className: cn35(
2271
- "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5",
2272
- "text-sm text-popover-foreground outline-none",
2273
- "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
2274
- "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
2275
- "data-[selected]:font-medium"
2276
- ),
2277
- children: item.label
2278
- },
2279
- item.value
2280
- )),
2281
- /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage })
2282
- ] })
2261
+ sideOffset: 4,
2262
+ side,
2263
+ align,
2264
+ collisionBoundary,
2265
+ collisionPadding,
2266
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2267
+ combobox.Combobox.Popup,
2268
+ {
2269
+ className: cn35(
2270
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border",
2271
+ "bg-popover p-1 text-popover-foreground shadow-md",
2272
+ "origin-[var(--transform-origin)]",
2273
+ "transition-[transform,scale,opacity]",
2274
+ "data-[open]:scale-100 data-[open]:opacity-100",
2275
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2276
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2277
+ ),
2278
+ children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.List, { children: filteredItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage }) : filteredItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
2279
+ combobox.Combobox.Item,
2280
+ {
2281
+ value: item.value,
2282
+ disabled: item.disabled,
2283
+ className: cn35(
2284
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5",
2285
+ "text-sm text-popover-foreground outline-none",
2286
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
2287
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
2288
+ "data-[selected]:font-medium"
2289
+ ),
2290
+ children: item.label
2291
+ },
2292
+ item.value
2293
+ )) })
2294
+ }
2295
+ )
2283
2296
  }
2284
- ) }) })
2297
+ ) })
2285
2298
  ] })
2286
2299
  }
2287
2300
  );
@@ -2322,7 +2335,11 @@ function MosaicModelSelector({
2322
2335
  emptyMessage,
2323
2336
  disabled,
2324
2337
  name,
2325
- className
2338
+ className,
2339
+ side,
2340
+ align,
2341
+ collisionBoundary,
2342
+ collisionPadding
2326
2343
  }) {
2327
2344
  const [inputValue, setInputValue] = React30__namespace.useState("");
2328
2345
  const filter = combobox.Combobox.useFilter({ sensitivity: "base" });
@@ -2361,40 +2378,47 @@ function MosaicModelSelector({
2361
2378
  }
2362
2379
  ),
2363
2380
  value != null && value in labelMap && inputValue === "" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-sm text-foreground", children: labelMap[value] }),
2364
- /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
2365
- combobox.Combobox.Popup,
2381
+ /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2382
+ combobox.Combobox.Positioner,
2366
2383
  {
2367
- className: cn36(
2368
- "z-50 min-w-[16rem] overflow-hidden rounded-md border border-border",
2369
- "bg-popover p-1 text-popover-foreground shadow-md",
2370
- "origin-[var(--transform-origin)]",
2371
- "transition-[transform,scale,opacity]",
2372
- "data-[open]:scale-100 data-[open]:opacity-100",
2373
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2374
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2375
- ),
2376
- children: /* @__PURE__ */ jsxRuntime.jsxs(combobox.Combobox.List, { children: [
2377
- filteredModels.map((model) => /* @__PURE__ */ jsxRuntime.jsxs(
2378
- combobox.Combobox.Item,
2379
- {
2380
- value: model.value,
2381
- disabled: model.disabled,
2382
- className: modelSelectorItemVariants({ className: void 0 }),
2383
- children: [
2384
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2385
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: model.label }),
2386
- model.badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: model.badge })
2387
- ] }),
2388
- model.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: model.description }),
2389
- model.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: model.meta })
2390
- ]
2391
- },
2392
- model.value
2393
- )),
2394
- /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage })
2395
- ] })
2384
+ sideOffset: 4,
2385
+ side,
2386
+ align,
2387
+ collisionBoundary,
2388
+ collisionPadding,
2389
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2390
+ combobox.Combobox.Popup,
2391
+ {
2392
+ className: cn36(
2393
+ "z-50 min-w-[16rem] overflow-hidden rounded-md border border-border",
2394
+ "bg-popover p-1 text-popover-foreground shadow-md",
2395
+ "origin-[var(--transform-origin)]",
2396
+ "transition-[transform,scale,opacity]",
2397
+ "data-[open]:scale-100 data-[open]:opacity-100",
2398
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2399
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2400
+ ),
2401
+ children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.List, { children: filteredModels.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage }) : filteredModels.map((model) => /* @__PURE__ */ jsxRuntime.jsxs(
2402
+ combobox.Combobox.Item,
2403
+ {
2404
+ value: model.value,
2405
+ disabled: model.disabled,
2406
+ className: modelSelectorItemVariants({ className: void 0 }),
2407
+ children: [
2408
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2409
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: model.label }),
2410
+ model.badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: model.badge })
2411
+ ] }),
2412
+ model.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: model.description }),
2413
+ model.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: model.meta })
2414
+ ]
2415
+ },
2416
+ model.value
2417
+ )) })
2418
+ }
2419
+ )
2396
2420
  }
2397
- ) }) })
2421
+ ) })
2398
2422
  ] })
2399
2423
  }
2400
2424
  );
@@ -2844,6 +2868,7 @@ function MosaicAdaptiveNavigation({
2844
2868
  tabNavAriaLabel,
2845
2869
  completeStatusLabel,
2846
2870
  inProgressStatusLabel,
2871
+ formatDuration,
2847
2872
  className,
2848
2873
  ref
2849
2874
  }) {
@@ -2886,10 +2911,7 @@ function MosaicAdaptiveNavigation({
2886
2911
  ] })
2887
2912
  ] }),
2888
2913
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
2889
- item.duration !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground", children: [
2890
- item.duration,
2891
- "s"
2892
- ] }),
2914
+ item.duration !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground", children: formatDuration(item.duration) }),
2893
2915
  /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon2, { rotated: isExpanded })
2894
2916
  ] })
2895
2917
  ]
@@ -2941,17 +2963,14 @@ function MosaicAdaptiveNavigation({
2941
2963
  }
2942
2964
  ),
2943
2965
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: item.title }),
2944
- item.duration !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
2966
+ item.duration !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
2945
2967
  "span",
2946
2968
  {
2947
2969
  className: cn40(
2948
2970
  "rounded px-1 py-0.5 text-xs",
2949
2971
  isActive ? "bg-primary-foreground/20" : "bg-muted"
2950
2972
  ),
2951
- children: [
2952
- item.duration,
2953
- "s"
2954
- ]
2973
+ children: formatDuration(item.duration)
2955
2974
  }
2956
2975
  )
2957
2976
  ]
@@ -3711,7 +3730,12 @@ function ArrowRightIcon() {
3711
3730
  }
3712
3731
  );
3713
3732
  }
3714
- function MosaicActivityItem({ activity, icon, className }) {
3733
+ function MosaicActivityItem({
3734
+ activity,
3735
+ formatMessageCount,
3736
+ icon,
3737
+ className
3738
+ }) {
3715
3739
  return /* @__PURE__ */ jsxRuntime.jsxs(
3716
3740
  "div",
3717
3741
  {
@@ -3739,10 +3763,7 @@ function MosaicActivityItem({ activity, icon, className }) {
3739
3763
  label
3740
3764
  );
3741
3765
  }) }),
3742
- activity.messages !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
3743
- activity.messages,
3744
- " messages"
3745
- ] })
3766
+ activity.messages !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: formatMessageCount(activity.messages) })
3746
3767
  ] }),
3747
3768
  activity.excerpt && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs text-muted-foreground line-clamp-1", children: activity.excerpt })
3748
3769
  ] }),
@@ -3771,6 +3792,7 @@ function MosaicActivityFeed({
3771
3792
  viewAllHref,
3772
3793
  viewAllLabel,
3773
3794
  emptyMessage,
3795
+ formatMessageCount,
3774
3796
  iconMap,
3775
3797
  renderLink,
3776
3798
  className,
@@ -3810,7 +3832,14 @@ function MosaicActivityFeed({
3810
3832
  {
3811
3833
  className: "mosaic-activity-row",
3812
3834
  style: { animationDelay: `${idx * 80}ms` },
3813
- children: /* @__PURE__ */ jsxRuntime.jsx(MosaicActivityItem, { activity, icon: iconMap?.[activity.type] })
3835
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3836
+ MosaicActivityItem,
3837
+ {
3838
+ activity,
3839
+ formatMessageCount,
3840
+ icon: iconMap?.[activity.type]
3841
+ }
3842
+ )
3814
3843
  },
3815
3844
  activity.id
3816
3845
  )) })
@@ -4005,6 +4034,7 @@ function MosaicAgentComposerDesktop({
4005
4034
  customInstructionsPreviewLabel,
4006
4035
  selectAllModulesLabel,
4007
4036
  unnamedAgentLabel,
4037
+ formatContextWindow,
4008
4038
  roleSublabel,
4009
4039
  personaSublabel,
4010
4040
  frameworkSublabel,
@@ -4110,7 +4140,7 @@ function MosaicAgentComposerDesktop({
4110
4140
  ] }),
4111
4141
  selectedModel.provider && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs capitalize text-muted-foreground", children: selectedModel.provider }),
4112
4142
  (selectedModel.contextWindow || selectedModel.pricingLabel) && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
4113
- selectedModel.contextWindow && `${selectedModel.contextWindow.toLocaleString()} context`,
4143
+ selectedModel.contextWindow && formatContextWindow(selectedModel.contextWindow),
4114
4144
  selectedModel.contextWindow && selectedModel.pricingLabel && " \u2022 ",
4115
4145
  selectedModel.pricingLabel
4116
4146
  ] })
@@ -4476,7 +4506,8 @@ function MosaicAgentComposerMobile({
4476
4506
  editModuleAriaLabel,
4477
4507
  removeModuleAriaLabel,
4478
4508
  selectModuleAriaLabel,
4479
- changeModuleLabel
4509
+ changeModuleLabel,
4510
+ formatContextWindow
4480
4511
  }) {
4481
4512
  const L = labels;
4482
4513
  const instructionsId = React30__namespace.useId();
@@ -4590,7 +4621,7 @@ function MosaicAgentComposerMobile({
4590
4621
  ] }),
4591
4622
  selectedModel.provider && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs capitalize text-muted-foreground", children: selectedModel.provider }),
4592
4623
  (selectedModel.contextWindow || selectedModel.pricingLabel) && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
4593
- selectedModel.contextWindow && `${selectedModel.contextWindow.toLocaleString()} context`,
4624
+ selectedModel.contextWindow && formatContextWindow(selectedModel.contextWindow),
4594
4625
  selectedModel.contextWindow && selectedModel.pricingLabel && " \u2022 ",
4595
4626
  selectedModel.pricingLabel
4596
4627
  ] })
@@ -9094,7 +9125,9 @@ function MosaicTemplateCard({
9094
9125
  showActions = false,
9095
9126
  compact = false,
9096
9127
  previewLabel,
9097
- duplicateLabel
9128
+ duplicateLabel,
9129
+ formatAgentCount,
9130
+ formatUsageCount
9098
9131
  }) {
9099
9132
  const isPopular = (template.metadata?.usageCount ?? 0) > 10;
9100
9133
  const isTrending = (template.metadata?.usageCount ?? 0) > 5;
@@ -9125,14 +9158,8 @@ function MosaicTemplateCard({
9125
9158
  ] }),
9126
9159
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
9127
9160
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: template.category }),
9128
- template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: [
9129
- template.agents.length,
9130
- " agents"
9131
- ] }),
9132
- (template.metadata?.usageCount ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: [
9133
- template.metadata?.usageCount,
9134
- " uses"
9135
- ] }),
9161
+ template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: formatAgentCount(template.agents.length) }),
9162
+ (template.metadata?.usageCount ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: formatUsageCount(template.metadata?.usageCount ?? 0) }),
9136
9163
  tags.slice(0, compact ? 1 : 2).map((tag) => /* @__PURE__ */ jsxRuntime.jsxs(
9137
9164
  "span",
9138
9165
  {
@@ -9396,6 +9423,8 @@ function TemplateGalleryContent({
9396
9423
  expandSidebarAriaLabel,
9397
9424
  previewLabel,
9398
9425
  duplicateLabel,
9426
+ formatAgentCount,
9427
+ formatUsageCount,
9399
9428
  isMobile
9400
9429
  }) {
9401
9430
  const [query, setQuery] = React30__namespace.useState("");
@@ -9472,6 +9501,8 @@ function TemplateGalleryContent({
9472
9501
  showActions,
9473
9502
  previewLabel,
9474
9503
  duplicateLabel,
9504
+ formatAgentCount,
9505
+ formatUsageCount,
9475
9506
  compact: true
9476
9507
  },
9477
9508
  template.id
@@ -9521,7 +9552,9 @@ function TemplateGalleryContent({
9521
9552
  onDuplicate: onDuplicateTemplate,
9522
9553
  showActions,
9523
9554
  previewLabel,
9524
- duplicateLabel
9555
+ duplicateLabel,
9556
+ formatAgentCount,
9557
+ formatUsageCount
9525
9558
  },
9526
9559
  template.id
9527
9560
  )) }),
@@ -10111,6 +10144,7 @@ function MosaicOrgRoleBadge({
10111
10144
  MosaicOrgRoleBadge.displayName = "MosaicOrgRoleBadge";
10112
10145
  function MosaicMultiOrgIndicator({
10113
10146
  orgCount,
10147
+ formatOrgCount,
10114
10148
  currentOrgName,
10115
10149
  onSwitchOrg,
10116
10150
  className
@@ -10147,14 +10181,10 @@ function MosaicMultiOrgIndicator({
10147
10181
  ]
10148
10182
  }
10149
10183
  ),
10150
- orgCount,
10151
- " orgs"
10184
+ formatOrgCount(orgCount)
10152
10185
  ]
10153
10186
  }
10154
- ) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-secondary px-2.5 py-1 text-xs font-medium text-secondary-foreground", children: [
10155
- orgCount,
10156
- " orgs"
10157
- ] }),
10187
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-secondary px-2.5 py-1 text-xs font-medium text-secondary-foreground", children: formatOrgCount(orgCount) }),
10158
10188
  currentOrgName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: currentOrgName })
10159
10189
  ] });
10160
10190
  }
@@ -17121,6 +17151,1361 @@ function MosaicEditableCell({
17121
17151
  }
17122
17152
  MosaicEditableCell.displayName = "MosaicEditableCell";
17123
17153
 
17154
+ // src/components/artifact-canvas-adapter/normalize.ts
17155
+ var KNOWN_TYPES = ["document", "data-table", "checklist", "chart"];
17156
+ function isArtifactType(value) {
17157
+ return KNOWN_TYPES.includes(value);
17158
+ }
17159
+ function titleFromData(data) {
17160
+ return typeof data.title === "string" ? data.title : "";
17161
+ }
17162
+ function normalizeFromAiSdkArtifacts(source) {
17163
+ if (!source.activeId) return null;
17164
+ const entry = source.artifacts.find((a) => a.id === source.activeId);
17165
+ if (!entry) return null;
17166
+ if (!isArtifactType(entry.type)) return null;
17167
+ return {
17168
+ id: entry.id,
17169
+ type: entry.type,
17170
+ title: titleFromData(entry.data),
17171
+ data: entry.data
17172
+ };
17173
+ }
17174
+ function normalizeFromMcpToolResult(source) {
17175
+ const resourceUri = source.toolResult?._meta?.ui?.resourceUri;
17176
+ if (!resourceUri) return null;
17177
+ const segments = resourceUri.split("/").filter(Boolean);
17178
+ const typeSegment = segments[segments.length - 1];
17179
+ if (!typeSegment || !isArtifactType(typeSegment)) return null;
17180
+ const data = source.toolResult.structuredContent ?? {};
17181
+ const id = typeof data.id === "string" ? data.id : resourceUri;
17182
+ return {
17183
+ id,
17184
+ type: typeSegment,
17185
+ title: titleFromData(data),
17186
+ data
17187
+ };
17188
+ }
17189
+ function normalizeArtifact(source) {
17190
+ if (source.kind === "ai-sdk-artifacts") return normalizeFromAiSdkArtifacts(source);
17191
+ if (source.kind === "mcp-ui") return normalizeFromMcpToolResult(source);
17192
+ return null;
17193
+ }
17194
+ function cn117(...classes) {
17195
+ return classes.filter(Boolean).join(" ");
17196
+ }
17197
+ function MosaicArtifactCanvasAdapter({
17198
+ source,
17199
+ isOpen,
17200
+ onToggle,
17201
+ onClose,
17202
+ labels,
17203
+ className,
17204
+ ref
17205
+ }) {
17206
+ const artifact = source ? normalizeArtifact(source) : null;
17207
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, "data-slot": "artifact-canvas-adapter", className: cn117("relative", className), children: [
17208
+ /* @__PURE__ */ jsxRuntime.jsx(
17209
+ "button",
17210
+ {
17211
+ type: "button",
17212
+ "data-slot": "artifact-canvas-toggle",
17213
+ "aria-label": labels.toggleLabel,
17214
+ "aria-expanded": isOpen,
17215
+ onClick: onToggle,
17216
+ className: cn117(
17217
+ "inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium",
17218
+ "outline-none transition-colors",
17219
+ "focus-visible:ring-ring focus-visible:ring-[3px]",
17220
+ "bg-muted text-muted-foreground hover:text-foreground"
17221
+ ),
17222
+ children: labels.toggleLabel
17223
+ }
17224
+ ),
17225
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
17226
+ "section",
17227
+ {
17228
+ "aria-label": labels.toolbarHeading,
17229
+ "data-slot": "artifact-canvas",
17230
+ className: cn117(
17231
+ "mt-2 flex flex-col rounded-lg border border-border bg-background",
17232
+ "shadow-xs"
17233
+ ),
17234
+ children: [
17235
+ /* @__PURE__ */ jsxRuntime.jsxs(
17236
+ "div",
17237
+ {
17238
+ "data-slot": "artifact-canvas-toolbar",
17239
+ className: "flex items-center justify-between border-border border-b px-4 py-2",
17240
+ children: [
17241
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: labels.toolbarHeading }),
17242
+ /* @__PURE__ */ jsxRuntime.jsx(
17243
+ "button",
17244
+ {
17245
+ type: "button",
17246
+ "aria-label": labels.closeLabel,
17247
+ onClick: onClose,
17248
+ className: cn117(
17249
+ "rounded-md p-1 outline-none transition-colors",
17250
+ "focus-visible:ring-ring focus-visible:ring-[3px]",
17251
+ "hover:bg-muted"
17252
+ ),
17253
+ children: labels.closeLabel
17254
+ }
17255
+ )
17256
+ ]
17257
+ }
17258
+ ),
17259
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "artifact-canvas-body", className: "flex-1 p-4", children: [
17260
+ !source && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
17261
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-muted-foreground", children: labels.emptyTitle }),
17262
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-muted-foreground/70 text-sm", children: labels.emptyBody })
17263
+ ] }),
17264
+ source && !artifact && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
17265
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-muted-foreground", children: labels.notFoundTitle }),
17266
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-muted-foreground/70 text-sm", children: labels.notFoundBody })
17267
+ ] }),
17268
+ artifact && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "artifact-canvas-artifact", "data-artifact-type": artifact.type, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
17269
+ /* @__PURE__ */ jsxRuntime.jsx(
17270
+ "span",
17271
+ {
17272
+ "data-slot": "artifact-canvas-type-badge",
17273
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17274
+ children: labels.typeLabel(artifact.type)
17275
+ }
17276
+ ),
17277
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-base", children: artifact.title })
17278
+ ] }) })
17279
+ ] })
17280
+ ]
17281
+ }
17282
+ )
17283
+ ] });
17284
+ }
17285
+ MosaicArtifactCanvasAdapter.displayName = "MosaicArtifactCanvasAdapter";
17286
+ function cn118(...classes) {
17287
+ return classes.filter(Boolean).join(" ");
17288
+ }
17289
+ function MosaicArtifactDocument({
17290
+ data,
17291
+ labels,
17292
+ className,
17293
+ ref
17294
+ }) {
17295
+ const sortedSections = data.sections ? [...data.sections].sort((a, b) => a.order - b.order) : [];
17296
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17297
+ "div",
17298
+ {
17299
+ ref,
17300
+ "data-slot": "artifact-document",
17301
+ className: cn118(
17302
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17303
+ className
17304
+ ),
17305
+ children: [
17306
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 border-border border-b px-4 py-3", children: [
17307
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
17308
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "truncate font-medium text-base", children: data.title }),
17309
+ /* @__PURE__ */ jsxRuntime.jsx(
17310
+ "span",
17311
+ {
17312
+ "data-slot": "artifact-document-type-badge",
17313
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17314
+ children: labels.typeBadgeLabel
17315
+ }
17316
+ )
17317
+ ] }),
17318
+ data.metadata?.updatedAt && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground text-xs", children: labels.updatedLabel(new Date(data.metadata.updatedAt).toLocaleDateString()) })
17319
+ ] }),
17320
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: data.content || labels.emptyContentMessage }) }),
17321
+ sortedSections.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-t p-4", children: [
17322
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "mb-3 font-medium text-sm", children: labels.sectionsHeading }),
17323
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: sortedSections.map((section) => /* @__PURE__ */ jsxRuntime.jsxs(
17324
+ "li",
17325
+ {
17326
+ "data-slot": "artifact-document-section",
17327
+ className: "flex items-center gap-2 rounded bg-muted/50 p-2",
17328
+ children: [
17329
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-4 w-1 shrink-0 rounded-full bg-primary" }),
17330
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: section.title }),
17331
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.charsLabel(section.content.length) })
17332
+ ]
17333
+ },
17334
+ section.id
17335
+ )) })
17336
+ ] }),
17337
+ data.metadata?.tags && data.metadata.tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border border-t p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
17338
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: labels.tagsLabel }),
17339
+ data.metadata.tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
17340
+ "span",
17341
+ {
17342
+ "data-slot": "artifact-document-tag",
17343
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17344
+ children: tag
17345
+ },
17346
+ tag
17347
+ ))
17348
+ ] }) })
17349
+ ]
17350
+ }
17351
+ );
17352
+ }
17353
+ MosaicArtifactDocument.displayName = "MosaicArtifactDocument";
17354
+ function cn119(...classes) {
17355
+ return classes.filter(Boolean).join(" ");
17356
+ }
17357
+ function MosaicArtifactDataTable({
17358
+ data,
17359
+ labels,
17360
+ className,
17361
+ ref
17362
+ }) {
17363
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17364
+ "div",
17365
+ {
17366
+ ref,
17367
+ "data-slot": "artifact-data-table",
17368
+ className: cn119(
17369
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17370
+ className
17371
+ ),
17372
+ children: [
17373
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17374
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-medium text-base", children: data.title }),
17375
+ /* @__PURE__ */ jsxRuntime.jsx(
17376
+ "span",
17377
+ {
17378
+ "data-slot": "artifact-data-table-type-badge",
17379
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17380
+ children: labels.typeBadgeLabel
17381
+ }
17382
+ ),
17383
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.rowsColsLabel(data.rows.length, data.columns.length) })
17384
+ ] }),
17385
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
17386
+ MosaicDataTable,
17387
+ {
17388
+ columns: data.columns.map((column) => ({
17389
+ key: column.id,
17390
+ header: column.name,
17391
+ render: (row) => {
17392
+ const value = row[column.id];
17393
+ if (column.type === "boolean") {
17394
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs", children: value ? labels.yesLabel : labels.noLabel });
17395
+ }
17396
+ if (column.type === "number") {
17397
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: String(value ?? "") });
17398
+ }
17399
+ return String(value ?? "");
17400
+ }
17401
+ })),
17402
+ rows: data.rows,
17403
+ emptyMessage: labels.emptyMessage
17404
+ }
17405
+ ) })
17406
+ ]
17407
+ }
17408
+ );
17409
+ }
17410
+ MosaicArtifactDataTable.displayName = "MosaicArtifactDataTable";
17411
+ function cn120(...classes) {
17412
+ return classes.filter(Boolean).join(" ");
17413
+ }
17414
+ var CHART_COLORS = [
17415
+ "var(--color-chart-1)",
17416
+ "var(--color-chart-2)",
17417
+ "var(--color-chart-3)",
17418
+ "var(--color-chart-4)",
17419
+ "var(--color-chart-5)"
17420
+ ];
17421
+ function seriesKeys(rows, xAxisKey) {
17422
+ return Object.keys(rows[0] ?? {}).filter((key) => key !== xAxisKey);
17423
+ }
17424
+ function renderChart(data, labels, recharts) {
17425
+ const {
17426
+ BarChart,
17427
+ Bar,
17428
+ LineChart,
17429
+ Line,
17430
+ PieChart,
17431
+ Pie,
17432
+ Cell,
17433
+ XAxis,
17434
+ YAxis,
17435
+ CartesianGrid,
17436
+ Tooltip: Tooltip2,
17437
+ Legend,
17438
+ ResponsiveContainer
17439
+ } = recharts;
17440
+ const xAxisKey = data.config?.xAxis ?? Object.keys(data.data[0] ?? {})[0] ?? "";
17441
+ const colors = data.config?.colors ?? CHART_COLORS;
17442
+ if (data.type === "bar") {
17443
+ return /* @__PURE__ */ jsxRuntime.jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(BarChart, { data: data.data, margin: { top: 20, right: 30, left: 20, bottom: 5 }, children: [
17444
+ data.config?.grid && /* @__PURE__ */ jsxRuntime.jsx(CartesianGrid, { strokeDasharray: "3 3" }),
17445
+ /* @__PURE__ */ jsxRuntime.jsx(XAxis, { dataKey: xAxisKey }),
17446
+ /* @__PURE__ */ jsxRuntime.jsx(YAxis, {}),
17447
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, {}),
17448
+ data.config?.legend && /* @__PURE__ */ jsxRuntime.jsx(Legend, {}),
17449
+ seriesKeys(data.data, xAxisKey).map((key, index) => /* @__PURE__ */ jsxRuntime.jsx(Bar, { dataKey: key, fill: colors[index % colors.length] }, key))
17450
+ ] }) });
17451
+ }
17452
+ if (data.type === "line") {
17453
+ return /* @__PURE__ */ jsxRuntime.jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(LineChart, { data: data.data, margin: { top: 20, right: 30, left: 20, bottom: 5 }, children: [
17454
+ data.config?.grid && /* @__PURE__ */ jsxRuntime.jsx(CartesianGrid, { strokeDasharray: "3 3" }),
17455
+ /* @__PURE__ */ jsxRuntime.jsx(XAxis, { dataKey: xAxisKey }),
17456
+ /* @__PURE__ */ jsxRuntime.jsx(YAxis, {}),
17457
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, {}),
17458
+ data.config?.legend && /* @__PURE__ */ jsxRuntime.jsx(Legend, {}),
17459
+ seriesKeys(data.data, xAxisKey).map((key, index) => /* @__PURE__ */ jsxRuntime.jsx(
17460
+ Line,
17461
+ {
17462
+ type: "monotone",
17463
+ dataKey: key,
17464
+ stroke: colors[index % colors.length],
17465
+ strokeWidth: 2
17466
+ },
17467
+ key
17468
+ ))
17469
+ ] }) });
17470
+ }
17471
+ if (data.type === "pie") {
17472
+ const nameKey = Object.keys(data.data[0] ?? {})[0] ?? "name";
17473
+ const valueKey = Object.keys(data.data[0] ?? {})[1] ?? "value";
17474
+ return /* @__PURE__ */ jsxRuntime.jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(PieChart, { children: [
17475
+ /* @__PURE__ */ jsxRuntime.jsx(Pie, { data: data.data, cx: "50%", cy: "50%", outerRadius: 80, dataKey: valueKey, children: data.data.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { fill: colors[index % colors.length] }, String(entry[nameKey] ?? index))) }),
17476
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, {}),
17477
+ data.config?.legend && /* @__PURE__ */ jsxRuntime.jsx(Legend, {})
17478
+ ] }) });
17479
+ }
17480
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center text-muted-foreground text-sm", children: labels.unsupportedTypeMessage(data.type) });
17481
+ }
17482
+ function MosaicArtifactChart({
17483
+ data,
17484
+ labels,
17485
+ recharts,
17486
+ className,
17487
+ ref
17488
+ }) {
17489
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17490
+ "div",
17491
+ {
17492
+ ref,
17493
+ "data-slot": "artifact-chart",
17494
+ className: cn120(
17495
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17496
+ className
17497
+ ),
17498
+ children: [
17499
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17500
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-medium text-base", children: data.title }),
17501
+ /* @__PURE__ */ jsxRuntime.jsx(
17502
+ "span",
17503
+ {
17504
+ "data-slot": "artifact-chart-type-badge",
17505
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17506
+ children: labels.typeBadgeLabel(data.type)
17507
+ }
17508
+ ),
17509
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.pointsLabel(data.data.length) })
17510
+ ] }),
17511
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-64 flex-1 p-6", children: recharts ? renderChart(data, labels, recharts) : /* @__PURE__ */ jsxRuntime.jsx(
17512
+ "div",
17513
+ {
17514
+ "data-slot": "artifact-chart-unavailable",
17515
+ className: "flex h-full items-center justify-center text-muted-foreground text-sm",
17516
+ children: labels.unavailableMessage
17517
+ }
17518
+ ) }),
17519
+ (data.metadata?.dataSource || data.metadata?.description) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border border-t px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 text-muted-foreground text-xs", children: [
17520
+ data.metadata?.dataSource && /* @__PURE__ */ jsxRuntime.jsx("span", { children: data.metadata.dataSource }),
17521
+ data.metadata?.description && /* @__PURE__ */ jsxRuntime.jsx("span", { children: data.metadata.description })
17522
+ ] }) })
17523
+ ]
17524
+ }
17525
+ );
17526
+ }
17527
+ MosaicArtifactChart.displayName = "MosaicArtifactChart";
17528
+ function cn121(...classes) {
17529
+ return classes.filter(Boolean).join(" ");
17530
+ }
17531
+ function MosaicArtifactChecklist({
17532
+ data,
17533
+ labels,
17534
+ className,
17535
+ ref
17536
+ }) {
17537
+ const completedCount = data.items.filter((item) => item.completed).length;
17538
+ const totalCount = data.items.length;
17539
+ const progress = totalCount > 0 ? completedCount / totalCount * 100 : 0;
17540
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17541
+ "div",
17542
+ {
17543
+ ref,
17544
+ "data-slot": "artifact-checklist",
17545
+ className: cn121(
17546
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17547
+ className
17548
+ ),
17549
+ children: [
17550
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17551
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-medium text-base", children: data.title }),
17552
+ /* @__PURE__ */ jsxRuntime.jsx(
17553
+ "span",
17554
+ {
17555
+ "data-slot": "artifact-checklist-type-badge",
17556
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17557
+ children: labels.typeBadgeLabel
17558
+ }
17559
+ ),
17560
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.progressLabel(completedCount, totalCount) })
17561
+ ] }),
17562
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 border-border border-b bg-muted/20 p-4", children: [
17563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: labels.completedOfTotalLabel(completedCount, totalCount, Math.round(progress)) }) }),
17564
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicProgress, { value: progress, "aria-label": labels.typeBadgeLabel }),
17565
+ data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: data.description })
17566
+ ] }),
17567
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto p-4", children: totalCount === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-8 text-center text-muted-foreground text-sm", children: labels.emptyMessage }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-3", children: data.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
17568
+ "li",
17569
+ {
17570
+ "data-slot": "artifact-checklist-item",
17571
+ className: cn121(
17572
+ "flex items-start gap-3 rounded-lg border p-3",
17573
+ item.completed ? "border-primary/20 bg-primary/10" : "border-border bg-background"
17574
+ ),
17575
+ children: [
17576
+ /* @__PURE__ */ jsxRuntime.jsx(
17577
+ "span",
17578
+ {
17579
+ "aria-hidden": "true",
17580
+ className: cn121(
17581
+ "mt-0.5 h-4 w-4 shrink-0 rounded border-2",
17582
+ item.completed ? "border-primary bg-primary" : "border-muted-foreground"
17583
+ )
17584
+ }
17585
+ ),
17586
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
17587
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
17588
+ /* @__PURE__ */ jsxRuntime.jsx(
17589
+ "span",
17590
+ {
17591
+ className: cn121(
17592
+ "text-sm leading-relaxed",
17593
+ item.completed && "text-muted-foreground line-through"
17594
+ ),
17595
+ children: item.text
17596
+ }
17597
+ ),
17598
+ item.priority && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full border border-border px-2 py-0.5 text-xs", children: labels.priorityLabel(item.priority) })
17599
+ ] }),
17600
+ item.notes && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 rounded bg-muted/50 p-2 text-muted-foreground text-xs", children: item.notes })
17601
+ ] })
17602
+ ]
17603
+ },
17604
+ item.id
17605
+ )) }) }),
17606
+ data.metadata?.category && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border border-t bg-muted/20 px-4 py-3 text-muted-foreground text-xs", children: data.metadata.category })
17607
+ ]
17608
+ }
17609
+ );
17610
+ }
17611
+ MosaicArtifactChecklist.displayName = "MosaicArtifactChecklist";
17612
+ function cn122(...classes) {
17613
+ return classes.filter(Boolean).join(" ");
17614
+ }
17615
+ function SearchIcon10() {
17616
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17617
+ "svg",
17618
+ {
17619
+ xmlns: "http://www.w3.org/2000/svg",
17620
+ width: "16",
17621
+ height: "16",
17622
+ viewBox: "0 0 24 24",
17623
+ fill: "none",
17624
+ stroke: "currentColor",
17625
+ strokeWidth: "2",
17626
+ strokeLinecap: "round",
17627
+ strokeLinejoin: "round",
17628
+ "aria-hidden": "true",
17629
+ children: [
17630
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
17631
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
17632
+ ]
17633
+ }
17634
+ );
17635
+ }
17636
+ function MosaicArtifactLibrary({
17637
+ items,
17638
+ selectedId,
17639
+ onSelect,
17640
+ source,
17641
+ isCanvasOpen,
17642
+ onToggleCanvas,
17643
+ onCloseCanvas,
17644
+ title,
17645
+ searchPlaceholder,
17646
+ searchAriaLabel,
17647
+ emptyMessage,
17648
+ typeLabel,
17649
+ countLabel,
17650
+ adapterLabels,
17651
+ className
17652
+ }) {
17653
+ const [query, setQuery] = React30__namespace.useState("");
17654
+ const filtered = React30__namespace.useMemo(() => {
17655
+ const q = query.trim().toLowerCase();
17656
+ if (!q) return items;
17657
+ return items.filter((item) => item.title.toLowerCase().includes(q));
17658
+ }, [items, query]);
17659
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "artifact-library", className: cn122("flex h-full flex-col", className), children: [
17660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b px-4 py-3", children: [
17661
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 flex items-center justify-between", children: [
17662
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-lg", children: title }),
17663
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: countLabel(filtered.length) })
17664
+ ] }),
17665
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
17666
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "-translate-y-1/2 absolute top-1/2 left-3 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon10, {}) }),
17667
+ /* @__PURE__ */ jsxRuntime.jsx(
17668
+ "input",
17669
+ {
17670
+ type: "search",
17671
+ "data-slot": "artifact-library-search",
17672
+ value: query,
17673
+ onChange: (e) => setQuery(e.target.value),
17674
+ placeholder: searchPlaceholder,
17675
+ "aria-label": searchAriaLabel,
17676
+ className: cn122(
17677
+ "w-full rounded-md border border-input bg-background py-2 pr-3 pl-9",
17678
+ "text-sm placeholder:text-muted-foreground",
17679
+ "outline-none focus-visible:ring-[3px] focus-visible:ring-ring"
17680
+ )
17681
+ }
17682
+ )
17683
+ ] })
17684
+ ] }),
17685
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [
17686
+ filtered.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-10 text-center text-muted-foreground text-sm", children: emptyMessage }),
17687
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { "data-slot": "artifact-library-list", className: "space-y-2", children: filtered.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
17688
+ "button",
17689
+ {
17690
+ type: "button",
17691
+ "data-slot": "artifact-library-item",
17692
+ "aria-current": selectedId === item.id ? "true" : void 0,
17693
+ onClick: () => onSelect(item.id),
17694
+ className: cn122(
17695
+ "flex w-full items-start justify-between gap-3 rounded-md border border-border px-3 py-2 text-left",
17696
+ "outline-none transition-colors hover:bg-muted",
17697
+ "focus-visible:ring-[3px] focus-visible:ring-ring",
17698
+ selectedId === item.id && "border-primary bg-primary/5"
17699
+ ),
17700
+ children: [
17701
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
17702
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-medium text-sm", children: item.title }),
17703
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-muted-foreground text-xs", children: item.updatedAtLabel })
17704
+ ] }),
17705
+ /* @__PURE__ */ jsxRuntime.jsx(
17706
+ "span",
17707
+ {
17708
+ "data-slot": "artifact-library-item-type",
17709
+ className: "shrink-0 rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17710
+ children: typeLabel(item.type)
17711
+ }
17712
+ )
17713
+ ]
17714
+ }
17715
+ ) }, item.id)) })
17716
+ ] }),
17717
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "artifact-library-canvas", className: "border-border border-t p-4", children: /* @__PURE__ */ jsxRuntime.jsx(
17718
+ MosaicArtifactCanvasAdapter,
17719
+ {
17720
+ source,
17721
+ isOpen: isCanvasOpen,
17722
+ onToggle: onToggleCanvas,
17723
+ onClose: onCloseCanvas,
17724
+ labels: adapterLabels
17725
+ }
17726
+ ) })
17727
+ ] });
17728
+ }
17729
+ MosaicArtifactLibrary.displayName = "MosaicArtifactLibrary";
17730
+ var artifactSaveAsMemoryFormRootVariants = classVarianceAuthority.cva(["flex flex-col gap-4"]);
17731
+ var artifactSaveAsMemoryFormPreviewVariants = classVarianceAuthority.cva([
17732
+ "flex items-start gap-3 rounded-md border border-border p-3"
17733
+ ]);
17734
+ var artifactSaveAsMemoryFormFieldVariants = classVarianceAuthority.cva(["flex flex-col gap-1.5"]);
17735
+ var artifactSaveAsMemoryFormErrorVariants = classVarianceAuthority.cva(["text-xs font-medium text-destructive"]);
17736
+ var artifactSaveAsMemoryFormLearningVariants = classVarianceAuthority.cva([
17737
+ "flex items-start gap-2 rounded-md border border-border p-2"
17738
+ ]);
17739
+ var artifactSaveAsMemoryFormFooterVariants = classVarianceAuthority.cva([
17740
+ "flex items-center justify-end gap-3 border-t border-border pt-4"
17741
+ ]);
17742
+ var artifactSaveAsMemoryFormButtonVariants = classVarianceAuthority.cva(
17743
+ [
17744
+ "inline-flex min-h-9 items-center justify-center gap-2 rounded-md px-4 text-sm font-medium",
17745
+ "transition-colors disabled:cursor-not-allowed disabled:opacity-50"
17746
+ ],
17747
+ {
17748
+ variants: {
17749
+ intent: {
17750
+ cancel: "border border-border bg-background hover:bg-muted",
17751
+ save: "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90",
17752
+ ghost: "border border-transparent bg-transparent hover:bg-muted"
17753
+ }
17754
+ },
17755
+ defaultVariants: {
17756
+ intent: "cancel"
17757
+ }
17758
+ }
17759
+ );
17760
+ function cn123(...classes) {
17761
+ return classes.filter(Boolean).join(" ");
17762
+ }
17763
+ function MosaicArtifactSaveAsMemoryForm({
17764
+ artifact,
17765
+ typeLabel,
17766
+ title,
17767
+ onTitleChange,
17768
+ titleLabel,
17769
+ titlePlaceholder,
17770
+ titleError,
17771
+ learnings,
17772
+ onEditLearning,
17773
+ onRemoveLearning,
17774
+ learningsLabel,
17775
+ learningsDescription,
17776
+ editLearningAriaLabel,
17777
+ removeLearningAriaLabel,
17778
+ scope,
17779
+ onScopeChange,
17780
+ scopeLabel,
17781
+ scopeOptions,
17782
+ tags,
17783
+ onAddTag,
17784
+ onRemoveTag,
17785
+ tagsLabel,
17786
+ tagInputPlaceholder,
17787
+ removeTagAriaLabel,
17788
+ suggestedTags,
17789
+ maxTags,
17790
+ isSaving,
17791
+ canSave,
17792
+ onSave,
17793
+ onCancel,
17794
+ saveLabel,
17795
+ savingLabel,
17796
+ cancelLabel,
17797
+ className
17798
+ }) {
17799
+ const titleErrorId = React30.useId();
17800
+ const scopeId = React30.useId();
17801
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17802
+ "div",
17803
+ {
17804
+ "data-slot": "artifact-save-as-memory-form",
17805
+ className: cn123(artifactSaveAsMemoryFormRootVariants(), className),
17806
+ children: [
17807
+ /* @__PURE__ */ jsxRuntime.jsx(
17808
+ "div",
17809
+ {
17810
+ "data-slot": "artifact-save-as-memory-form-preview",
17811
+ className: artifactSaveAsMemoryFormPreviewVariants(),
17812
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
17813
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-medium text-sm", children: artifact.title }),
17814
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 line-clamp-2 text-muted-foreground text-xs", children: artifact.preview || artifact.content }),
17815
+ /* @__PURE__ */ jsxRuntime.jsx(
17816
+ "span",
17817
+ {
17818
+ "data-slot": "artifact-save-as-memory-form-type",
17819
+ className: "mt-2 inline-block shrink-0 rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17820
+ children: typeLabel(artifact.type)
17821
+ }
17822
+ )
17823
+ ] })
17824
+ }
17825
+ ),
17826
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17827
+ /* @__PURE__ */ jsxRuntime.jsx(
17828
+ "label",
17829
+ {
17830
+ htmlFor: "mosaic-artifact-save-as-memory-title",
17831
+ className: "text-sm font-medium text-foreground",
17832
+ children: titleLabel
17833
+ }
17834
+ ),
17835
+ /* @__PURE__ */ jsxRuntime.jsx(
17836
+ MosaicInput,
17837
+ {
17838
+ id: "mosaic-artifact-save-as-memory-title",
17839
+ value: title,
17840
+ placeholder: titlePlaceholder,
17841
+ onChange: (e) => onTitleChange(e.target.value),
17842
+ "aria-invalid": titleError ? "true" : "false",
17843
+ "aria-describedby": titleError ? titleErrorId : void 0
17844
+ }
17845
+ ),
17846
+ titleError && /* @__PURE__ */ jsxRuntime.jsx("p", { id: titleErrorId, className: artifactSaveAsMemoryFormErrorVariants(), children: titleError })
17847
+ ] }),
17848
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17849
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: learningsLabel }),
17850
+ learningsDescription && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: learningsDescription }),
17851
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: learnings.map((learning, index) => /* @__PURE__ */ jsxRuntime.jsxs(
17852
+ "div",
17853
+ {
17854
+ "data-slot": "artifact-save-as-memory-form-learning",
17855
+ className: artifactSaveAsMemoryFormLearningVariants(),
17856
+ children: [
17857
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 text-sm", children: learning }),
17858
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 gap-1", children: [
17859
+ /* @__PURE__ */ jsxRuntime.jsx(
17860
+ "button",
17861
+ {
17862
+ type: "button",
17863
+ "data-slot": "artifact-save-as-memory-form-learning-edit",
17864
+ onClick: () => onEditLearning(index),
17865
+ "aria-label": editLearningAriaLabel(index),
17866
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "ghost" }),
17867
+ children: editLearningAriaLabel(index)
17868
+ }
17869
+ ),
17870
+ /* @__PURE__ */ jsxRuntime.jsx(
17871
+ "button",
17872
+ {
17873
+ type: "button",
17874
+ "data-slot": "artifact-save-as-memory-form-learning-remove",
17875
+ onClick: () => onRemoveLearning(index),
17876
+ "aria-label": removeLearningAriaLabel(index),
17877
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "ghost" }),
17878
+ children: removeLearningAriaLabel(index)
17879
+ }
17880
+ )
17881
+ ] })
17882
+ ]
17883
+ },
17884
+ `${index}-${learning}`
17885
+ )) })
17886
+ ] }),
17887
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17888
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: scopeId, className: "text-sm font-medium text-foreground", children: scopeLabel }),
17889
+ /* @__PURE__ */ jsxRuntime.jsx(
17890
+ "select",
17891
+ {
17892
+ id: scopeId,
17893
+ "data-slot": "artifact-save-as-memory-form-scope",
17894
+ value: scope,
17895
+ onChange: (e) => onScopeChange(e.target.value),
17896
+ className: cn123(
17897
+ "h-9 rounded-md border border-input bg-background px-3 text-sm",
17898
+ "outline-none focus-visible:ring-[3px] focus-visible:ring-ring"
17899
+ ),
17900
+ children: scopeOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
17901
+ }
17902
+ )
17903
+ ] }),
17904
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17905
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: tagsLabel }),
17906
+ /* @__PURE__ */ jsxRuntime.jsx(
17907
+ MosaicTagInput,
17908
+ {
17909
+ tags,
17910
+ onAddTag,
17911
+ onRemoveTag,
17912
+ placeholder: tagInputPlaceholder,
17913
+ removeTagAriaLabel,
17914
+ suggestions: suggestedTags,
17915
+ maxTags
17916
+ }
17917
+ )
17918
+ ] }),
17919
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: artifactSaveAsMemoryFormFooterVariants(), children: [
17920
+ /* @__PURE__ */ jsxRuntime.jsx(
17921
+ "button",
17922
+ {
17923
+ type: "button",
17924
+ "data-slot": "artifact-save-as-memory-form-cancel-button",
17925
+ onClick: onCancel,
17926
+ disabled: isSaving,
17927
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "cancel" }),
17928
+ children: cancelLabel
17929
+ }
17930
+ ),
17931
+ /* @__PURE__ */ jsxRuntime.jsx(
17932
+ "button",
17933
+ {
17934
+ type: "button",
17935
+ "data-slot": "artifact-save-as-memory-form-save-button",
17936
+ onClick: onSave,
17937
+ disabled: !canSave || isSaving,
17938
+ "aria-busy": isSaving ? "true" : "false",
17939
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "save" }),
17940
+ children: isSaving ? savingLabel : saveLabel
17941
+ }
17942
+ )
17943
+ ] })
17944
+ ]
17945
+ }
17946
+ );
17947
+ }
17948
+ MosaicArtifactSaveAsMemoryForm.displayName = "MosaicArtifactSaveAsMemoryForm";
17949
+ function cn124(...classes) {
17950
+ return classes.filter(Boolean).join(" ");
17951
+ }
17952
+ function MosaicArtifactVersionHistory(props) {
17953
+ const {
17954
+ versions,
17955
+ selectedId,
17956
+ onSelectVersion,
17957
+ title,
17958
+ emptyMessage,
17959
+ currentLabel,
17960
+ selectAriaLabel,
17961
+ className
17962
+ } = props;
17963
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "artifact-version-history", className: cn124("flex h-full flex-col", className), children: [
17964
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border border-b px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-lg", children: title }) }),
17965
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [
17966
+ versions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-10 text-center text-muted-foreground text-sm", children: emptyMessage }),
17967
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { "data-slot": "artifact-version-history-list", className: "space-y-2", children: versions.map((version2) => /* @__PURE__ */ jsxRuntime.jsx("li", { "data-slot": "artifact-version-history-item", children: /* @__PURE__ */ jsxRuntime.jsxs(
17968
+ "div",
17969
+ {
17970
+ className: cn124(
17971
+ "flex items-start justify-between gap-3 rounded-md border border-border px-3 py-2",
17972
+ selectedId === version2.id && "border-primary bg-primary/5"
17973
+ ),
17974
+ children: [
17975
+ /* @__PURE__ */ jsxRuntime.jsxs(
17976
+ "button",
17977
+ {
17978
+ type: "button",
17979
+ "aria-current": selectedId === version2.id ? "true" : void 0,
17980
+ onClick: () => onSelectVersion(version2.id),
17981
+ className: cn124(
17982
+ "min-w-0 flex-1 text-left",
17983
+ "outline-none transition-colors",
17984
+ "focus-visible:ring-[3px] focus-visible:ring-ring"
17985
+ ),
17986
+ "aria-label": selectAriaLabel(version2),
17987
+ children: [
17988
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex flex-wrap items-center gap-2", children: [
17989
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-xs", children: version2.versionLabel }),
17990
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs", children: version2.changeTypeLabel }),
17991
+ version2.isCurrent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-primary px-2 py-0.5 text-primary-foreground text-xs", children: currentLabel })
17992
+ ] }),
17993
+ version2.descriptionLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 truncate font-medium text-sm", children: version2.descriptionLabel }),
17994
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3 text-muted-foreground text-xs", children: [
17995
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: version2.authorLabel }),
17996
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: version2.timestampLabel })
17997
+ ] })
17998
+ ]
17999
+ }
18000
+ ),
18001
+ props.onRestoreVersion && !version2.isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
18002
+ "button",
18003
+ {
18004
+ type: "button",
18005
+ onClick: () => props.onRestoreVersion?.(version2.id),
18006
+ className: cn124(
18007
+ "shrink-0 rounded-md border border-input px-2 py-1 text-xs",
18008
+ "outline-none transition-colors hover:bg-muted",
18009
+ "focus-visible:ring-[3px] focus-visible:ring-ring"
18010
+ ),
18011
+ "aria-label": props.restoreAriaLabel(version2),
18012
+ children: props.restoreLabel
18013
+ }
18014
+ )
18015
+ ]
18016
+ }
18017
+ ) }, version2.id)) })
18018
+ ] })
18019
+ ] });
18020
+ }
18021
+ MosaicArtifactVersionHistory.displayName = "MosaicArtifactVersionHistory";
18022
+ function cn125(...classes) {
18023
+ return classes.filter(Boolean).join(" ");
18024
+ }
18025
+ function ChevronDownIcon6() {
18026
+ return /* @__PURE__ */ jsxRuntime.jsx(
18027
+ "svg",
18028
+ {
18029
+ xmlns: "http://www.w3.org/2000/svg",
18030
+ width: "16",
18031
+ height: "16",
18032
+ viewBox: "0 0 24 24",
18033
+ fill: "none",
18034
+ stroke: "currentColor",
18035
+ strokeWidth: "2",
18036
+ strokeLinecap: "round",
18037
+ strokeLinejoin: "round",
18038
+ "aria-hidden": "true",
18039
+ className: "h-4 w-4 shrink-0 text-muted-foreground",
18040
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" })
18041
+ }
18042
+ );
18043
+ }
18044
+ function OrgAvatar({ org }) {
18045
+ if (org.avatarUrl) {
18046
+ return /* @__PURE__ */ jsxRuntime.jsx(
18047
+ "img",
18048
+ {
18049
+ src: org.avatarUrl,
18050
+ alt: "",
18051
+ className: "h-8 w-8 shrink-0 rounded-full object-cover md:h-10 md:w-10"
18052
+ }
18053
+ );
18054
+ }
18055
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 md:h-10 md:w-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-primary text-sm font-medium", children: org.name.charAt(0).toUpperCase() }) });
18056
+ }
18057
+ function MosaicOrgContextDisplay(props) {
18058
+ const { org, roleLabel, roleDescription, memberCountLabel, className } = props;
18059
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18060
+ /* @__PURE__ */ jsxRuntime.jsx(OrgAvatar, { org }),
18061
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 text-left", children: [
18062
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
18063
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium text-sm md:text-base", children: org.name }),
18064
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden md:inline-flex", children: /* @__PURE__ */ jsxRuntime.jsx(MosaicOrgRoleBadge, { role: org.role, label: roleLabel, description: roleDescription }) })
18065
+ ] }),
18066
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden text-muted-foreground text-xs md:block", children: memberCountLabel(org.memberCount) })
18067
+ ] })
18068
+ ] });
18069
+ if (!props.onSwitchOrg) {
18070
+ return /* @__PURE__ */ jsxRuntime.jsx(
18071
+ "div",
18072
+ {
18073
+ "data-slot": "org-context-display",
18074
+ className: cn125("flex w-full items-center gap-3 min-h-[44px] p-2 md:p-3", className),
18075
+ children: content
18076
+ }
18077
+ );
18078
+ }
18079
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18080
+ "button",
18081
+ {
18082
+ type: "button",
18083
+ "data-slot": "org-context-display",
18084
+ onClick: props.onSwitchOrg,
18085
+ "aria-label": props.switchAriaLabel,
18086
+ className: cn125(
18087
+ "flex w-full items-center gap-3 justify-start rounded-md border border-border",
18088
+ "outline-none transition-colors hover:bg-accent min-h-[44px] p-2 md:p-3",
18089
+ "focus-visible:ring-[3px] focus-visible:ring-ring",
18090
+ className
18091
+ ),
18092
+ children: [
18093
+ content,
18094
+ /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon6, {})
18095
+ ]
18096
+ }
18097
+ );
18098
+ }
18099
+ MosaicOrgContextDisplay.displayName = "MosaicOrgContextDisplay";
18100
+ function cn126(...classes) {
18101
+ return classes.filter(Boolean).join(" ");
18102
+ }
18103
+ function ShieldIcon() {
18104
+ return /* @__PURE__ */ jsxRuntime.jsx(
18105
+ "svg",
18106
+ {
18107
+ xmlns: "http://www.w3.org/2000/svg",
18108
+ width: "16",
18109
+ height: "16",
18110
+ viewBox: "0 0 24 24",
18111
+ fill: "none",
18112
+ stroke: "currentColor",
18113
+ strokeWidth: "2",
18114
+ strokeLinecap: "round",
18115
+ strokeLinejoin: "round",
18116
+ "aria-hidden": "true",
18117
+ className: "size-3 shrink-0 md:size-4",
18118
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 13c0 5-3.5 7.5-7.35 8.95a1 1 0 0 1-1.3 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.79 17 5 19 5a1 1 0 0 1 1 1z" })
18119
+ }
18120
+ );
18121
+ }
18122
+ function AlertTriangleIcon() {
18123
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18124
+ "svg",
18125
+ {
18126
+ xmlns: "http://www.w3.org/2000/svg",
18127
+ width: "16",
18128
+ height: "16",
18129
+ viewBox: "0 0 24 24",
18130
+ fill: "none",
18131
+ stroke: "currentColor",
18132
+ strokeWidth: "2",
18133
+ strokeLinecap: "round",
18134
+ strokeLinejoin: "round",
18135
+ "aria-hidden": "true",
18136
+ className: "size-8 shrink-0 text-destructive md:size-10",
18137
+ children: [
18138
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
18139
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9v4" }),
18140
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 17h.01" })
18141
+ ]
18142
+ }
18143
+ );
18144
+ }
18145
+ function ArrowLeftIcon2() {
18146
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18147
+ "svg",
18148
+ {
18149
+ xmlns: "http://www.w3.org/2000/svg",
18150
+ width: "16",
18151
+ height: "16",
18152
+ viewBox: "0 0 24 24",
18153
+ fill: "none",
18154
+ stroke: "currentColor",
18155
+ strokeWidth: "2",
18156
+ strokeLinecap: "round",
18157
+ strokeLinejoin: "round",
18158
+ "aria-hidden": "true",
18159
+ className: "size-4 shrink-0",
18160
+ children: [
18161
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m12 19-7-7 7-7" }),
18162
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 12H5" })
18163
+ ]
18164
+ }
18165
+ );
18166
+ }
18167
+ function DefaultLoadingFallback() {
18168
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center p-4 md:p-8", children: /* @__PURE__ */ jsxRuntime.jsx(
18169
+ "div",
18170
+ {
18171
+ "data-slot": "admin-only-guard-loading",
18172
+ "aria-hidden": "true",
18173
+ className: "size-8 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-primary md:size-10"
18174
+ }
18175
+ ) });
18176
+ }
18177
+ function MosaicAdminOnlyGuard(props) {
18178
+ const {
18179
+ children,
18180
+ isAdmin,
18181
+ isLoaded,
18182
+ title,
18183
+ description,
18184
+ requiredRoleLabel,
18185
+ loadingFallback,
18186
+ className
18187
+ } = props;
18188
+ if (!isLoaded) {
18189
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultLoadingFallback, {}) });
18190
+ }
18191
+ if (!isAdmin) {
18192
+ return /* @__PURE__ */ jsxRuntime.jsx(
18193
+ "div",
18194
+ {
18195
+ "data-slot": "admin-only-guard",
18196
+ className: cn126(
18197
+ "flex min-h-screen flex-col items-center justify-center p-4 md:p-8",
18198
+ className
18199
+ ),
18200
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-md flex-col items-center gap-4 rounded-lg border bg-card p-6 md:gap-6 md:p-8", children: [
18201
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-16 items-center justify-center rounded-full bg-destructive/10 md:size-20", children: /* @__PURE__ */ jsxRuntime.jsx(AlertTriangleIcon, {}) }),
18202
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-center font-semibold text-lg md:text-xl", children: title }),
18203
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-muted-foreground text-sm md:text-base", children: description }),
18204
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-primary text-xs md:text-sm", children: [
18205
+ /* @__PURE__ */ jsxRuntime.jsx(ShieldIcon, {}),
18206
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: requiredRoleLabel })
18207
+ ] }),
18208
+ props.onExit ? /* @__PURE__ */ jsxRuntime.jsxs(
18209
+ MosaicButton,
18210
+ {
18211
+ onClick: props.onExit,
18212
+ "aria-label": props.exitAriaLabel,
18213
+ className: "mt-2 min-h-[44px] w-full",
18214
+ children: [
18215
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon2, {}),
18216
+ props.exitLabel
18217
+ ]
18218
+ }
18219
+ ) : null
18220
+ ] })
18221
+ }
18222
+ );
18223
+ }
18224
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
18225
+ }
18226
+ MosaicAdminOnlyGuard.displayName = "MosaicAdminOnlyGuard";
18227
+
18228
+ // src/components/document-review/panel-tab.ts
18229
+ var REVIEW_PANEL_TABS = ["compare", "document", "row"];
18230
+ var INITIAL_REVIEW_PANEL_TAB = "compare";
18231
+
18232
+ // src/components/document-review/row-navigation.ts
18233
+ function isEditableTarget(target) {
18234
+ return target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target instanceof HTMLElement && target.isContentEditable === true;
18235
+ }
18236
+ function neighbourRowId(orderedRowIds, currentRowId, direction) {
18237
+ const index = orderedRowIds.indexOf(currentRowId);
18238
+ if (index === -1) return null;
18239
+ const neighbourIndex = index + (direction === "next" ? 1 : -1);
18240
+ if (neighbourIndex < 0 || neighbourIndex >= orderedRowIds.length) return null;
18241
+ return orderedRowIds[neighbourIndex] ?? null;
18242
+ }
18243
+
18244
+ // src/components/document-review/column-model.ts
18245
+ var COLUMN_MODEL_ERRORS = {
18246
+ // allow-hardcoded-word: developer-facing invariant error, never rendered to an end user
18247
+ unknownColumn: (id) => `document-review: visibility names unknown column "${id}"`
18248
+ };
18249
+ function assertKnown(columns, ids) {
18250
+ const known = new Set(columns.map((c) => c.id));
18251
+ for (const id of ids) {
18252
+ if (!known.has(id)) {
18253
+ throw new Error(COLUMN_MODEL_ERRORS.unknownColumn(id));
18254
+ }
18255
+ }
18256
+ }
18257
+ function initialColumnVisibility(columns) {
18258
+ return Object.fromEntries(columns.map((c) => [c.id, c.defaultVisible]));
18259
+ }
18260
+ function toggleColumnVisibility(columns, visibility, id) {
18261
+ assertKnown(columns, [id]);
18262
+ const column = columns.find((c) => c.id === id);
18263
+ const current = visibility[id] ?? column.defaultVisible;
18264
+ return { ...visibility, [id]: !current };
18265
+ }
18266
+ function visibleColumns(columns, visibility) {
18267
+ assertKnown(columns, Object.keys(visibility));
18268
+ return columns.filter((c) => visibility[c.id] ?? c.defaultVisible);
18269
+ }
18270
+
18271
+ // src/components/document-review/field-correction.ts
18272
+ async function applyFieldCorrection(args) {
18273
+ const { row, field, input, by, provenance, write, validate, now } = args;
18274
+ const checked = validate ? validate(field, input, row) : { ok: true, value: input };
18275
+ if (!checked.ok) return { ok: false, row, message: checked.message };
18276
+ let response;
18277
+ try {
18278
+ response = await write({ rowId: row.id, field, input, by, provenance });
18279
+ } catch (e) {
18280
+ return { ok: false, row, message: e instanceof Error ? e.message : String(e) };
18281
+ }
18282
+ if (!response.ok) return { ok: false, row, message: response.message };
18283
+ const confirmed = "value" in response;
18284
+ const corrected = confirmed ? response.value ?? null : checked.value;
18285
+ const original = row.corrections?.[field]?.original ?? row.values[field] ?? null;
18286
+ const record = {
18287
+ original,
18288
+ corrected,
18289
+ by,
18290
+ at: now ? now() : (/* @__PURE__ */ new Date()).toISOString(),
18291
+ provenance
18292
+ };
18293
+ return {
18294
+ ok: true,
18295
+ confirmed,
18296
+ row: {
18297
+ ...row,
18298
+ values: { ...row.values, [field]: corrected },
18299
+ corrections: { ...row.corrections, [field]: record }
18300
+ }
18301
+ };
18302
+ }
18303
+ function correctionOutcome(result) {
18304
+ if (!result.ok) return "failed";
18305
+ return result.confirmed ? "ok" : "uncertain";
18306
+ }
18307
+ function MosaicDocumentTable({
18308
+ columns,
18309
+ rows,
18310
+ getRowId,
18311
+ columnVisibility,
18312
+ selectedRowId: controlledSelectedRowId,
18313
+ onSelectedRowChange,
18314
+ renderPanel,
18315
+ emptyMessage,
18316
+ className
18317
+ }) {
18318
+ const [internalSelectedRowId, setInternalSelectedRowId] = React30.useState(null);
18319
+ const isControlled = controlledSelectedRowId !== void 0;
18320
+ const selectedRowId = isControlled ? controlledSelectedRowId : internalSelectedRowId;
18321
+ function select(rowId) {
18322
+ if (!isControlled) setInternalSelectedRowId(rowId);
18323
+ onSelectedRowChange?.(rowId);
18324
+ }
18325
+ const shown = visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns));
18326
+ const tableColumns = shown.map((column, columnIndex) => ({
18327
+ key: column.id,
18328
+ header: column.label,
18329
+ render: (row) => {
18330
+ const value = column.accessor(row);
18331
+ const text = value === null ? "" : String(value);
18332
+ if (columnIndex !== 0) return text;
18333
+ const isSelected = getRowId(row) === selectedRowId;
18334
+ return /* @__PURE__ */ jsxRuntime.jsx(
18335
+ "button",
18336
+ {
18337
+ type: "button",
18338
+ "data-slot": "document-table-open",
18339
+ "aria-current": isSelected ? "true" : void 0,
18340
+ "data-selected": isSelected ? "true" : void 0,
18341
+ className: "text-left underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18342
+ children: text
18343
+ }
18344
+ );
18345
+ }
18346
+ }));
18347
+ function handleClick(event) {
18348
+ const tr = event.target.closest("tr[data-slot='data-table-row']");
18349
+ if (!(tr instanceof HTMLTableRowElement)) return;
18350
+ const row = rows[tr.sectionRowIndex];
18351
+ if (row !== void 0) select(getRowId(row));
18352
+ }
18353
+ const orderedRowIds = rows.map(getRowId);
18354
+ const selectedRow = selectedRowId === null ? void 0 : rows.find((row) => getRowId(row) === selectedRowId);
18355
+ return (
18356
+ // biome-ignore lint/a11y/useKeyWithClickEvents: keyboard path is the first column's real <button>; this only resolves mouse clicks on other cells to their row
18357
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "document-table", className, onClick: handleClick, children: [
18358
+ /* @__PURE__ */ jsxRuntime.jsx(
18359
+ MosaicDataTable,
18360
+ {
18361
+ columns: tableColumns,
18362
+ rows,
18363
+ getRowKey: (row) => getRowId(row),
18364
+ sortable: false,
18365
+ emptyMessage
18366
+ }
18367
+ ),
18368
+ selectedRow !== void 0 && renderPanel ? renderPanel(selectedRow, {
18369
+ rowId: getRowId(selectedRow),
18370
+ orderedRowIds,
18371
+ selectRow: (rowId) => select(rowId),
18372
+ closeRow: () => select(null)
18373
+ }) : null
18374
+ ] })
18375
+ );
18376
+ }
18377
+ MosaicDocumentTable.displayName = "MosaicDocumentTable";
18378
+ function MosaicDocumentCriteriaPanel({
18379
+ row,
18380
+ rowId,
18381
+ columns,
18382
+ columnVisibility,
18383
+ documentUrl,
18384
+ orderedRowIds,
18385
+ onNavigate,
18386
+ onCorrect,
18387
+ actor,
18388
+ correctionProvenance,
18389
+ provenanceLabel,
18390
+ labels,
18391
+ defaultTab = INITIAL_REVIEW_PANEL_TAB,
18392
+ className
18393
+ }) {
18394
+ const [tab, setTab] = React30.useState(defaultTab);
18395
+ const [sideWidth, setSideWidth] = React30.useState(45);
18396
+ const [isSideCollapsed, setIsSideCollapsed] = React30.useState(false);
18397
+ const previousId = neighbourRowId(orderedRowIds, rowId, "prev");
18398
+ const nextId = neighbourRowId(orderedRowIds, rowId, "next");
18399
+ const tabLabel = {
18400
+ compare: labels.tabCompare,
18401
+ document: labels.tabDocument,
18402
+ row: labels.tabRow
18403
+ };
18404
+ const document_ = /* @__PURE__ */ jsxRuntime.jsx(
18405
+ MosaicPdfViewer,
18406
+ {
18407
+ fileUrl: documentUrl,
18408
+ loadingLabel: labels.documentLoading,
18409
+ errorLabel: labels.documentError
18410
+ }
18411
+ );
18412
+ const fields = /* @__PURE__ */ jsxRuntime.jsx("dl", { "data-slot": "document-criteria-fields", className: "flex flex-col gap-3 p-3", children: visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns)).map(
18413
+ (column) => {
18414
+ const value = column.accessor(row);
18415
+ const provenance = provenanceLabel(row, column);
18416
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18417
+ "div",
18418
+ {
18419
+ "data-slot": "document-criteria-field",
18420
+ className: "flex flex-col gap-1",
18421
+ children: [
18422
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-xs font-medium text-muted-foreground", children: column.label }),
18423
+ /* @__PURE__ */ jsxRuntime.jsxs("dd", { className: "m-0 flex flex-col gap-1", children: [
18424
+ /* @__PURE__ */ jsxRuntime.jsx(
18425
+ MosaicEditableCell,
18426
+ {
18427
+ value: value === null ? "" : String(value),
18428
+ disabled: column.editable === false,
18429
+ editAriaLabel: labels.editField(column.label),
18430
+ onCommit: (input) => {
18431
+ onCorrect({
18432
+ rowId,
18433
+ field: column.id,
18434
+ input,
18435
+ by: actor,
18436
+ provenance: correctionProvenance
18437
+ });
18438
+ }
18439
+ }
18440
+ ),
18441
+ provenance ? /* @__PURE__ */ jsxRuntime.jsx(
18442
+ "span",
18443
+ {
18444
+ "data-slot": "document-criteria-provenance",
18445
+ className: "text-xs text-muted-foreground",
18446
+ children: provenance
18447
+ }
18448
+ ) : null
18449
+ ] })
18450
+ ]
18451
+ },
18452
+ column.id
18453
+ );
18454
+ }
18455
+ ) });
18456
+ return /* @__PURE__ */ jsxRuntime.jsx(
18457
+ "section",
18458
+ {
18459
+ "data-slot": "document-criteria-panel",
18460
+ "data-row-id": rowId,
18461
+ className: ["flex flex-col gap-2 rounded-md border border-border p-2", className].filter(Boolean).join(" "),
18462
+ children: /* @__PURE__ */ jsxRuntime.jsxs(MosaicTabs, { value: tab, onValueChange: (next) => setTab(next), children: [
18463
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
18464
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicTabsList, { children: REVIEW_PANEL_TABS.map((value) => /* @__PURE__ */ jsxRuntime.jsx(MosaicTabsTrigger, { value, children: tabLabel[value] }, value)) }),
18465
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
18466
+ /* @__PURE__ */ jsxRuntime.jsx(
18467
+ "button",
18468
+ {
18469
+ type: "button",
18470
+ disabled: previousId === null,
18471
+ onClick: () => previousId !== null && onNavigate(previousId),
18472
+ className: "rounded-md border border-border px-3 py-1 text-sm disabled:opacity-50",
18473
+ children: labels.previous
18474
+ }
18475
+ ),
18476
+ /* @__PURE__ */ jsxRuntime.jsx(
18477
+ "button",
18478
+ {
18479
+ type: "button",
18480
+ disabled: nextId === null,
18481
+ onClick: () => nextId !== null && onNavigate(nextId),
18482
+ className: "rounded-md border border-border px-3 py-1 text-sm disabled:opacity-50",
18483
+ children: labels.next
18484
+ }
18485
+ )
18486
+ ] })
18487
+ ] }),
18488
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicTabsPanel, { value: "compare", children: /* @__PURE__ */ jsxRuntime.jsx(
18489
+ MosaicResizableSplitPane,
18490
+ {
18491
+ main: document_,
18492
+ side: fields,
18493
+ sideWidth,
18494
+ onSideWidthChange: setSideWidth,
18495
+ isSideCollapsed,
18496
+ onToggleSideCollapsed: () => setIsSideCollapsed((c) => !c),
18497
+ collapseButtonAriaLabel: labels.collapse,
18498
+ resizeHandleAriaLabel: labels.resize
18499
+ }
18500
+ ) }),
18501
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicTabsPanel, { value: "document", children: document_ }),
18502
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicTabsPanel, { value: "row", children: fields })
18503
+ ] })
18504
+ }
18505
+ );
18506
+ }
18507
+ MosaicDocumentCriteriaPanel.displayName = "MosaicDocumentCriteriaPanel";
18508
+
17124
18509
  Object.defineProperty(exports, "Accordion", {
17125
18510
  enumerable: true,
17126
18511
  get: function () { return accordion.Accordion; }
@@ -17129,6 +18514,7 @@ Object.defineProperty(exports, "Tooltip", {
17129
18514
  enumerable: true,
17130
18515
  get: function () { return tooltip.Tooltip; }
17131
18516
  });
18517
+ exports.INITIAL_REVIEW_PANEL_TAB = INITIAL_REVIEW_PANEL_TAB;
17132
18518
  exports.MosaicAccordion = MosaicAccordion;
17133
18519
  exports.MosaicAccordionItem = MosaicAccordionItem;
17134
18520
  exports.MosaicAccordionPanel = MosaicAccordionPanel;
@@ -17139,6 +18525,7 @@ exports.MosaicAdaptiveGrid = MosaicAdaptiveGrid;
17139
18525
  exports.MosaicAdaptiveModal = MosaicAdaptiveModal;
17140
18526
  exports.MosaicAdaptiveNavigation = MosaicAdaptiveNavigation;
17141
18527
  exports.MosaicAddMemoryForm = MosaicAddMemoryForm;
18528
+ exports.MosaicAdminOnlyGuard = MosaicAdminOnlyGuard;
17142
18529
  exports.MosaicAgentBuilderModal = MosaicAgentBuilderModal;
17143
18530
  exports.MosaicAgentCard = MosaicAgentCard;
17144
18531
  exports.MosaicAgentChat = MosaicAgentChat;
@@ -17166,6 +18553,14 @@ exports.MosaicAnimatedList = MosaicAnimatedList;
17166
18553
  exports.MosaicApiKeyPanel = MosaicApiKeyPanel;
17167
18554
  exports.MosaicAppSidebar = MosaicAppSidebar;
17168
18555
  exports.MosaicApprovalPrompt = MosaicApprovalPrompt;
18556
+ exports.MosaicArtifactCanvasAdapter = MosaicArtifactCanvasAdapter;
18557
+ exports.MosaicArtifactChart = MosaicArtifactChart;
18558
+ exports.MosaicArtifactChecklist = MosaicArtifactChecklist;
18559
+ exports.MosaicArtifactDataTable = MosaicArtifactDataTable;
18560
+ exports.MosaicArtifactDocument = MosaicArtifactDocument;
18561
+ exports.MosaicArtifactLibrary = MosaicArtifactLibrary;
18562
+ exports.MosaicArtifactSaveAsMemoryForm = MosaicArtifactSaveAsMemoryForm;
18563
+ exports.MosaicArtifactVersionHistory = MosaicArtifactVersionHistory;
17169
18564
  exports.MosaicAvatar = MosaicAvatar;
17170
18565
  exports.MosaicBadge = MosaicBadge;
17171
18566
  exports.MosaicBlurredOrb = MosaicBlurredOrb;
@@ -17196,6 +18591,8 @@ exports.MosaicDashboardLayout = MosaicDashboardLayout;
17196
18591
  exports.MosaicDataTable = MosaicDataTable;
17197
18592
  exports.MosaicDeleteConfirmationDialog = MosaicDeleteConfirmationDialog;
17198
18593
  exports.MosaicDeviceProvider = MosaicDeviceProvider;
18594
+ exports.MosaicDocumentCriteriaPanel = MosaicDocumentCriteriaPanel;
18595
+ exports.MosaicDocumentTable = MosaicDocumentTable;
17199
18596
  exports.MosaicDocumentUpload = MosaicDocumentUpload;
17200
18597
  exports.MosaicDrawer = MosaicDrawer;
17201
18598
  exports.MosaicDropdownMenu = MosaicDropdownMenu;
@@ -17248,6 +18645,7 @@ exports.MosaicModuleLibrary = MosaicModuleLibrary;
17248
18645
  exports.MosaicMultiOrgIndicator = MosaicMultiOrgIndicator;
17249
18646
  exports.MosaicMultiTenantProvider = MosaicMultiTenantProvider;
17250
18647
  exports.MosaicNavbar = MosaicNavbar;
18648
+ exports.MosaicOrgContextDisplay = MosaicOrgContextDisplay;
17251
18649
  exports.MosaicOrgPanel = MosaicOrgPanel;
17252
18650
  exports.MosaicOrgProfilePage = MosaicOrgProfilePage;
17253
18651
  exports.MosaicOrgRoleBadge = MosaicOrgRoleBadge;
@@ -17310,6 +18708,7 @@ exports.MosaicTooltipTrigger = MosaicTooltipTrigger;
17310
18708
  exports.MosaicUrlScraper = MosaicUrlScraper;
17311
18709
  exports.MosaicUserButton = MosaicUserButton;
17312
18710
  exports.Placeholder = Placeholder;
18711
+ exports.REVIEW_PANEL_TABS = REVIEW_PANEL_TABS;
17313
18712
  exports.addMemoryFormButtonVariants = addMemoryFormButtonVariants;
17314
18713
  exports.addMemoryFormErrorVariants = addMemoryFormErrorVariants;
17315
18714
  exports.addMemoryFormFieldVariants = addMemoryFormFieldVariants;
@@ -17322,6 +18721,14 @@ exports.agentEditorVariants = agentEditorVariants;
17322
18721
  exports.agentPreviewVariants = agentPreviewVariants;
17323
18722
  exports.alertDialogContentVariants = alertDialogContentVariants;
17324
18723
  exports.alertDialogOverlayVariants = alertDialogOverlayVariants;
18724
+ exports.applyFieldCorrection = applyFieldCorrection;
18725
+ exports.artifactSaveAsMemoryFormButtonVariants = artifactSaveAsMemoryFormButtonVariants;
18726
+ exports.artifactSaveAsMemoryFormErrorVariants = artifactSaveAsMemoryFormErrorVariants;
18727
+ exports.artifactSaveAsMemoryFormFieldVariants = artifactSaveAsMemoryFormFieldVariants;
18728
+ exports.artifactSaveAsMemoryFormFooterVariants = artifactSaveAsMemoryFormFooterVariants;
18729
+ exports.artifactSaveAsMemoryFormLearningVariants = artifactSaveAsMemoryFormLearningVariants;
18730
+ exports.artifactSaveAsMemoryFormPreviewVariants = artifactSaveAsMemoryFormPreviewVariants;
18731
+ exports.artifactSaveAsMemoryFormRootVariants = artifactSaveAsMemoryFormRootVariants;
17325
18732
  exports.badgeVariants = badgeVariants;
17326
18733
  exports.buttonVariants = buttonVariants;
17327
18734
  exports.calloutVariants = calloutVariants;
@@ -17329,6 +18736,7 @@ exports.chatMessageBubbleVariants = chatMessageBubbleVariants;
17329
18736
  exports.chatMessageContainerVariants = chatMessageContainerVariants;
17330
18737
  exports.chatMessageToolStatusVariants = chatMessageToolStatusVariants;
17331
18738
  exports.chatSidebarThreadVariants = chatSidebarThreadVariants;
18739
+ exports.correctionOutcome = correctionOutcome;
17332
18740
  exports.drawerBackdropVariants = drawerBackdropVariants;
17333
18741
  exports.drawerPopupVariants = drawerPopupVariants;
17334
18742
  exports.editMemoryDialogBackdropVariants = editMemoryDialogBackdropVariants;
@@ -17341,6 +18749,8 @@ exports.editSessionDialogErrorVariants = editSessionDialogErrorVariants;
17341
18749
  exports.editSessionDialogFieldVariants = editSessionDialogFieldVariants;
17342
18750
  exports.editSessionDialogFooterVariants = editSessionDialogFooterVariants;
17343
18751
  exports.editableCellVariants = editableCellVariants;
18752
+ exports.initialColumnVisibility = initialColumnVisibility;
18753
+ exports.isEditableTarget = isEditableTarget;
17344
18754
  exports.marketplaceCardVariants = marketplaceCardVariants;
17345
18755
  exports.matchStateVariants = matchStateVariants;
17346
18756
  exports.memoryDashboardViewToggleButtonVariants = memoryDashboardViewToggleButtonVariants;
@@ -17351,6 +18761,10 @@ exports.memorySearchFilterChipVariants = memorySearchFilterChipVariants;
17351
18761
  exports.mentionInputFieldVariants = mentionInputFieldVariants;
17352
18762
  exports.mentionListItemVariants = mentionListItemVariants;
17353
18763
  exports.mentionListVariants = mentionListVariants;
18764
+ exports.neighbourRowId = neighbourRowId;
18765
+ exports.normalizeArtifact = normalizeArtifact;
18766
+ exports.normalizeFromAiSdkArtifacts = normalizeFromAiSdkArtifacts;
18767
+ exports.normalizeFromMcpToolResult = normalizeFromMcpToolResult;
17354
18768
  exports.pdfViewerFrameVariants = pdfViewerFrameVariants;
17355
18769
  exports.pdfViewerStatusVariants = pdfViewerStatusVariants;
17356
18770
  exports.pdfViewerToolbarButtonVariants = pdfViewerToolbarButtonVariants;
@@ -17397,6 +18811,7 @@ exports.toastCardVariants = toastCardVariants;
17397
18811
  exports.toastDismissButtonVariants = toastDismissButtonVariants;
17398
18812
  exports.toastProviderPositionVariants = toastProviderPositionVariants;
17399
18813
  exports.toastTitleVariants = toastTitleVariants;
18814
+ exports.toggleColumnVisibility = toggleColumnVisibility;
17400
18815
  exports.toolToggleListRowVariants = toolToggleListRowVariants;
17401
18816
  exports.toolToggleListSectionVariants = toolToggleListSectionVariants;
17402
18817
  exports.useBreakpoint = useBreakpoint;
@@ -17410,5 +18825,6 @@ exports.useMosaicWorkspace = useMosaicWorkspace;
17410
18825
  exports.useOrientation = useOrientation;
17411
18826
  exports.useViewport = useViewport;
17412
18827
  exports.version = version;
18828
+ exports.visibleColumns = visibleColumns;
17413
18829
  //# sourceMappingURL=index.cjs.map
17414
18830
  //# sourceMappingURL=index.cjs.map