@almadar/ui 5.25.1 → 5.26.1

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 (63) hide show
  1. package/dist/avl/index.cjs +2210 -2295
  2. package/dist/avl/index.js +1159 -1244
  3. package/dist/components/core/atoms/FlipContainer.d.ts +4 -4
  4. package/dist/components/core/atoms/Icon.d.ts +4 -2
  5. package/dist/components/core/atoms/ProgressBar.d.ts +1 -1
  6. package/dist/components/core/atoms/svg/SvgBranch.d.ts +6 -2
  7. package/dist/components/core/atoms/svg/SvgConnection.d.ts +8 -4
  8. package/dist/components/core/atoms/svg/SvgFlow.d.ts +5 -1
  9. package/dist/components/core/atoms/svg/SvgGrid.d.ts +6 -2
  10. package/dist/components/core/atoms/svg/SvgLobe.d.ts +6 -2
  11. package/dist/components/core/atoms/svg/SvgMesh.d.ts +6 -2
  12. package/dist/components/core/atoms/svg/SvgMorph.d.ts +6 -2
  13. package/dist/components/core/atoms/svg/SvgNode.d.ts +6 -2
  14. package/dist/components/core/atoms/svg/SvgPulse.d.ts +6 -2
  15. package/dist/components/core/atoms/svg/SvgRing.d.ts +6 -2
  16. package/dist/components/core/atoms/svg/SvgShield.d.ts +6 -2
  17. package/dist/components/core/atoms/svg/SvgStack.d.ts +6 -2
  18. package/dist/components/core/atoms/types.d.ts +6 -0
  19. package/dist/components/core/molecules/ArrayEditor.d.ts +15 -0
  20. package/dist/components/core/molecules/Carousel.d.ts +8 -2
  21. package/dist/components/core/molecules/Container.d.ts +4 -4
  22. package/dist/components/core/molecules/DateRangeSelector.d.ts +3 -4
  23. package/dist/components/core/molecules/DocSidebar.d.ts +4 -4
  24. package/dist/components/core/molecules/EdgeDecoration.d.ts +3 -2
  25. package/dist/components/core/molecules/Flex.d.ts +4 -4
  26. package/dist/components/core/molecules/FlipCard.d.ts +3 -4
  27. package/dist/components/core/molecules/GradientDivider.d.ts +3 -2
  28. package/dist/components/core/molecules/MapEditor.d.ts +16 -0
  29. package/dist/components/core/molecules/ObjectEditor.d.ts +15 -0
  30. package/dist/components/core/molecules/SidePanel.d.ts +4 -4
  31. package/dist/components/core/molecules/SortableList.d.ts +4 -5
  32. package/dist/components/core/molecules/ViolationAlert.d.ts +4 -9
  33. package/dist/components/core/molecules/index.d.ts +4 -3
  34. package/dist/components/core/molecules/markdown/CodeBlock.d.ts +44 -2
  35. package/dist/components/core/molecules/markdown/MarkdownContent.d.ts +2 -2
  36. package/dist/components/game/atoms/ResourceCounter.d.ts +3 -2
  37. package/dist/components/game/atoms/StateIndicator.d.ts +4 -5
  38. package/dist/components/game/atoms/StatusEffect.d.ts +2 -3
  39. package/dist/components/game/molecules/ActionButtons.d.ts +6 -0
  40. package/dist/components/game/molecules/GameHud.d.ts +2 -3
  41. package/dist/components/game/molecules/StatBadge.d.ts +6 -0
  42. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +16 -0
  43. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  44. package/dist/components/index.cjs +2458 -2092
  45. package/dist/components/index.js +1558 -1192
  46. package/dist/docs/index.cjs +6021 -4606
  47. package/dist/docs/index.css +1252 -0
  48. package/dist/docs/index.d.cts +108 -16
  49. package/dist/docs/index.d.ts +2 -2
  50. package/dist/docs/index.js +5977 -4567
  51. package/dist/hooks/index.cjs +9 -2
  52. package/dist/hooks/index.js +9 -2
  53. package/dist/marketing/index.cjs +32 -9
  54. package/dist/marketing/index.d.cts +30 -20
  55. package/dist/marketing/index.js +32 -9
  56. package/dist/providers/index.cjs +2035 -2120
  57. package/dist/providers/index.js +1134 -1219
  58. package/dist/runtime/index.cjs +2075 -2160
  59. package/dist/runtime/index.js +1138 -1223
  60. package/package.json +1 -1
  61. package/dist/components/core/molecules/CodeViewer.d.ts +0 -70
  62. package/dist/components/core/molecules/DocCodeBlock.d.ts +0 -14
  63. package/dist/components/game/organisms/puzzles/state-architect/CodeView.d.ts +0 -24
@@ -1,5 +1,5 @@
1
- import * as React86 from 'react';
2
- import React86__default, { createContext, useMemo, useContext, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React84 from 'react';
2
+ import React84__default, { createContext, useMemo, useContext, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
@@ -393,7 +393,7 @@ var init_Box = __esm({
393
393
  fixed: "fixed",
394
394
  sticky: "sticky"
395
395
  };
396
- Box = React86__default.forwardRef(
396
+ Box = React84__default.forwardRef(
397
397
  ({
398
398
  padding,
399
399
  paddingX,
@@ -443,7 +443,7 @@ var init_Box = __esm({
443
443
  onMouseLeave?.(e);
444
444
  }, [hoverEvent, eventBus, onMouseLeave]);
445
445
  const isClickable = action || onClick;
446
- return React86__default.createElement(
446
+ return React84__default.createElement(
447
447
  Component,
448
448
  {
449
449
  ref,
@@ -1182,12 +1182,20 @@ function doResolve(name) {
1182
1182
  if (asIs && typeof asIs === "object") return asIs;
1183
1183
  return LucideIcons2.HelpCircle;
1184
1184
  }
1185
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1185
+ var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1186
1186
  var init_Icon = __esm({
1187
1187
  "components/core/atoms/Icon.tsx"() {
1188
1188
  "use client";
1189
1189
  init_cn();
1190
1190
  init_iconFamily();
1191
+ colorTokenClasses = {
1192
+ primary: "text-primary",
1193
+ secondary: "text-secondary",
1194
+ success: "text-success",
1195
+ warning: "text-warning",
1196
+ error: "text-error",
1197
+ muted: "text-muted-foreground"
1198
+ };
1191
1199
  iconAliases = {
1192
1200
  "close": LucideIcons2.X,
1193
1201
  "trash": LucideIcons2.Trash2,
@@ -1226,7 +1234,7 @@ var init_Icon = __esm({
1226
1234
  const directIcon = typeof icon === "string" ? void 0 : icon;
1227
1235
  const effectiveName = typeof icon === "string" ? icon : name;
1228
1236
  const family = useIconFamily();
1229
- const RenderedComponent = React86__default.useMemo(() => {
1237
+ const RenderedComponent = React84__default.useMemo(() => {
1230
1238
  if (directIcon) return null;
1231
1239
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1232
1240
  }, [directIcon, effectiveName, family]);
@@ -1235,10 +1243,11 @@ var init_Icon = __esm({
1235
1243
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
1236
1244
  ...style
1237
1245
  };
1246
+ const resolvedColor = color ? color in colorTokenClasses ? colorTokenClasses[color] : color : "text-current";
1238
1247
  const composedClassName = cn(
1239
1248
  sizeClasses[size],
1240
1249
  animationClasses[animation],
1241
- color ? color : "text-current",
1250
+ resolvedColor,
1242
1251
  className
1243
1252
  );
1244
1253
  if (directIcon) {
@@ -1284,7 +1293,7 @@ function resolveIconProp(value, sizeClass) {
1284
1293
  const IconComp = value;
1285
1294
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1286
1295
  }
1287
- if (React86__default.isValidElement(value)) {
1296
+ if (React84__default.isValidElement(value)) {
1288
1297
  return value;
1289
1298
  }
1290
1299
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1360,7 +1369,7 @@ var init_Button = __esm({
1360
1369
  md: "h-icon-default w-icon-default",
1361
1370
  lg: "h-icon-default w-icon-default"
1362
1371
  };
1363
- Button = React86__default.forwardRef(
1372
+ Button = React84__default.forwardRef(
1364
1373
  ({
1365
1374
  className,
1366
1375
  variant = "primary",
@@ -1425,7 +1434,7 @@ var Dialog;
1425
1434
  var init_Dialog = __esm({
1426
1435
  "components/core/atoms/Dialog.tsx"() {
1427
1436
  init_cn();
1428
- Dialog = React86__default.forwardRef(
1437
+ Dialog = React84__default.forwardRef(
1429
1438
  ({
1430
1439
  role = "dialog",
1431
1440
  "aria-modal": ariaModal = true,
@@ -1566,43 +1575,6 @@ var init_Typography = __esm({
1566
1575
  Typography.displayName = "Typography";
1567
1576
  }
1568
1577
  });
1569
- var Overlay;
1570
- var init_Overlay = __esm({
1571
- "components/core/atoms/Overlay.tsx"() {
1572
- "use client";
1573
- init_cn();
1574
- init_useEventBus();
1575
- Overlay = ({
1576
- isVisible = true,
1577
- onClick,
1578
- className,
1579
- blur = false,
1580
- action
1581
- }) => {
1582
- const eventBus = useEventBus();
1583
- if (!isVisible) return null;
1584
- const handleClick = (e) => {
1585
- if (action) {
1586
- eventBus.emit(`UI:${action}`, {});
1587
- }
1588
- onClick?.(e);
1589
- };
1590
- return /* @__PURE__ */ jsx(
1591
- "div",
1592
- {
1593
- className: cn(
1594
- "fixed inset-0 z-40",
1595
- blur && "backdrop-blur-sm",
1596
- className
1597
- ),
1598
- style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1599
- onClick: action || onClick ? handleClick : void 0,
1600
- "aria-hidden": "true"
1601
- }
1602
- );
1603
- };
1604
- }
1605
- });
1606
1578
  var sizeClasses2, minWidthClasses, lookStyles, Modal;
1607
1579
  var init_Modal = __esm({
1608
1580
  "components/core/molecules/Modal.tsx"() {
@@ -1611,7 +1583,6 @@ var init_Modal = __esm({
1611
1583
  init_Button();
1612
1584
  init_Dialog();
1613
1585
  init_Typography();
1614
- init_Overlay();
1615
1586
  init_cn();
1616
1587
  init_useEventBus();
1617
1588
  sizeClasses2 = {
@@ -1701,130 +1672,160 @@ var init_Modal = __esm({
1701
1672
  }
1702
1673
  };
1703
1674
  return createPortal(
1704
- /* @__PURE__ */ jsxs(Fragment, { children: [
1705
- /* @__PURE__ */ jsx(
1706
- Overlay,
1707
- {
1708
- isVisible: isOpen,
1709
- onClick: handleOverlayClick,
1710
- className: "z-[1000]"
1711
- }
1712
- ),
1713
- /* @__PURE__ */ jsx(
1714
- Box,
1715
- {
1716
- className: cn(
1717
- "fixed inset-0 z-[1001] pointer-events-none",
1718
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
1719
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
1720
- ),
1721
- children: /* @__PURE__ */ jsxs(
1722
- Dialog,
1723
- {
1724
- ref: modalRef,
1725
- open: true,
1726
- className: cn(
1727
- // Reset browser-default dialog chrome — we own styling. `static`
1728
- // overrides the user-agent `position: absolute` so the parent
1729
- // flex container's `justify-center` actually centers the dialog
1730
- // (without this, the dialog drops out of flex flow and `m-0`
1731
- // kills the user-agent's `margin: auto` centering, pinning the
1732
- // dialog to top-left).
1733
- "static m-0 p-0 border-0 bg-transparent",
1734
- // Pre-existing dialog frame
1735
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
1736
- // Desktop sizing + viewport-aware floor.
1737
- sizeClasses2[size],
1738
- minWidthClasses[size],
1739
- "max-h-[80vh]",
1740
- // Mobile: take the entire screen. Override desktop max-w cap,
1741
- // full height, no rounded corners, no min-width.
1742
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
1743
- lookStyles[look],
1744
- className
1675
+ /* @__PURE__ */ jsx(
1676
+ "div",
1677
+ {
1678
+ className: cn(
1679
+ "fixed inset-0 z-[1000]",
1680
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
1681
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
1682
+ ),
1683
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1684
+ onClick: handleOverlayClick,
1685
+ "aria-hidden": "true",
1686
+ children: /* @__PURE__ */ jsxs(
1687
+ Dialog,
1688
+ {
1689
+ ref: modalRef,
1690
+ open: true,
1691
+ className: cn(
1692
+ // Reset browser-default dialog chrome — we own styling. `static`
1693
+ // overrides the user-agent `position: absolute` so the parent
1694
+ // flex container's `justify-center` actually centers the dialog
1695
+ // (without this, the dialog drops out of flex flow and `m-0`
1696
+ // kills the user-agent's `margin: auto` centering, pinning the
1697
+ // dialog to top-left).
1698
+ "static m-0 p-0 border-0 bg-transparent",
1699
+ // Pre-existing dialog frame
1700
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
1701
+ // Desktop sizing + viewport-aware floor.
1702
+ sizeClasses2[size],
1703
+ minWidthClasses[size],
1704
+ "max-h-[80vh]",
1705
+ // Mobile: take the entire screen. Override desktop max-w cap,
1706
+ // full height, no rounded corners, no min-width.
1707
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
1708
+ lookStyles[look],
1709
+ className
1710
+ ),
1711
+ style: dragY > 0 ? {
1712
+ transform: `translateY(${dragY}px)`,
1713
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
1714
+ } : void 0,
1715
+ ...title && { "aria-labelledby": "modal-title" },
1716
+ children: [
1717
+ /* @__PURE__ */ jsx(
1718
+ Box,
1719
+ {
1720
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
1721
+ onPointerDown: (e) => {
1722
+ if (!swipeDownToClose) return;
1723
+ dragStartY.current = e.clientY;
1724
+ isDragging.current = true;
1725
+ e.target.setPointerCapture(e.pointerId);
1726
+ },
1727
+ onPointerMove: (e) => {
1728
+ if (!isDragging.current) return;
1729
+ const dy = Math.max(0, e.clientY - dragStartY.current);
1730
+ setDragY(dy);
1731
+ },
1732
+ onPointerUp: () => {
1733
+ if (!isDragging.current) return;
1734
+ isDragging.current = false;
1735
+ if (dragY > 100) {
1736
+ handleClose();
1737
+ }
1738
+ setDragY(0);
1739
+ },
1740
+ onPointerCancel: () => {
1741
+ isDragging.current = false;
1742
+ setDragY(0);
1743
+ },
1744
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
1745
+ }
1745
1746
  ),
1746
- style: dragY > 0 ? {
1747
- transform: `translateY(${dragY}px)`,
1748
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
1749
- } : void 0,
1750
- ...title && { "aria-labelledby": "modal-title" },
1751
- children: [
1752
- /* @__PURE__ */ jsx(
1753
- Box,
1754
- {
1755
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
1756
- onPointerDown: (e) => {
1757
- if (!swipeDownToClose) return;
1758
- dragStartY.current = e.clientY;
1759
- isDragging.current = true;
1760
- e.target.setPointerCapture(e.pointerId);
1761
- },
1762
- onPointerMove: (e) => {
1763
- if (!isDragging.current) return;
1764
- const dy = Math.max(0, e.clientY - dragStartY.current);
1765
- setDragY(dy);
1766
- },
1767
- onPointerUp: () => {
1768
- if (!isDragging.current) return;
1769
- isDragging.current = false;
1770
- if (dragY > 100) {
1771
- handleClose();
1747
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
1748
+ Box,
1749
+ {
1750
+ className: cn(
1751
+ "px-6 py-4 flex items-center justify-between",
1752
+ "border-b-[length:var(--border-width)] border-border"
1753
+ ),
1754
+ children: [
1755
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
1756
+ showCloseButton && /* @__PURE__ */ jsx(
1757
+ Button,
1758
+ {
1759
+ variant: "ghost",
1760
+ size: "sm",
1761
+ icon: "x",
1762
+ onClick: handleClose,
1763
+ "data-event": "CLOSE",
1764
+ "aria-label": t("aria.closeModal")
1772
1765
  }
1773
- setDragY(0);
1774
- },
1775
- onPointerCancel: () => {
1776
- isDragging.current = false;
1777
- setDragY(0);
1778
- },
1779
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
1780
- }
1781
- ),
1782
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
1783
- Box,
1784
- {
1785
- className: cn(
1786
- "px-6 py-4 flex items-center justify-between",
1787
- "border-b-[length:var(--border-width)] border-border"
1788
- ),
1789
- children: [
1790
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
1791
- showCloseButton && /* @__PURE__ */ jsx(
1792
- Button,
1793
- {
1794
- variant: "ghost",
1795
- size: "sm",
1796
- icon: "x",
1797
- onClick: handleClose,
1798
- "data-event": "CLOSE",
1799
- "aria-label": t("aria.closeModal")
1800
- }
1801
- )
1802
- ]
1803
- }
1804
- ),
1805
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
1806
- footer && /* @__PURE__ */ jsx(
1807
- Box,
1808
- {
1809
- className: cn(
1810
- "px-6 py-4 bg-muted",
1811
- "border-t-[length:var(--border-width)] border-border"
1812
- ),
1813
- children: footer
1814
- }
1815
- )
1816
- ]
1817
- }
1818
- )
1819
- }
1820
- )
1821
- ] }),
1766
+ )
1767
+ ]
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
1771
+ footer && /* @__PURE__ */ jsx(
1772
+ Box,
1773
+ {
1774
+ className: cn(
1775
+ "px-6 py-4 bg-muted",
1776
+ "border-t-[length:var(--border-width)] border-border"
1777
+ ),
1778
+ children: footer
1779
+ }
1780
+ )
1781
+ ]
1782
+ }
1783
+ )
1784
+ }
1785
+ ),
1822
1786
  document.body
1823
1787
  );
1824
1788
  };
1825
1789
  Modal.displayName = "Modal";
1826
1790
  }
1827
1791
  });
1792
+ var Overlay;
1793
+ var init_Overlay = __esm({
1794
+ "components/core/atoms/Overlay.tsx"() {
1795
+ "use client";
1796
+ init_cn();
1797
+ init_useEventBus();
1798
+ Overlay = ({
1799
+ isVisible = true,
1800
+ onClick,
1801
+ className,
1802
+ blur = false,
1803
+ action
1804
+ }) => {
1805
+ const eventBus = useEventBus();
1806
+ if (!isVisible) return null;
1807
+ const handleClick = (e) => {
1808
+ if (action) {
1809
+ eventBus.emit(`UI:${action}`, {});
1810
+ }
1811
+ onClick?.(e);
1812
+ };
1813
+ return /* @__PURE__ */ jsx(
1814
+ "div",
1815
+ {
1816
+ className: cn(
1817
+ "fixed inset-0 z-40",
1818
+ blur && "backdrop-blur-sm",
1819
+ className
1820
+ ),
1821
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1822
+ onClick: action || onClick ? handleClick : void 0,
1823
+ "aria-hidden": "true"
1824
+ }
1825
+ );
1826
+ };
1827
+ }
1828
+ });
1828
1829
  var sizeWidths, Drawer;
1829
1830
  var init_Drawer = __esm({
1830
1831
  "components/core/molecules/Drawer.tsx"() {
@@ -2047,7 +2048,7 @@ var init_Badge = __esm({
2047
2048
  md: "px-2.5 py-1 text-sm",
2048
2049
  lg: "px-3 py-1.5 text-base"
2049
2050
  };
2050
- Badge = React86__default.forwardRef(
2051
+ Badge = React84__default.forwardRef(
2051
2052
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2052
2053
  const iconSizes3 = {
2053
2054
  sm: "h-icon-default w-icon-default",
@@ -2268,18 +2269,22 @@ var init_SvgBranch = __esm({
2268
2269
  "components/core/atoms/svg/SvgBranch.tsx"() {
2269
2270
  "use client";
2270
2271
  SvgBranch = ({
2271
- x,
2272
- y,
2272
+ x = 5,
2273
+ y = 50,
2273
2274
  variant = "fork",
2274
2275
  branches = 2,
2275
2276
  size = 1,
2276
2277
  color = "var(--color-primary)",
2277
2278
  opacity = 1,
2278
- className
2279
+ className,
2280
+ asRoot = true,
2281
+ width = 100,
2282
+ height = 100
2279
2283
  }) => {
2284
+ let inner;
2280
2285
  if (variant === "diamond") {
2281
2286
  const points = buildDiamondPoints(x, y, size);
2282
- return /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
2287
+ inner = /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
2283
2288
  "polygon",
2284
2289
  {
2285
2290
  points,
@@ -2289,23 +2294,28 @@ var init_SvgBranch = __esm({
2289
2294
  strokeLinejoin: "round"
2290
2295
  }
2291
2296
  ) });
2297
+ } else {
2298
+ const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
2299
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2300
+ paths.map((d, i) => /* @__PURE__ */ jsx(
2301
+ "path",
2302
+ {
2303
+ d,
2304
+ fill: "none",
2305
+ stroke: color,
2306
+ strokeWidth: 2,
2307
+ strokeLinecap: "round"
2308
+ },
2309
+ i
2310
+ )),
2311
+ variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
2312
+ variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
2313
+ ] });
2292
2314
  }
2293
- const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
2294
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2295
- paths.map((d, i) => /* @__PURE__ */ jsx(
2296
- "path",
2297
- {
2298
- d,
2299
- fill: "none",
2300
- stroke: color,
2301
- strokeWidth: 2,
2302
- strokeLinecap: "round"
2303
- },
2304
- i
2305
- )),
2306
- variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
2307
- variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
2308
- ] });
2315
+ if (asRoot) {
2316
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2317
+ }
2318
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
2309
2319
  };
2310
2320
  SvgBranch.displayName = "SvgBranch";
2311
2321
  }
@@ -2315,20 +2325,23 @@ var init_SvgConnection = __esm({
2315
2325
  "components/core/atoms/svg/SvgConnection.tsx"() {
2316
2326
  "use client";
2317
2327
  SvgConnection = ({
2318
- x1,
2319
- y1,
2320
- x2,
2321
- y2,
2328
+ x1 = 10,
2329
+ y1 = 50,
2330
+ x2 = 90,
2331
+ y2 = 50,
2322
2332
  variant = "solid",
2323
2333
  color = "var(--color-primary)",
2324
2334
  strokeWidth = 1.5,
2325
2335
  opacity = 1,
2326
- className
2336
+ className,
2337
+ asRoot = true,
2338
+ width = 100,
2339
+ height = 100
2327
2340
  }) => {
2328
2341
  const dashProps = variant === "solid" ? {} : {
2329
2342
  strokeDasharray: "8 6"
2330
2343
  };
2331
- return /* @__PURE__ */ jsx(
2344
+ const inner = /* @__PURE__ */ jsx(
2332
2345
  "line",
2333
2346
  {
2334
2347
  className: [
@@ -2346,24 +2359,32 @@ var init_SvgConnection = __esm({
2346
2359
  ...dashProps
2347
2360
  }
2348
2361
  );
2362
+ if (asRoot) {
2363
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2364
+ }
2365
+ return inner;
2349
2366
  };
2350
2367
  SvgConnection.displayName = "SvgConnection";
2351
2368
  }
2352
2369
  });
2353
- var flowIdCounter, SvgFlow;
2370
+ var flowIdCounter, DEFAULT_POINTS, SvgFlow;
2354
2371
  var init_SvgFlow = __esm({
2355
2372
  "components/core/atoms/svg/SvgFlow.tsx"() {
2356
2373
  "use client";
2357
2374
  flowIdCounter = 0;
2375
+ DEFAULT_POINTS = [[10, 50], [50, 20], [90, 50]];
2358
2376
  SvgFlow = ({
2359
- points,
2377
+ points = DEFAULT_POINTS,
2360
2378
  color = "var(--color-primary)",
2361
2379
  strokeWidth = 1.5,
2362
2380
  animated = false,
2363
2381
  opacity = 1,
2364
- className
2382
+ className,
2383
+ asRoot = true,
2384
+ width = 100,
2385
+ height = 100
2365
2386
  }) => {
2366
- const markerId = React86__default.useMemo(() => {
2387
+ const markerId = React84__default.useMemo(() => {
2367
2388
  flowIdCounter += 1;
2368
2389
  return `almadar-flow-arrow-${flowIdCounter}`;
2369
2390
  }, []);
@@ -2371,7 +2392,7 @@ var init_SvgFlow = __esm({
2371
2392
  return null;
2372
2393
  }
2373
2394
  const pathData = points.map((pt, i) => `${i === 0 ? "M" : "L"}${pt[0]},${pt[1]}`).join(" ");
2374
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2395
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2375
2396
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
2376
2397
  "marker",
2377
2398
  {
@@ -2400,6 +2421,10 @@ var init_SvgFlow = __esm({
2400
2421
  }
2401
2422
  )
2402
2423
  ] });
2424
+ if (asRoot) {
2425
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2426
+ }
2427
+ return inner;
2403
2428
  };
2404
2429
  SvgFlow.displayName = "SvgFlow";
2405
2430
  }
@@ -2409,8 +2434,8 @@ var init_SvgGrid = __esm({
2409
2434
  "components/core/atoms/svg/SvgGrid.tsx"() {
2410
2435
  "use client";
2411
2436
  SvgGrid = ({
2412
- x,
2413
- y,
2437
+ x = 10,
2438
+ y = 10,
2414
2439
  cols = 4,
2415
2440
  rows: rows2 = 3,
2416
2441
  spacing = 20,
@@ -2418,10 +2443,13 @@ var init_SvgGrid = __esm({
2418
2443
  color = "var(--color-primary)",
2419
2444
  opacity = 1,
2420
2445
  className,
2421
- highlights = []
2446
+ highlights = [],
2447
+ asRoot = true,
2448
+ width = 100,
2449
+ height = 100
2422
2450
  }) => {
2423
2451
  const highlightSet = new Set(highlights);
2424
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
2452
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
2425
2453
  (_, row) => Array.from({ length: cols }).map((_2, col) => {
2426
2454
  const index = row * cols + col;
2427
2455
  const isHighlighted = highlightSet.has(index);
@@ -2440,6 +2468,10 @@ var init_SvgGrid = __esm({
2440
2468
  );
2441
2469
  })
2442
2470
  ) });
2471
+ if (asRoot) {
2472
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2473
+ }
2474
+ return inner;
2443
2475
  };
2444
2476
  SvgGrid.displayName = "SvgGrid";
2445
2477
  }
@@ -2449,15 +2481,18 @@ var init_SvgLobe = __esm({
2449
2481
  "components/core/atoms/svg/SvgLobe.tsx"() {
2450
2482
  "use client";
2451
2483
  SvgLobe = ({
2452
- cx,
2453
- cy,
2484
+ cx = 50,
2485
+ cy = 50,
2454
2486
  rx = 14,
2455
2487
  ry = 20,
2456
2488
  rotation = 0,
2457
2489
  shells = 2,
2458
2490
  color = "var(--color-primary)",
2459
2491
  opacity = 1,
2460
- className
2492
+ className,
2493
+ asRoot = true,
2494
+ width = 100,
2495
+ height = 100
2461
2496
  }) => {
2462
2497
  const clampedShells = Math.max(1, Math.min(3, shells));
2463
2498
  const renderShell = (shellIndex) => {
@@ -2492,7 +2527,7 @@ var init_SvgLobe = __esm({
2492
2527
  )
2493
2528
  ] }, shellIndex);
2494
2529
  };
2495
- return /* @__PURE__ */ jsx(
2530
+ const inner = /* @__PURE__ */ jsx(
2496
2531
  "g",
2497
2532
  {
2498
2533
  className,
@@ -2501,6 +2536,10 @@ var init_SvgLobe = __esm({
2501
2536
  children: Array.from({ length: clampedShells }, (_, i) => renderShell(i))
2502
2537
  }
2503
2538
  );
2539
+ if (asRoot) {
2540
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2541
+ }
2542
+ return inner;
2504
2543
  };
2505
2544
  SvgLobe.displayName = "SvgLobe";
2506
2545
  }
@@ -2529,18 +2568,21 @@ var init_SvgMesh = __esm({
2529
2568
  "components/core/atoms/svg/SvgMesh.tsx"() {
2530
2569
  "use client";
2531
2570
  SvgMesh = ({
2532
- cx,
2533
- cy,
2571
+ cx = 60,
2572
+ cy = 60,
2534
2573
  nodes = 6,
2535
2574
  radius = 50,
2536
2575
  color = "var(--color-primary)",
2537
2576
  connectionDensity = 0.5,
2538
2577
  opacity = 1,
2539
- className
2578
+ className,
2579
+ asRoot = true,
2580
+ width = 120,
2581
+ height = 120
2540
2582
  }) => {
2541
2583
  const positions = getNodePositions(cx, cy, nodes, radius);
2542
2584
  const connections = getConnections(nodes, connectionDensity);
2543
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2585
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2544
2586
  connections.map(([a, b]) => /* @__PURE__ */ jsx(
2545
2587
  "line",
2546
2588
  {
@@ -2565,6 +2607,10 @@ var init_SvgMesh = __esm({
2565
2607
  i
2566
2608
  ))
2567
2609
  ] });
2610
+ if (asRoot) {
2611
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2612
+ }
2613
+ return inner;
2568
2614
  };
2569
2615
  SvgMesh.displayName = "SvgMesh";
2570
2616
  }
@@ -2706,74 +2752,82 @@ var init_SvgMorph = __esm({
2706
2752
  };
2707
2753
  FlowArrow.displayName = "FlowArrow";
2708
2754
  SvgMorph = ({
2709
- x,
2710
- y,
2755
+ x = 5,
2756
+ y = 10,
2711
2757
  size = 1,
2712
2758
  variant = "generic",
2713
2759
  color = "var(--color-primary)",
2714
2760
  opacity = 1,
2715
- className
2761
+ className,
2762
+ asRoot = true,
2763
+ width = 130,
2764
+ height = 50
2716
2765
  }) => {
2717
2766
  const gap = 40 * size;
2718
2767
  const midY = y + 10 * size;
2768
+ let inner;
2719
2769
  if (variant === "text-to-code") {
2720
2770
  const leftEnd = x + 30 * size;
2721
2771
  const rightStart = leftEnd + gap;
2722
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2772
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2723
2773
  /* @__PURE__ */ jsx(TextLines, { x, y, scale: size, color }),
2724
2774
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
2725
2775
  /* @__PURE__ */ jsx(CodeBrackets, { x: rightStart, y, scale: size, color })
2726
2776
  ] });
2727
- }
2728
- if (variant === "code-to-app") {
2777
+ } else if (variant === "code-to-app") {
2729
2778
  const leftEnd = x + 26 * size;
2730
2779
  const rightStart = leftEnd + gap;
2731
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2780
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2732
2781
  /* @__PURE__ */ jsx(CodeBrackets, { x, y, scale: size, color }),
2733
2782
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
2734
2783
  /* @__PURE__ */ jsx(AppRect, { x: rightStart, y, scale: size, color })
2735
2784
  ] });
2785
+ } else {
2786
+ const circleR = 10 * size;
2787
+ const circleX = x + circleR;
2788
+ const squareStart = x + circleR * 2 + gap;
2789
+ const squareSize = circleR * 2;
2790
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2791
+ /* @__PURE__ */ jsx(
2792
+ "circle",
2793
+ {
2794
+ cx: circleX,
2795
+ cy: midY,
2796
+ r: circleR,
2797
+ fill: "none",
2798
+ stroke: color,
2799
+ strokeWidth: 2 * size
2800
+ }
2801
+ ),
2802
+ /* @__PURE__ */ jsx(
2803
+ FlowArrow,
2804
+ {
2805
+ x1: circleX + circleR + 2 * size,
2806
+ y: midY,
2807
+ x2: squareStart,
2808
+ scale: size,
2809
+ color
2810
+ }
2811
+ ),
2812
+ /* @__PURE__ */ jsx(
2813
+ "rect",
2814
+ {
2815
+ x: squareStart,
2816
+ y: midY - circleR,
2817
+ width: squareSize,
2818
+ height: squareSize,
2819
+ rx: 3 * size,
2820
+ fill: "none",
2821
+ stroke: color,
2822
+ strokeWidth: 2 * size
2823
+ }
2824
+ )
2825
+ ] });
2736
2826
  }
2737
- const circleR = 10 * size;
2738
- const circleX = x + circleR;
2739
- const squareStart = x + circleR * 2 + gap;
2740
- const squareSize = circleR * 2;
2741
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2742
- /* @__PURE__ */ jsx(
2743
- "circle",
2744
- {
2745
- cx: circleX,
2746
- cy: midY,
2747
- r: circleR,
2748
- fill: "none",
2749
- stroke: color,
2750
- strokeWidth: 2 * size
2751
- }
2752
- ),
2753
- /* @__PURE__ */ jsx(
2754
- FlowArrow,
2755
- {
2756
- x1: circleX + circleR + 2 * size,
2757
- y: midY,
2758
- x2: squareStart,
2759
- scale: size,
2760
- color
2761
- }
2762
- ),
2763
- /* @__PURE__ */ jsx(
2764
- "rect",
2765
- {
2766
- x: squareStart,
2767
- y: midY - circleR,
2768
- width: squareSize,
2769
- height: squareSize,
2770
- rx: 3 * size,
2771
- fill: "none",
2772
- stroke: color,
2773
- strokeWidth: 2 * size
2774
- }
2775
- )
2776
- ] });
2827
+ if (asRoot) {
2828
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2829
+ }
2830
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
2777
2831
  };
2778
2832
  SvgMorph.displayName = "SvgMorph";
2779
2833
  }
@@ -2783,16 +2837,19 @@ var init_SvgNode = __esm({
2783
2837
  "components/core/atoms/svg/SvgNode.tsx"() {
2784
2838
  "use client";
2785
2839
  SvgNode = ({
2786
- x,
2787
- y,
2840
+ x = 50,
2841
+ y = 50,
2788
2842
  r = 6,
2789
2843
  variant = "filled",
2790
2844
  color = "var(--color-primary)",
2791
2845
  opacity = 1,
2792
2846
  className,
2793
- label
2847
+ label,
2848
+ asRoot = true,
2849
+ width = 100,
2850
+ height = 100
2794
2851
  }) => {
2795
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2852
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2796
2853
  variant === "pulse" && /* @__PURE__ */ jsx(
2797
2854
  "circle",
2798
2855
  {
@@ -2830,6 +2887,10 @@ var init_SvgNode = __esm({
2830
2887
  }
2831
2888
  )
2832
2889
  ] });
2890
+ if (asRoot) {
2891
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2892
+ }
2893
+ return inner;
2833
2894
  };
2834
2895
  SvgNode.displayName = "SvgNode";
2835
2896
  }
@@ -2851,16 +2912,19 @@ var init_SvgPulse = __esm({
2851
2912
  }
2852
2913
  `;
2853
2914
  SvgPulse = ({
2854
- cx,
2855
- cy,
2915
+ cx = 70,
2916
+ cy = 70,
2856
2917
  rings = 3,
2857
2918
  maxRadius = 60,
2858
2919
  color = "var(--color-primary)",
2859
2920
  animated = true,
2860
2921
  opacity = 1,
2861
- className
2922
+ className,
2923
+ asRoot = true,
2924
+ width = 140,
2925
+ height = 140
2862
2926
  }) => {
2863
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2927
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2864
2928
  animated && /* @__PURE__ */ jsx("style", { children: PULSE_KEYFRAMES }),
2865
2929
  Array.from({ length: rings }).map((_, i) => {
2866
2930
  const ringRadius = (i + 1) / rings * maxRadius;
@@ -2886,6 +2950,10 @@ var init_SvgPulse = __esm({
2886
2950
  }),
2887
2951
  /* @__PURE__ */ jsx("circle", { cx, cy, r: 3, fill: color })
2888
2952
  ] });
2953
+ if (asRoot) {
2954
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2955
+ }
2956
+ return inner;
2889
2957
  };
2890
2958
  SvgPulse.displayName = "SvgPulse";
2891
2959
  }
@@ -2896,21 +2964,24 @@ var init_SvgRing = __esm({
2896
2964
  "use client";
2897
2965
  ringIdCounter = 0;
2898
2966
  SvgRing = ({
2899
- cx,
2900
- cy,
2967
+ cx = 50,
2968
+ cy = 50,
2901
2969
  r = 40,
2902
2970
  variant = "solid",
2903
2971
  color = "var(--color-primary)",
2904
2972
  strokeWidth = 1.5,
2905
2973
  opacity = 1,
2906
2974
  className,
2907
- label
2975
+ label,
2976
+ asRoot = true,
2977
+ width = 100,
2978
+ height = 100
2908
2979
  }) => {
2909
- const gradientId = React86__default.useMemo(() => {
2980
+ const gradientId = React84__default.useMemo(() => {
2910
2981
  ringIdCounter += 1;
2911
2982
  return `almadar-ring-glow-${ringIdCounter}`;
2912
2983
  }, []);
2913
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2984
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2914
2985
  variant === "glow" && /* @__PURE__ */ jsxs(Fragment, { children: [
2915
2986
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("radialGradient", { id: gradientId, cx: "50%", cy: "50%", r: "50%", children: [
2916
2987
  /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
@@ -2943,6 +3014,10 @@ var init_SvgRing = __esm({
2943
3014
  }
2944
3015
  )
2945
3016
  ] });
3017
+ if (asRoot) {
3018
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3019
+ }
3020
+ return inner;
2946
3021
  };
2947
3022
  SvgRing.displayName = "SvgRing";
2948
3023
  }
@@ -2954,15 +3029,18 @@ var init_SvgShield = __esm({
2954
3029
  SHIELD_PATH = "M15,2 C15,2 5,5 2,6 C2,6 2,18 5,24 C8,30 15,34 15,34 C15,34 22,30 25,24 C28,18 28,6 28,6 C25,5 15,2 15,2 Z";
2955
3030
  CHECK_PATH = "M10,18 L14,22 L21,13";
2956
3031
  SvgShield = ({
2957
- x,
2958
- y,
3032
+ x = 50,
3033
+ y = 50,
2959
3034
  size = 1,
2960
3035
  variant = "outline",
2961
3036
  color = "var(--color-primary)",
2962
3037
  opacity = 1,
2963
- className
3038
+ className,
3039
+ asRoot = true,
3040
+ width = 100,
3041
+ height = 100
2964
3042
  }) => {
2965
- return /* @__PURE__ */ jsxs(
3043
+ const inner = /* @__PURE__ */ jsxs(
2966
3044
  "g",
2967
3045
  {
2968
3046
  className,
@@ -2993,6 +3071,10 @@ var init_SvgShield = __esm({
2993
3071
  ]
2994
3072
  }
2995
3073
  );
3074
+ if (asRoot) {
3075
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3076
+ }
3077
+ return inner;
2996
3078
  };
2997
3079
  SvgShield.displayName = "SvgShield";
2998
3080
  }
@@ -3002,20 +3084,23 @@ var init_SvgStack = __esm({
3002
3084
  "components/core/atoms/svg/SvgStack.tsx"() {
3003
3085
  "use client";
3004
3086
  SvgStack = ({
3005
- x,
3006
- y,
3087
+ x = 10,
3088
+ y = 40,
3007
3089
  layers: rawLayers = 3,
3008
3090
  width = 60,
3009
3091
  height = 40,
3010
3092
  color = "var(--color-primary)",
3011
3093
  opacity = 1,
3012
3094
  className,
3013
- labels
3095
+ labels,
3096
+ asRoot = true,
3097
+ svgWidth = 90,
3098
+ svgHeight = 80
3014
3099
  }) => {
3015
3100
  const layers = Math.max(2, Math.min(4, rawLayers));
3016
3101
  const verticalOffset = 8;
3017
3102
  const horizontalOffset = 4;
3018
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
3103
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
3019
3104
  const layerIndex = layers - 1 - i;
3020
3105
  const layerX = x + layerIndex * horizontalOffset;
3021
3106
  const layerY = y - layerIndex * verticalOffset;
@@ -3053,6 +3138,10 @@ var init_SvgStack = __esm({
3053
3138
  )
3054
3139
  ] }, layerIndex);
3055
3140
  }) });
3141
+ if (asRoot) {
3142
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${svgWidth} ${svgHeight}`, width: svgWidth, height: svgHeight, children: inner });
3143
+ }
3144
+ return inner;
3056
3145
  };
3057
3146
  SvgStack.displayName = "SvgStack";
3058
3147
  }
@@ -3068,7 +3157,7 @@ var init_Input = __esm({
3068
3157
  "components/core/atoms/Input.tsx"() {
3069
3158
  init_cn();
3070
3159
  init_Icon();
3071
- Input = React86__default.forwardRef(
3160
+ Input = React84__default.forwardRef(
3072
3161
  ({
3073
3162
  className,
3074
3163
  inputType,
@@ -3189,7 +3278,7 @@ var Label;
3189
3278
  var init_Label = __esm({
3190
3279
  "components/core/atoms/Label.tsx"() {
3191
3280
  init_cn();
3192
- Label = React86__default.forwardRef(
3281
+ Label = React84__default.forwardRef(
3193
3282
  ({ className, required, children, ...props }, ref) => {
3194
3283
  return /* @__PURE__ */ jsxs(
3195
3284
  "label",
@@ -3215,7 +3304,7 @@ var Textarea;
3215
3304
  var init_Textarea = __esm({
3216
3305
  "components/core/atoms/Textarea.tsx"() {
3217
3306
  init_cn();
3218
- Textarea = React86__default.forwardRef(
3307
+ Textarea = React84__default.forwardRef(
3219
3308
  ({ className, error, ...props }, ref) => {
3220
3309
  return /* @__PURE__ */ jsx(
3221
3310
  "textarea",
@@ -3245,7 +3334,7 @@ var init_Select = __esm({
3245
3334
  "components/core/atoms/Select.tsx"() {
3246
3335
  init_cn();
3247
3336
  init_Icon();
3248
- Select = React86__default.forwardRef(
3337
+ Select = React84__default.forwardRef(
3249
3338
  ({ className, options, placeholder, error, ...props }, ref) => {
3250
3339
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3251
3340
  /* @__PURE__ */ jsxs(
@@ -3287,7 +3376,7 @@ var Checkbox;
3287
3376
  var init_Checkbox = __esm({
3288
3377
  "components/core/atoms/Checkbox.tsx"() {
3289
3378
  init_cn();
3290
- Checkbox = React86__default.forwardRef(
3379
+ Checkbox = React84__default.forwardRef(
3291
3380
  ({ className, label, id, ...props }, ref) => {
3292
3381
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3293
3382
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -3378,7 +3467,7 @@ var init_Card = __esm({
3378
3467
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3379
3468
  "tile-image-first": "p-0 overflow-hidden"
3380
3469
  };
3381
- Card = React86__default.forwardRef(
3470
+ Card = React84__default.forwardRef(
3382
3471
  ({
3383
3472
  className,
3384
3473
  variant = "bordered",
@@ -3416,9 +3505,9 @@ var init_Card = __esm({
3416
3505
  }
3417
3506
  );
3418
3507
  Card.displayName = "Card";
3419
- CardHeader = React86__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3508
+ CardHeader = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3420
3509
  CardHeader.displayName = "CardHeader";
3421
- CardTitle = React86__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3510
+ CardTitle = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3422
3511
  "h3",
3423
3512
  {
3424
3513
  ref,
@@ -3431,11 +3520,11 @@ var init_Card = __esm({
3431
3520
  }
3432
3521
  ));
3433
3522
  CardTitle.displayName = "CardTitle";
3434
- CardContent = React86__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3523
+ CardContent = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3435
3524
  CardContent.displayName = "CardContent";
3436
3525
  CardBody = CardContent;
3437
3526
  CardBody.displayName = "CardBody";
3438
- CardFooter = React86__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3527
+ CardFooter = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3439
3528
  "div",
3440
3529
  {
3441
3530
  ref,
@@ -3490,7 +3579,7 @@ var init_FilterPill = __esm({
3490
3579
  md: "w-3.5 h-3.5",
3491
3580
  lg: "w-4 h-4"
3492
3581
  };
3493
- FilterPill = React86__default.forwardRef(
3582
+ FilterPill = React84__default.forwardRef(
3494
3583
  ({
3495
3584
  className,
3496
3585
  variant = "default",
@@ -3567,7 +3656,7 @@ var init_Spinner = __esm({
3567
3656
  md: "h-6 w-6",
3568
3657
  lg: "h-8 w-8"
3569
3658
  };
3570
- Spinner = React86__default.forwardRef(
3659
+ Spinner = React84__default.forwardRef(
3571
3660
  ({ className, size = "md", ...props }, ref) => {
3572
3661
  return /* @__PURE__ */ jsx(
3573
3662
  "div",
@@ -3646,13 +3735,12 @@ var init_Avatar = __esm({
3646
3735
  actionPayload
3647
3736
  }) => {
3648
3737
  const eventBus = useEventBus();
3649
- const [imgFailed, setImgFailed] = React86__default.useState(false);
3650
- React86__default.useEffect(() => {
3738
+ const [imgFailed, setImgFailed] = React84__default.useState(false);
3739
+ React84__default.useEffect(() => {
3651
3740
  setImgFailed(false);
3652
3741
  }, [src]);
3653
3742
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
3654
3743
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
3655
- const hasImage = !!src && !imgFailed;
3656
3744
  const hasIcon = !!IconComponent;
3657
3745
  const hasInitials = !!initials && !(hasIcon && !providedInitials);
3658
3746
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
@@ -3678,15 +3766,13 @@ var init_Avatar = __esm({
3678
3766
  onClick: isClickable ? handleClick : void 0,
3679
3767
  role: isClickable ? "button" : void 0,
3680
3768
  tabIndex: isClickable ? 0 : void 0,
3681
- children: hasImage ? /* @__PURE__ */ jsx(
3769
+ children: src && !imgFailed ? /* @__PURE__ */ jsx(
3682
3770
  "img",
3683
3771
  {
3684
3772
  src,
3685
3773
  alt: alt || "Avatar",
3686
3774
  className: "w-full h-full object-cover",
3687
- onError: () => {
3688
- setImgFailed(true);
3689
- }
3775
+ onError: () => setImgFailed(true)
3690
3776
  }
3691
3777
  ) : hasInitials ? /* @__PURE__ */ jsx(
3692
3778
  "div",
@@ -3867,6 +3953,7 @@ var init_ProgressBar = __esm({
3867
3953
  primary: "bg-primary",
3868
3954
  success: "bg-success",
3869
3955
  warning: "bg-warning",
3956
+ error: "bg-error",
3870
3957
  danger: "bg-error"
3871
3958
  };
3872
3959
  circularSizeClasses = {
@@ -3891,10 +3978,11 @@ var init_ProgressBar = __esm({
3891
3978
  const effectiveColor = color ?? variant;
3892
3979
  const effectiveShowPercentage = showPercentage || showLabel;
3893
3980
  if (progressType === "linear") {
3981
+ const showHeader = label || effectiveShowPercentage;
3894
3982
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
3895
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
3896
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
3897
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-foreground font-medium", children: [
3983
+ showHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
3984
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
3985
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-foreground font-medium", !label && "ml-auto"), children: [
3898
3986
  Math.round(percentage),
3899
3987
  "%"
3900
3988
  ] })
@@ -3979,10 +4067,11 @@ var init_ProgressBar = __esm({
3979
4067
  const stepValue = max / steps;
3980
4068
  const activeSteps = Math.floor(value / stepValue);
3981
4069
  const partialStep = value % stepValue / stepValue;
4070
+ const showStepHeader = label || effectiveShowPercentage;
3982
4071
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
3983
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
3984
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
3985
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4072
+ showStepHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
4073
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
4074
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-muted-foreground", !label && "ml-auto"), children: [
3986
4075
  Math.round(percentage),
3987
4076
  "%"
3988
4077
  ] })
@@ -4032,7 +4121,7 @@ var init_Radio = __esm({
4032
4121
  md: "w-2.5 h-2.5",
4033
4122
  lg: "w-3 h-3"
4034
4123
  };
4035
- Radio = React86__default.forwardRef(
4124
+ Radio = React84__default.forwardRef(
4036
4125
  ({
4037
4126
  label,
4038
4127
  helperText,
@@ -4049,12 +4138,12 @@ var init_Radio = __esm({
4049
4138
  onChange,
4050
4139
  ...props
4051
4140
  }, ref) => {
4052
- const reactId = React86__default.useId();
4141
+ const reactId = React84__default.useId();
4053
4142
  const baseId = id || `radio-${reactId}`;
4054
4143
  const hasError = !!error;
4055
4144
  const eventBus = useEventBus();
4056
- const [selected, setSelected] = React86__default.useState(value);
4057
- React86__default.useEffect(() => {
4145
+ const [selected, setSelected] = React84__default.useState(value);
4146
+ React84__default.useEffect(() => {
4058
4147
  if (value !== void 0) setSelected(value);
4059
4148
  }, [value]);
4060
4149
  const pick = (next, e) => {
@@ -4236,7 +4325,7 @@ var init_Switch = __esm({
4236
4325
  "components/core/atoms/Switch.tsx"() {
4237
4326
  "use client";
4238
4327
  init_cn();
4239
- Switch = React86.forwardRef(
4328
+ Switch = React84.forwardRef(
4240
4329
  ({
4241
4330
  checked,
4242
4331
  defaultChecked = false,
@@ -4247,10 +4336,10 @@ var init_Switch = __esm({
4247
4336
  name,
4248
4337
  className
4249
4338
  }, ref) => {
4250
- const [isChecked, setIsChecked] = React86.useState(
4339
+ const [isChecked, setIsChecked] = React84.useState(
4251
4340
  checked !== void 0 ? checked : defaultChecked
4252
4341
  );
4253
- React86.useEffect(() => {
4342
+ React84.useEffect(() => {
4254
4343
  if (checked !== void 0) {
4255
4344
  setIsChecked(checked);
4256
4345
  }
@@ -4781,7 +4870,7 @@ var Aside;
4781
4870
  var init_Aside = __esm({
4782
4871
  "components/core/atoms/Aside.tsx"() {
4783
4872
  init_cn();
4784
- Aside = React86__default.forwardRef(
4873
+ Aside = React84__default.forwardRef(
4785
4874
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4786
4875
  );
4787
4876
  Aside.displayName = "Aside";
@@ -4859,8 +4948,8 @@ var init_LawReferenceTooltip = __esm({
4859
4948
  className
4860
4949
  }) => {
4861
4950
  const { t } = useTranslate();
4862
- const [isVisible, setIsVisible] = React86__default.useState(false);
4863
- const timeoutRef = React86__default.useRef(null);
4951
+ const [isVisible, setIsVisible] = React84__default.useState(false);
4952
+ const timeoutRef = React84__default.useRef(null);
4864
4953
  const handleMouseEnter = () => {
4865
4954
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4866
4955
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4869,7 +4958,7 @@ var init_LawReferenceTooltip = __esm({
4869
4958
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4870
4959
  setIsVisible(false);
4871
4960
  };
4872
- React86__default.useEffect(() => {
4961
+ React84__default.useEffect(() => {
4873
4962
  return () => {
4874
4963
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4875
4964
  };
@@ -5079,7 +5168,7 @@ var init_StatusDot = __esm({
5079
5168
  md: "w-2.5 h-2.5",
5080
5169
  lg: "w-3 h-3"
5081
5170
  };
5082
- StatusDot = React86__default.forwardRef(
5171
+ StatusDot = React84__default.forwardRef(
5083
5172
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5084
5173
  return /* @__PURE__ */ jsx(
5085
5174
  "span",
@@ -5133,7 +5222,7 @@ var init_TrendIndicator = __esm({
5133
5222
  down: "trending-down",
5134
5223
  flat: "arrow-right"
5135
5224
  };
5136
- TrendIndicator = React86__default.forwardRef(
5225
+ TrendIndicator = React84__default.forwardRef(
5137
5226
  ({
5138
5227
  className,
5139
5228
  value,
@@ -5200,7 +5289,7 @@ var init_RangeSlider = __esm({
5200
5289
  md: "w-4 h-4",
5201
5290
  lg: "w-5 h-5"
5202
5291
  };
5203
- RangeSlider = React86__default.forwardRef(
5292
+ RangeSlider = React84__default.forwardRef(
5204
5293
  ({
5205
5294
  className,
5206
5295
  min = 0,
@@ -5708,7 +5797,7 @@ var init_ContentSection = __esm({
5708
5797
  md: "py-16",
5709
5798
  lg: "py-24"
5710
5799
  };
5711
- ContentSection = React86__default.forwardRef(
5800
+ ContentSection = React84__default.forwardRef(
5712
5801
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5713
5802
  return /* @__PURE__ */ jsx(
5714
5803
  Box,
@@ -6242,7 +6331,7 @@ var init_AnimatedReveal = __esm({
6242
6331
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6243
6332
  "none": {}
6244
6333
  };
6245
- AnimatedReveal = React86__default.forwardRef(
6334
+ AnimatedReveal = React84__default.forwardRef(
6246
6335
  ({
6247
6336
  trigger = "scroll",
6248
6337
  animation = "fade-up",
@@ -6402,7 +6491,7 @@ var init_AnimatedGraphic = __esm({
6402
6491
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6403
6492
  "use client";
6404
6493
  init_cn();
6405
- AnimatedGraphic = React86__default.forwardRef(
6494
+ AnimatedGraphic = React84__default.forwardRef(
6406
6495
  ({
6407
6496
  src,
6408
6497
  svgContent,
@@ -6425,7 +6514,7 @@ var init_AnimatedGraphic = __esm({
6425
6514
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6426
6515
  const resolvedSvg = svgContent ?? fetchedSvg;
6427
6516
  const prevAnimateRef = useRef(animate);
6428
- const setRef = React86__default.useCallback(
6517
+ const setRef = React84__default.useCallback(
6429
6518
  (node) => {
6430
6519
  containerRef.current = node;
6431
6520
  if (typeof ref === "function") ref(node);
@@ -6650,9 +6739,9 @@ function ScoreDisplay({
6650
6739
  ...rest
6651
6740
  }) {
6652
6741
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
6653
- const [displayValue, setDisplayValue] = React86.useState(resolvedValue);
6654
- const [isAnimating, setIsAnimating] = React86.useState(false);
6655
- React86.useEffect(() => {
6742
+ const [displayValue, setDisplayValue] = React84.useState(resolvedValue);
6743
+ const [isAnimating, setIsAnimating] = React84.useState(false);
6744
+ React84.useEffect(() => {
6656
6745
  if (!animated || displayValue === resolvedValue) {
6657
6746
  setDisplayValue(resolvedValue);
6658
6747
  return;
@@ -6722,9 +6811,9 @@ function ControlButton({
6722
6811
  className
6723
6812
  }) {
6724
6813
  const eventBus = useEventBus();
6725
- const [isPressed, setIsPressed] = React86.useState(false);
6814
+ const [isPressed, setIsPressed] = React84.useState(false);
6726
6815
  const actualPressed = pressed ?? isPressed;
6727
- const handlePointerDown = React86.useCallback(
6816
+ const handlePointerDown = React84.useCallback(
6728
6817
  (e) => {
6729
6818
  e.preventDefault();
6730
6819
  if (disabled) return;
@@ -6734,7 +6823,7 @@ function ControlButton({
6734
6823
  },
6735
6824
  [disabled, pressEvent, eventBus, onPress]
6736
6825
  );
6737
- const handlePointerUp = React86.useCallback(
6826
+ const handlePointerUp = React84.useCallback(
6738
6827
  (e) => {
6739
6828
  e.preventDefault();
6740
6829
  if (disabled) return;
@@ -6744,7 +6833,7 @@ function ControlButton({
6744
6833
  },
6745
6834
  [disabled, releaseEvent, eventBus, onRelease]
6746
6835
  );
6747
- const handlePointerLeave = React86.useCallback(
6836
+ const handlePointerLeave = React84.useCallback(
6748
6837
  (e) => {
6749
6838
  if (isPressed) {
6750
6839
  setIsPressed(false);
@@ -7015,7 +7104,7 @@ function ResourceCounter({
7015
7104
  children: [
7016
7105
  icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
7017
7106
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
7018
- /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color), children: [
7107
+ /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color && (color in colorTokenClasses2 ? colorTokenClasses2[color] : color)), children: [
7019
7108
  value,
7020
7109
  max != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
7021
7110
  "/",
@@ -7026,10 +7115,18 @@ function ResourceCounter({
7026
7115
  }
7027
7116
  );
7028
7117
  }
7029
- var sizeMap5;
7118
+ var colorTokenClasses2, sizeMap5;
7030
7119
  var init_ResourceCounter = __esm({
7031
7120
  "components/game/atoms/ResourceCounter.tsx"() {
7032
7121
  init_cn();
7122
+ colorTokenClasses2 = {
7123
+ primary: "text-primary",
7124
+ secondary: "text-secondary",
7125
+ success: "text-success",
7126
+ warning: "text-warning",
7127
+ error: "text-error",
7128
+ muted: "text-muted-foreground"
7129
+ };
7033
7130
  sizeMap5 = {
7034
7131
  sm: { wrapper: "text-xs gap-1 px-1.5 py-0.5", icon: "text-sm" },
7035
7132
  md: { wrapper: "text-sm gap-1.5 px-2 py-1", icon: "text-base" },
@@ -7233,14 +7330,20 @@ function XPBar({
7233
7330
  }) {
7234
7331
  const sizes = sizeMap9[size];
7235
7332
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
7236
- const [fillWidth, setFillWidth] = React86.useState(animated ? 0 : percentage);
7237
- React86.useEffect(() => {
7333
+ const [fillWidth, setFillWidth] = React84.useState(animated ? 0 : percentage);
7334
+ React84.useEffect(() => {
7238
7335
  if (!animated) {
7239
7336
  setFillWidth(percentage);
7240
7337
  return;
7241
7338
  }
7242
- const frame = requestAnimationFrame(() => setFillWidth(percentage));
7243
- return () => cancelAnimationFrame(frame);
7339
+ let frame2;
7340
+ const frame1 = requestAnimationFrame(() => {
7341
+ frame2 = requestAnimationFrame(() => setFillWidth(percentage));
7342
+ });
7343
+ return () => {
7344
+ cancelAnimationFrame(frame1);
7345
+ cancelAnimationFrame(frame2);
7346
+ };
7244
7347
  }, [animated, percentage]);
7245
7348
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
7246
7349
  level != null && /* @__PURE__ */ jsxs(
@@ -7278,7 +7381,7 @@ function XPBar({
7278
7381
  )
7279
7382
  }
7280
7383
  ),
7281
- showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground tabular-nums", sizes.text), children: [
7384
+ showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-foreground/70 tabular-nums", sizes.text), children: [
7282
7385
  current,
7283
7386
  " / ",
7284
7387
  max,
@@ -7396,7 +7499,7 @@ function StatusEffect({
7396
7499
  ),
7397
7500
  title: label,
7398
7501
  children: [
7399
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: icon }),
7502
+ /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }),
7400
7503
  duration !== void 0 && /* @__PURE__ */ jsx(
7401
7504
  "span",
7402
7505
  {
@@ -7427,6 +7530,7 @@ var sizeMap11, variantStyles7;
7427
7530
  var init_StatusEffect = __esm({
7428
7531
  "components/game/atoms/StatusEffect.tsx"() {
7429
7532
  init_cn();
7533
+ init_Icon();
7430
7534
  sizeMap11 = {
7431
7535
  sm: { container: "w-8 h-8", icon: "text-sm", badge: "text-xs -top-1 -right-1 w-4 h-4", timer: "text-[9px]" },
7432
7536
  md: { container: "w-10 h-10", icon: "text-base", badge: "text-xs -top-1 -right-1 w-5 h-5", timer: "text-xs" },
@@ -7660,9 +7764,9 @@ function MiniMap({
7660
7764
  viewportRect,
7661
7765
  className
7662
7766
  }) {
7663
- const canvasRef = React86.useRef(null);
7664
- const frameRef = React86.useRef(0);
7665
- React86.useEffect(() => {
7767
+ const canvasRef = React84.useRef(null);
7768
+ const frameRef = React84.useRef(0);
7769
+ React84.useEffect(() => {
7666
7770
  const canvas = canvasRef.current;
7667
7771
  if (!canvas) return;
7668
7772
  const ctx = canvas.getContext("2d");
@@ -7836,7 +7940,7 @@ var init_ErrorBoundary = __esm({
7836
7940
  }
7837
7941
  );
7838
7942
  };
7839
- ErrorBoundary = class extends React86__default.Component {
7943
+ ErrorBoundary = class extends React84__default.Component {
7840
7944
  constructor(props) {
7841
7945
  super(props);
7842
7946
  __publicField(this, "reset", () => {
@@ -8915,7 +9019,7 @@ var init_Tooltip = __esm({
8915
9019
  setIsVisible(false);
8916
9020
  }, hideDelay);
8917
9021
  };
8918
- useEffect(() => {
9022
+ useLayoutEffect(() => {
8919
9023
  if (isVisible) {
8920
9024
  updatePosition();
8921
9025
  }
@@ -8926,8 +9030,8 @@ var init_Tooltip = __esm({
8926
9030
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
8927
9031
  };
8928
9032
  }, []);
8929
- const triggerElement = React86__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8930
- const trigger = React86__default.cloneElement(triggerElement, {
9033
+ const triggerElement = React84__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9034
+ const trigger = React84__default.cloneElement(triggerElement, {
8931
9035
  ref: triggerRef,
8932
9036
  onMouseEnter: handleMouseEnter,
8933
9037
  onMouseLeave: handleMouseLeave,
@@ -9074,8 +9178,8 @@ var init_Popover = __esm({
9074
9178
  onMouseEnter: handleOpen,
9075
9179
  onMouseLeave: handleClose
9076
9180
  };
9077
- const childElement = React86__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9078
- const triggerElement = React86__default.cloneElement(
9181
+ const childElement = React84__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9182
+ const triggerElement = React84__default.cloneElement(
9079
9183
  childElement,
9080
9184
  {
9081
9185
  ref: triggerRef,
@@ -9091,7 +9195,10 @@ var init_Popover = __esm({
9091
9195
  "bg-card border-2 border-border shadow-elevation-popover",
9092
9196
  className
9093
9197
  ),
9094
- style: computePopoverStyle(position, triggerRect, popoverWidth),
9198
+ style: {
9199
+ ...computePopoverStyle(position, triggerRect, popoverWidth),
9200
+ ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
9201
+ },
9095
9202
  role: "dialog",
9096
9203
  onMouseEnter: trigger === "hover" ? handleOpen : void 0,
9097
9204
  onMouseLeave: trigger === "hover" ? handleClose : void 0,
@@ -9201,8 +9308,8 @@ var init_Menu = __esm({
9201
9308
  };
9202
9309
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
9203
9310
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
9204
- const triggerChild = React86__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
9205
- const triggerElement = React86__default.cloneElement(
9311
+ const triggerChild = React84__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
9312
+ const triggerElement = React84__default.cloneElement(
9206
9313
  triggerChild,
9207
9314
  {
9208
9315
  ref: triggerRef,
@@ -9609,7 +9716,7 @@ var init_MapView = __esm({
9609
9716
  shadowSize: [41, 41]
9610
9717
  });
9611
9718
  L.Marker.prototype.options.icon = defaultIcon;
9612
- const { useEffect: useEffect72, useRef: useRef66, useCallback: useCallback114, useState: useState104 } = React86__default;
9719
+ const { useEffect: useEffect72, useRef: useRef66, useCallback: useCallback112, useState: useState102 } = React84__default;
9613
9720
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9614
9721
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9615
9722
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -9654,8 +9761,8 @@ var init_MapView = __esm({
9654
9761
  showAttribution = true
9655
9762
  }) {
9656
9763
  const eventBus = useEventBus3();
9657
- const [clickedPosition, setClickedPosition] = useState104(null);
9658
- const handleMapClick = useCallback114((lat, lng) => {
9764
+ const [clickedPosition, setClickedPosition] = useState102(null);
9765
+ const handleMapClick = useCallback112((lat, lng) => {
9659
9766
  if (showClickedPin) {
9660
9767
  setClickedPosition({ lat, lng });
9661
9768
  }
@@ -9664,7 +9771,7 @@ var init_MapView = __esm({
9664
9771
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
9665
9772
  }
9666
9773
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
9667
- const handleMarkerClick = useCallback114((marker) => {
9774
+ const handleMarkerClick = useCallback112((marker) => {
9668
9775
  onMarkerClick?.(marker);
9669
9776
  if (markerClickEvent) {
9670
9777
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -9673,7 +9780,7 @@ var init_MapView = __esm({
9673
9780
  return /* @__PURE__ */ jsx(
9674
9781
  Box,
9675
9782
  {
9676
- className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
9783
+ className: cn("relative isolate z-0 w-full overflow-hidden rounded-lg", className),
9677
9784
  style: { height },
9678
9785
  "data-testid": "map-view",
9679
9786
  children: /* @__PURE__ */ jsxs(
@@ -9855,7 +9962,7 @@ function InputPattern({
9855
9962
  fieldName
9856
9963
  }) {
9857
9964
  const { emit } = useEventBus();
9858
- const [localValue, setLocalValue] = React86__default.useState(value);
9965
+ const [localValue, setLocalValue] = React84__default.useState(value);
9859
9966
  const handleChange = (e) => {
9860
9967
  setLocalValue(e.target.value);
9861
9968
  if (onChange) {
@@ -9893,7 +10000,7 @@ function TextareaPattern({
9893
10000
  fieldName
9894
10001
  }) {
9895
10002
  const { emit } = useEventBus();
9896
- const [localValue, setLocalValue] = React86__default.useState(value);
10003
+ const [localValue, setLocalValue] = React84__default.useState(value);
9897
10004
  const handleChange = (e) => {
9898
10005
  setLocalValue(e.target.value);
9899
10006
  if (onChange) {
@@ -9925,7 +10032,7 @@ function SelectPattern({
9925
10032
  fieldName
9926
10033
  }) {
9927
10034
  const { emit } = useEventBus();
9928
- const [localValue, setLocalValue] = React86__default.useState(value);
10035
+ const [localValue, setLocalValue] = React84__default.useState(value);
9929
10036
  const handleChange = (e) => {
9930
10037
  setLocalValue(e.target.value);
9931
10038
  if (onChange) {
@@ -9954,7 +10061,7 @@ function CheckboxPattern({
9954
10061
  className
9955
10062
  }) {
9956
10063
  const { emit } = useEventBus();
9957
- const [localChecked, setLocalChecked] = React86__default.useState(checked);
10064
+ const [localChecked, setLocalChecked] = React84__default.useState(checked);
9958
10065
  const handleChange = (e) => {
9959
10066
  setLocalChecked(e.target.checked);
9960
10067
  if (onChange) {
@@ -10186,8 +10293,8 @@ function ActionButtons({
10186
10293
  disabled
10187
10294
  }) {
10188
10295
  const eventBus = useEventBus();
10189
- const [activeButtons, setActiveButtons] = React86.useState(/* @__PURE__ */ new Set());
10190
- const handlePress = React86.useCallback(
10296
+ const [activeButtons, setActiveButtons] = React84.useState(/* @__PURE__ */ new Set());
10297
+ const handlePress = React84.useCallback(
10191
10298
  (id) => {
10192
10299
  setActiveButtons((prev) => new Set(prev).add(id));
10193
10300
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -10195,7 +10302,7 @@ function ActionButtons({
10195
10302
  },
10196
10303
  [actionEvent, eventBus, onAction]
10197
10304
  );
10198
- const handleRelease = React86.useCallback(
10305
+ const handleRelease = React84.useCallback(
10199
10306
  (id) => {
10200
10307
  setActiveButtons((prev) => {
10201
10308
  const next = new Set(prev);
@@ -10485,7 +10592,7 @@ var init_AuthLayout = __esm({
10485
10592
  init_Stack();
10486
10593
  init_Typography();
10487
10594
  AuthLayout = ({
10488
- appName = "{{APP_TITLE}}",
10595
+ appName = "My App",
10489
10596
  logo,
10490
10597
  backgroundImage,
10491
10598
  showBranding = true,
@@ -13188,6 +13295,263 @@ var init_katex_min = __esm({
13188
13295
  "node_modules/katex/dist/katex.min.css"() {
13189
13296
  }
13190
13297
  });
13298
+ var Tabs;
13299
+ var init_Tabs = __esm({
13300
+ "components/core/molecules/Tabs.tsx"() {
13301
+ "use client";
13302
+ init_Icon();
13303
+ init_Badge();
13304
+ init_Typography();
13305
+ init_Box();
13306
+ init_cn();
13307
+ init_useEventBus();
13308
+ Tabs = ({
13309
+ items,
13310
+ tabs,
13311
+ defaultActiveTab,
13312
+ activeTab: controlledActiveTab,
13313
+ onTabChange,
13314
+ tabChangeEvent,
13315
+ variant = "default",
13316
+ orientation = "horizontal",
13317
+ className
13318
+ }) => {
13319
+ const rawItems = items ?? tabs ?? [];
13320
+ const safeItems = rawItems.map(({ id, value, ...rest }) => ({
13321
+ ...rest,
13322
+ id: id || value || ""
13323
+ }));
13324
+ const eventBus = useEventBus();
13325
+ const { t } = useTranslate();
13326
+ const initialActive = safeItems.find((item) => item.active)?.id;
13327
+ const [internalActiveTab, setInternalActiveTab] = useState(
13328
+ defaultActiveTab || initialActive || safeItems[0]?.id || ""
13329
+ );
13330
+ const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
13331
+ const tabRefs = useRef({});
13332
+ const handleTabChange = (tabId, tabEvent) => {
13333
+ if (controlledActiveTab === void 0) {
13334
+ setInternalActiveTab(tabId);
13335
+ }
13336
+ onTabChange?.(tabId);
13337
+ if (tabChangeEvent) {
13338
+ eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
13339
+ }
13340
+ if (tabEvent) {
13341
+ eventBus.emit(`UI:${tabEvent}`, { tabId });
13342
+ }
13343
+ };
13344
+ const handleKeyDown = (e, index) => {
13345
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
13346
+ e.preventDefault();
13347
+ const direction = e.key === "ArrowLeft" ? -1 : 1;
13348
+ const nextIndex = (index + direction + safeItems.length) % safeItems.length;
13349
+ const nextTab = safeItems[nextIndex];
13350
+ if (nextTab && !nextTab.disabled) {
13351
+ handleTabChange(nextTab.id);
13352
+ tabRefs.current[nextTab.id]?.focus();
13353
+ }
13354
+ } else if (e.key === "Home" || e.key === "End") {
13355
+ e.preventDefault();
13356
+ const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
13357
+ const targetTab = safeItems[targetIndex];
13358
+ if (targetTab && !targetTab.disabled) {
13359
+ handleTabChange(targetTab.id);
13360
+ tabRefs.current[targetTab.id]?.focus();
13361
+ }
13362
+ }
13363
+ };
13364
+ const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
13365
+ if (safeItems.length === 0) {
13366
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
13367
+ }
13368
+ const variantClasses2 = {
13369
+ default: [
13370
+ "border-b-[length:var(--border-width)] border-transparent",
13371
+ "hover:border-muted-foreground",
13372
+ "data-[active=true]:border-primary"
13373
+ ].join(" "),
13374
+ pills: [
13375
+ "rounded-sm",
13376
+ "data-[active=true]:bg-primary",
13377
+ "data-[active=true]:text-primary-foreground"
13378
+ ].join(" "),
13379
+ underline: [
13380
+ "border-b-[length:var(--border-width)] border-transparent",
13381
+ "data-[active=true]:border-primary"
13382
+ ].join(" ")
13383
+ };
13384
+ return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
13385
+ /* @__PURE__ */ jsx(
13386
+ Box,
13387
+ {
13388
+ role: "tablist",
13389
+ className: cn(
13390
+ "flex",
13391
+ // Horizontal tab strip becomes a horizontally-scrollable lane
13392
+ // below its container width — phones with many tabs scroll
13393
+ // instead of clipping. `snap-x` snaps to each tab; the
13394
+ // scrollbar is hidden for a cleaner affordance (the swipe
13395
+ // gesture is the discoverability cue).
13396
+ orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
13397
+ variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
13398
+ variant === "underline" && orientation === "vertical" && "border-b-0"
13399
+ ),
13400
+ children: safeItems.map((item, index) => {
13401
+ const isActive = item.id === activeTab;
13402
+ const isDisabled = item.disabled;
13403
+ return /* @__PURE__ */ jsxs(
13404
+ Box,
13405
+ {
13406
+ as: "button",
13407
+ ref: (el) => {
13408
+ tabRefs.current[item.id] = el;
13409
+ },
13410
+ role: "tab",
13411
+ "aria-selected": isActive,
13412
+ "aria-controls": `tabpanel-${item.id}`,
13413
+ "aria-disabled": isDisabled,
13414
+ onClick: () => !isDisabled && handleTabChange(item.id, item.event),
13415
+ onKeyDown: (e) => handleKeyDown(e, index),
13416
+ "data-active": isActive,
13417
+ className: cn(
13418
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
13419
+ orientation === "horizontal" && "snap-start shrink-0",
13420
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
13421
+ isDisabled && "opacity-50 cursor-not-allowed",
13422
+ variantClasses2[variant],
13423
+ isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
13424
+ ),
13425
+ children: [
13426
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
13427
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
13428
+ item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
13429
+ ]
13430
+ },
13431
+ item.id
13432
+ );
13433
+ })
13434
+ }
13435
+ ),
13436
+ activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
13437
+ Box,
13438
+ {
13439
+ role: "tabpanel",
13440
+ id: `tabpanel-${activeTab}`,
13441
+ "aria-labelledby": `tab-${activeTab}`,
13442
+ className: "mt-4",
13443
+ children: activeTabContent
13444
+ }
13445
+ )
13446
+ ] });
13447
+ };
13448
+ Tabs.displayName = "Tabs";
13449
+ }
13450
+ });
13451
+ var ICON_NAME_ALIASES, lookStyles3, EmptyState;
13452
+ var init_EmptyState = __esm({
13453
+ "components/core/molecules/EmptyState.tsx"() {
13454
+ "use client";
13455
+ init_cn();
13456
+ init_atoms2();
13457
+ init_Box();
13458
+ init_Icon();
13459
+ init_Stack();
13460
+ init_Typography();
13461
+ init_useEventBus();
13462
+ ICON_NAME_ALIASES = {
13463
+ check: "check-circle",
13464
+ error: "x-circle",
13465
+ warning: "alert-circle"
13466
+ };
13467
+ lookStyles3 = {
13468
+ "icon-only": "",
13469
+ illustrated: "[&_svg]:w-32 [&_svg]:h-32",
13470
+ "text-only": "[&_svg]:hidden",
13471
+ mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
13472
+ };
13473
+ EmptyState = ({
13474
+ icon,
13475
+ title,
13476
+ message,
13477
+ description,
13478
+ actionLabel,
13479
+ onAction,
13480
+ className,
13481
+ destructive,
13482
+ variant,
13483
+ actionEvent,
13484
+ look = "icon-only"
13485
+ }) => {
13486
+ const eventBus = useEventBus();
13487
+ const { t } = useTranslate();
13488
+ const handleAction = () => {
13489
+ if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
13490
+ onAction?.();
13491
+ };
13492
+ const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
13493
+ const iconComponent = typeof icon === "function" ? icon : void 0;
13494
+ const hasIcon = Boolean(iconName || iconComponent);
13495
+ const isDestructive = destructive || variant === "error";
13496
+ const isSuccess = variant === "success";
13497
+ const displayText = title || message || t("empty.noItems");
13498
+ return /* @__PURE__ */ jsxs(
13499
+ VStack,
13500
+ {
13501
+ align: "center",
13502
+ className: cn(
13503
+ "justify-center py-12 text-center",
13504
+ lookStyles3[look],
13505
+ className
13506
+ ),
13507
+ children: [
13508
+ hasIcon && /* @__PURE__ */ jsx(
13509
+ Box,
13510
+ {
13511
+ className: cn(
13512
+ "mb-4 rounded-full p-3",
13513
+ isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
13514
+ ),
13515
+ children: /* @__PURE__ */ jsx(
13516
+ Icon,
13517
+ {
13518
+ ...iconName ? { name: iconName } : { icon: iconComponent },
13519
+ className: cn(
13520
+ "h-8 w-8",
13521
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
13522
+ )
13523
+ }
13524
+ )
13525
+ }
13526
+ ),
13527
+ /* @__PURE__ */ jsx(
13528
+ Typography,
13529
+ {
13530
+ variant: "h3",
13531
+ className: cn(
13532
+ "text-lg font-medium",
13533
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
13534
+ ),
13535
+ children: displayText
13536
+ }
13537
+ ),
13538
+ description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
13539
+ actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
13540
+ Button,
13541
+ {
13542
+ className: "mt-4",
13543
+ variant: isDestructive ? "danger" : "primary",
13544
+ onClick: handleAction,
13545
+ children: actionLabel
13546
+ }
13547
+ )
13548
+ ]
13549
+ }
13550
+ );
13551
+ };
13552
+ EmptyState.displayName = "EmptyState";
13553
+ }
13554
+ });
13191
13555
  function computeFoldRegions(code) {
13192
13556
  const lines = code.split("\n");
13193
13557
  const regions = [];
@@ -13225,9 +13589,32 @@ function computeFoldRegions(code) {
13225
13589
  function toCodeLanguage(value) {
13226
13590
  return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
13227
13591
  }
13228
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13592
+ function generateDiff(oldVal, newVal) {
13593
+ const oldLines = oldVal.split("\n");
13594
+ const newLines = newVal.split("\n");
13595
+ const diff = [];
13596
+ const maxLen = Math.max(oldLines.length, newLines.length);
13597
+ for (let i = 0; i < maxLen; i++) {
13598
+ const oldLine = oldLines[i];
13599
+ const newLine = newLines[i];
13600
+ if (oldLine === newLine) {
13601
+ diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
13602
+ } else {
13603
+ if (oldLine !== void 0) diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
13604
+ if (newLine !== void 0) diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
13605
+ }
13606
+ }
13607
+ return diff;
13608
+ }
13609
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13229
13610
  var init_CodeBlock = __esm({
13230
13611
  "components/core/molecules/markdown/CodeBlock.tsx"() {
13612
+ init_cn();
13613
+ init_atoms2();
13614
+ init_Tabs();
13615
+ init_LoadingState();
13616
+ init_ErrorState();
13617
+ init_EmptyState();
13231
13618
  init_Box();
13232
13619
  init_Button();
13233
13620
  init_Badge();
@@ -13334,9 +13721,14 @@ var init_CodeBlock = __esm({
13334
13721
  "lolo"
13335
13722
  ];
13336
13723
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
13724
+ DIFF_STYLES = {
13725
+ add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
13726
+ remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
13727
+ context: { bg: "", prefix: " ", text: "text-foreground" }
13728
+ };
13337
13729
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
13338
13730
  HIDDEN_LINE_NUMBERS = { display: "none" };
13339
- CodeBlock = React86__default.memo(
13731
+ CodeBlock = React84__default.memo(
13340
13732
  ({
13341
13733
  code: rawCode,
13342
13734
  language = "text",
@@ -13347,7 +13739,20 @@ var init_CodeBlock = __esm({
13347
13739
  className,
13348
13740
  editable = false,
13349
13741
  onChange,
13350
- errorLines
13742
+ errorLines,
13743
+ // viewer props
13744
+ title,
13745
+ mode = "code",
13746
+ diff: propDiff,
13747
+ oldValue,
13748
+ newValue,
13749
+ showLineNumbers = false,
13750
+ wordWrap = false,
13751
+ files,
13752
+ actions,
13753
+ isLoading = false,
13754
+ error,
13755
+ showCopy
13351
13756
  }) => {
13352
13757
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
13353
13758
  const isOrb = language === "orb";
@@ -13359,6 +13764,20 @@ var init_CodeBlock = __esm({
13359
13764
  const codeRef = useRef(null);
13360
13765
  const savedScrollLeftRef = useRef(0);
13361
13766
  const [copied, setCopied] = useState(false);
13767
+ const [wrap, setWrap] = useState(wordWrap);
13768
+ const [activeFileIndex, setActiveFileIndex] = useState(0);
13769
+ const activeFile = files?.[activeFileIndex];
13770
+ const activeCode = activeFile?.code ?? code;
13771
+ const activeLanguage = activeFile?.language ?? language;
13772
+ const diffLines = useMemo(() => {
13773
+ if (propDiff) return propDiff;
13774
+ if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
13775
+ return generateDiff(oldValue, newValue);
13776
+ }
13777
+ return null;
13778
+ }, [propDiff, mode, oldValue, newValue]);
13779
+ const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
13780
+ const effectiveCopy = showCopy ?? showCopyButton;
13362
13781
  const [editableValue, setEditableValue] = useState(code);
13363
13782
  const [editableTextareaKey, setEditableTextareaKey] = useState(0);
13364
13783
  const lastPropCodeRef = useRef(code);
@@ -13529,13 +13948,13 @@ var init_CodeBlock = __esm({
13529
13948
  }, [language, code]);
13530
13949
  const handleCopy = async () => {
13531
13950
  try {
13532
- await navigator.clipboard.writeText(code);
13951
+ await navigator.clipboard.writeText(activeCode);
13533
13952
  setCopied(true);
13534
- eventBus.emit("UI:COPY_CODE", { language, success: true });
13953
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
13535
13954
  setTimeout(() => setCopied(false), 2e3);
13536
13955
  } catch (err) {
13537
13956
  log7.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13538
- eventBus.emit("UI:COPY_CODE", { language, success: false });
13957
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
13539
13958
  }
13540
13959
  };
13541
13960
  const handleSelectionCopy = useCallback((e) => {
@@ -13588,11 +14007,134 @@ var init_CodeBlock = __esm({
13588
14007
  }
13589
14008
  });
13590
14009
  }
13591
- const full = code.split("\n").slice(a, endLine + 1).join("\n");
14010
+ const full = activeCode.split("\n").slice(a, endLine + 1).join("\n");
13592
14011
  e.clipboardData.setData("text/plain", full);
13593
14012
  e.preventDefault();
13594
14013
  }, [code]);
13595
- const hasHeader = showLanguageBadge || showCopyButton;
14014
+ if (isLoading) {
14015
+ return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
14016
+ }
14017
+ if (error) {
14018
+ return /* @__PURE__ */ jsx(ErrorState, { title: t("display.codeViewerError"), message: error.message, className });
14019
+ }
14020
+ if (isViewerMode && !activeCode && !diffLines) {
14021
+ return /* @__PURE__ */ jsx(EmptyState, { icon: Code, title: t("display.noCode"), description: "No code to display.", className });
14022
+ }
14023
+ if (isViewerMode) {
14024
+ const tabItems = files?.map((file, idx) => ({
14025
+ id: `file-${idx}`,
14026
+ label: file.label,
14027
+ content: null
14028
+ }));
14029
+ const lines = activeCode.split("\n");
14030
+ return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
14031
+ tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
14032
+ Tabs,
14033
+ {
14034
+ tabs: tabItems,
14035
+ activeTab: `file-${activeFileIndex}`,
14036
+ onTabChange: (id) => {
14037
+ const idx = parseInt(id.replace("file-", ""), 10);
14038
+ setActiveFileIndex(idx);
14039
+ }
14040
+ }
14041
+ ) }),
14042
+ /* @__PURE__ */ jsxs(
14043
+ HStack,
14044
+ {
14045
+ gap: "sm",
14046
+ align: "center",
14047
+ justify: "between",
14048
+ className: "px-4 py-2 border-b border-border bg-muted/30",
14049
+ children: [
14050
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
14051
+ /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
14052
+ title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
14053
+ activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
14054
+ ] }),
14055
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
14056
+ /* @__PURE__ */ jsx(
14057
+ Button,
14058
+ {
14059
+ variant: "ghost",
14060
+ size: "sm",
14061
+ icon: WrapText,
14062
+ onClick: () => setWrap(!wrap),
14063
+ className: cn(wrap && "text-primary")
14064
+ }
14065
+ ),
14066
+ effectiveCopy && /* @__PURE__ */ jsx(
14067
+ Button,
14068
+ {
14069
+ variant: "ghost",
14070
+ size: "sm",
14071
+ icon: copied ? Check : Copy,
14072
+ onClick: handleCopy,
14073
+ className: cn(copied && "text-success")
14074
+ }
14075
+ ),
14076
+ actions?.map((action, idx) => /* @__PURE__ */ jsx(
14077
+ Badge,
14078
+ {
14079
+ variant: "default",
14080
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
14081
+ onClick: () => {
14082
+ if (action.event) eventBus.emit(`UI:${action.event}`, {});
14083
+ },
14084
+ children: action.label
14085
+ },
14086
+ idx
14087
+ ))
14088
+ ] })
14089
+ ]
14090
+ }
14091
+ ),
14092
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
14093
+ const style = DIFF_STYLES[line.type];
14094
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
14095
+ showLineNumbers && /* @__PURE__ */ jsx(
14096
+ Typography,
14097
+ {
14098
+ variant: "caption",
14099
+ color: "secondary",
14100
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
14101
+ children: line.lineNumber ?? ""
14102
+ }
14103
+ ),
14104
+ /* @__PURE__ */ jsxs(
14105
+ Typography,
14106
+ {
14107
+ variant: "caption",
14108
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14109
+ children: [
14110
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
14111
+ line.content
14112
+ ]
14113
+ }
14114
+ )
14115
+ ] }, idx);
14116
+ }) }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
14117
+ showLineNumbers && /* @__PURE__ */ jsx(
14118
+ Typography,
14119
+ {
14120
+ variant: "caption",
14121
+ color: "secondary",
14122
+ className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
14123
+ children: idx + 1
14124
+ }
14125
+ ),
14126
+ /* @__PURE__ */ jsx(
14127
+ Typography,
14128
+ {
14129
+ variant: "caption",
14130
+ className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14131
+ children: line || " "
14132
+ }
14133
+ )
14134
+ ] }, idx)) }) })
14135
+ ] }) });
14136
+ }
14137
+ const hasHeader = showLanguageBadge || effectiveCopy;
13596
14138
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
13597
14139
  hasHeader && /* @__PURE__ */ jsxs(
13598
14140
  HStack,
@@ -13602,7 +14144,7 @@ var init_CodeBlock = __esm({
13602
14144
  className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
13603
14145
  children: [
13604
14146
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
13605
- showCopyButton && /* @__PURE__ */ jsx(
14147
+ effectiveCopy && /* @__PURE__ */ jsx(
13606
14148
  Button,
13607
14149
  {
13608
14150
  variant: "ghost",
@@ -13761,7 +14303,7 @@ var init_CodeBlock = __esm({
13761
14303
  )
13762
14304
  ] });
13763
14305
  },
13764
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
14306
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error
13765
14307
  );
13766
14308
  CodeBlock.displayName = "CodeBlock";
13767
14309
  }
@@ -13773,8 +14315,8 @@ var init_MarkdownContent = __esm({
13773
14315
  init_Box();
13774
14316
  init_CodeBlock();
13775
14317
  init_cn();
13776
- MarkdownContent = React86__default.memo(
13777
- ({ content, direction, className }) => {
14318
+ MarkdownContent = React84__default.memo(
14319
+ ({ content, direction = "ltr", className }) => {
13778
14320
  const { t: _t } = useTranslate();
13779
14321
  const safeContent = typeof content === "string" ? content : String(content ?? "");
13780
14322
  return /* @__PURE__ */ jsx(
@@ -14869,7 +15411,7 @@ var init_StateMachineView = __esm({
14869
15411
  style: { top: title ? 30 : 0 },
14870
15412
  children: [
14871
15413
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
14872
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React86__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15414
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React84__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14873
15415
  StateNode,
14874
15416
  {
14875
15417
  state,
@@ -16018,110 +16560,6 @@ var init_BookTableOfContents = __esm({
16018
16560
  BookTableOfContents.displayName = "BookTableOfContents";
16019
16561
  }
16020
16562
  });
16021
- var ICON_NAME_ALIASES, lookStyles3, EmptyState;
16022
- var init_EmptyState = __esm({
16023
- "components/core/molecules/EmptyState.tsx"() {
16024
- "use client";
16025
- init_cn();
16026
- init_atoms2();
16027
- init_Box();
16028
- init_Icon();
16029
- init_Stack();
16030
- init_Typography();
16031
- init_useEventBus();
16032
- ICON_NAME_ALIASES = {
16033
- check: "check-circle",
16034
- error: "x-circle",
16035
- warning: "alert-circle"
16036
- };
16037
- lookStyles3 = {
16038
- "icon-only": "",
16039
- illustrated: "[&_svg]:w-32 [&_svg]:h-32",
16040
- "text-only": "[&_svg]:hidden",
16041
- mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
16042
- };
16043
- EmptyState = ({
16044
- icon,
16045
- title,
16046
- message,
16047
- description,
16048
- actionLabel,
16049
- onAction,
16050
- className,
16051
- destructive,
16052
- variant,
16053
- actionEvent,
16054
- look = "icon-only"
16055
- }) => {
16056
- const eventBus = useEventBus();
16057
- const { t } = useTranslate();
16058
- const handleAction = () => {
16059
- if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
16060
- onAction?.();
16061
- };
16062
- const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
16063
- const iconComponent = typeof icon === "function" ? icon : void 0;
16064
- const hasIcon = Boolean(iconName || iconComponent);
16065
- const isDestructive = destructive || variant === "error";
16066
- const isSuccess = variant === "success";
16067
- const displayText = title || message || t("empty.noItems");
16068
- return /* @__PURE__ */ jsxs(
16069
- VStack,
16070
- {
16071
- align: "center",
16072
- className: cn(
16073
- "justify-center py-12 text-center",
16074
- lookStyles3[look],
16075
- className
16076
- ),
16077
- children: [
16078
- hasIcon && /* @__PURE__ */ jsx(
16079
- Box,
16080
- {
16081
- className: cn(
16082
- "mb-4 rounded-full p-3",
16083
- isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
16084
- ),
16085
- children: /* @__PURE__ */ jsx(
16086
- Icon,
16087
- {
16088
- ...iconName ? { name: iconName } : { icon: iconComponent },
16089
- className: cn(
16090
- "h-8 w-8",
16091
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
16092
- )
16093
- }
16094
- )
16095
- }
16096
- ),
16097
- /* @__PURE__ */ jsx(
16098
- Typography,
16099
- {
16100
- variant: "h3",
16101
- className: cn(
16102
- "text-lg font-medium",
16103
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
16104
- ),
16105
- children: displayText
16106
- }
16107
- ),
16108
- description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
16109
- actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
16110
- Button,
16111
- {
16112
- className: "mt-4",
16113
- variant: isDestructive ? "danger" : "primary",
16114
- onClick: handleAction,
16115
- children: actionLabel
16116
- }
16117
- )
16118
- ]
16119
- }
16120
- );
16121
- };
16122
- EmptyState.displayName = "EmptyState";
16123
- }
16124
- });
16125
16563
 
16126
16564
  // components/core/organisms/book/types.ts
16127
16565
  function resolveFieldMap(fieldMap) {
@@ -16474,7 +16912,7 @@ var init_Grid = __esm({
16474
16912
  as: Component = "div"
16475
16913
  }) => {
16476
16914
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
16477
- return React86__default.createElement(
16915
+ return React84__default.createElement(
16478
16916
  Component,
16479
16917
  {
16480
16918
  className: cn(
@@ -20917,449 +21355,6 @@ var init_ClassifierBoard = __esm({
20917
21355
  ClassifierBoard.displayName = "ClassifierBoard";
20918
21356
  }
20919
21357
  });
20920
- function CodeView({
20921
- data,
20922
- label,
20923
- defaultExpanded = false,
20924
- className
20925
- }) {
20926
- const { t } = useTranslate();
20927
- const [expanded, setExpanded] = useState(defaultExpanded);
20928
- const jsonString = JSON.stringify(data, null, 2);
20929
- return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
20930
- /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
20931
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
20932
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
20933
- ] }),
20934
- expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
20935
- Typography,
20936
- {
20937
- variant: "caption",
20938
- className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
20939
- children: jsonString
20940
- }
20941
- ) })
20942
- ] });
20943
- }
20944
- var init_CodeView = __esm({
20945
- "components/game/organisms/puzzles/state-architect/CodeView.tsx"() {
20946
- init_atoms2();
20947
- init_cn();
20948
- CodeView.displayName = "CodeView";
20949
- }
20950
- });
20951
- var Tabs;
20952
- var init_Tabs = __esm({
20953
- "components/core/molecules/Tabs.tsx"() {
20954
- "use client";
20955
- init_Icon();
20956
- init_Badge();
20957
- init_Typography();
20958
- init_Box();
20959
- init_cn();
20960
- init_useEventBus();
20961
- Tabs = ({
20962
- items,
20963
- tabs,
20964
- defaultActiveTab,
20965
- activeTab: controlledActiveTab,
20966
- onTabChange,
20967
- tabChangeEvent,
20968
- variant = "default",
20969
- orientation = "horizontal",
20970
- className
20971
- }) => {
20972
- const rawItems = items ?? tabs ?? [];
20973
- const safeItems = rawItems.map(({ id, value, ...rest }) => ({
20974
- ...rest,
20975
- id: id || value || ""
20976
- }));
20977
- const eventBus = useEventBus();
20978
- const { t } = useTranslate();
20979
- const initialActive = safeItems.find((item) => item.active)?.id;
20980
- const [internalActiveTab, setInternalActiveTab] = useState(
20981
- defaultActiveTab || initialActive || safeItems[0]?.id || ""
20982
- );
20983
- const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
20984
- const tabRefs = useRef({});
20985
- const handleTabChange = (tabId, tabEvent) => {
20986
- if (controlledActiveTab === void 0) {
20987
- setInternalActiveTab(tabId);
20988
- }
20989
- onTabChange?.(tabId);
20990
- if (tabChangeEvent) {
20991
- eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
20992
- }
20993
- if (tabEvent) {
20994
- eventBus.emit(`UI:${tabEvent}`, { tabId });
20995
- }
20996
- };
20997
- const handleKeyDown = (e, index) => {
20998
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
20999
- e.preventDefault();
21000
- const direction = e.key === "ArrowLeft" ? -1 : 1;
21001
- const nextIndex = (index + direction + safeItems.length) % safeItems.length;
21002
- const nextTab = safeItems[nextIndex];
21003
- if (nextTab && !nextTab.disabled) {
21004
- handleTabChange(nextTab.id);
21005
- tabRefs.current[nextTab.id]?.focus();
21006
- }
21007
- } else if (e.key === "Home" || e.key === "End") {
21008
- e.preventDefault();
21009
- const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
21010
- const targetTab = safeItems[targetIndex];
21011
- if (targetTab && !targetTab.disabled) {
21012
- handleTabChange(targetTab.id);
21013
- tabRefs.current[targetTab.id]?.focus();
21014
- }
21015
- }
21016
- };
21017
- const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
21018
- if (safeItems.length === 0) {
21019
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
21020
- }
21021
- const variantClasses2 = {
21022
- default: [
21023
- "border-b-[length:var(--border-width)] border-transparent",
21024
- "hover:border-muted-foreground",
21025
- "data-[active=true]:border-primary"
21026
- ].join(" "),
21027
- pills: [
21028
- "rounded-sm",
21029
- "data-[active=true]:bg-primary",
21030
- "data-[active=true]:text-primary-foreground"
21031
- ].join(" "),
21032
- underline: [
21033
- "border-b-[length:var(--border-width)] border-transparent",
21034
- "data-[active=true]:border-primary"
21035
- ].join(" ")
21036
- };
21037
- return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
21038
- /* @__PURE__ */ jsx(
21039
- Box,
21040
- {
21041
- role: "tablist",
21042
- className: cn(
21043
- "flex",
21044
- // Horizontal tab strip becomes a horizontally-scrollable lane
21045
- // below its container width — phones with many tabs scroll
21046
- // instead of clipping. `snap-x` snaps to each tab; the
21047
- // scrollbar is hidden for a cleaner affordance (the swipe
21048
- // gesture is the discoverability cue).
21049
- orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
21050
- variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
21051
- variant === "underline" && orientation === "vertical" && "border-b-0"
21052
- ),
21053
- children: safeItems.map((item, index) => {
21054
- const isActive = item.id === activeTab;
21055
- const isDisabled = item.disabled;
21056
- return /* @__PURE__ */ jsxs(
21057
- Box,
21058
- {
21059
- as: "button",
21060
- ref: (el) => {
21061
- tabRefs.current[item.id] = el;
21062
- },
21063
- role: "tab",
21064
- "aria-selected": isActive,
21065
- "aria-controls": `tabpanel-${item.id}`,
21066
- "aria-disabled": isDisabled,
21067
- onClick: () => !isDisabled && handleTabChange(item.id, item.event),
21068
- onKeyDown: (e) => handleKeyDown(e, index),
21069
- "data-active": isActive,
21070
- className: cn(
21071
- "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
21072
- orientation === "horizontal" && "snap-start shrink-0",
21073
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
21074
- isDisabled && "opacity-50 cursor-not-allowed",
21075
- variantClasses2[variant],
21076
- isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
21077
- ),
21078
- children: [
21079
- item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
21080
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
21081
- item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
21082
- ]
21083
- },
21084
- item.id
21085
- );
21086
- })
21087
- }
21088
- ),
21089
- activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
21090
- Box,
21091
- {
21092
- role: "tabpanel",
21093
- id: `tabpanel-${activeTab}`,
21094
- "aria-labelledby": `tab-${activeTab}`,
21095
- className: "mt-4",
21096
- children: activeTabContent
21097
- }
21098
- )
21099
- ] });
21100
- };
21101
- Tabs.displayName = "Tabs";
21102
- }
21103
- });
21104
- function generateDiff(oldVal, newVal) {
21105
- const oldLines = oldVal.split("\n");
21106
- const newLines = newVal.split("\n");
21107
- const diff = [];
21108
- const maxLen = Math.max(oldLines.length, newLines.length);
21109
- for (let i = 0; i < maxLen; i++) {
21110
- const oldLine = oldLines[i];
21111
- const newLine = newLines[i];
21112
- if (oldLine === newLine) {
21113
- diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
21114
- } else {
21115
- if (oldLine !== void 0) {
21116
- diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
21117
- }
21118
- if (newLine !== void 0) {
21119
- diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
21120
- }
21121
- }
21122
- }
21123
- return diff;
21124
- }
21125
- var DIFF_STYLES, CodeViewer;
21126
- var init_CodeViewer = __esm({
21127
- "components/core/molecules/CodeViewer.tsx"() {
21128
- "use client";
21129
- init_cn();
21130
- init_atoms2();
21131
- init_Stack();
21132
- init_LoadingState();
21133
- init_ErrorState();
21134
- init_EmptyState();
21135
- init_Tabs();
21136
- init_useEventBus();
21137
- DIFF_STYLES = {
21138
- add: {
21139
- bg: "bg-success/10",
21140
- prefix: "+",
21141
- text: "text-success"
21142
- },
21143
- remove: {
21144
- bg: "bg-error/10",
21145
- prefix: "-",
21146
- text: "text-error"
21147
- },
21148
- context: {
21149
- bg: "",
21150
- prefix: " ",
21151
- text: "text-foreground"
21152
- }
21153
- };
21154
- CodeViewer = ({
21155
- title,
21156
- code,
21157
- language,
21158
- diff: propDiff,
21159
- oldValue,
21160
- newValue,
21161
- mode = "code",
21162
- showLineNumbers = true,
21163
- showCopy = true,
21164
- wordWrap = false,
21165
- maxHeight = 500,
21166
- files,
21167
- actions,
21168
- entity,
21169
- isLoading = false,
21170
- error,
21171
- className
21172
- }) => {
21173
- const eventBus = useEventBus();
21174
- const { t } = useTranslate();
21175
- const [copied, setCopied] = useState(false);
21176
- const [wrap, setWrap] = useState(wordWrap);
21177
- const [activeFileIndex, setActiveFileIndex] = useState(0);
21178
- const handleAction = useCallback(
21179
- (action) => {
21180
- if (action.event) {
21181
- eventBus.emit(`UI:${action.event}`, {});
21182
- }
21183
- },
21184
- [eventBus]
21185
- );
21186
- const activeFile = files?.[activeFileIndex];
21187
- const activeCode = activeFile?.code ?? code ?? "";
21188
- const activeLanguage = activeFile?.language ?? language ?? "text";
21189
- const lines = useMemo(() => activeCode.split("\n"), [activeCode]);
21190
- const diffLines = useMemo(() => {
21191
- if (propDiff) return propDiff;
21192
- if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
21193
- return generateDiff(oldValue, newValue);
21194
- }
21195
- return null;
21196
- }, [propDiff, mode, oldValue, newValue]);
21197
- const handleCopy = useCallback(async () => {
21198
- try {
21199
- await navigator.clipboard.writeText(activeCode);
21200
- setCopied(true);
21201
- eventBus.emit("UI:CODE_COPY", { language: activeLanguage });
21202
- setTimeout(() => setCopied(false), 2e3);
21203
- } catch {
21204
- }
21205
- }, [activeCode, eventBus, activeLanguage]);
21206
- const tabItems = files?.map((file, idx) => ({
21207
- id: `file-${idx}`,
21208
- label: file.label,
21209
- content: null
21210
- }));
21211
- if (isLoading) {
21212
- return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
21213
- }
21214
- if (error) {
21215
- return /* @__PURE__ */ jsx(
21216
- ErrorState,
21217
- {
21218
- title: t("display.codeViewerError"),
21219
- message: error.message,
21220
- className
21221
- }
21222
- );
21223
- }
21224
- if (!activeCode && !diffLines) {
21225
- return /* @__PURE__ */ jsx(
21226
- EmptyState,
21227
- {
21228
- icon: Code,
21229
- title: t("display.noCode"),
21230
- description: "No code to display.",
21231
- className
21232
- }
21233
- );
21234
- }
21235
- return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
21236
- tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
21237
- Tabs,
21238
- {
21239
- tabs: tabItems,
21240
- activeTab: `file-${activeFileIndex}`,
21241
- onTabChange: (id) => {
21242
- const idx = parseInt(id.replace("file-", ""), 10);
21243
- setActiveFileIndex(idx);
21244
- }
21245
- }
21246
- ) }),
21247
- /* @__PURE__ */ jsxs(
21248
- HStack,
21249
- {
21250
- gap: "sm",
21251
- align: "center",
21252
- justify: "between",
21253
- className: "px-4 py-2 border-b border-border bg-muted/30",
21254
- children: [
21255
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
21256
- /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
21257
- title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
21258
- activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
21259
- ] }),
21260
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
21261
- /* @__PURE__ */ jsx(
21262
- Button,
21263
- {
21264
- variant: "ghost",
21265
- size: "sm",
21266
- icon: WrapText,
21267
- onClick: () => setWrap(!wrap),
21268
- className: cn(wrap && "text-primary")
21269
- }
21270
- ),
21271
- showCopy && /* @__PURE__ */ jsx(
21272
- Button,
21273
- {
21274
- variant: "ghost",
21275
- size: "sm",
21276
- icon: copied ? Check : Copy,
21277
- onClick: handleCopy,
21278
- className: cn(copied && "text-success")
21279
- }
21280
- ),
21281
- actions?.map((action, idx) => /* @__PURE__ */ jsx(
21282
- Badge,
21283
- {
21284
- variant: "default",
21285
- className: "cursor-pointer hover:opacity-80 transition-opacity",
21286
- onClick: () => handleAction(action),
21287
- children: action.label
21288
- },
21289
- idx
21290
- ))
21291
- ] })
21292
- ]
21293
- }
21294
- ),
21295
- /* @__PURE__ */ jsx(
21296
- Box,
21297
- {
21298
- className: "overflow-auto bg-muted/20",
21299
- style: { maxHeight },
21300
- children: diffLines ? (
21301
- /* Diff mode */
21302
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: diffLines.map((line, idx) => {
21303
- const style = DIFF_STYLES[line.type];
21304
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
21305
- showLineNumbers && /* @__PURE__ */ jsx(
21306
- Typography,
21307
- {
21308
- variant: "caption",
21309
- color: "secondary",
21310
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
21311
- children: line.lineNumber ?? ""
21312
- }
21313
- ),
21314
- /* @__PURE__ */ jsxs(
21315
- Typography,
21316
- {
21317
- variant: "caption",
21318
- className: cn(
21319
- "font-mono flex-1 min-w-0",
21320
- style.text,
21321
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
21322
- ),
21323
- children: [
21324
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
21325
- line.content
21326
- ]
21327
- }
21328
- )
21329
- ] }, idx);
21330
- }) })
21331
- ) : (
21332
- /* Code mode */
21333
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
21334
- showLineNumbers && /* @__PURE__ */ jsx(
21335
- Typography,
21336
- {
21337
- variant: "caption",
21338
- color: "secondary",
21339
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
21340
- children: idx + 1
21341
- }
21342
- ),
21343
- /* @__PURE__ */ jsx(
21344
- Typography,
21345
- {
21346
- variant: "caption",
21347
- className: cn(
21348
- "font-mono flex-1 min-w-0",
21349
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
21350
- ),
21351
- children: line || " "
21352
- }
21353
- )
21354
- ] }, idx)) })
21355
- )
21356
- }
21357
- )
21358
- ] }) });
21359
- };
21360
- CodeViewer.displayName = "CodeViewer";
21361
- }
21362
- });
21363
21358
  function CombatLog({
21364
21359
  events: events2,
21365
21360
  maxVisible = 50,
@@ -21834,7 +21829,7 @@ function CraftingRecipe({
21834
21829
  className
21835
21830
  }) {
21836
21831
  const eventBus = useEventBus();
21837
- const handleCraft = React86.useCallback(() => {
21832
+ const handleCraft = React84.useCallback(() => {
21838
21833
  onCraft?.();
21839
21834
  if (craftEvent) {
21840
21835
  eventBus.emit(craftEvent, { output: output.label });
@@ -21851,7 +21846,7 @@ function CraftingRecipe({
21851
21846
  children: [
21852
21847
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
21853
21848
  const hasSufficient = ingredient.available >= ingredient.required;
21854
- return /* @__PURE__ */ jsxs(React86.Fragment, { children: [
21849
+ return /* @__PURE__ */ jsxs(React84.Fragment, { children: [
21855
21850
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
21856
21851
  ItemSlot,
21857
21852
  {
@@ -21914,8 +21909,8 @@ function DPad({
21914
21909
  }) {
21915
21910
  const eventBus = useEventBus();
21916
21911
  const sizes = sizeMap15[size];
21917
- const [activeDirections, setActiveDirections] = React86.useState(/* @__PURE__ */ new Set());
21918
- const handlePress = React86.useCallback(
21912
+ const [activeDirections, setActiveDirections] = React84.useState(/* @__PURE__ */ new Set());
21913
+ const handlePress = React84.useCallback(
21919
21914
  (direction) => {
21920
21915
  setActiveDirections((prev) => new Set(prev).add(direction));
21921
21916
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -21923,7 +21918,7 @@ function DPad({
21923
21918
  },
21924
21919
  [directionEvent, eventBus, onDirection]
21925
21920
  );
21926
- const handleRelease = React86.useCallback(
21921
+ const handleRelease = React84.useCallback(
21927
21922
  (direction) => {
21928
21923
  setActiveDirections((prev) => {
21929
21924
  const next = new Set(prev);
@@ -22609,14 +22604,14 @@ function useDataDnd(args) {
22609
22604
  const isZone = Boolean(dragGroup || accepts || sortable);
22610
22605
  const enabled = isZone || Boolean(dndRoot);
22611
22606
  const eventBus = useEventBus();
22612
- const parentRoot = React86__default.useContext(RootCtx);
22607
+ const parentRoot = React84__default.useContext(RootCtx);
22613
22608
  const isRoot = enabled && parentRoot === null;
22614
- const zoneId = React86__default.useId();
22609
+ const zoneId = React84__default.useId();
22615
22610
  const ownGroup = dragGroup ?? accepts ?? zoneId;
22616
- const [optimisticOrders, setOptimisticOrders] = React86__default.useState(() => /* @__PURE__ */ new Map());
22617
- const optimisticOrdersRef = React86__default.useRef(optimisticOrders);
22611
+ const [optimisticOrders, setOptimisticOrders] = React84__default.useState(() => /* @__PURE__ */ new Map());
22612
+ const optimisticOrdersRef = React84__default.useRef(optimisticOrders);
22618
22613
  optimisticOrdersRef.current = optimisticOrders;
22619
- const clearOptimisticOrder = React86__default.useCallback((group) => {
22614
+ const clearOptimisticOrder = React84__default.useCallback((group) => {
22620
22615
  setOptimisticOrders((prev) => {
22621
22616
  if (!prev.has(group)) return prev;
22622
22617
  const next = new Map(prev);
@@ -22641,7 +22636,7 @@ function useDataDnd(args) {
22641
22636
  const raw = it[dndItemIdField];
22642
22637
  return String(raw ?? `__idx_${idx}`);
22643
22638
  }).join("|");
22644
- const itemIds = React86__default.useMemo(
22639
+ const itemIds = React84__default.useMemo(
22645
22640
  () => orderedItems.map((it, idx) => {
22646
22641
  const raw = it[dndItemIdField];
22647
22642
  return raw ?? `__idx_${idx}`;
@@ -22649,7 +22644,7 @@ function useDataDnd(args) {
22649
22644
  [itemIdsSignature]
22650
22645
  );
22651
22646
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
22652
- React86__default.useEffect(() => {
22647
+ React84__default.useEffect(() => {
22653
22648
  const root = isRoot ? null : parentRoot;
22654
22649
  if (root) {
22655
22650
  root.clearOptimisticOrder(ownGroup);
@@ -22657,20 +22652,20 @@ function useDataDnd(args) {
22657
22652
  clearOptimisticOrder(ownGroup);
22658
22653
  }
22659
22654
  }, [itemsContentSig, ownGroup]);
22660
- const zonesRef = React86__default.useRef(/* @__PURE__ */ new Map());
22661
- const registerZone = React86__default.useCallback((zoneId2, meta2) => {
22655
+ const zonesRef = React84__default.useRef(/* @__PURE__ */ new Map());
22656
+ const registerZone = React84__default.useCallback((zoneId2, meta2) => {
22662
22657
  zonesRef.current.set(zoneId2, meta2);
22663
22658
  }, []);
22664
- const unregisterZone = React86__default.useCallback((zoneId2) => {
22659
+ const unregisterZone = React84__default.useCallback((zoneId2) => {
22665
22660
  zonesRef.current.delete(zoneId2);
22666
22661
  }, []);
22667
- const [activeDrag, setActiveDrag] = React86__default.useState(null);
22668
- const [overZoneGroup, setOverZoneGroup] = React86__default.useState(null);
22669
- const meta = React86__default.useMemo(
22662
+ const [activeDrag, setActiveDrag] = React84__default.useState(null);
22663
+ const [overZoneGroup, setOverZoneGroup] = React84__default.useState(null);
22664
+ const meta = React84__default.useMemo(
22670
22665
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
22671
22666
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
22672
22667
  );
22673
- React86__default.useEffect(() => {
22668
+ React84__default.useEffect(() => {
22674
22669
  const target = isRoot ? null : parentRoot;
22675
22670
  if (!target) {
22676
22671
  zonesRef.current.set(zoneId, meta);
@@ -22689,7 +22684,7 @@ function useDataDnd(args) {
22689
22684
  }, [parentRoot, isRoot, zoneId, meta]);
22690
22685
  const sensors = useAlmadarDndSensors(true);
22691
22686
  const collisionDetection = almadarDndCollisionDetection;
22692
- const findZoneByItem = React86__default.useCallback(
22687
+ const findZoneByItem = React84__default.useCallback(
22693
22688
  (id) => {
22694
22689
  for (const z of zonesRef.current.values()) {
22695
22690
  if (z.itemIds.includes(id)) return z;
@@ -22698,7 +22693,7 @@ function useDataDnd(args) {
22698
22693
  },
22699
22694
  []
22700
22695
  );
22701
- React86__default.useCallback(
22696
+ React84__default.useCallback(
22702
22697
  (group) => {
22703
22698
  for (const z of zonesRef.current.values()) {
22704
22699
  if (z.group === group) return z;
@@ -22707,7 +22702,7 @@ function useDataDnd(args) {
22707
22702
  },
22708
22703
  []
22709
22704
  );
22710
- const handleDragEnd = React86__default.useCallback(
22705
+ const handleDragEnd = React84__default.useCallback(
22711
22706
  (event) => {
22712
22707
  const { active, over } = event;
22713
22708
  const activeIdStr = String(active.id);
@@ -22798,8 +22793,8 @@ function useDataDnd(args) {
22798
22793
  },
22799
22794
  [eventBus]
22800
22795
  );
22801
- const sortableData = React86__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22802
- const SortableItem = React86__default.useCallback(
22796
+ const sortableData = React84__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22797
+ const SortableItem = React84__default.useCallback(
22803
22798
  ({ id, children }) => {
22804
22799
  const {
22805
22800
  attributes,
@@ -22839,7 +22834,7 @@ function useDataDnd(args) {
22839
22834
  id: droppableId,
22840
22835
  data: sortableData
22841
22836
  });
22842
- const ctx = React86__default.useContext(RootCtx);
22837
+ const ctx = React84__default.useContext(RootCtx);
22843
22838
  const activeDrag2 = ctx?.activeDrag ?? null;
22844
22839
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22845
22840
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22854,7 +22849,7 @@ function useDataDnd(args) {
22854
22849
  showForeignPlaceholder,
22855
22850
  ctxAvailable: ctx != null
22856
22851
  });
22857
- React86__default.useEffect(() => {
22852
+ React84__default.useEffect(() => {
22858
22853
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22859
22854
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22860
22855
  return /* @__PURE__ */ jsx(
@@ -22868,11 +22863,11 @@ function useDataDnd(args) {
22868
22863
  }
22869
22864
  );
22870
22865
  };
22871
- const rootContextValue = React86__default.useMemo(
22866
+ const rootContextValue = React84__default.useMemo(
22872
22867
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22873
22868
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22874
22869
  );
22875
- const handleDragStart = React86__default.useCallback((event) => {
22870
+ const handleDragStart = React84__default.useCallback((event) => {
22876
22871
  const sourceZone = findZoneByItem(event.active.id);
22877
22872
  const rect = event.active.rect.current.initial;
22878
22873
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22891,7 +22886,7 @@ function useDataDnd(args) {
22891
22886
  isRoot
22892
22887
  });
22893
22888
  }, [findZoneByItem, isRoot, zoneId]);
22894
- const handleDragOver = React86__default.useCallback((event) => {
22889
+ const handleDragOver = React84__default.useCallback((event) => {
22895
22890
  const { active, over } = event;
22896
22891
  const overData = over?.data?.current;
22897
22892
  const overGroup = overData?.dndGroup ?? null;
@@ -22961,7 +22956,7 @@ function useDataDnd(args) {
22961
22956
  return next;
22962
22957
  });
22963
22958
  }, []);
22964
- const handleDragCancel = React86__default.useCallback((event) => {
22959
+ const handleDragCancel = React84__default.useCallback((event) => {
22965
22960
  setActiveDrag(null);
22966
22961
  setOverZoneGroup(null);
22967
22962
  dndLog.warn("dragCancel", {
@@ -22969,12 +22964,12 @@ function useDataDnd(args) {
22969
22964
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22970
22965
  });
22971
22966
  }, []);
22972
- const handleDragEndWithCleanup = React86__default.useCallback((event) => {
22967
+ const handleDragEndWithCleanup = React84__default.useCallback((event) => {
22973
22968
  handleDragEnd(event);
22974
22969
  setActiveDrag(null);
22975
22970
  setOverZoneGroup(null);
22976
22971
  }, [handleDragEnd]);
22977
- const wrapContainer = React86__default.useCallback(
22972
+ const wrapContainer = React84__default.useCallback(
22978
22973
  (children) => {
22979
22974
  if (!enabled) return children;
22980
22975
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -23028,7 +23023,7 @@ var init_useDataDnd = __esm({
23028
23023
  init_useAlmadarDndCollision();
23029
23024
  init_Box();
23030
23025
  dndLog = createLogger("almadar:ui:dnd");
23031
- RootCtx = React86__default.createContext(null);
23026
+ RootCtx = React84__default.createContext(null);
23032
23027
  }
23033
23028
  });
23034
23029
  function fieldLabel2(key) {
@@ -23548,7 +23543,7 @@ function DataList({
23548
23543
  }) {
23549
23544
  const eventBus = useEventBus();
23550
23545
  const { t } = useTranslate();
23551
- const [visibleCount, setVisibleCount] = React86__default.useState(pageSize || Infinity);
23546
+ const [visibleCount, setVisibleCount] = React84__default.useState(pageSize || Infinity);
23552
23547
  const fieldDefs = fields ?? columns ?? [];
23553
23548
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
23554
23549
  const dnd = useDataDnd({
@@ -23567,7 +23562,7 @@ function DataList({
23567
23562
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
23568
23563
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
23569
23564
  const hasRenderProp = typeof children === "function";
23570
- React86__default.useEffect(() => {
23565
+ React84__default.useEffect(() => {
23571
23566
  const renderItemTypeOf = typeof schemaRenderItem;
23572
23567
  const childrenTypeOf = typeof children;
23573
23568
  if (data.length > 0 && !hasRenderProp) {
@@ -23672,7 +23667,7 @@ function DataList({
23672
23667
  const items2 = data.map((item) => item);
23673
23668
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
23674
23669
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
23675
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
23670
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
23676
23671
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
23677
23672
  group.items.map((itemData, index) => {
23678
23673
  const id = itemData.id || `${gi}-${index}`;
@@ -23820,7 +23815,7 @@ function DataList({
23820
23815
  className
23821
23816
  ),
23822
23817
  children: [
23823
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
23818
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
23824
23819
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23825
23820
  group.items.map(
23826
23821
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -25194,7 +25189,7 @@ var init_WizardProgress = __esm({
25194
25189
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
25195
25190
  const isActive = index === currentStep;
25196
25191
  const isCompleted = index < currentStep;
25197
- return /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
25192
+ return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
25198
25193
  /* @__PURE__ */ jsx(
25199
25194
  "button",
25200
25195
  {
@@ -25711,8 +25706,9 @@ var init_FormSectionHeader = __esm({
25711
25706
  Box,
25712
25707
  {
25713
25708
  className: cn(
25714
- "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
25715
- isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
25709
+ "px-5 py-4 bg-muted/60 rounded-lg",
25710
+ "border border-border border-l-4 border-l-primary",
25711
+ isClickable && "cursor-pointer hover:bg-muted transition-colors",
25716
25712
  className
25717
25713
  ),
25718
25714
  onClick: isClickable ? onToggle : void 0,
@@ -25723,7 +25719,7 @@ var init_FormSectionHeader = __esm({
25723
25719
  {
25724
25720
  name: icon,
25725
25721
  size: "md",
25726
- className: "text-primary"
25722
+ className: "text-primary shrink-0"
25727
25723
  }
25728
25724
  ),
25729
25725
  statusIcon && /* @__PURE__ */ jsx(
@@ -25731,12 +25727,15 @@ var init_FormSectionHeader = __esm({
25731
25727
  {
25732
25728
  name: statusIcon,
25733
25729
  size: "md",
25734
- className: hasErrors ? "text-error" : "text-success"
25730
+ className: cn(
25731
+ "shrink-0",
25732
+ hasErrors ? "text-error" : "text-success"
25733
+ )
25735
25734
  }
25736
25735
  ),
25737
25736
  /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
25738
- /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
25739
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
25737
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", className: "text-foreground", children: title }),
25738
+ subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "leading-snug", children: subtitle })
25740
25739
  ] })
25741
25740
  ] }),
25742
25741
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -25745,9 +25744,9 @@ var init_FormSectionHeader = __esm({
25745
25744
  Icon,
25746
25745
  {
25747
25746
  name: "chevron-down",
25748
- size: "md",
25747
+ size: "sm",
25749
25748
  className: cn(
25750
- "text-muted-foreground transition-transform",
25749
+ "text-muted-foreground transition-transform duration-200 shrink-0",
25751
25750
  isCollapsed && "-rotate-90"
25752
25751
  )
25753
25752
  }
@@ -26249,7 +26248,7 @@ function InventoryGrid({
26249
26248
  const eventBus = useEventBus();
26250
26249
  const slotCount = totalSlots ?? items.length;
26251
26250
  const emptySlotCount = Math.max(0, slotCount - items.length);
26252
- const handleSelect = React86.useCallback(
26251
+ const handleSelect = React84.useCallback(
26253
26252
  (id) => {
26254
26253
  onSelect?.(id);
26255
26254
  if (selectEvent) {
@@ -26466,31 +26465,31 @@ function GameCanvas2D({
26466
26465
  assetBaseUrl = "",
26467
26466
  className
26468
26467
  }) {
26469
- const canvasRef = React86.useRef(null);
26470
- const rafRef = React86.useRef(0);
26471
- const frameRef = React86.useRef(0);
26472
- const lastTimeRef = React86.useRef(0);
26473
- const imageCache = React86.useRef(/* @__PURE__ */ new Map());
26468
+ const canvasRef = React84.useRef(null);
26469
+ const rafRef = React84.useRef(0);
26470
+ const frameRef = React84.useRef(0);
26471
+ const lastTimeRef = React84.useRef(0);
26472
+ const imageCache = React84.useRef(/* @__PURE__ */ new Map());
26474
26473
  const emit = useEmitEvent();
26475
- const onDrawRef = React86.useRef(onDraw);
26474
+ const onDrawRef = React84.useRef(onDraw);
26476
26475
  onDrawRef.current = onDraw;
26477
- const onTickRef = React86.useRef(onTick);
26476
+ const onTickRef = React84.useRef(onTick);
26478
26477
  onTickRef.current = onTick;
26479
- const tickEventRef = React86.useRef(tickEvent);
26478
+ const tickEventRef = React84.useRef(tickEvent);
26480
26479
  tickEventRef.current = tickEvent;
26481
- const drawEventRef = React86.useRef(drawEvent);
26480
+ const drawEventRef = React84.useRef(drawEvent);
26482
26481
  drawEventRef.current = drawEvent;
26483
- const emitRef = React86.useRef(emit);
26482
+ const emitRef = React84.useRef(emit);
26484
26483
  emitRef.current = emit;
26485
- const assetBaseUrlRef = React86.useRef(assetBaseUrl);
26484
+ const assetBaseUrlRef = React84.useRef(assetBaseUrl);
26486
26485
  assetBaseUrlRef.current = assetBaseUrl;
26487
- const backgroundImageRef = React86.useRef(backgroundImage);
26486
+ const backgroundImageRef = React84.useRef(backgroundImage);
26488
26487
  backgroundImageRef.current = backgroundImage;
26489
- const widthRef = React86.useRef(width);
26488
+ const widthRef = React84.useRef(width);
26490
26489
  widthRef.current = width;
26491
- const heightRef = React86.useRef(height);
26490
+ const heightRef = React84.useRef(height);
26492
26491
  heightRef.current = height;
26493
- const loadImage = React86.useCallback((url) => {
26492
+ const loadImage = React84.useCallback((url) => {
26494
26493
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
26495
26494
  const cached = imageCache.current.get(fullUrl);
26496
26495
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -26502,7 +26501,7 @@ function GameCanvas2D({
26502
26501
  }
26503
26502
  return null;
26504
26503
  }, []);
26505
- React86.useEffect(() => {
26504
+ React84.useEffect(() => {
26506
26505
  const canvas = canvasRef.current;
26507
26506
  if (!canvas) return;
26508
26507
  const ctx = canvas.getContext("2d");
@@ -26805,7 +26804,7 @@ function TurnPanel({
26805
26804
  className
26806
26805
  }) {
26807
26806
  const eventBus = useEventBus();
26808
- const handleAction = React86.useCallback(
26807
+ const handleAction = React84.useCallback(
26809
26808
  (event) => {
26810
26809
  if (event) {
26811
26810
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -26951,7 +26950,7 @@ function UnitCommandBar({
26951
26950
  className
26952
26951
  }) {
26953
26952
  const eventBus = useEventBus();
26954
- const handleCommand = React86.useCallback(
26953
+ const handleCommand = React84.useCallback(
26955
26954
  (event) => {
26956
26955
  if (event) {
26957
26956
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -27436,7 +27435,7 @@ function GameMenu({
27436
27435
  } catch {
27437
27436
  }
27438
27437
  const eventBus = eventBusProp || eventBusFromHook;
27439
- const handleOptionClick = React86.useCallback(
27438
+ const handleOptionClick = React84.useCallback(
27440
27439
  (option) => {
27441
27440
  if (option.event && eventBus) {
27442
27441
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27550,7 +27549,7 @@ function GameOverScreen({
27550
27549
  } catch {
27551
27550
  }
27552
27551
  const eventBus = eventBusProp || eventBusFromHook;
27553
- const handleActionClick = React86.useCallback(
27552
+ const handleActionClick = React84.useCallback(
27554
27553
  (action) => {
27555
27554
  if (action.event && eventBus) {
27556
27555
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28544,7 +28543,7 @@ var init_StarRating = __esm({
28544
28543
  name: "star",
28545
28544
  className: cn(
28546
28545
  styles.star,
28547
- "text-muted-foreground",
28546
+ "text-foreground/30",
28548
28547
  "transition-colors duration-100"
28549
28548
  ),
28550
28549
  strokeWidth: 1.5
@@ -29027,8 +29026,8 @@ function TableView({
29027
29026
  }) {
29028
29027
  const eventBus = useEventBus();
29029
29028
  const { t } = useTranslate();
29030
- const [visibleCount, setVisibleCount] = React86__default.useState(pageSize > 0 ? pageSize : Infinity);
29031
- const [localSelected, setLocalSelected] = React86__default.useState(/* @__PURE__ */ new Set());
29029
+ const [visibleCount, setVisibleCount] = React84__default.useState(pageSize > 0 ? pageSize : Infinity);
29030
+ const [localSelected, setLocalSelected] = React84__default.useState(/* @__PURE__ */ new Set());
29032
29031
  const colDefs = columns ?? fields ?? [];
29033
29032
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29034
29033
  const dnd = useDataDnd({
@@ -29223,12 +29222,12 @@ function TableView({
29223
29222
  ]
29224
29223
  }
29225
29224
  );
29226
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React86__default.Fragment, { children: rowInner }, id);
29225
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React84__default.Fragment, { children: rowInner }, id);
29227
29226
  };
29228
29227
  const items = data.map((row) => row);
29229
29228
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
29230
29229
  let runningIndex = 0;
29231
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
29230
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
29232
29231
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
29233
29232
  group.items.map((row) => renderRow(row, runningIndex++))
29234
29233
  ] }, gi)) });
@@ -30580,7 +30579,7 @@ var init_StepFlow = __esm({
30580
30579
  className
30581
30580
  }) => {
30582
30581
  if (orientation === "vertical") {
30583
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React86__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30582
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React84__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30584
30583
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
30585
30584
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30586
30585
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -30591,7 +30590,7 @@ var init_StepFlow = __esm({
30591
30590
  ] })
30592
30591
  ] }) }, index)) });
30593
30592
  }
30594
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
30593
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
30595
30594
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
30596
30595
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30597
30596
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31346,11 +31345,19 @@ function LatticeSVG({
31346
31345
  function f2(n) {
31347
31346
  return n.toFixed(2);
31348
31347
  }
31349
- var VARIANT_MAP2, EdgeDecoration;
31348
+ var colorTokenVars, VARIANT_MAP2, EdgeDecoration;
31350
31349
  var init_EdgeDecoration = __esm({
31351
31350
  "components/core/molecules/EdgeDecoration.tsx"() {
31352
31351
  "use client";
31353
31352
  init_cn();
31353
+ colorTokenVars = {
31354
+ primary: "var(--color-primary)",
31355
+ secondary: "var(--color-secondary)",
31356
+ success: "var(--color-success)",
31357
+ warning: "var(--color-warning)",
31358
+ error: "var(--color-error)",
31359
+ muted: "var(--color-muted)"
31360
+ };
31354
31361
  VARIANT_MAP2 = {
31355
31362
  arch: ArchSVG,
31356
31363
  vine: VineSVG,
@@ -31360,13 +31367,14 @@ var init_EdgeDecoration = __esm({
31360
31367
  variant = "arch",
31361
31368
  side = "both",
31362
31369
  opacity = 0.15,
31363
- color = "var(--color-primary)",
31370
+ color = "primary",
31364
31371
  strokeWidth = 0.5,
31365
31372
  width = 15,
31366
31373
  className
31367
31374
  }) => {
31368
31375
  const id = useId();
31369
31376
  const Variant = VARIANT_MAP2[variant];
31377
+ const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
31370
31378
  const sides = side === "both" ? ["left", "right"] : [side];
31371
31379
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
31372
31380
  "svg",
@@ -31389,7 +31397,7 @@ var init_EdgeDecoration = __esm({
31389
31397
  facing: s,
31390
31398
  w: 200,
31391
31399
  h: 600,
31392
- color,
31400
+ color: resolvedColor,
31393
31401
  strokeWidth
31394
31402
  }
31395
31403
  )
@@ -31567,7 +31575,7 @@ var init_LikertScale = __esm({
31567
31575
  md: "text-base",
31568
31576
  lg: "text-lg"
31569
31577
  };
31570
- LikertScale = React86__default.forwardRef(
31578
+ LikertScale = React84__default.forwardRef(
31571
31579
  ({
31572
31580
  question,
31573
31581
  options = DEFAULT_LIKERT_OPTIONS,
@@ -31579,7 +31587,7 @@ var init_LikertScale = __esm({
31579
31587
  variant = "radios",
31580
31588
  className
31581
31589
  }, ref) => {
31582
- const groupId = React86__default.useId();
31590
+ const groupId = React84__default.useId();
31583
31591
  const eventBus = useEventBus();
31584
31592
  const handleSelect = useCallback(
31585
31593
  (next) => {
@@ -32729,7 +32737,6 @@ function BlockRow({
32729
32737
  onUpdate,
32730
32738
  onDelete,
32731
32739
  onDuplicate,
32732
- onInsertAfter,
32733
32740
  onChangeType
32734
32741
  }) {
32735
32742
  const { t } = useTranslate();
@@ -33005,34 +33012,16 @@ function BlockRow({
33005
33012
  "data-block-id": block.id,
33006
33013
  "data-block-type": block.type,
33007
33014
  children: [
33008
- !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
33009
- /* @__PURE__ */ jsx(
33010
- Button,
33011
- {
33012
- type: "button",
33013
- variant: "ghost",
33014
- "aria-label": t("richBlockEditor.insertParagraphBelow"),
33015
- className: cn(
33016
- "inline-flex h-6 w-6 items-center justify-center rounded-sm p-0 gap-0",
33017
- "text-muted-foreground hover:bg-muted hover:text-foreground",
33018
- "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
33019
- "transition-opacity"
33020
- ),
33021
- onClick: () => onInsertAfter("paragraph"),
33022
- children: /* @__PURE__ */ jsx(Icon, { name: "plus", className: "w-3.5 h-3.5" })
33023
- }
33024
- ),
33025
- /* @__PURE__ */ jsx(
33026
- BlockMenu,
33027
- {
33028
- block,
33029
- readOnly,
33030
- onDelete,
33031
- onDuplicate,
33032
- onChangeType
33033
- }
33034
- )
33035
- ] }),
33015
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { className: "flex w-8 shrink-0 items-center pt-1", children: /* @__PURE__ */ jsx(
33016
+ BlockMenu,
33017
+ {
33018
+ block,
33019
+ readOnly,
33020
+ onDelete,
33021
+ onDuplicate,
33022
+ onChangeType
33023
+ }
33024
+ ) }),
33036
33025
  /* @__PURE__ */ jsx(Box, { className: "min-w-0 flex-1", children: renderBody() })
33037
33026
  ]
33038
33027
  }
@@ -33155,12 +33144,6 @@ var init_RichBlockEditor = __esm({
33155
33144
  },
33156
33145
  [blocks, commit]
33157
33146
  );
33158
- const handleInsertAfter = useCallback(
33159
- (id, type) => {
33160
- commit(insertAfter(blocks, id, createBlock(type)));
33161
- },
33162
- [blocks, commit]
33163
- );
33164
33147
  const handleChangeType = useCallback(
33165
33148
  (id, type) => {
33166
33149
  commit(
@@ -33217,7 +33200,6 @@ var init_RichBlockEditor = __esm({
33217
33200
  onUpdate: (updater) => handleUpdate(block.id, updater),
33218
33201
  onDelete: () => handleDelete(block.id),
33219
33202
  onDuplicate: () => handleDuplicate(block.id),
33220
- onInsertAfter: (type) => handleInsertAfter(block.id, type),
33221
33203
  onChangeType: (type) => handleChangeType(block.id, type)
33222
33204
  },
33223
33205
  block.id
@@ -33887,7 +33869,7 @@ var init_DocBreadcrumb = __esm({
33887
33869
  "aria-label": t("aria.breadcrumb"),
33888
33870
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
33889
33871
  const isLast = idx === items.length - 1;
33890
- return /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
33872
+ return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
33891
33873
  idx > 0 && /* @__PURE__ */ jsx(
33892
33874
  Icon,
33893
33875
  {
@@ -33934,108 +33916,6 @@ var init_DocBreadcrumb = __esm({
33934
33916
  DocBreadcrumb.displayName = "DocBreadcrumb";
33935
33917
  }
33936
33918
  });
33937
- function DocCodeBlock({
33938
- code,
33939
- language,
33940
- title,
33941
- showLineNumbers = false,
33942
- className
33943
- }) {
33944
- const [copied, setCopied] = useState(false);
33945
- const handleCopy = useCallback(() => {
33946
- void navigator.clipboard.writeText(code).then(() => {
33947
- setCopied(true);
33948
- setTimeout(() => setCopied(false), 2e3);
33949
- });
33950
- }, [code]);
33951
- const lines = code.split("\n");
33952
- return /* @__PURE__ */ jsxs(
33953
- Box,
33954
- {
33955
- className: cn(
33956
- "rounded-container border border-border overflow-hidden",
33957
- className
33958
- ),
33959
- position: "relative",
33960
- children: [
33961
- title ? /* @__PURE__ */ jsxs(
33962
- HStack,
33963
- {
33964
- align: "center",
33965
- justify: "between",
33966
- className: "bg-muted px-4 py-2 border-b border-border",
33967
- children: [
33968
- /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "sm", children: [
33969
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: title }),
33970
- language ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: language }) : null
33971
- ] }),
33972
- /* @__PURE__ */ jsx(
33973
- Button,
33974
- {
33975
- variant: "ghost",
33976
- size: "sm",
33977
- onClick: handleCopy,
33978
- leftIcon: copied ? "check" : "copy",
33979
- children: copied ? "Copied!" : "Copy"
33980
- }
33981
- )
33982
- ]
33983
- }
33984
- ) : null,
33985
- !title ? /* @__PURE__ */ jsx(Box, { position: "absolute", className: "top-2 right-2 z-10", children: /* @__PURE__ */ jsx(
33986
- Button,
33987
- {
33988
- variant: "ghost",
33989
- size: "sm",
33990
- onClick: handleCopy,
33991
- leftIcon: copied ? "check" : "copy",
33992
- children: copied ? "Copied!" : "Copy"
33993
- }
33994
- ) }) : null,
33995
- /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "bg-foreground overflow-x-auto", children: [
33996
- showLineNumbers ? /* @__PURE__ */ jsx(
33997
- Box,
33998
- {
33999
- className: "py-4 pl-4 pr-3 select-none border-r border-border flex-shrink-0",
34000
- children: lines.map((_, i) => /* @__PURE__ */ jsx(
34001
- Typography,
34002
- {
34003
- variant: "caption",
34004
- color: "muted",
34005
- className: "block font-mono text-right leading-6",
34006
- as: "span",
34007
- children: i + 1
34008
- },
34009
- i
34010
- ))
34011
- }
34012
- ) : null,
34013
- /* @__PURE__ */ jsx(
34014
- Box,
34015
- {
34016
- as: "pre",
34017
- className: cn(
34018
- "p-4 font-mono text-sm text-background leading-6 flex-1 min-w-0",
34019
- !title && "pr-24"
34020
- ),
34021
- children: /* @__PURE__ */ jsx(Box, { as: "code", className: "whitespace-pre", children: code })
34022
- }
34023
- )
34024
- ] })
34025
- ]
34026
- }
34027
- );
34028
- }
34029
- var init_DocCodeBlock = __esm({
34030
- "components/core/molecules/DocCodeBlock.tsx"() {
34031
- "use client";
34032
- init_cn();
34033
- init_Box();
34034
- init_Stack();
34035
- init_Typography();
34036
- init_Button();
34037
- }
34038
- });
34039
33919
  function DocPagination({ prev, next, className }) {
34040
33920
  if (!prev && !next) return null;
34041
33921
  return /* @__PURE__ */ jsxs(
@@ -34472,17 +34352,25 @@ var init_DocTOC = __esm({
34472
34352
  DocTOC.displayName = "DocTOC";
34473
34353
  }
34474
34354
  });
34475
- var GradientDivider;
34355
+ var colorTokenVars2, GradientDivider;
34476
34356
  var init_GradientDivider = __esm({
34477
34357
  "components/core/molecules/GradientDivider.tsx"() {
34478
34358
  "use client";
34479
34359
  init_cn();
34480
34360
  init_Box();
34361
+ colorTokenVars2 = {
34362
+ primary: "var(--color-primary)",
34363
+ secondary: "var(--color-secondary)",
34364
+ success: "var(--color-success)",
34365
+ warning: "var(--color-warning)",
34366
+ error: "var(--color-error)",
34367
+ muted: "var(--color-muted)"
34368
+ };
34481
34369
  GradientDivider = ({
34482
34370
  color,
34483
34371
  className
34484
34372
  }) => {
34485
- const centerColor = color ?? "var(--color-primary)";
34373
+ const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
34486
34374
  return /* @__PURE__ */ jsx(
34487
34375
  Box,
34488
34376
  {
@@ -34851,7 +34739,7 @@ var init_MiniStateMachine = __esm({
34851
34739
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
34852
34740
  const tc = transitionCounts[s.name] ?? 0;
34853
34741
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
34854
- return /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
34742
+ return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
34855
34743
  /* @__PURE__ */ jsx(
34856
34744
  AvlState,
34857
34745
  {
@@ -35055,7 +34943,7 @@ var init_PageHeader = __esm({
35055
34943
  info: "bg-info/10 text-info"
35056
34944
  };
35057
34945
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
35058
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
34946
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
35059
34947
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
35060
34948
  crumb.href ? /* @__PURE__ */ jsx(
35061
34949
  "a",
@@ -35792,7 +35680,7 @@ var init_WizardContainer = __esm({
35792
35680
  const isCompleted = index < currentStep;
35793
35681
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
35794
35682
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
35795
- return /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
35683
+ return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
35796
35684
  /* @__PURE__ */ jsx(
35797
35685
  Button,
35798
35686
  {
@@ -38077,7 +37965,7 @@ var init_DetailPanel = __esm({
38077
37965
  }
38078
37966
  });
38079
37967
  function extractTitle(children) {
38080
- if (!React86__default.isValidElement(children)) return void 0;
37968
+ if (!React84__default.isValidElement(children)) return void 0;
38081
37969
  const props = children.props;
38082
37970
  if (typeof props.title === "string") {
38083
37971
  return props.title;
@@ -38132,7 +38020,7 @@ function LinearView({
38132
38020
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
38133
38021
  const isDone = i < currentIdx;
38134
38022
  const isCurrent = i === currentIdx;
38135
- return /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
38023
+ return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
38136
38024
  i > 0 && /* @__PURE__ */ jsx(
38137
38025
  Typography,
38138
38026
  {
@@ -39090,12 +38978,12 @@ var init_Form = __esm({
39090
38978
  const isSchemaEntity = isOrbitalEntitySchema(entity);
39091
38979
  const resolvedEntity = isSchemaEntity ? entity : void 0;
39092
38980
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
39093
- const normalizedInitialData = React86__default.useMemo(() => {
38981
+ const normalizedInitialData = React84__default.useMemo(() => {
39094
38982
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
39095
38983
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
39096
38984
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
39097
38985
  }, [entity, initialData]);
39098
- const entityDerivedFields = React86__default.useMemo(() => {
38986
+ const entityDerivedFields = React84__default.useMemo(() => {
39099
38987
  if (fields && fields.length > 0) return void 0;
39100
38988
  if (!resolvedEntity) return void 0;
39101
38989
  return resolvedEntity.fields.map(
@@ -39115,16 +39003,16 @@ var init_Form = __esm({
39115
39003
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
39116
39004
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
39117
39005
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
39118
- const [formData, setFormData] = React86__default.useState(
39006
+ const [formData, setFormData] = React84__default.useState(
39119
39007
  normalizedInitialData
39120
39008
  );
39121
- const [collapsedSections, setCollapsedSections] = React86__default.useState(
39009
+ const [collapsedSections, setCollapsedSections] = React84__default.useState(
39122
39010
  /* @__PURE__ */ new Set()
39123
39011
  );
39124
- const [submitError, setSubmitError] = React86__default.useState(null);
39125
- const formRef = React86__default.useRef(null);
39012
+ const [submitError, setSubmitError] = React84__default.useState(null);
39013
+ const formRef = React84__default.useRef(null);
39126
39014
  const formMode = props.mode;
39127
- const mountedRef = React86__default.useRef(false);
39015
+ const mountedRef = React84__default.useRef(false);
39128
39016
  if (!mountedRef.current) {
39129
39017
  mountedRef.current = true;
39130
39018
  debug("forms", "mount", {
@@ -39137,7 +39025,7 @@ var init_Form = __esm({
39137
39025
  });
39138
39026
  }
39139
39027
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
39140
- const evalContext = React86__default.useMemo(
39028
+ const evalContext = React84__default.useMemo(
39141
39029
  () => ({
39142
39030
  formValues: formData,
39143
39031
  globalVariables: externalContext?.globalVariables ?? {},
@@ -39146,7 +39034,7 @@ var init_Form = __esm({
39146
39034
  }),
39147
39035
  [formData, externalContext]
39148
39036
  );
39149
- React86__default.useEffect(() => {
39037
+ React84__default.useEffect(() => {
39150
39038
  debug("forms", "initialData-sync", {
39151
39039
  mode: formMode,
39152
39040
  normalizedInitialData,
@@ -39157,7 +39045,7 @@ var init_Form = __esm({
39157
39045
  setFormData(normalizedInitialData);
39158
39046
  }
39159
39047
  }, [normalizedInitialData]);
39160
- const processCalculations = React86__default.useCallback(
39048
+ const processCalculations = React84__default.useCallback(
39161
39049
  (changedFieldId, newFormData) => {
39162
39050
  if (!hiddenCalculations.length) return;
39163
39051
  const context = {
@@ -39182,7 +39070,7 @@ var init_Form = __esm({
39182
39070
  },
39183
39071
  [hiddenCalculations, externalContext, eventBus]
39184
39072
  );
39185
- const checkViolations = React86__default.useCallback(
39073
+ const checkViolations = React84__default.useCallback(
39186
39074
  (changedFieldId, newFormData) => {
39187
39075
  if (!violationTriggers.length) return;
39188
39076
  const context = {
@@ -39220,7 +39108,7 @@ var init_Form = __esm({
39220
39108
  processCalculations(name, newFormData);
39221
39109
  checkViolations(name, newFormData);
39222
39110
  };
39223
- const isFieldVisible = React86__default.useCallback(
39111
+ const isFieldVisible = React84__default.useCallback(
39224
39112
  (fieldName) => {
39225
39113
  const condition = conditionalFields[fieldName];
39226
39114
  if (!condition) return true;
@@ -39228,7 +39116,7 @@ var init_Form = __esm({
39228
39116
  },
39229
39117
  [conditionalFields, evalContext]
39230
39118
  );
39231
- const isSectionVisible = React86__default.useCallback(
39119
+ const isSectionVisible = React84__default.useCallback(
39232
39120
  (section) => {
39233
39121
  if (!section.condition) return true;
39234
39122
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -39304,7 +39192,7 @@ var init_Form = __esm({
39304
39192
  eventBus.emit(`UI:${onCancel}`);
39305
39193
  }
39306
39194
  };
39307
- const renderField = React86__default.useCallback(
39195
+ const renderField = React84__default.useCallback(
39308
39196
  (field) => {
39309
39197
  const fieldName = field.name || field.field;
39310
39198
  if (!fieldName) return null;
@@ -39325,7 +39213,7 @@ var init_Form = __esm({
39325
39213
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
39326
39214
  );
39327
39215
  const effectiveFields = entityDerivedFields ?? fields;
39328
- const normalizedFields = React86__default.useMemo(() => {
39216
+ const normalizedFields = React84__default.useMemo(() => {
39329
39217
  if (!effectiveFields || effectiveFields.length === 0) return [];
39330
39218
  return effectiveFields.map((field) => {
39331
39219
  if (typeof field === "string") {
@@ -39348,7 +39236,7 @@ var init_Form = __esm({
39348
39236
  return field;
39349
39237
  });
39350
39238
  }, [effectiveFields, resolvedEntity]);
39351
- const schemaFields = React86__default.useMemo(() => {
39239
+ const schemaFields = React84__default.useMemo(() => {
39352
39240
  if (normalizedFields.length === 0) return null;
39353
39241
  if (isDebugEnabled()) {
39354
39242
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -39358,7 +39246,7 @@ var init_Form = __esm({
39358
39246
  }
39359
39247
  return normalizedFields.map(renderField).filter(Boolean);
39360
39248
  }, [normalizedFields, renderField, entityName, conditionalFields]);
39361
- const sectionElements = React86__default.useMemo(() => {
39249
+ const sectionElements = React84__default.useMemo(() => {
39362
39250
  if (!sections || sections.length === 0) return null;
39363
39251
  return sections.map((section) => {
39364
39252
  if (!isSectionVisible(section)) {
@@ -40633,7 +40521,7 @@ var init_List = __esm({
40633
40521
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
40634
40522
  return [];
40635
40523
  }, [entity]);
40636
- const getItemActions = React86__default.useCallback(
40524
+ const getItemActions = React84__default.useCallback(
40637
40525
  (item) => {
40638
40526
  if (!itemActions) return [];
40639
40527
  if (typeof itemActions === "function") {
@@ -41109,7 +40997,7 @@ var init_MediaGallery = __esm({
41109
40997
  [selectable, selectedItems, selectionEvent, eventBus]
41110
40998
  );
41111
40999
  const entityData = Array.isArray(entity) ? entity : [];
41112
- const items = React86__default.useMemo(() => {
41000
+ const items = React84__default.useMemo(() => {
41113
41001
  if (propItems) return propItems;
41114
41002
  if (entityData.length === 0) return [];
41115
41003
  return entityData.map((record, idx) => ({
@@ -41270,7 +41158,7 @@ var init_MediaGallery = __esm({
41270
41158
  }
41271
41159
  });
41272
41160
  function extractTitle2(children) {
41273
- if (!React86__default.isValidElement(children)) return void 0;
41161
+ if (!React84__default.isValidElement(children)) return void 0;
41274
41162
  const props = children.props;
41275
41163
  if (typeof props.title === "string") {
41276
41164
  return props.title;
@@ -41701,7 +41589,7 @@ var init_debugRegistry = __esm({
41701
41589
  }
41702
41590
  });
41703
41591
  function useDebugData() {
41704
- const [data, setData] = React86.useState(() => ({
41592
+ const [data, setData] = React84.useState(() => ({
41705
41593
  traits: [],
41706
41594
  ticks: [],
41707
41595
  guards: [],
@@ -41715,7 +41603,7 @@ function useDebugData() {
41715
41603
  },
41716
41604
  lastUpdate: Date.now()
41717
41605
  }));
41718
- React86.useEffect(() => {
41606
+ React84.useEffect(() => {
41719
41607
  const updateData = () => {
41720
41608
  setData({
41721
41609
  traits: getAllTraits(),
@@ -41824,12 +41712,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
41824
41712
  return positions;
41825
41713
  }
41826
41714
  function WalkMinimap() {
41827
- const [walkStep, setWalkStep] = React86.useState(null);
41828
- const [traits2, setTraits] = React86.useState([]);
41829
- const [coveredEdges, setCoveredEdges] = React86.useState([]);
41830
- const [completedTraits, setCompletedTraits] = React86.useState(/* @__PURE__ */ new Set());
41831
- const prevTraitRef = React86.useRef(null);
41832
- React86.useEffect(() => {
41715
+ const [walkStep, setWalkStep] = React84.useState(null);
41716
+ const [traits2, setTraits] = React84.useState([]);
41717
+ const [coveredEdges, setCoveredEdges] = React84.useState([]);
41718
+ const [completedTraits, setCompletedTraits] = React84.useState(/* @__PURE__ */ new Set());
41719
+ const prevTraitRef = React84.useRef(null);
41720
+ React84.useEffect(() => {
41833
41721
  const interval = setInterval(() => {
41834
41722
  const w = window;
41835
41723
  const step = w.__orbitalWalkStep;
@@ -42265,15 +42153,15 @@ var init_EntitiesTab = __esm({
42265
42153
  });
42266
42154
  function EventFlowTab({ events: events2 }) {
42267
42155
  const { t } = useTranslate();
42268
- const [filter, setFilter] = React86.useState("all");
42269
- const containerRef = React86.useRef(null);
42270
- const [autoScroll, setAutoScroll] = React86.useState(true);
42271
- React86.useEffect(() => {
42156
+ const [filter, setFilter] = React84.useState("all");
42157
+ const containerRef = React84.useRef(null);
42158
+ const [autoScroll, setAutoScroll] = React84.useState(true);
42159
+ React84.useEffect(() => {
42272
42160
  if (autoScroll && containerRef.current) {
42273
42161
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42274
42162
  }
42275
42163
  }, [events2.length, autoScroll]);
42276
- const filteredEvents = React86.useMemo(() => {
42164
+ const filteredEvents = React84.useMemo(() => {
42277
42165
  if (filter === "all") return events2;
42278
42166
  return events2.filter((e) => e.type === filter);
42279
42167
  }, [events2, filter]);
@@ -42389,7 +42277,7 @@ var init_EventFlowTab = __esm({
42389
42277
  });
42390
42278
  function GuardsPanel({ guards }) {
42391
42279
  const { t } = useTranslate();
42392
- const [filter, setFilter] = React86.useState("all");
42280
+ const [filter, setFilter] = React84.useState("all");
42393
42281
  if (guards.length === 0) {
42394
42282
  return /* @__PURE__ */ jsx(
42395
42283
  EmptyState,
@@ -42402,7 +42290,7 @@ function GuardsPanel({ guards }) {
42402
42290
  }
42403
42291
  const passedCount = guards.filter((g) => g.result).length;
42404
42292
  const failedCount = guards.length - passedCount;
42405
- const filteredGuards = React86.useMemo(() => {
42293
+ const filteredGuards = React84.useMemo(() => {
42406
42294
  if (filter === "all") return guards;
42407
42295
  if (filter === "passed") return guards.filter((g) => g.result);
42408
42296
  return guards.filter((g) => !g.result);
@@ -42565,10 +42453,10 @@ function EffectBadge({ effect }) {
42565
42453
  }
42566
42454
  function TransitionTimeline({ transitions }) {
42567
42455
  const { t } = useTranslate();
42568
- const containerRef = React86.useRef(null);
42569
- const [autoScroll, setAutoScroll] = React86.useState(true);
42570
- const [expandedId, setExpandedId] = React86.useState(null);
42571
- React86.useEffect(() => {
42456
+ const containerRef = React84.useRef(null);
42457
+ const [autoScroll, setAutoScroll] = React84.useState(true);
42458
+ const [expandedId, setExpandedId] = React84.useState(null);
42459
+ React84.useEffect(() => {
42572
42460
  if (autoScroll && containerRef.current) {
42573
42461
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42574
42462
  }
@@ -42848,9 +42736,9 @@ function getAllEvents(traits2) {
42848
42736
  function EventDispatcherTab({ traits: traits2, schema }) {
42849
42737
  const eventBus = useEventBus();
42850
42738
  const { t } = useTranslate();
42851
- const [log12, setLog] = React86.useState([]);
42852
- const prevStatesRef = React86.useRef(/* @__PURE__ */ new Map());
42853
- React86.useEffect(() => {
42739
+ const [log12, setLog] = React84.useState([]);
42740
+ const prevStatesRef = React84.useRef(/* @__PURE__ */ new Map());
42741
+ React84.useEffect(() => {
42854
42742
  for (const trait of traits2) {
42855
42743
  const prev = prevStatesRef.current.get(trait.id);
42856
42744
  if (prev && prev !== trait.currentState) {
@@ -43019,10 +42907,10 @@ function VerifyModePanel({
43019
42907
  localCount
43020
42908
  }) {
43021
42909
  const { t } = useTranslate();
43022
- const [expanded, setExpanded] = React86.useState(true);
43023
- const scrollRef = React86.useRef(null);
43024
- const prevCountRef = React86.useRef(0);
43025
- React86.useEffect(() => {
42910
+ const [expanded, setExpanded] = React84.useState(true);
42911
+ const scrollRef = React84.useRef(null);
42912
+ const prevCountRef = React84.useRef(0);
42913
+ React84.useEffect(() => {
43026
42914
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43027
42915
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43028
42916
  }
@@ -43079,10 +42967,10 @@ function RuntimeDebugger({
43079
42967
  schema
43080
42968
  }) {
43081
42969
  const { t } = useTranslate();
43082
- const [isCollapsed, setIsCollapsed] = React86.useState(mode === "verify" ? true : defaultCollapsed);
43083
- const [isVisible, setIsVisible] = React86.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
42970
+ const [isCollapsed, setIsCollapsed] = React84.useState(mode === "verify" ? true : defaultCollapsed);
42971
+ const [isVisible, setIsVisible] = React84.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43084
42972
  const debugData = useDebugData();
43085
- React86.useEffect(() => {
42973
+ React84.useEffect(() => {
43086
42974
  if (mode === "inline") return;
43087
42975
  return onDebugToggle((enabled) => {
43088
42976
  setIsVisible(enabled);
@@ -43091,7 +42979,7 @@ function RuntimeDebugger({
43091
42979
  }
43092
42980
  });
43093
42981
  }, [mode]);
43094
- React86.useEffect(() => {
42982
+ React84.useEffect(() => {
43095
42983
  if (mode === "inline") return;
43096
42984
  const handleKeyDown = (e) => {
43097
42985
  if (e.key === "`" && isVisible) {
@@ -43540,7 +43428,7 @@ function SequenceBar({
43540
43428
  onSlotRemove(index);
43541
43429
  }, [onSlotRemove, playing]);
43542
43430
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
43543
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React86__default.Fragment, { children: [
43431
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
43544
43432
  i > 0 && /* @__PURE__ */ jsx(
43545
43433
  Typography,
43546
43434
  {
@@ -44519,7 +44407,7 @@ var init_StatCard = __esm({
44519
44407
  const labelToUse = propLabel ?? propTitle;
44520
44408
  const eventBus = useEventBus();
44521
44409
  const { t } = useTranslate();
44522
- const handleActionClick = React86__default.useCallback(() => {
44410
+ const handleActionClick = React84__default.useCallback(() => {
44523
44411
  if (action?.event) {
44524
44412
  eventBus.emit(`UI:${action.event}`, {});
44525
44413
  }
@@ -44530,7 +44418,7 @@ var init_StatCard = __esm({
44530
44418
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
44531
44419
  const isLoading = externalLoading ?? false;
44532
44420
  const error = externalError;
44533
- const computeMetricValue = React86__default.useCallback(
44421
+ const computeMetricValue = React84__default.useCallback(
44534
44422
  (metric, items) => {
44535
44423
  if (metric.value !== void 0) {
44536
44424
  return metric.value;
@@ -44569,7 +44457,7 @@ var init_StatCard = __esm({
44569
44457
  },
44570
44458
  []
44571
44459
  );
44572
- const schemaStats = React86__default.useMemo(() => {
44460
+ const schemaStats = React84__default.useMemo(() => {
44573
44461
  if (!metrics || metrics.length === 0) return null;
44574
44462
  return metrics.map((metric) => ({
44575
44463
  label: metric.label,
@@ -44577,7 +44465,7 @@ var init_StatCard = __esm({
44577
44465
  format: metric.format
44578
44466
  }));
44579
44467
  }, [metrics, data, computeMetricValue]);
44580
- const calculatedTrend = React86__default.useMemo(() => {
44468
+ const calculatedTrend = React84__default.useMemo(() => {
44581
44469
  if (manualTrend !== void 0) return manualTrend;
44582
44470
  if (previousValue === void 0 || currentValue === void 0)
44583
44471
  return void 0;
@@ -44858,6 +44746,37 @@ var init_VariablePanel = __esm({
44858
44746
  VariablePanel.displayName = "VariablePanel";
44859
44747
  }
44860
44748
  });
44749
+ function StateJsonView({
44750
+ data,
44751
+ label,
44752
+ defaultExpanded = false,
44753
+ className
44754
+ }) {
44755
+ const { t } = useTranslate();
44756
+ const [expanded, setExpanded] = useState(defaultExpanded);
44757
+ const jsonString = JSON.stringify(data, null, 2);
44758
+ return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
44759
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
44760
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
44761
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
44762
+ ] }),
44763
+ expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
44764
+ Typography,
44765
+ {
44766
+ variant: "caption",
44767
+ className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
44768
+ children: jsonString
44769
+ }
44770
+ ) })
44771
+ ] });
44772
+ }
44773
+ var init_StateJsonView = __esm({
44774
+ "components/game/organisms/puzzles/state-architect/StateJsonView.tsx"() {
44775
+ init_atoms2();
44776
+ init_cn();
44777
+ StateJsonView.displayName = "StateJsonView";
44778
+ }
44779
+ });
44861
44780
  function layoutStates(states, width, height) {
44862
44781
  const cx = width / 2;
44863
44782
  const cy = height / 2;
@@ -45149,7 +45068,7 @@ function StateArchitectBoard({
45149
45068
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
45150
45069
  ] }, i))
45151
45070
  ] }),
45152
- resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
45071
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
45153
45072
  ] })
45154
45073
  ] }),
45155
45074
  playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
@@ -45186,7 +45105,7 @@ var init_StateArchitectBoard = __esm({
45186
45105
  init_StateNode();
45187
45106
  init_TransitionArrow();
45188
45107
  init_VariablePanel();
45189
- init_CodeView();
45108
+ init_StateJsonView();
45190
45109
  init_boardEntity();
45191
45110
  ENCOURAGEMENT_KEYS3 = [
45192
45111
  "puzzle.tryAgain1",
@@ -45511,7 +45430,7 @@ var init_Timeline = __esm({
45511
45430
  }) => {
45512
45431
  const { t } = useTranslate();
45513
45432
  const entityData = Array.isArray(entity) ? entity : [];
45514
- const items = React86__default.useMemo(() => {
45433
+ const items = React84__default.useMemo(() => {
45515
45434
  if (propItems) return propItems;
45516
45435
  if (entityData.length === 0) return [];
45517
45436
  return entityData.map((record, idx) => {
@@ -45618,7 +45537,7 @@ var init_Timeline = __esm({
45618
45537
  }
45619
45538
  });
45620
45539
  function extractToastProps(children) {
45621
- if (!React86__default.isValidElement(children)) {
45540
+ if (!React84__default.isValidElement(children)) {
45622
45541
  if (typeof children === "string") {
45623
45542
  return { message: children };
45624
45543
  }
@@ -45656,7 +45575,7 @@ var init_ToastSlot = __esm({
45656
45575
  eventBus.emit("UI:CLOSE");
45657
45576
  };
45658
45577
  if (!isVisible) return null;
45659
- const isCustomContent = React86__default.isValidElement(children) && !message;
45578
+ const isCustomContent = React84__default.isValidElement(children) && !message;
45660
45579
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
45661
45580
  Toast,
45662
45581
  {
@@ -46166,12 +46085,12 @@ var init_WorldMapTemplate = __esm({
46166
46085
  }
46167
46086
  });
46168
46087
  function lazyThree(name, loader) {
46169
- const Lazy = React86__default.lazy(() => loader().then((m) => ({ default: m[name] })));
46088
+ const Lazy = React84__default.lazy(() => loader().then((m) => ({ default: m[name] })));
46170
46089
  function ThreeWrapper(props) {
46171
- return React86__default.createElement(
46172
- React86__default.Suspense,
46090
+ return React84__default.createElement(
46091
+ React84__default.Suspense,
46173
46092
  { fallback: null },
46174
- React86__default.createElement(Lazy, props)
46093
+ React84__default.createElement(Lazy, props)
46175
46094
  );
46176
46095
  }
46177
46096
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -46219,8 +46138,6 @@ var init_component_registry_generated = __esm({
46219
46138
  init_ChoiceButton();
46220
46139
  init_ClassifierBoard();
46221
46140
  init_CodeBlock();
46222
- init_CodeView();
46223
- init_CodeViewer();
46224
46141
  init_CombatLog();
46225
46142
  init_ComboCounter();
46226
46143
  init_CommunityLinks();
@@ -46248,7 +46165,6 @@ var init_component_registry_generated = __esm({
46248
46165
  init_DialogueBox();
46249
46166
  init_DialogueBubble();
46250
46167
  init_DocBreadcrumb();
46251
- init_DocCodeBlock();
46252
46168
  init_DocPagination();
46253
46169
  init_DocSearch();
46254
46170
  init_DocSidebar();
@@ -46386,6 +46302,7 @@ var init_component_registry_generated = __esm({
46386
46302
  init_StatDisplay();
46387
46303
  init_StateArchitectBoard();
46388
46304
  init_StateIndicator();
46305
+ init_StateJsonView();
46389
46306
  init_StateMachineView();
46390
46307
  init_StateNode();
46391
46308
  init_StatsGrid();
@@ -46503,8 +46420,6 @@ var init_component_registry_generated = __esm({
46503
46420
  "ChoiceButton": ChoiceButton,
46504
46421
  "ClassifierBoard": ClassifierBoard,
46505
46422
  "CodeBlock": CodeBlock,
46506
- "CodeView": CodeView,
46507
- "CodeViewer": CodeViewer,
46508
46423
  "CombatLog": CombatLog,
46509
46424
  "ComboCounter": ComboCounter,
46510
46425
  "CommunityLinks": CommunityLinks,
@@ -46536,7 +46451,6 @@ var init_component_registry_generated = __esm({
46536
46451
  "Divider": DividerPattern,
46537
46452
  "DividerPattern": DividerPattern,
46538
46453
  "DocBreadcrumb": DocBreadcrumb,
46539
- "DocCodeBlock": DocCodeBlock,
46540
46454
  "DocPagination": DocPagination,
46541
46455
  "DocSearch": DocSearch,
46542
46456
  "DocSidebar": DocSidebar,
@@ -46703,6 +46617,7 @@ var init_component_registry_generated = __esm({
46703
46617
  "StatDisplay": StatDisplay,
46704
46618
  "StateArchitectBoard": StateArchitectBoard,
46705
46619
  "StateIndicator": StateIndicator,
46620
+ "StateJsonView": StateJsonView,
46706
46621
  "StateMachineView": StateMachineView,
46707
46622
  "StateNode": StateNode2,
46708
46623
  "StatsGrid": StatsGrid,
@@ -46787,7 +46702,7 @@ function SuspenseConfigProvider({
46787
46702
  config,
46788
46703
  children
46789
46704
  }) {
46790
- return React86__default.createElement(
46705
+ return React84__default.createElement(
46791
46706
  SuspenseConfigContext.Provider,
46792
46707
  { value: config },
46793
46708
  children
@@ -47277,7 +47192,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47277
47192
  const key = `${parentId}-${index}-trait:${traitName}`;
47278
47193
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
47279
47194
  }
47280
- return /* @__PURE__ */ jsx(React86__default.Fragment, { children: child }, `${parentId}-${index}`);
47195
+ return /* @__PURE__ */ jsx(React84__default.Fragment, { children: child }, `${parentId}-${index}`);
47281
47196
  }
47282
47197
  if (!child || typeof child !== "object") return null;
47283
47198
  const childId = `${parentId}-${index}`;
@@ -47317,14 +47232,14 @@ function isPatternConfig(value) {
47317
47232
  if (value === null || value === void 0) return false;
47318
47233
  if (typeof value !== "object") return false;
47319
47234
  if (Array.isArray(value)) return false;
47320
- if (React86__default.isValidElement(value)) return false;
47235
+ if (React84__default.isValidElement(value)) return false;
47321
47236
  if (value instanceof Date) return false;
47322
47237
  if (typeof value === "function") return false;
47323
47238
  const record = value;
47324
47239
  return "type" in record && typeof record.type === "string";
47325
47240
  }
47326
47241
  function isPlainConfigObject(value) {
47327
- if (React86__default.isValidElement(value)) return false;
47242
+ if (React84__default.isValidElement(value)) return false;
47328
47243
  if (value instanceof Date) return false;
47329
47244
  const proto = Object.getPrototypeOf(value);
47330
47245
  return proto === Object.prototype || proto === null;
@@ -47734,7 +47649,7 @@ function resolveLambdaBindings(body, params, item, index) {
47734
47649
  if (Array.isArray(body)) {
47735
47650
  return body.map((b) => recur(b));
47736
47651
  }
47737
- if (body !== null && typeof body === "object" && !React86__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
47652
+ if (body !== null && typeof body === "object" && !React84__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
47738
47653
  const out = {};
47739
47654
  for (const [k, v] of Object.entries(body)) {
47740
47655
  out[k] = recur(v);
@@ -47753,7 +47668,7 @@ function getSlotContentRenderer2() {
47753
47668
  function makeLambdaFn(params, lambdaBody, callerKey) {
47754
47669
  return (item, index) => {
47755
47670
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
47756
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React86__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
47671
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React84__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
47757
47672
  return null;
47758
47673
  }
47759
47674
  const record = resolvedBody;
@@ -47772,7 +47687,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
47772
47687
  props: childProps,
47773
47688
  priority: 0
47774
47689
  };
47775
- return React86__default.createElement(SlotContentRenderer2, { content: childContent });
47690
+ return React84__default.createElement(SlotContentRenderer2, { content: childContent });
47776
47691
  };
47777
47692
  }
47778
47693
  function convertNode(node, callerKey) {
@@ -47791,7 +47706,7 @@ function convertNode(node, callerKey) {
47791
47706
  });
47792
47707
  return anyChanged ? mapped : node;
47793
47708
  }
47794
- if (typeof node === "object" && !React86__default.isValidElement(node) && !(node instanceof Date)) {
47709
+ if (typeof node === "object" && !React84__default.isValidElement(node) && !(node instanceof Date)) {
47795
47710
  return convertObjectProps(node);
47796
47711
  }
47797
47712
  return node;