@almadar/ui 5.25.1 → 5.26.0

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 (48) hide show
  1. package/dist/avl/index.cjs +2001 -2178
  2. package/dist/avl/index.js +950 -1127
  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/types.d.ts +6 -0
  7. package/dist/components/core/molecules/ArrayEditor.d.ts +15 -0
  8. package/dist/components/core/molecules/Carousel.d.ts +8 -2
  9. package/dist/components/core/molecules/Container.d.ts +4 -4
  10. package/dist/components/core/molecules/DateRangeSelector.d.ts +3 -4
  11. package/dist/components/core/molecules/DocSidebar.d.ts +4 -4
  12. package/dist/components/core/molecules/EdgeDecoration.d.ts +3 -2
  13. package/dist/components/core/molecules/Flex.d.ts +4 -4
  14. package/dist/components/core/molecules/FlipCard.d.ts +3 -4
  15. package/dist/components/core/molecules/GradientDivider.d.ts +3 -2
  16. package/dist/components/core/molecules/MapEditor.d.ts +16 -0
  17. package/dist/components/core/molecules/ObjectEditor.d.ts +15 -0
  18. package/dist/components/core/molecules/SidePanel.d.ts +4 -4
  19. package/dist/components/core/molecules/SortableList.d.ts +4 -5
  20. package/dist/components/core/molecules/ViolationAlert.d.ts +4 -9
  21. package/dist/components/core/molecules/index.d.ts +4 -3
  22. package/dist/components/core/molecules/markdown/CodeBlock.d.ts +44 -2
  23. package/dist/components/game/atoms/ResourceCounter.d.ts +3 -2
  24. package/dist/components/game/atoms/StateIndicator.d.ts +4 -5
  25. package/dist/components/game/atoms/StatusEffect.d.ts +2 -3
  26. package/dist/components/game/molecules/ActionButtons.d.ts +6 -0
  27. package/dist/components/game/molecules/GameHud.d.ts +2 -3
  28. package/dist/components/game/molecules/StatBadge.d.ts +6 -0
  29. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +16 -0
  30. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  31. package/dist/components/index.cjs +2249 -1975
  32. package/dist/components/index.js +1349 -1075
  33. package/dist/docs/index.cjs +6014 -4606
  34. package/dist/docs/index.css +1252 -0
  35. package/dist/docs/index.d.cts +108 -16
  36. package/dist/docs/index.d.ts +2 -2
  37. package/dist/docs/index.js +5970 -4567
  38. package/dist/marketing/index.cjs +32 -9
  39. package/dist/marketing/index.d.cts +30 -20
  40. package/dist/marketing/index.js +32 -9
  41. package/dist/providers/index.cjs +1826 -2003
  42. package/dist/providers/index.js +925 -1102
  43. package/dist/runtime/index.cjs +1866 -2043
  44. package/dist/runtime/index.js +929 -1106
  45. package/package.json +1 -1
  46. package/dist/components/core/molecules/CodeViewer.d.ts +0 -70
  47. package/dist/components/core/molecules/DocCodeBlock.d.ts +0 -14
  48. package/dist/components/game/organisms/puzzles/state-architect/CodeView.d.ts +0 -24
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import * as React81 from 'react';
3
- import React81__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
2
+ import * as React79 from 'react';
3
+ import React79__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
7
7
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
8
8
  import * as LucideIcons2 from 'lucide-react';
9
- import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, CheckCircle, XCircle, Wrench, RotateCcw, Send, Search, ChevronUp, ChevronDown, MoreHorizontal, Bug, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, ArrowRight, Pause, Play, SkipForward, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Code, GitBranch, Plus, Trash, ArrowLeft, Menu as Menu$1, Check, AlertTriangle, Trash2, Eraser, FileText, ZoomOut, Download, WrapText, Copy, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
9
+ import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, CheckCircle, XCircle, Wrench, RotateCcw, Send, Search, ChevronUp, ChevronDown, MoreHorizontal, Bug, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, ArrowRight, Pause, Play, SkipForward, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, Code, FileText, WrapText, Check, Copy, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, GitBranch, Plus, Trash, ArrowLeft, Menu as Menu$1, AlertTriangle, Trash2, Eraser, ZoomOut, Download, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
10
10
  import * as PhosphorIcons from '@phosphor-icons/react';
11
11
  import * as TablerIcons from '@tabler/icons-react';
12
12
  import * as FaIcons from 'react-icons/fa';
@@ -211,7 +211,7 @@ var init_SvgFlow = __esm({
211
211
  opacity = 1,
212
212
  className
213
213
  }) => {
214
- const markerId = React81__default.useMemo(() => {
214
+ const markerId = React79__default.useMemo(() => {
215
215
  flowIdCounter += 1;
216
216
  return `almadar-flow-arrow-${flowIdCounter}`;
217
217
  }, []);
@@ -754,7 +754,7 @@ var init_SvgRing = __esm({
754
754
  className,
755
755
  label
756
756
  }) => {
757
- const gradientId = React81__default.useMemo(() => {
757
+ const gradientId = React79__default.useMemo(() => {
758
758
  ringIdCounter += 1;
759
759
  return `almadar-ring-glow-${ringIdCounter}`;
760
760
  }, []);
@@ -1792,12 +1792,20 @@ function doResolve(name) {
1792
1792
  if (asIs && typeof asIs === "object") return asIs;
1793
1793
  return LucideIcons2.HelpCircle;
1794
1794
  }
1795
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1795
+ var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1796
1796
  var init_Icon = __esm({
1797
1797
  "components/core/atoms/Icon.tsx"() {
1798
1798
  "use client";
1799
1799
  init_cn();
1800
1800
  init_iconFamily();
1801
+ colorTokenClasses = {
1802
+ primary: "text-primary",
1803
+ secondary: "text-secondary",
1804
+ success: "text-success",
1805
+ warning: "text-warning",
1806
+ error: "text-error",
1807
+ muted: "text-muted-foreground"
1808
+ };
1801
1809
  iconAliases = {
1802
1810
  "close": LucideIcons2.X,
1803
1811
  "trash": LucideIcons2.Trash2,
@@ -1836,7 +1844,7 @@ var init_Icon = __esm({
1836
1844
  const directIcon = typeof icon === "string" ? void 0 : icon;
1837
1845
  const effectiveName = typeof icon === "string" ? icon : name;
1838
1846
  const family = useIconFamily();
1839
- const RenderedComponent = React81__default.useMemo(() => {
1847
+ const RenderedComponent = React79__default.useMemo(() => {
1840
1848
  if (directIcon) return null;
1841
1849
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1842
1850
  }, [directIcon, effectiveName, family]);
@@ -1845,10 +1853,11 @@ var init_Icon = __esm({
1845
1853
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
1846
1854
  ...style
1847
1855
  };
1856
+ const resolvedColor = color ? color in colorTokenClasses ? colorTokenClasses[color] : color : "text-current";
1848
1857
  const composedClassName = cn(
1849
1858
  sizeClasses[size],
1850
1859
  animationClasses[animation],
1851
- color ? color : "text-current",
1860
+ resolvedColor,
1852
1861
  className
1853
1862
  );
1854
1863
  if (directIcon) {
@@ -1894,7 +1903,7 @@ function resolveIconProp(value, sizeClass) {
1894
1903
  const IconComp = value;
1895
1904
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1896
1905
  }
1897
- if (React81__default.isValidElement(value)) {
1906
+ if (React79__default.isValidElement(value)) {
1898
1907
  return value;
1899
1908
  }
1900
1909
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1970,7 +1979,7 @@ var init_Button = __esm({
1970
1979
  md: "h-icon-default w-icon-default",
1971
1980
  lg: "h-icon-default w-icon-default"
1972
1981
  };
1973
- Button = React81__default.forwardRef(
1982
+ Button = React79__default.forwardRef(
1974
1983
  ({
1975
1984
  className,
1976
1985
  variant = "primary",
@@ -2036,7 +2045,7 @@ var init_Input = __esm({
2036
2045
  "components/core/atoms/Input.tsx"() {
2037
2046
  init_cn();
2038
2047
  init_Icon();
2039
- Input = React81__default.forwardRef(
2048
+ Input = React79__default.forwardRef(
2040
2049
  ({
2041
2050
  className,
2042
2051
  inputType,
@@ -2157,7 +2166,7 @@ var Label;
2157
2166
  var init_Label = __esm({
2158
2167
  "components/core/atoms/Label.tsx"() {
2159
2168
  init_cn();
2160
- Label = React81__default.forwardRef(
2169
+ Label = React79__default.forwardRef(
2161
2170
  ({ className, required, children, ...props }, ref) => {
2162
2171
  return /* @__PURE__ */ jsxs(
2163
2172
  "label",
@@ -2183,7 +2192,7 @@ var Textarea;
2183
2192
  var init_Textarea = __esm({
2184
2193
  "components/core/atoms/Textarea.tsx"() {
2185
2194
  init_cn();
2186
- Textarea = React81__default.forwardRef(
2195
+ Textarea = React79__default.forwardRef(
2187
2196
  ({ className, error, ...props }, ref) => {
2188
2197
  return /* @__PURE__ */ jsx(
2189
2198
  "textarea",
@@ -2213,7 +2222,7 @@ var init_Select = __esm({
2213
2222
  "components/core/atoms/Select.tsx"() {
2214
2223
  init_cn();
2215
2224
  init_Icon();
2216
- Select = React81__default.forwardRef(
2225
+ Select = React79__default.forwardRef(
2217
2226
  ({ className, options, placeholder, error, ...props }, ref) => {
2218
2227
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2219
2228
  /* @__PURE__ */ jsxs(
@@ -2255,7 +2264,7 @@ var Checkbox;
2255
2264
  var init_Checkbox = __esm({
2256
2265
  "components/core/atoms/Checkbox.tsx"() {
2257
2266
  init_cn();
2258
- Checkbox = React81__default.forwardRef(
2267
+ Checkbox = React79__default.forwardRef(
2259
2268
  ({ className, label, id, ...props }, ref) => {
2260
2269
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2261
2270
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2346,7 +2355,7 @@ var init_Card = __esm({
2346
2355
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
2347
2356
  "tile-image-first": "p-0 overflow-hidden"
2348
2357
  };
2349
- Card = React81__default.forwardRef(
2358
+ Card = React79__default.forwardRef(
2350
2359
  ({
2351
2360
  className,
2352
2361
  variant = "bordered",
@@ -2384,9 +2393,9 @@ var init_Card = __esm({
2384
2393
  }
2385
2394
  );
2386
2395
  Card.displayName = "Card";
2387
- CardHeader = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2396
+ CardHeader = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2388
2397
  CardHeader.displayName = "CardHeader";
2389
- CardTitle = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2398
+ CardTitle = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2390
2399
  "h3",
2391
2400
  {
2392
2401
  ref,
@@ -2399,11 +2408,11 @@ var init_Card = __esm({
2399
2408
  }
2400
2409
  ));
2401
2410
  CardTitle.displayName = "CardTitle";
2402
- CardContent = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2411
+ CardContent = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2403
2412
  CardContent.displayName = "CardContent";
2404
2413
  CardBody = CardContent;
2405
2414
  CardBody.displayName = "CardBody";
2406
- CardFooter = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2415
+ CardFooter = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2407
2416
  "div",
2408
2417
  {
2409
2418
  ref,
@@ -2456,7 +2465,7 @@ var init_Badge = __esm({
2456
2465
  md: "px-2.5 py-1 text-sm",
2457
2466
  lg: "px-3 py-1.5 text-base"
2458
2467
  };
2459
- Badge = React81__default.forwardRef(
2468
+ Badge = React79__default.forwardRef(
2460
2469
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2461
2470
  const iconSizes3 = {
2462
2471
  sm: "h-icon-default w-icon-default",
@@ -2549,7 +2558,7 @@ var init_FilterPill = __esm({
2549
2558
  md: "w-3.5 h-3.5",
2550
2559
  lg: "w-4 h-4"
2551
2560
  };
2552
- FilterPill = React81__default.forwardRef(
2561
+ FilterPill = React79__default.forwardRef(
2553
2562
  ({
2554
2563
  className,
2555
2564
  variant = "default",
@@ -2626,7 +2635,7 @@ var init_Spinner = __esm({
2626
2635
  md: "h-6 w-6",
2627
2636
  lg: "h-8 w-8"
2628
2637
  };
2629
- Spinner = React81__default.forwardRef(
2638
+ Spinner = React79__default.forwardRef(
2630
2639
  ({ className, size = "md", ...props }, ref) => {
2631
2640
  return /* @__PURE__ */ jsx(
2632
2641
  "div",
@@ -2705,13 +2714,12 @@ var init_Avatar = __esm({
2705
2714
  actionPayload
2706
2715
  }) => {
2707
2716
  const eventBus = useEventBus();
2708
- const [imgFailed, setImgFailed] = React81__default.useState(false);
2709
- React81__default.useEffect(() => {
2717
+ const [imgFailed, setImgFailed] = React79__default.useState(false);
2718
+ React79__default.useEffect(() => {
2710
2719
  setImgFailed(false);
2711
2720
  }, [src]);
2712
2721
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
2713
2722
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
2714
- const hasImage = !!src && !imgFailed;
2715
2723
  const hasIcon = !!IconComponent;
2716
2724
  const hasInitials = !!initials && !(hasIcon && !providedInitials);
2717
2725
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
@@ -2737,15 +2745,13 @@ var init_Avatar = __esm({
2737
2745
  onClick: isClickable ? handleClick : void 0,
2738
2746
  role: isClickable ? "button" : void 0,
2739
2747
  tabIndex: isClickable ? 0 : void 0,
2740
- children: hasImage ? /* @__PURE__ */ jsx(
2748
+ children: src && !imgFailed ? /* @__PURE__ */ jsx(
2741
2749
  "img",
2742
2750
  {
2743
2751
  src,
2744
2752
  alt: alt || "Avatar",
2745
2753
  className: "w-full h-full object-cover",
2746
- onError: () => {
2747
- setImgFailed(true);
2748
- }
2754
+ onError: () => setImgFailed(true)
2749
2755
  }
2750
2756
  ) : hasInitials ? /* @__PURE__ */ jsx(
2751
2757
  "div",
@@ -2913,7 +2919,7 @@ var init_Box = __esm({
2913
2919
  fixed: "fixed",
2914
2920
  sticky: "sticky"
2915
2921
  };
2916
- Box = React81__default.forwardRef(
2922
+ Box = React79__default.forwardRef(
2917
2923
  ({
2918
2924
  padding,
2919
2925
  paddingX,
@@ -2963,7 +2969,7 @@ var init_Box = __esm({
2963
2969
  onMouseLeave?.(e);
2964
2970
  }, [hoverEvent, eventBus, onMouseLeave]);
2965
2971
  const isClickable = action || onClick;
2966
- return React81__default.createElement(
2972
+ return React79__default.createElement(
2967
2973
  Component,
2968
2974
  {
2969
2975
  ref,
@@ -3120,6 +3126,7 @@ var init_ProgressBar = __esm({
3120
3126
  primary: "bg-primary",
3121
3127
  success: "bg-success",
3122
3128
  warning: "bg-warning",
3129
+ error: "bg-error",
3123
3130
  danger: "bg-error"
3124
3131
  };
3125
3132
  circularSizeClasses = {
@@ -3285,7 +3292,7 @@ var init_Radio = __esm({
3285
3292
  md: "w-2.5 h-2.5",
3286
3293
  lg: "w-3 h-3"
3287
3294
  };
3288
- Radio = React81__default.forwardRef(
3295
+ Radio = React79__default.forwardRef(
3289
3296
  ({
3290
3297
  label,
3291
3298
  helperText,
@@ -3302,12 +3309,12 @@ var init_Radio = __esm({
3302
3309
  onChange,
3303
3310
  ...props
3304
3311
  }, ref) => {
3305
- const reactId = React81__default.useId();
3312
+ const reactId = React79__default.useId();
3306
3313
  const baseId = id || `radio-${reactId}`;
3307
3314
  const hasError = !!error;
3308
3315
  const eventBus = useEventBus();
3309
- const [selected, setSelected] = React81__default.useState(value);
3310
- React81__default.useEffect(() => {
3316
+ const [selected, setSelected] = React79__default.useState(value);
3317
+ React79__default.useEffect(() => {
3311
3318
  if (value !== void 0) setSelected(value);
3312
3319
  }, [value]);
3313
3320
  const pick = (next, e) => {
@@ -3489,7 +3496,7 @@ var init_Switch = __esm({
3489
3496
  "components/core/atoms/Switch.tsx"() {
3490
3497
  "use client";
3491
3498
  init_cn();
3492
- Switch = React81.forwardRef(
3499
+ Switch = React79.forwardRef(
3493
3500
  ({
3494
3501
  checked,
3495
3502
  defaultChecked = false,
@@ -3500,10 +3507,10 @@ var init_Switch = __esm({
3500
3507
  name,
3501
3508
  className
3502
3509
  }, ref) => {
3503
- const [isChecked, setIsChecked] = React81.useState(
3510
+ const [isChecked, setIsChecked] = React79.useState(
3504
3511
  checked !== void 0 ? checked : defaultChecked
3505
3512
  );
3506
- React81.useEffect(() => {
3513
+ React79.useEffect(() => {
3507
3514
  if (checked !== void 0) {
3508
3515
  setIsChecked(checked);
3509
3516
  }
@@ -4332,7 +4339,7 @@ var Dialog;
4332
4339
  var init_Dialog = __esm({
4333
4340
  "components/core/atoms/Dialog.tsx"() {
4334
4341
  init_cn();
4335
- Dialog = React81__default.forwardRef(
4342
+ Dialog = React79__default.forwardRef(
4336
4343
  ({
4337
4344
  role = "dialog",
4338
4345
  "aria-modal": ariaModal = true,
@@ -4358,7 +4365,7 @@ var Aside;
4358
4365
  var init_Aside = __esm({
4359
4366
  "components/core/atoms/Aside.tsx"() {
4360
4367
  init_cn();
4361
- Aside = React81__default.forwardRef(
4368
+ Aside = React79__default.forwardRef(
4362
4369
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4363
4370
  );
4364
4371
  Aside.displayName = "Aside";
@@ -4436,8 +4443,8 @@ var init_LawReferenceTooltip = __esm({
4436
4443
  className
4437
4444
  }) => {
4438
4445
  const { t } = useTranslate();
4439
- const [isVisible, setIsVisible] = React81__default.useState(false);
4440
- const timeoutRef = React81__default.useRef(null);
4446
+ const [isVisible, setIsVisible] = React79__default.useState(false);
4447
+ const timeoutRef = React79__default.useRef(null);
4441
4448
  const handleMouseEnter = () => {
4442
4449
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4443
4450
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4446,7 +4453,7 @@ var init_LawReferenceTooltip = __esm({
4446
4453
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4447
4454
  setIsVisible(false);
4448
4455
  };
4449
- React81__default.useEffect(() => {
4456
+ React79__default.useEffect(() => {
4450
4457
  return () => {
4451
4458
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4452
4459
  };
@@ -4656,7 +4663,7 @@ var init_StatusDot = __esm({
4656
4663
  md: "w-2.5 h-2.5",
4657
4664
  lg: "w-3 h-3"
4658
4665
  };
4659
- StatusDot = React81__default.forwardRef(
4666
+ StatusDot = React79__default.forwardRef(
4660
4667
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4661
4668
  return /* @__PURE__ */ jsx(
4662
4669
  "span",
@@ -4710,7 +4717,7 @@ var init_TrendIndicator = __esm({
4710
4717
  down: "trending-down",
4711
4718
  flat: "arrow-right"
4712
4719
  };
4713
- TrendIndicator = React81__default.forwardRef(
4720
+ TrendIndicator = React79__default.forwardRef(
4714
4721
  ({
4715
4722
  className,
4716
4723
  value,
@@ -4777,7 +4784,7 @@ var init_RangeSlider = __esm({
4777
4784
  md: "w-4 h-4",
4778
4785
  lg: "w-5 h-5"
4779
4786
  };
4780
- RangeSlider = React81__default.forwardRef(
4787
+ RangeSlider = React79__default.forwardRef(
4781
4788
  ({
4782
4789
  className,
4783
4790
  min = 0,
@@ -5373,7 +5380,7 @@ var init_ContentSection = __esm({
5373
5380
  md: "py-16",
5374
5381
  lg: "py-24"
5375
5382
  };
5376
- ContentSection = React81__default.forwardRef(
5383
+ ContentSection = React79__default.forwardRef(
5377
5384
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5378
5385
  return /* @__PURE__ */ jsx(
5379
5386
  Box,
@@ -5907,7 +5914,7 @@ var init_AnimatedReveal = __esm({
5907
5914
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5908
5915
  "none": {}
5909
5916
  };
5910
- AnimatedReveal = React81__default.forwardRef(
5917
+ AnimatedReveal = React79__default.forwardRef(
5911
5918
  ({
5912
5919
  trigger = "scroll",
5913
5920
  animation = "fade-up",
@@ -6067,7 +6074,7 @@ var init_AnimatedGraphic = __esm({
6067
6074
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6068
6075
  "use client";
6069
6076
  init_cn();
6070
- AnimatedGraphic = React81__default.forwardRef(
6077
+ AnimatedGraphic = React79__default.forwardRef(
6071
6078
  ({
6072
6079
  src,
6073
6080
  svgContent,
@@ -6090,7 +6097,7 @@ var init_AnimatedGraphic = __esm({
6090
6097
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6091
6098
  const resolvedSvg = svgContent ?? fetchedSvg;
6092
6099
  const prevAnimateRef = useRef(animate);
6093
- const setRef = React81__default.useCallback(
6100
+ const setRef = React79__default.useCallback(
6094
6101
  (node) => {
6095
6102
  containerRef.current = node;
6096
6103
  if (typeof ref === "function") ref(node);
@@ -6196,7 +6203,6 @@ var init_Modal = __esm({
6196
6203
  init_Button();
6197
6204
  init_Dialog();
6198
6205
  init_Typography();
6199
- init_Overlay();
6200
6206
  init_cn();
6201
6207
  init_useEventBus();
6202
6208
  sizeClasses6 = {
@@ -6286,124 +6292,117 @@ var init_Modal = __esm({
6286
6292
  }
6287
6293
  };
6288
6294
  return createPortal(
6289
- /* @__PURE__ */ jsxs(Fragment, { children: [
6290
- /* @__PURE__ */ jsx(
6291
- Overlay,
6292
- {
6293
- isVisible: isOpen,
6294
- onClick: handleOverlayClick,
6295
- className: "z-[1000]"
6296
- }
6297
- ),
6298
- /* @__PURE__ */ jsx(
6299
- Box,
6300
- {
6301
- className: cn(
6302
- "fixed inset-0 z-[1001] pointer-events-none",
6303
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6304
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6305
- ),
6306
- children: /* @__PURE__ */ jsxs(
6307
- Dialog,
6308
- {
6309
- ref: modalRef,
6310
- open: true,
6311
- className: cn(
6312
- // Reset browser-default dialog chrome — we own styling. `static`
6313
- // overrides the user-agent `position: absolute` so the parent
6314
- // flex container's `justify-center` actually centers the dialog
6315
- // (without this, the dialog drops out of flex flow and `m-0`
6316
- // kills the user-agent's `margin: auto` centering, pinning the
6317
- // dialog to top-left).
6318
- "static m-0 p-0 border-0 bg-transparent",
6319
- // Pre-existing dialog frame
6320
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6321
- // Desktop sizing + viewport-aware floor.
6322
- sizeClasses6[size],
6323
- minWidthClasses[size],
6324
- "max-h-[80vh]",
6325
- // Mobile: take the entire screen. Override desktop max-w cap,
6326
- // full height, no rounded corners, no min-width.
6327
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6328
- lookStyles2[look],
6329
- className
6295
+ /* @__PURE__ */ jsx(
6296
+ "div",
6297
+ {
6298
+ className: cn(
6299
+ "fixed inset-0 z-[1000]",
6300
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6301
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6302
+ ),
6303
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
6304
+ onClick: handleOverlayClick,
6305
+ "aria-hidden": "true",
6306
+ children: /* @__PURE__ */ jsxs(
6307
+ Dialog,
6308
+ {
6309
+ ref: modalRef,
6310
+ open: true,
6311
+ className: cn(
6312
+ // Reset browser-default dialog chrome — we own styling. `static`
6313
+ // overrides the user-agent `position: absolute` so the parent
6314
+ // flex container's `justify-center` actually centers the dialog
6315
+ // (without this, the dialog drops out of flex flow and `m-0`
6316
+ // kills the user-agent's `margin: auto` centering, pinning the
6317
+ // dialog to top-left).
6318
+ "static m-0 p-0 border-0 bg-transparent",
6319
+ // Pre-existing dialog frame
6320
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6321
+ // Desktop sizing + viewport-aware floor.
6322
+ sizeClasses6[size],
6323
+ minWidthClasses[size],
6324
+ "max-h-[80vh]",
6325
+ // Mobile: take the entire screen. Override desktop max-w cap,
6326
+ // full height, no rounded corners, no min-width.
6327
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6328
+ lookStyles2[look],
6329
+ className
6330
+ ),
6331
+ style: dragY > 0 ? {
6332
+ transform: `translateY(${dragY}px)`,
6333
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6334
+ } : void 0,
6335
+ ...title && { "aria-labelledby": "modal-title" },
6336
+ children: [
6337
+ /* @__PURE__ */ jsx(
6338
+ Box,
6339
+ {
6340
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6341
+ onPointerDown: (e) => {
6342
+ if (!swipeDownToClose) return;
6343
+ dragStartY.current = e.clientY;
6344
+ isDragging.current = true;
6345
+ e.target.setPointerCapture(e.pointerId);
6346
+ },
6347
+ onPointerMove: (e) => {
6348
+ if (!isDragging.current) return;
6349
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6350
+ setDragY(dy);
6351
+ },
6352
+ onPointerUp: () => {
6353
+ if (!isDragging.current) return;
6354
+ isDragging.current = false;
6355
+ if (dragY > 100) {
6356
+ handleClose();
6357
+ }
6358
+ setDragY(0);
6359
+ },
6360
+ onPointerCancel: () => {
6361
+ isDragging.current = false;
6362
+ setDragY(0);
6363
+ },
6364
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6365
+ }
6330
6366
  ),
6331
- style: dragY > 0 ? {
6332
- transform: `translateY(${dragY}px)`,
6333
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6334
- } : void 0,
6335
- ...title && { "aria-labelledby": "modal-title" },
6336
- children: [
6337
- /* @__PURE__ */ jsx(
6338
- Box,
6339
- {
6340
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6341
- onPointerDown: (e) => {
6342
- if (!swipeDownToClose) return;
6343
- dragStartY.current = e.clientY;
6344
- isDragging.current = true;
6345
- e.target.setPointerCapture(e.pointerId);
6346
- },
6347
- onPointerMove: (e) => {
6348
- if (!isDragging.current) return;
6349
- const dy = Math.max(0, e.clientY - dragStartY.current);
6350
- setDragY(dy);
6351
- },
6352
- onPointerUp: () => {
6353
- if (!isDragging.current) return;
6354
- isDragging.current = false;
6355
- if (dragY > 100) {
6356
- handleClose();
6367
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
6368
+ Box,
6369
+ {
6370
+ className: cn(
6371
+ "px-6 py-4 flex items-center justify-between",
6372
+ "border-b-[length:var(--border-width)] border-border"
6373
+ ),
6374
+ children: [
6375
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6376
+ showCloseButton && /* @__PURE__ */ jsx(
6377
+ Button,
6378
+ {
6379
+ variant: "ghost",
6380
+ size: "sm",
6381
+ icon: "x",
6382
+ onClick: handleClose,
6383
+ "data-event": "CLOSE",
6384
+ "aria-label": t("aria.closeModal")
6357
6385
  }
6358
- setDragY(0);
6359
- },
6360
- onPointerCancel: () => {
6361
- isDragging.current = false;
6362
- setDragY(0);
6363
- },
6364
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6365
- }
6366
- ),
6367
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
6368
- Box,
6369
- {
6370
- className: cn(
6371
- "px-6 py-4 flex items-center justify-between",
6372
- "border-b-[length:var(--border-width)] border-border"
6373
- ),
6374
- children: [
6375
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6376
- showCloseButton && /* @__PURE__ */ jsx(
6377
- Button,
6378
- {
6379
- variant: "ghost",
6380
- size: "sm",
6381
- icon: "x",
6382
- onClick: handleClose,
6383
- "data-event": "CLOSE",
6384
- "aria-label": t("aria.closeModal")
6385
- }
6386
- )
6387
- ]
6388
- }
6389
- ),
6390
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6391
- footer && /* @__PURE__ */ jsx(
6392
- Box,
6393
- {
6394
- className: cn(
6395
- "px-6 py-4 bg-muted",
6396
- "border-t-[length:var(--border-width)] border-border"
6397
- ),
6398
- children: footer
6399
- }
6400
- )
6401
- ]
6402
- }
6403
- )
6404
- }
6405
- )
6406
- ] }),
6386
+ )
6387
+ ]
6388
+ }
6389
+ ),
6390
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6391
+ footer && /* @__PURE__ */ jsx(
6392
+ Box,
6393
+ {
6394
+ className: cn(
6395
+ "px-6 py-4 bg-muted",
6396
+ "border-t-[length:var(--border-width)] border-border"
6397
+ ),
6398
+ children: footer
6399
+ }
6400
+ )
6401
+ ]
6402
+ }
6403
+ )
6404
+ }
6405
+ ),
6407
6406
  document.body
6408
6407
  );
6409
6408
  };
@@ -6780,7 +6779,7 @@ var init_ErrorBoundary = __esm({
6780
6779
  }
6781
6780
  );
6782
6781
  };
6783
- ErrorBoundary = class extends React81__default.Component {
6782
+ ErrorBoundary = class extends React79__default.Component {
6784
6783
  constructor(props) {
6785
6784
  super(props);
6786
6785
  __publicField(this, "reset", () => {
@@ -7832,7 +7831,7 @@ var init_Tooltip = __esm({
7832
7831
  setIsVisible(false);
7833
7832
  }, hideDelay);
7834
7833
  };
7835
- useEffect(() => {
7834
+ useLayoutEffect(() => {
7836
7835
  if (isVisible) {
7837
7836
  updatePosition();
7838
7837
  }
@@ -7843,8 +7842,8 @@ var init_Tooltip = __esm({
7843
7842
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7844
7843
  };
7845
7844
  }, []);
7846
- const triggerElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7847
- const trigger = React81__default.cloneElement(triggerElement, {
7845
+ const triggerElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7846
+ const trigger = React79__default.cloneElement(triggerElement, {
7848
7847
  ref: triggerRef,
7849
7848
  onMouseEnter: handleMouseEnter,
7850
7849
  onMouseLeave: handleMouseLeave,
@@ -7991,8 +7990,8 @@ var init_Popover = __esm({
7991
7990
  onMouseEnter: handleOpen,
7992
7991
  onMouseLeave: handleClose
7993
7992
  };
7994
- const childElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7995
- const triggerElement = React81__default.cloneElement(
7993
+ const childElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7994
+ const triggerElement = React79__default.cloneElement(
7996
7995
  childElement,
7997
7996
  {
7998
7997
  ref: triggerRef,
@@ -8008,7 +8007,10 @@ var init_Popover = __esm({
8008
8007
  "bg-card border-2 border-border shadow-elevation-popover",
8009
8008
  className
8010
8009
  ),
8011
- style: computePopoverStyle(position, triggerRect, popoverWidth),
8010
+ style: {
8011
+ ...computePopoverStyle(position, triggerRect, popoverWidth),
8012
+ ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
8013
+ },
8012
8014
  role: "dialog",
8013
8015
  onMouseEnter: trigger === "hover" ? handleOpen : void 0,
8014
8016
  onMouseLeave: trigger === "hover" ? handleClose : void 0,
@@ -8118,8 +8120,8 @@ var init_Menu = __esm({
8118
8120
  };
8119
8121
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
8120
8122
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
8121
- const triggerChild = React81__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8122
- const triggerElement = React81__default.cloneElement(
8123
+ const triggerChild = React79__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8124
+ const triggerElement = React79__default.cloneElement(
8123
8125
  triggerChild,
8124
8126
  {
8125
8127
  ref: triggerRef,
@@ -8526,7 +8528,7 @@ var init_MapView = __esm({
8526
8528
  shadowSize: [41, 41]
8527
8529
  });
8528
8530
  L.Marker.prototype.options.icon = defaultIcon;
8529
- const { useEffect: useEffect71, useRef: useRef68, useCallback: useCallback116, useState: useState102 } = React81__default;
8531
+ const { useEffect: useEffect71, useRef: useRef68, useCallback: useCallback114, useState: useState100 } = React79__default;
8530
8532
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8531
8533
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8532
8534
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -8571,8 +8573,8 @@ var init_MapView = __esm({
8571
8573
  showAttribution = true
8572
8574
  }) {
8573
8575
  const eventBus = useEventBus2();
8574
- const [clickedPosition, setClickedPosition] = useState102(null);
8575
- const handleMapClick = useCallback116((lat, lng) => {
8576
+ const [clickedPosition, setClickedPosition] = useState100(null);
8577
+ const handleMapClick = useCallback114((lat, lng) => {
8576
8578
  if (showClickedPin) {
8577
8579
  setClickedPosition({ lat, lng });
8578
8580
  }
@@ -8581,7 +8583,7 @@ var init_MapView = __esm({
8581
8583
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
8582
8584
  }
8583
8585
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
8584
- const handleMarkerClick = useCallback116((marker) => {
8586
+ const handleMarkerClick = useCallback114((marker) => {
8585
8587
  onMarkerClick?.(marker);
8586
8588
  if (markerClickEvent) {
8587
8589
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -8590,7 +8592,7 @@ var init_MapView = __esm({
8590
8592
  return /* @__PURE__ */ jsx(
8591
8593
  Box,
8592
8594
  {
8593
- className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
8595
+ className: cn("relative isolate z-0 w-full overflow-hidden rounded-lg", className),
8594
8596
  style: { height },
8595
8597
  "data-testid": "map-view",
8596
8598
  children: /* @__PURE__ */ jsxs(
@@ -8772,7 +8774,7 @@ function InputPattern({
8772
8774
  fieldName
8773
8775
  }) {
8774
8776
  const { emit } = useEventBus();
8775
- const [localValue, setLocalValue] = React81__default.useState(value);
8777
+ const [localValue, setLocalValue] = React79__default.useState(value);
8776
8778
  const handleChange = (e) => {
8777
8779
  setLocalValue(e.target.value);
8778
8780
  if (onChange) {
@@ -8810,7 +8812,7 @@ function TextareaPattern({
8810
8812
  fieldName
8811
8813
  }) {
8812
8814
  const { emit } = useEventBus();
8813
- const [localValue, setLocalValue] = React81__default.useState(value);
8815
+ const [localValue, setLocalValue] = React79__default.useState(value);
8814
8816
  const handleChange = (e) => {
8815
8817
  setLocalValue(e.target.value);
8816
8818
  if (onChange) {
@@ -8842,7 +8844,7 @@ function SelectPattern({
8842
8844
  fieldName
8843
8845
  }) {
8844
8846
  const { emit } = useEventBus();
8845
- const [localValue, setLocalValue] = React81__default.useState(value);
8847
+ const [localValue, setLocalValue] = React79__default.useState(value);
8846
8848
  const handleChange = (e) => {
8847
8849
  setLocalValue(e.target.value);
8848
8850
  if (onChange) {
@@ -8871,7 +8873,7 @@ function CheckboxPattern({
8871
8873
  className
8872
8874
  }) {
8873
8875
  const { emit } = useEventBus();
8874
- const [localChecked, setLocalChecked] = React81__default.useState(checked);
8876
+ const [localChecked, setLocalChecked] = React79__default.useState(checked);
8875
8877
  const handleChange = (e) => {
8876
8878
  setLocalChecked(e.target.checked);
8877
8879
  if (onChange) {
@@ -9185,9 +9187,9 @@ function ControlButton({
9185
9187
  className
9186
9188
  }) {
9187
9189
  const eventBus = useEventBus();
9188
- const [isPressed, setIsPressed] = React81.useState(false);
9190
+ const [isPressed, setIsPressed] = React79.useState(false);
9189
9191
  const actualPressed = pressed ?? isPressed;
9190
- const handlePointerDown = React81.useCallback(
9192
+ const handlePointerDown = React79.useCallback(
9191
9193
  (e) => {
9192
9194
  e.preventDefault();
9193
9195
  if (disabled) return;
@@ -9197,7 +9199,7 @@ function ControlButton({
9197
9199
  },
9198
9200
  [disabled, pressEvent, eventBus, onPress]
9199
9201
  );
9200
- const handlePointerUp = React81.useCallback(
9202
+ const handlePointerUp = React79.useCallback(
9201
9203
  (e) => {
9202
9204
  e.preventDefault();
9203
9205
  if (disabled) return;
@@ -9207,7 +9209,7 @@ function ControlButton({
9207
9209
  },
9208
9210
  [disabled, releaseEvent, eventBus, onRelease]
9209
9211
  );
9210
- const handlePointerLeave = React81.useCallback(
9212
+ const handlePointerLeave = React79.useCallback(
9211
9213
  (e) => {
9212
9214
  if (isPressed) {
9213
9215
  setIsPressed(false);
@@ -9284,8 +9286,8 @@ function ActionButtons({
9284
9286
  disabled
9285
9287
  }) {
9286
9288
  const eventBus = useEventBus();
9287
- const [activeButtons, setActiveButtons] = React81.useState(/* @__PURE__ */ new Set());
9288
- const handlePress = React81.useCallback(
9289
+ const [activeButtons, setActiveButtons] = React79.useState(/* @__PURE__ */ new Set());
9290
+ const handlePress = React79.useCallback(
9289
9291
  (id) => {
9290
9292
  setActiveButtons((prev) => new Set(prev).add(id));
9291
9293
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9293,7 +9295,7 @@ function ActionButtons({
9293
9295
  },
9294
9296
  [actionEvent, eventBus, onAction]
9295
9297
  );
9296
- const handleRelease = React81.useCallback(
9298
+ const handleRelease = React79.useCallback(
9297
9299
  (id) => {
9298
9300
  setActiveButtons((prev) => {
9299
9301
  const next = new Set(prev);
@@ -12185,6 +12187,263 @@ var init_katex_min = __esm({
12185
12187
  "node_modules/katex/dist/katex.min.css"() {
12186
12188
  }
12187
12189
  });
12190
+ var Tabs;
12191
+ var init_Tabs = __esm({
12192
+ "components/core/molecules/Tabs.tsx"() {
12193
+ "use client";
12194
+ init_Icon();
12195
+ init_Badge();
12196
+ init_Typography();
12197
+ init_Box();
12198
+ init_cn();
12199
+ init_useEventBus();
12200
+ Tabs = ({
12201
+ items,
12202
+ tabs,
12203
+ defaultActiveTab,
12204
+ activeTab: controlledActiveTab,
12205
+ onTabChange,
12206
+ tabChangeEvent,
12207
+ variant = "default",
12208
+ orientation = "horizontal",
12209
+ className
12210
+ }) => {
12211
+ const rawItems = items ?? tabs ?? [];
12212
+ const safeItems = rawItems.map(({ id, value, ...rest }) => ({
12213
+ ...rest,
12214
+ id: id || value || ""
12215
+ }));
12216
+ const eventBus = useEventBus();
12217
+ const { t } = useTranslate();
12218
+ const initialActive = safeItems.find((item) => item.active)?.id;
12219
+ const [internalActiveTab, setInternalActiveTab] = useState(
12220
+ defaultActiveTab || initialActive || safeItems[0]?.id || ""
12221
+ );
12222
+ const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
12223
+ const tabRefs = useRef({});
12224
+ const handleTabChange = (tabId, tabEvent) => {
12225
+ if (controlledActiveTab === void 0) {
12226
+ setInternalActiveTab(tabId);
12227
+ }
12228
+ onTabChange?.(tabId);
12229
+ if (tabChangeEvent) {
12230
+ eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
12231
+ }
12232
+ if (tabEvent) {
12233
+ eventBus.emit(`UI:${tabEvent}`, { tabId });
12234
+ }
12235
+ };
12236
+ const handleKeyDown = (e, index) => {
12237
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
12238
+ e.preventDefault();
12239
+ const direction = e.key === "ArrowLeft" ? -1 : 1;
12240
+ const nextIndex = (index + direction + safeItems.length) % safeItems.length;
12241
+ const nextTab = safeItems[nextIndex];
12242
+ if (nextTab && !nextTab.disabled) {
12243
+ handleTabChange(nextTab.id);
12244
+ tabRefs.current[nextTab.id]?.focus();
12245
+ }
12246
+ } else if (e.key === "Home" || e.key === "End") {
12247
+ e.preventDefault();
12248
+ const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
12249
+ const targetTab = safeItems[targetIndex];
12250
+ if (targetTab && !targetTab.disabled) {
12251
+ handleTabChange(targetTab.id);
12252
+ tabRefs.current[targetTab.id]?.focus();
12253
+ }
12254
+ }
12255
+ };
12256
+ const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
12257
+ if (safeItems.length === 0) {
12258
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
12259
+ }
12260
+ const variantClasses2 = {
12261
+ default: [
12262
+ "border-b-[length:var(--border-width)] border-transparent",
12263
+ "hover:border-muted-foreground",
12264
+ "data-[active=true]:border-primary"
12265
+ ].join(" "),
12266
+ pills: [
12267
+ "rounded-sm",
12268
+ "data-[active=true]:bg-primary",
12269
+ "data-[active=true]:text-primary-foreground"
12270
+ ].join(" "),
12271
+ underline: [
12272
+ "border-b-[length:var(--border-width)] border-transparent",
12273
+ "data-[active=true]:border-primary"
12274
+ ].join(" ")
12275
+ };
12276
+ return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
12277
+ /* @__PURE__ */ jsx(
12278
+ Box,
12279
+ {
12280
+ role: "tablist",
12281
+ className: cn(
12282
+ "flex",
12283
+ // Horizontal tab strip becomes a horizontally-scrollable lane
12284
+ // below its container width — phones with many tabs scroll
12285
+ // instead of clipping. `snap-x` snaps to each tab; the
12286
+ // scrollbar is hidden for a cleaner affordance (the swipe
12287
+ // gesture is the discoverability cue).
12288
+ 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",
12289
+ variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
12290
+ variant === "underline" && orientation === "vertical" && "border-b-0"
12291
+ ),
12292
+ children: safeItems.map((item, index) => {
12293
+ const isActive = item.id === activeTab;
12294
+ const isDisabled = item.disabled;
12295
+ return /* @__PURE__ */ jsxs(
12296
+ Box,
12297
+ {
12298
+ as: "button",
12299
+ ref: (el) => {
12300
+ tabRefs.current[item.id] = el;
12301
+ },
12302
+ role: "tab",
12303
+ "aria-selected": isActive,
12304
+ "aria-controls": `tabpanel-${item.id}`,
12305
+ "aria-disabled": isDisabled,
12306
+ onClick: () => !isDisabled && handleTabChange(item.id, item.event),
12307
+ onKeyDown: (e) => handleKeyDown(e, index),
12308
+ "data-active": isActive,
12309
+ className: cn(
12310
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
12311
+ orientation === "horizontal" && "snap-start shrink-0",
12312
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
12313
+ isDisabled && "opacity-50 cursor-not-allowed",
12314
+ variantClasses2[variant],
12315
+ isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
12316
+ ),
12317
+ children: [
12318
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
12319
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
12320
+ item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
12321
+ ]
12322
+ },
12323
+ item.id
12324
+ );
12325
+ })
12326
+ }
12327
+ ),
12328
+ activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
12329
+ Box,
12330
+ {
12331
+ role: "tabpanel",
12332
+ id: `tabpanel-${activeTab}`,
12333
+ "aria-labelledby": `tab-${activeTab}`,
12334
+ className: "mt-4",
12335
+ children: activeTabContent
12336
+ }
12337
+ )
12338
+ ] });
12339
+ };
12340
+ Tabs.displayName = "Tabs";
12341
+ }
12342
+ });
12343
+ var ICON_NAME_ALIASES, lookStyles3, EmptyState;
12344
+ var init_EmptyState = __esm({
12345
+ "components/core/molecules/EmptyState.tsx"() {
12346
+ "use client";
12347
+ init_cn();
12348
+ init_atoms2();
12349
+ init_Box();
12350
+ init_Icon();
12351
+ init_Stack();
12352
+ init_Typography();
12353
+ init_useEventBus();
12354
+ ICON_NAME_ALIASES = {
12355
+ check: "check-circle",
12356
+ error: "x-circle",
12357
+ warning: "alert-circle"
12358
+ };
12359
+ lookStyles3 = {
12360
+ "icon-only": "",
12361
+ illustrated: "[&_svg]:w-32 [&_svg]:h-32",
12362
+ "text-only": "[&_svg]:hidden",
12363
+ mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
12364
+ };
12365
+ EmptyState = ({
12366
+ icon,
12367
+ title,
12368
+ message,
12369
+ description,
12370
+ actionLabel,
12371
+ onAction,
12372
+ className,
12373
+ destructive,
12374
+ variant,
12375
+ actionEvent,
12376
+ look = "icon-only"
12377
+ }) => {
12378
+ const eventBus = useEventBus();
12379
+ const { t } = useTranslate();
12380
+ const handleAction = () => {
12381
+ if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
12382
+ onAction?.();
12383
+ };
12384
+ const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
12385
+ const iconComponent = typeof icon === "function" ? icon : void 0;
12386
+ const hasIcon = Boolean(iconName || iconComponent);
12387
+ const isDestructive = destructive || variant === "error";
12388
+ const isSuccess = variant === "success";
12389
+ const displayText = title || message || t("empty.noItems");
12390
+ return /* @__PURE__ */ jsxs(
12391
+ VStack,
12392
+ {
12393
+ align: "center",
12394
+ className: cn(
12395
+ "justify-center py-12 text-center",
12396
+ lookStyles3[look],
12397
+ className
12398
+ ),
12399
+ children: [
12400
+ hasIcon && /* @__PURE__ */ jsx(
12401
+ Box,
12402
+ {
12403
+ className: cn(
12404
+ "mb-4 rounded-full p-3",
12405
+ isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
12406
+ ),
12407
+ children: /* @__PURE__ */ jsx(
12408
+ Icon,
12409
+ {
12410
+ ...iconName ? { name: iconName } : { icon: iconComponent },
12411
+ className: cn(
12412
+ "h-8 w-8",
12413
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
12414
+ )
12415
+ }
12416
+ )
12417
+ }
12418
+ ),
12419
+ /* @__PURE__ */ jsx(
12420
+ Typography,
12421
+ {
12422
+ variant: "h3",
12423
+ className: cn(
12424
+ "text-lg font-medium",
12425
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
12426
+ ),
12427
+ children: displayText
12428
+ }
12429
+ ),
12430
+ description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
12431
+ actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
12432
+ Button,
12433
+ {
12434
+ className: "mt-4",
12435
+ variant: isDestructive ? "danger" : "primary",
12436
+ onClick: handleAction,
12437
+ children: actionLabel
12438
+ }
12439
+ )
12440
+ ]
12441
+ }
12442
+ );
12443
+ };
12444
+ EmptyState.displayName = "EmptyState";
12445
+ }
12446
+ });
12188
12447
  function computeFoldRegions(code) {
12189
12448
  const lines = code.split("\n");
12190
12449
  const regions = [];
@@ -12222,9 +12481,32 @@ function computeFoldRegions(code) {
12222
12481
  function toCodeLanguage(value) {
12223
12482
  return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
12224
12483
  }
12225
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12484
+ function generateDiff(oldVal, newVal) {
12485
+ const oldLines = oldVal.split("\n");
12486
+ const newLines = newVal.split("\n");
12487
+ const diff = [];
12488
+ const maxLen = Math.max(oldLines.length, newLines.length);
12489
+ for (let i = 0; i < maxLen; i++) {
12490
+ const oldLine = oldLines[i];
12491
+ const newLine = newLines[i];
12492
+ if (oldLine === newLine) {
12493
+ diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
12494
+ } else {
12495
+ if (oldLine !== void 0) diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
12496
+ if (newLine !== void 0) diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
12497
+ }
12498
+ }
12499
+ return diff;
12500
+ }
12501
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12226
12502
  var init_CodeBlock = __esm({
12227
12503
  "components/core/molecules/markdown/CodeBlock.tsx"() {
12504
+ init_cn();
12505
+ init_atoms2();
12506
+ init_Tabs();
12507
+ init_LoadingState();
12508
+ init_ErrorState();
12509
+ init_EmptyState();
12228
12510
  init_Box();
12229
12511
  init_Button();
12230
12512
  init_Badge();
@@ -12331,9 +12613,14 @@ var init_CodeBlock = __esm({
12331
12613
  "lolo"
12332
12614
  ];
12333
12615
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
12616
+ DIFF_STYLES = {
12617
+ add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12618
+ remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12619
+ context: { bg: "", prefix: " ", text: "text-foreground" }
12620
+ };
12334
12621
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12335
12622
  HIDDEN_LINE_NUMBERS = { display: "none" };
12336
- CodeBlock = React81__default.memo(
12623
+ CodeBlock = React79__default.memo(
12337
12624
  ({
12338
12625
  code: rawCode,
12339
12626
  language = "text",
@@ -12344,7 +12631,20 @@ var init_CodeBlock = __esm({
12344
12631
  className,
12345
12632
  editable = false,
12346
12633
  onChange,
12347
- errorLines
12634
+ errorLines,
12635
+ // viewer props
12636
+ title,
12637
+ mode = "code",
12638
+ diff: propDiff,
12639
+ oldValue,
12640
+ newValue,
12641
+ showLineNumbers = false,
12642
+ wordWrap = false,
12643
+ files,
12644
+ actions,
12645
+ isLoading = false,
12646
+ error,
12647
+ showCopy
12348
12648
  }) => {
12349
12649
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
12350
12650
  const isOrb = language === "orb";
@@ -12356,6 +12656,20 @@ var init_CodeBlock = __esm({
12356
12656
  const codeRef = useRef(null);
12357
12657
  const savedScrollLeftRef = useRef(0);
12358
12658
  const [copied, setCopied] = useState(false);
12659
+ const [wrap, setWrap] = useState(wordWrap);
12660
+ const [activeFileIndex, setActiveFileIndex] = useState(0);
12661
+ const activeFile = files?.[activeFileIndex];
12662
+ const activeCode = activeFile?.code ?? code;
12663
+ const activeLanguage = activeFile?.language ?? language;
12664
+ const diffLines = useMemo(() => {
12665
+ if (propDiff) return propDiff;
12666
+ if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
12667
+ return generateDiff(oldValue, newValue);
12668
+ }
12669
+ return null;
12670
+ }, [propDiff, mode, oldValue, newValue]);
12671
+ const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
12672
+ const effectiveCopy = showCopy ?? showCopyButton;
12359
12673
  const [editableValue, setEditableValue] = useState(code);
12360
12674
  const [editableTextareaKey, setEditableTextareaKey] = useState(0);
12361
12675
  const lastPropCodeRef = useRef(code);
@@ -12526,13 +12840,13 @@ var init_CodeBlock = __esm({
12526
12840
  }, [language, code]);
12527
12841
  const handleCopy = async () => {
12528
12842
  try {
12529
- await navigator.clipboard.writeText(code);
12843
+ await navigator.clipboard.writeText(activeCode);
12530
12844
  setCopied(true);
12531
- eventBus.emit("UI:COPY_CODE", { language, success: true });
12845
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
12532
12846
  setTimeout(() => setCopied(false), 2e3);
12533
12847
  } catch (err) {
12534
12848
  log5.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
12535
- eventBus.emit("UI:COPY_CODE", { language, success: false });
12849
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
12536
12850
  }
12537
12851
  };
12538
12852
  const handleSelectionCopy = useCallback((e) => {
@@ -12585,11 +12899,134 @@ var init_CodeBlock = __esm({
12585
12899
  }
12586
12900
  });
12587
12901
  }
12588
- const full = code.split("\n").slice(a, endLine + 1).join("\n");
12902
+ const full = activeCode.split("\n").slice(a, endLine + 1).join("\n");
12589
12903
  e.clipboardData.setData("text/plain", full);
12590
12904
  e.preventDefault();
12591
12905
  }, [code]);
12592
- const hasHeader = showLanguageBadge || showCopyButton;
12906
+ if (isLoading) {
12907
+ return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
12908
+ }
12909
+ if (error) {
12910
+ return /* @__PURE__ */ jsx(ErrorState, { title: t("display.codeViewerError"), message: error.message, className });
12911
+ }
12912
+ if (isViewerMode && !activeCode && !diffLines) {
12913
+ return /* @__PURE__ */ jsx(EmptyState, { icon: Code, title: t("display.noCode"), description: "No code to display.", className });
12914
+ }
12915
+ if (isViewerMode) {
12916
+ const tabItems = files?.map((file, idx) => ({
12917
+ id: `file-${idx}`,
12918
+ label: file.label,
12919
+ content: null
12920
+ }));
12921
+ const lines = activeCode.split("\n");
12922
+ return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
12923
+ tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
12924
+ Tabs,
12925
+ {
12926
+ tabs: tabItems,
12927
+ activeTab: `file-${activeFileIndex}`,
12928
+ onTabChange: (id) => {
12929
+ const idx = parseInt(id.replace("file-", ""), 10);
12930
+ setActiveFileIndex(idx);
12931
+ }
12932
+ }
12933
+ ) }),
12934
+ /* @__PURE__ */ jsxs(
12935
+ HStack,
12936
+ {
12937
+ gap: "sm",
12938
+ align: "center",
12939
+ justify: "between",
12940
+ className: "px-4 py-2 border-b border-border bg-muted/30",
12941
+ children: [
12942
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
12943
+ /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
12944
+ title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
12945
+ activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
12946
+ ] }),
12947
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
12948
+ /* @__PURE__ */ jsx(
12949
+ Button,
12950
+ {
12951
+ variant: "ghost",
12952
+ size: "sm",
12953
+ icon: WrapText,
12954
+ onClick: () => setWrap(!wrap),
12955
+ className: cn(wrap && "text-primary")
12956
+ }
12957
+ ),
12958
+ effectiveCopy && /* @__PURE__ */ jsx(
12959
+ Button,
12960
+ {
12961
+ variant: "ghost",
12962
+ size: "sm",
12963
+ icon: copied ? Check : Copy,
12964
+ onClick: handleCopy,
12965
+ className: cn(copied && "text-success")
12966
+ }
12967
+ ),
12968
+ actions?.map((action, idx) => /* @__PURE__ */ jsx(
12969
+ Badge,
12970
+ {
12971
+ variant: "default",
12972
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
12973
+ onClick: () => {
12974
+ if (action.event) eventBus.emit(`UI:${action.event}`, {});
12975
+ },
12976
+ children: action.label
12977
+ },
12978
+ idx
12979
+ ))
12980
+ ] })
12981
+ ]
12982
+ }
12983
+ ),
12984
+ /* @__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) => {
12985
+ const style = DIFF_STYLES[line.type];
12986
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
12987
+ showLineNumbers && /* @__PURE__ */ jsx(
12988
+ Typography,
12989
+ {
12990
+ variant: "caption",
12991
+ color: "secondary",
12992
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
12993
+ children: line.lineNumber ?? ""
12994
+ }
12995
+ ),
12996
+ /* @__PURE__ */ jsxs(
12997
+ Typography,
12998
+ {
12999
+ variant: "caption",
13000
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
13001
+ children: [
13002
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
13003
+ line.content
13004
+ ]
13005
+ }
13006
+ )
13007
+ ] }, idx);
13008
+ }) }) : /* @__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: [
13009
+ showLineNumbers && /* @__PURE__ */ jsx(
13010
+ Typography,
13011
+ {
13012
+ variant: "caption",
13013
+ color: "secondary",
13014
+ className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
13015
+ children: idx + 1
13016
+ }
13017
+ ),
13018
+ /* @__PURE__ */ jsx(
13019
+ Typography,
13020
+ {
13021
+ variant: "caption",
13022
+ className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
13023
+ children: line || " "
13024
+ }
13025
+ )
13026
+ ] }, idx)) }) })
13027
+ ] }) });
13028
+ }
13029
+ const hasHeader = showLanguageBadge || effectiveCopy;
12593
13030
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
12594
13031
  hasHeader && /* @__PURE__ */ jsxs(
12595
13032
  HStack,
@@ -12599,7 +13036,7 @@ var init_CodeBlock = __esm({
12599
13036
  className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
12600
13037
  children: [
12601
13038
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
12602
- showCopyButton && /* @__PURE__ */ jsx(
13039
+ effectiveCopy && /* @__PURE__ */ jsx(
12603
13040
  Button,
12604
13041
  {
12605
13042
  variant: "ghost",
@@ -12758,7 +13195,7 @@ var init_CodeBlock = __esm({
12758
13195
  )
12759
13196
  ] });
12760
13197
  },
12761
- (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
13198
+ (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
12762
13199
  );
12763
13200
  CodeBlock.displayName = "CodeBlock";
12764
13201
  }
@@ -12770,7 +13207,7 @@ var init_MarkdownContent = __esm({
12770
13207
  init_Box();
12771
13208
  init_CodeBlock();
12772
13209
  init_cn();
12773
- MarkdownContent = React81__default.memo(
13210
+ MarkdownContent = React79__default.memo(
12774
13211
  ({ content, direction, className }) => {
12775
13212
  const { t: _t } = useTranslate();
12776
13213
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -13866,7 +14303,7 @@ var init_StateMachineView = __esm({
13866
14303
  style: { top: title ? 30 : 0 },
13867
14304
  children: [
13868
14305
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
13869
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React81__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14306
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React79__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
13870
14307
  StateNode,
13871
14308
  {
13872
14309
  state,
@@ -15015,110 +15452,6 @@ var init_BookTableOfContents = __esm({
15015
15452
  BookTableOfContents.displayName = "BookTableOfContents";
15016
15453
  }
15017
15454
  });
15018
- var ICON_NAME_ALIASES, lookStyles3, EmptyState;
15019
- var init_EmptyState = __esm({
15020
- "components/core/molecules/EmptyState.tsx"() {
15021
- "use client";
15022
- init_cn();
15023
- init_atoms2();
15024
- init_Box();
15025
- init_Icon();
15026
- init_Stack();
15027
- init_Typography();
15028
- init_useEventBus();
15029
- ICON_NAME_ALIASES = {
15030
- check: "check-circle",
15031
- error: "x-circle",
15032
- warning: "alert-circle"
15033
- };
15034
- lookStyles3 = {
15035
- "icon-only": "",
15036
- illustrated: "[&_svg]:w-32 [&_svg]:h-32",
15037
- "text-only": "[&_svg]:hidden",
15038
- mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
15039
- };
15040
- EmptyState = ({
15041
- icon,
15042
- title,
15043
- message,
15044
- description,
15045
- actionLabel,
15046
- onAction,
15047
- className,
15048
- destructive,
15049
- variant,
15050
- actionEvent,
15051
- look = "icon-only"
15052
- }) => {
15053
- const eventBus = useEventBus();
15054
- const { t } = useTranslate();
15055
- const handleAction = () => {
15056
- if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
15057
- onAction?.();
15058
- };
15059
- const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
15060
- const iconComponent = typeof icon === "function" ? icon : void 0;
15061
- const hasIcon = Boolean(iconName || iconComponent);
15062
- const isDestructive = destructive || variant === "error";
15063
- const isSuccess = variant === "success";
15064
- const displayText = title || message || t("empty.noItems");
15065
- return /* @__PURE__ */ jsxs(
15066
- VStack,
15067
- {
15068
- align: "center",
15069
- className: cn(
15070
- "justify-center py-12 text-center",
15071
- lookStyles3[look],
15072
- className
15073
- ),
15074
- children: [
15075
- hasIcon && /* @__PURE__ */ jsx(
15076
- Box,
15077
- {
15078
- className: cn(
15079
- "mb-4 rounded-full p-3",
15080
- isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
15081
- ),
15082
- children: /* @__PURE__ */ jsx(
15083
- Icon,
15084
- {
15085
- ...iconName ? { name: iconName } : { icon: iconComponent },
15086
- className: cn(
15087
- "h-8 w-8",
15088
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
15089
- )
15090
- }
15091
- )
15092
- }
15093
- ),
15094
- /* @__PURE__ */ jsx(
15095
- Typography,
15096
- {
15097
- variant: "h3",
15098
- className: cn(
15099
- "text-lg font-medium",
15100
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
15101
- ),
15102
- children: displayText
15103
- }
15104
- ),
15105
- description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
15106
- actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
15107
- Button,
15108
- {
15109
- className: "mt-4",
15110
- variant: isDestructive ? "danger" : "primary",
15111
- onClick: handleAction,
15112
- children: actionLabel
15113
- }
15114
- )
15115
- ]
15116
- }
15117
- );
15118
- };
15119
- EmptyState.displayName = "EmptyState";
15120
- }
15121
- });
15122
15455
 
15123
15456
  // components/core/organisms/book/types.ts
15124
15457
  function resolveFieldMap(fieldMap) {
@@ -15471,7 +15804,7 @@ var init_Grid = __esm({
15471
15804
  as: Component = "div"
15472
15805
  }) => {
15473
15806
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
15474
- return React81__default.createElement(
15807
+ return React79__default.createElement(
15475
15808
  Component,
15476
15809
  {
15477
15810
  className: cn(
@@ -19960,449 +20293,6 @@ var init_ClassifierBoard = __esm({
19960
20293
  ClassifierBoard.displayName = "ClassifierBoard";
19961
20294
  }
19962
20295
  });
19963
- function CodeView({
19964
- data,
19965
- label,
19966
- defaultExpanded = false,
19967
- className
19968
- }) {
19969
- const { t } = useTranslate();
19970
- const [expanded, setExpanded] = useState(defaultExpanded);
19971
- const jsonString = JSON.stringify(data, null, 2);
19972
- return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
19973
- /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
19974
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
19975
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
19976
- ] }),
19977
- expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
19978
- Typography,
19979
- {
19980
- variant: "caption",
19981
- className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
19982
- children: jsonString
19983
- }
19984
- ) })
19985
- ] });
19986
- }
19987
- var init_CodeView = __esm({
19988
- "components/game/organisms/puzzles/state-architect/CodeView.tsx"() {
19989
- init_atoms2();
19990
- init_cn();
19991
- CodeView.displayName = "CodeView";
19992
- }
19993
- });
19994
- var Tabs;
19995
- var init_Tabs = __esm({
19996
- "components/core/molecules/Tabs.tsx"() {
19997
- "use client";
19998
- init_Icon();
19999
- init_Badge();
20000
- init_Typography();
20001
- init_Box();
20002
- init_cn();
20003
- init_useEventBus();
20004
- Tabs = ({
20005
- items,
20006
- tabs,
20007
- defaultActiveTab,
20008
- activeTab: controlledActiveTab,
20009
- onTabChange,
20010
- tabChangeEvent,
20011
- variant = "default",
20012
- orientation = "horizontal",
20013
- className
20014
- }) => {
20015
- const rawItems = items ?? tabs ?? [];
20016
- const safeItems = rawItems.map(({ id, value, ...rest }) => ({
20017
- ...rest,
20018
- id: id || value || ""
20019
- }));
20020
- const eventBus = useEventBus();
20021
- const { t } = useTranslate();
20022
- const initialActive = safeItems.find((item) => item.active)?.id;
20023
- const [internalActiveTab, setInternalActiveTab] = useState(
20024
- defaultActiveTab || initialActive || safeItems[0]?.id || ""
20025
- );
20026
- const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
20027
- const tabRefs = useRef({});
20028
- const handleTabChange = (tabId, tabEvent) => {
20029
- if (controlledActiveTab === void 0) {
20030
- setInternalActiveTab(tabId);
20031
- }
20032
- onTabChange?.(tabId);
20033
- if (tabChangeEvent) {
20034
- eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
20035
- }
20036
- if (tabEvent) {
20037
- eventBus.emit(`UI:${tabEvent}`, { tabId });
20038
- }
20039
- };
20040
- const handleKeyDown = (e, index) => {
20041
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
20042
- e.preventDefault();
20043
- const direction = e.key === "ArrowLeft" ? -1 : 1;
20044
- const nextIndex = (index + direction + safeItems.length) % safeItems.length;
20045
- const nextTab = safeItems[nextIndex];
20046
- if (nextTab && !nextTab.disabled) {
20047
- handleTabChange(nextTab.id);
20048
- tabRefs.current[nextTab.id]?.focus();
20049
- }
20050
- } else if (e.key === "Home" || e.key === "End") {
20051
- e.preventDefault();
20052
- const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
20053
- const targetTab = safeItems[targetIndex];
20054
- if (targetTab && !targetTab.disabled) {
20055
- handleTabChange(targetTab.id);
20056
- tabRefs.current[targetTab.id]?.focus();
20057
- }
20058
- }
20059
- };
20060
- const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
20061
- if (safeItems.length === 0) {
20062
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
20063
- }
20064
- const variantClasses2 = {
20065
- default: [
20066
- "border-b-[length:var(--border-width)] border-transparent",
20067
- "hover:border-muted-foreground",
20068
- "data-[active=true]:border-primary"
20069
- ].join(" "),
20070
- pills: [
20071
- "rounded-sm",
20072
- "data-[active=true]:bg-primary",
20073
- "data-[active=true]:text-primary-foreground"
20074
- ].join(" "),
20075
- underline: [
20076
- "border-b-[length:var(--border-width)] border-transparent",
20077
- "data-[active=true]:border-primary"
20078
- ].join(" ")
20079
- };
20080
- return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
20081
- /* @__PURE__ */ jsx(
20082
- Box,
20083
- {
20084
- role: "tablist",
20085
- className: cn(
20086
- "flex",
20087
- // Horizontal tab strip becomes a horizontally-scrollable lane
20088
- // below its container width — phones with many tabs scroll
20089
- // instead of clipping. `snap-x` snaps to each tab; the
20090
- // scrollbar is hidden for a cleaner affordance (the swipe
20091
- // gesture is the discoverability cue).
20092
- 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",
20093
- variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
20094
- variant === "underline" && orientation === "vertical" && "border-b-0"
20095
- ),
20096
- children: safeItems.map((item, index) => {
20097
- const isActive = item.id === activeTab;
20098
- const isDisabled = item.disabled;
20099
- return /* @__PURE__ */ jsxs(
20100
- Box,
20101
- {
20102
- as: "button",
20103
- ref: (el) => {
20104
- tabRefs.current[item.id] = el;
20105
- },
20106
- role: "tab",
20107
- "aria-selected": isActive,
20108
- "aria-controls": `tabpanel-${item.id}`,
20109
- "aria-disabled": isDisabled,
20110
- onClick: () => !isDisabled && handleTabChange(item.id, item.event),
20111
- onKeyDown: (e) => handleKeyDown(e, index),
20112
- "data-active": isActive,
20113
- className: cn(
20114
- "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
20115
- orientation === "horizontal" && "snap-start shrink-0",
20116
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
20117
- isDisabled && "opacity-50 cursor-not-allowed",
20118
- variantClasses2[variant],
20119
- isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
20120
- ),
20121
- children: [
20122
- item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
20123
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
20124
- item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
20125
- ]
20126
- },
20127
- item.id
20128
- );
20129
- })
20130
- }
20131
- ),
20132
- activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
20133
- Box,
20134
- {
20135
- role: "tabpanel",
20136
- id: `tabpanel-${activeTab}`,
20137
- "aria-labelledby": `tab-${activeTab}`,
20138
- className: "mt-4",
20139
- children: activeTabContent
20140
- }
20141
- )
20142
- ] });
20143
- };
20144
- Tabs.displayName = "Tabs";
20145
- }
20146
- });
20147
- function generateDiff(oldVal, newVal) {
20148
- const oldLines = oldVal.split("\n");
20149
- const newLines = newVal.split("\n");
20150
- const diff = [];
20151
- const maxLen = Math.max(oldLines.length, newLines.length);
20152
- for (let i = 0; i < maxLen; i++) {
20153
- const oldLine = oldLines[i];
20154
- const newLine = newLines[i];
20155
- if (oldLine === newLine) {
20156
- diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
20157
- } else {
20158
- if (oldLine !== void 0) {
20159
- diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
20160
- }
20161
- if (newLine !== void 0) {
20162
- diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
20163
- }
20164
- }
20165
- }
20166
- return diff;
20167
- }
20168
- var DIFF_STYLES, CodeViewer;
20169
- var init_CodeViewer = __esm({
20170
- "components/core/molecules/CodeViewer.tsx"() {
20171
- "use client";
20172
- init_cn();
20173
- init_atoms2();
20174
- init_Stack();
20175
- init_LoadingState();
20176
- init_ErrorState();
20177
- init_EmptyState();
20178
- init_Tabs();
20179
- init_useEventBus();
20180
- DIFF_STYLES = {
20181
- add: {
20182
- bg: "bg-success/10",
20183
- prefix: "+",
20184
- text: "text-success"
20185
- },
20186
- remove: {
20187
- bg: "bg-error/10",
20188
- prefix: "-",
20189
- text: "text-error"
20190
- },
20191
- context: {
20192
- bg: "",
20193
- prefix: " ",
20194
- text: "text-foreground"
20195
- }
20196
- };
20197
- CodeViewer = ({
20198
- title,
20199
- code,
20200
- language,
20201
- diff: propDiff,
20202
- oldValue,
20203
- newValue,
20204
- mode = "code",
20205
- showLineNumbers = true,
20206
- showCopy = true,
20207
- wordWrap = false,
20208
- maxHeight = 500,
20209
- files,
20210
- actions,
20211
- entity,
20212
- isLoading = false,
20213
- error,
20214
- className
20215
- }) => {
20216
- const eventBus = useEventBus();
20217
- const { t } = useTranslate();
20218
- const [copied, setCopied] = useState(false);
20219
- const [wrap, setWrap] = useState(wordWrap);
20220
- const [activeFileIndex, setActiveFileIndex] = useState(0);
20221
- const handleAction = useCallback(
20222
- (action) => {
20223
- if (action.event) {
20224
- eventBus.emit(`UI:${action.event}`, {});
20225
- }
20226
- },
20227
- [eventBus]
20228
- );
20229
- const activeFile = files?.[activeFileIndex];
20230
- const activeCode = activeFile?.code ?? code ?? "";
20231
- const activeLanguage = activeFile?.language ?? language ?? "text";
20232
- const lines = useMemo(() => activeCode.split("\n"), [activeCode]);
20233
- const diffLines = useMemo(() => {
20234
- if (propDiff) return propDiff;
20235
- if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
20236
- return generateDiff(oldValue, newValue);
20237
- }
20238
- return null;
20239
- }, [propDiff, mode, oldValue, newValue]);
20240
- const handleCopy = useCallback(async () => {
20241
- try {
20242
- await navigator.clipboard.writeText(activeCode);
20243
- setCopied(true);
20244
- eventBus.emit("UI:CODE_COPY", { language: activeLanguage });
20245
- setTimeout(() => setCopied(false), 2e3);
20246
- } catch {
20247
- }
20248
- }, [activeCode, eventBus, activeLanguage]);
20249
- const tabItems = files?.map((file, idx) => ({
20250
- id: `file-${idx}`,
20251
- label: file.label,
20252
- content: null
20253
- }));
20254
- if (isLoading) {
20255
- return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
20256
- }
20257
- if (error) {
20258
- return /* @__PURE__ */ jsx(
20259
- ErrorState,
20260
- {
20261
- title: t("display.codeViewerError"),
20262
- message: error.message,
20263
- className
20264
- }
20265
- );
20266
- }
20267
- if (!activeCode && !diffLines) {
20268
- return /* @__PURE__ */ jsx(
20269
- EmptyState,
20270
- {
20271
- icon: Code,
20272
- title: t("display.noCode"),
20273
- description: "No code to display.",
20274
- className
20275
- }
20276
- );
20277
- }
20278
- return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
20279
- tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
20280
- Tabs,
20281
- {
20282
- tabs: tabItems,
20283
- activeTab: `file-${activeFileIndex}`,
20284
- onTabChange: (id) => {
20285
- const idx = parseInt(id.replace("file-", ""), 10);
20286
- setActiveFileIndex(idx);
20287
- }
20288
- }
20289
- ) }),
20290
- /* @__PURE__ */ jsxs(
20291
- HStack,
20292
- {
20293
- gap: "sm",
20294
- align: "center",
20295
- justify: "between",
20296
- className: "px-4 py-2 border-b border-border bg-muted/30",
20297
- children: [
20298
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
20299
- /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
20300
- title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
20301
- activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
20302
- ] }),
20303
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
20304
- /* @__PURE__ */ jsx(
20305
- Button,
20306
- {
20307
- variant: "ghost",
20308
- size: "sm",
20309
- icon: WrapText,
20310
- onClick: () => setWrap(!wrap),
20311
- className: cn(wrap && "text-primary")
20312
- }
20313
- ),
20314
- showCopy && /* @__PURE__ */ jsx(
20315
- Button,
20316
- {
20317
- variant: "ghost",
20318
- size: "sm",
20319
- icon: copied ? Check : Copy,
20320
- onClick: handleCopy,
20321
- className: cn(copied && "text-success")
20322
- }
20323
- ),
20324
- actions?.map((action, idx) => /* @__PURE__ */ jsx(
20325
- Badge,
20326
- {
20327
- variant: "default",
20328
- className: "cursor-pointer hover:opacity-80 transition-opacity",
20329
- onClick: () => handleAction(action),
20330
- children: action.label
20331
- },
20332
- idx
20333
- ))
20334
- ] })
20335
- ]
20336
- }
20337
- ),
20338
- /* @__PURE__ */ jsx(
20339
- Box,
20340
- {
20341
- className: "overflow-auto bg-muted/20",
20342
- style: { maxHeight },
20343
- children: diffLines ? (
20344
- /* Diff mode */
20345
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: diffLines.map((line, idx) => {
20346
- const style = DIFF_STYLES[line.type];
20347
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
20348
- showLineNumbers && /* @__PURE__ */ jsx(
20349
- Typography,
20350
- {
20351
- variant: "caption",
20352
- color: "secondary",
20353
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
20354
- children: line.lineNumber ?? ""
20355
- }
20356
- ),
20357
- /* @__PURE__ */ jsxs(
20358
- Typography,
20359
- {
20360
- variant: "caption",
20361
- className: cn(
20362
- "font-mono flex-1 min-w-0",
20363
- style.text,
20364
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
20365
- ),
20366
- children: [
20367
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
20368
- line.content
20369
- ]
20370
- }
20371
- )
20372
- ] }, idx);
20373
- }) })
20374
- ) : (
20375
- /* Code mode */
20376
- /* @__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: [
20377
- showLineNumbers && /* @__PURE__ */ jsx(
20378
- Typography,
20379
- {
20380
- variant: "caption",
20381
- color: "secondary",
20382
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
20383
- children: idx + 1
20384
- }
20385
- ),
20386
- /* @__PURE__ */ jsx(
20387
- Typography,
20388
- {
20389
- variant: "caption",
20390
- className: cn(
20391
- "font-mono flex-1 min-w-0",
20392
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
20393
- ),
20394
- children: line || " "
20395
- }
20396
- )
20397
- ] }, idx)) })
20398
- )
20399
- }
20400
- )
20401
- ] }) });
20402
- };
20403
- CodeViewer.displayName = "CodeViewer";
20404
- }
20405
- });
20406
20296
  function CombatLog({
20407
20297
  events: events2,
20408
20298
  maxVisible = 50,
@@ -21009,7 +20899,7 @@ function CraftingRecipe({
21009
20899
  className
21010
20900
  }) {
21011
20901
  const eventBus = useEventBus();
21012
- const handleCraft = React81.useCallback(() => {
20902
+ const handleCraft = React79.useCallback(() => {
21013
20903
  onCraft?.();
21014
20904
  if (craftEvent) {
21015
20905
  eventBus.emit(craftEvent, { output: output.label });
@@ -21026,7 +20916,7 @@ function CraftingRecipe({
21026
20916
  children: [
21027
20917
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
21028
20918
  const hasSufficient = ingredient.available >= ingredient.required;
21029
- return /* @__PURE__ */ jsxs(React81.Fragment, { children: [
20919
+ return /* @__PURE__ */ jsxs(React79.Fragment, { children: [
21030
20920
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
21031
20921
  ItemSlot,
21032
20922
  {
@@ -21089,8 +20979,8 @@ function DPad({
21089
20979
  }) {
21090
20980
  const eventBus = useEventBus();
21091
20981
  const sizes = sizeMap6[size];
21092
- const [activeDirections, setActiveDirections] = React81.useState(/* @__PURE__ */ new Set());
21093
- const handlePress = React81.useCallback(
20982
+ const [activeDirections, setActiveDirections] = React79.useState(/* @__PURE__ */ new Set());
20983
+ const handlePress = React79.useCallback(
21094
20984
  (direction) => {
21095
20985
  setActiveDirections((prev) => new Set(prev).add(direction));
21096
20986
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -21098,7 +20988,7 @@ function DPad({
21098
20988
  },
21099
20989
  [directionEvent, eventBus, onDirection]
21100
20990
  );
21101
- const handleRelease = React81.useCallback(
20991
+ const handleRelease = React79.useCallback(
21102
20992
  (direction) => {
21103
20993
  setActiveDirections((prev) => {
21104
20994
  const next = new Set(prev);
@@ -21833,14 +21723,14 @@ function useDataDnd(args) {
21833
21723
  const isZone = Boolean(dragGroup || accepts || sortable);
21834
21724
  const enabled = isZone || Boolean(dndRoot);
21835
21725
  const eventBus = useEventBus();
21836
- const parentRoot = React81__default.useContext(RootCtx);
21726
+ const parentRoot = React79__default.useContext(RootCtx);
21837
21727
  const isRoot = enabled && parentRoot === null;
21838
- const zoneId = React81__default.useId();
21728
+ const zoneId = React79__default.useId();
21839
21729
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21840
- const [optimisticOrders, setOptimisticOrders] = React81__default.useState(() => /* @__PURE__ */ new Map());
21841
- const optimisticOrdersRef = React81__default.useRef(optimisticOrders);
21730
+ const [optimisticOrders, setOptimisticOrders] = React79__default.useState(() => /* @__PURE__ */ new Map());
21731
+ const optimisticOrdersRef = React79__default.useRef(optimisticOrders);
21842
21732
  optimisticOrdersRef.current = optimisticOrders;
21843
- const clearOptimisticOrder = React81__default.useCallback((group) => {
21733
+ const clearOptimisticOrder = React79__default.useCallback((group) => {
21844
21734
  setOptimisticOrders((prev) => {
21845
21735
  if (!prev.has(group)) return prev;
21846
21736
  const next = new Map(prev);
@@ -21865,7 +21755,7 @@ function useDataDnd(args) {
21865
21755
  const raw = it[dndItemIdField];
21866
21756
  return String(raw ?? `__idx_${idx}`);
21867
21757
  }).join("|");
21868
- const itemIds = React81__default.useMemo(
21758
+ const itemIds = React79__default.useMemo(
21869
21759
  () => orderedItems.map((it, idx) => {
21870
21760
  const raw = it[dndItemIdField];
21871
21761
  return raw ?? `__idx_${idx}`;
@@ -21873,7 +21763,7 @@ function useDataDnd(args) {
21873
21763
  [itemIdsSignature]
21874
21764
  );
21875
21765
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
21876
- React81__default.useEffect(() => {
21766
+ React79__default.useEffect(() => {
21877
21767
  const root = isRoot ? null : parentRoot;
21878
21768
  if (root) {
21879
21769
  root.clearOptimisticOrder(ownGroup);
@@ -21881,20 +21771,20 @@ function useDataDnd(args) {
21881
21771
  clearOptimisticOrder(ownGroup);
21882
21772
  }
21883
21773
  }, [itemsContentSig, ownGroup]);
21884
- const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
21885
- const registerZone = React81__default.useCallback((zoneId2, meta2) => {
21774
+ const zonesRef = React79__default.useRef(/* @__PURE__ */ new Map());
21775
+ const registerZone = React79__default.useCallback((zoneId2, meta2) => {
21886
21776
  zonesRef.current.set(zoneId2, meta2);
21887
21777
  }, []);
21888
- const unregisterZone = React81__default.useCallback((zoneId2) => {
21778
+ const unregisterZone = React79__default.useCallback((zoneId2) => {
21889
21779
  zonesRef.current.delete(zoneId2);
21890
21780
  }, []);
21891
- const [activeDrag, setActiveDrag] = React81__default.useState(null);
21892
- const [overZoneGroup, setOverZoneGroup] = React81__default.useState(null);
21893
- const meta = React81__default.useMemo(
21781
+ const [activeDrag, setActiveDrag] = React79__default.useState(null);
21782
+ const [overZoneGroup, setOverZoneGroup] = React79__default.useState(null);
21783
+ const meta = React79__default.useMemo(
21894
21784
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
21895
21785
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
21896
21786
  );
21897
- React81__default.useEffect(() => {
21787
+ React79__default.useEffect(() => {
21898
21788
  const target = isRoot ? null : parentRoot;
21899
21789
  if (!target) {
21900
21790
  zonesRef.current.set(zoneId, meta);
@@ -21913,7 +21803,7 @@ function useDataDnd(args) {
21913
21803
  }, [parentRoot, isRoot, zoneId, meta]);
21914
21804
  const sensors = useAlmadarDndSensors(true);
21915
21805
  const collisionDetection = almadarDndCollisionDetection;
21916
- const findZoneByItem = React81__default.useCallback(
21806
+ const findZoneByItem = React79__default.useCallback(
21917
21807
  (id) => {
21918
21808
  for (const z of zonesRef.current.values()) {
21919
21809
  if (z.itemIds.includes(id)) return z;
@@ -21922,7 +21812,7 @@ function useDataDnd(args) {
21922
21812
  },
21923
21813
  []
21924
21814
  );
21925
- React81__default.useCallback(
21815
+ React79__default.useCallback(
21926
21816
  (group) => {
21927
21817
  for (const z of zonesRef.current.values()) {
21928
21818
  if (z.group === group) return z;
@@ -21931,7 +21821,7 @@ function useDataDnd(args) {
21931
21821
  },
21932
21822
  []
21933
21823
  );
21934
- const handleDragEnd = React81__default.useCallback(
21824
+ const handleDragEnd = React79__default.useCallback(
21935
21825
  (event) => {
21936
21826
  const { active, over } = event;
21937
21827
  const activeIdStr = String(active.id);
@@ -22022,8 +21912,8 @@ function useDataDnd(args) {
22022
21912
  },
22023
21913
  [eventBus]
22024
21914
  );
22025
- const sortableData = React81__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22026
- const SortableItem = React81__default.useCallback(
21915
+ const sortableData = React79__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
21916
+ const SortableItem = React79__default.useCallback(
22027
21917
  ({ id, children }) => {
22028
21918
  const {
22029
21919
  attributes,
@@ -22063,7 +21953,7 @@ function useDataDnd(args) {
22063
21953
  id: droppableId,
22064
21954
  data: sortableData
22065
21955
  });
22066
- const ctx = React81__default.useContext(RootCtx);
21956
+ const ctx = React79__default.useContext(RootCtx);
22067
21957
  const activeDrag2 = ctx?.activeDrag ?? null;
22068
21958
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22069
21959
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22078,7 +21968,7 @@ function useDataDnd(args) {
22078
21968
  showForeignPlaceholder,
22079
21969
  ctxAvailable: ctx != null
22080
21970
  });
22081
- React81__default.useEffect(() => {
21971
+ React79__default.useEffect(() => {
22082
21972
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22083
21973
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22084
21974
  return /* @__PURE__ */ jsx(
@@ -22092,11 +21982,11 @@ function useDataDnd(args) {
22092
21982
  }
22093
21983
  );
22094
21984
  };
22095
- const rootContextValue = React81__default.useMemo(
21985
+ const rootContextValue = React79__default.useMemo(
22096
21986
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22097
21987
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22098
21988
  );
22099
- const handleDragStart = React81__default.useCallback((event) => {
21989
+ const handleDragStart = React79__default.useCallback((event) => {
22100
21990
  const sourceZone = findZoneByItem(event.active.id);
22101
21991
  const rect = event.active.rect.current.initial;
22102
21992
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22115,7 +22005,7 @@ function useDataDnd(args) {
22115
22005
  isRoot
22116
22006
  });
22117
22007
  }, [findZoneByItem, isRoot, zoneId]);
22118
- const handleDragOver = React81__default.useCallback((event) => {
22008
+ const handleDragOver = React79__default.useCallback((event) => {
22119
22009
  const { active, over } = event;
22120
22010
  const overData = over?.data?.current;
22121
22011
  const overGroup = overData?.dndGroup ?? null;
@@ -22185,7 +22075,7 @@ function useDataDnd(args) {
22185
22075
  return next;
22186
22076
  });
22187
22077
  }, []);
22188
- const handleDragCancel = React81__default.useCallback((event) => {
22078
+ const handleDragCancel = React79__default.useCallback((event) => {
22189
22079
  setActiveDrag(null);
22190
22080
  setOverZoneGroup(null);
22191
22081
  dndLog.warn("dragCancel", {
@@ -22193,12 +22083,12 @@ function useDataDnd(args) {
22193
22083
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22194
22084
  });
22195
22085
  }, []);
22196
- const handleDragEndWithCleanup = React81__default.useCallback((event) => {
22086
+ const handleDragEndWithCleanup = React79__default.useCallback((event) => {
22197
22087
  handleDragEnd(event);
22198
22088
  setActiveDrag(null);
22199
22089
  setOverZoneGroup(null);
22200
22090
  }, [handleDragEnd]);
22201
- const wrapContainer = React81__default.useCallback(
22091
+ const wrapContainer = React79__default.useCallback(
22202
22092
  (children) => {
22203
22093
  if (!enabled) return children;
22204
22094
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -22252,7 +22142,7 @@ var init_useDataDnd = __esm({
22252
22142
  init_useAlmadarDndCollision();
22253
22143
  init_Box();
22254
22144
  dndLog = createLogger("almadar:ui:dnd");
22255
- RootCtx = React81__default.createContext(null);
22145
+ RootCtx = React79__default.createContext(null);
22256
22146
  }
22257
22147
  });
22258
22148
  function fieldLabel2(key) {
@@ -22772,7 +22662,7 @@ function DataList({
22772
22662
  }) {
22773
22663
  const eventBus = useEventBus();
22774
22664
  const { t } = useTranslate();
22775
- const [visibleCount, setVisibleCount] = React81__default.useState(pageSize || Infinity);
22665
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize || Infinity);
22776
22666
  const fieldDefs = fields ?? columns ?? [];
22777
22667
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
22778
22668
  const dnd = useDataDnd({
@@ -22791,7 +22681,7 @@ function DataList({
22791
22681
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
22792
22682
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
22793
22683
  const hasRenderProp = typeof children === "function";
22794
- React81__default.useEffect(() => {
22684
+ React79__default.useEffect(() => {
22795
22685
  const renderItemTypeOf = typeof schemaRenderItem;
22796
22686
  const childrenTypeOf = typeof children;
22797
22687
  if (data.length > 0 && !hasRenderProp) {
@@ -22896,7 +22786,7 @@ function DataList({
22896
22786
  const items2 = data.map((item) => item);
22897
22787
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
22898
22788
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
22899
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22789
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
22900
22790
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
22901
22791
  group.items.map((itemData, index) => {
22902
22792
  const id = itemData.id || `${gi}-${index}`;
@@ -23044,7 +22934,7 @@ function DataList({
23044
22934
  className
23045
22935
  ),
23046
22936
  children: [
23047
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22937
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
23048
22938
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23049
22939
  group.items.map(
23050
22940
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -23107,6 +22997,422 @@ var init_DataList = __esm({
23107
22997
  DataList.displayName = "DataList";
23108
22998
  }
23109
22999
  });
23000
+ function isTraitConfigObject(v) {
23001
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23002
+ }
23003
+ function LeafControl({
23004
+ value,
23005
+ onChange
23006
+ }) {
23007
+ if (typeof value === "boolean") {
23008
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
23009
+ }
23010
+ if (typeof value === "number") {
23011
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23012
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23013
+ const commit2 = () => {
23014
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23015
+ onChange(Number.isNaN(n) ? 0 : n);
23016
+ };
23017
+ return /* @__PURE__ */ jsx(
23018
+ Input,
23019
+ {
23020
+ inputType: "number",
23021
+ value: draft2,
23022
+ onChange: (e) => setDraft2(e.target.value),
23023
+ onBlur: commit2,
23024
+ onKeyDown: (e) => {
23025
+ if (e.key === "Enter") commit2();
23026
+ }
23027
+ }
23028
+ );
23029
+ }
23030
+ if (isTraitConfigObject(value)) {
23031
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23032
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23033
+ const commit2 = () => {
23034
+ try {
23035
+ const parsed = JSON.parse(draft2);
23036
+ onChange(parsed);
23037
+ } catch {
23038
+ }
23039
+ };
23040
+ return /* @__PURE__ */ jsx(
23041
+ Input,
23042
+ {
23043
+ inputType: "text",
23044
+ value: draft2,
23045
+ onChange: (e) => setDraft2(e.target.value),
23046
+ onBlur: commit2,
23047
+ onKeyDown: (e) => {
23048
+ if (e.key === "Enter") commit2();
23049
+ }
23050
+ }
23051
+ );
23052
+ }
23053
+ if (Array.isArray(value)) {
23054
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23055
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23056
+ const commit2 = () => {
23057
+ try {
23058
+ const parsed = JSON.parse(draft2);
23059
+ onChange(parsed);
23060
+ } catch {
23061
+ }
23062
+ };
23063
+ return /* @__PURE__ */ jsx(
23064
+ Input,
23065
+ {
23066
+ inputType: "text",
23067
+ value: draft2,
23068
+ onChange: (e) => setDraft2(e.target.value),
23069
+ onBlur: commit2,
23070
+ onKeyDown: (e) => {
23071
+ if (e.key === "Enter") commit2();
23072
+ }
23073
+ }
23074
+ );
23075
+ }
23076
+ const strVal = value === null ? "" : String(value);
23077
+ const [draft, setDraft] = React79__default.useState(strVal);
23078
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23079
+ const commit = () => {
23080
+ onChange(draft);
23081
+ };
23082
+ return /* @__PURE__ */ jsx(
23083
+ Input,
23084
+ {
23085
+ inputType: "text",
23086
+ value: draft,
23087
+ onChange: (e) => setDraft(e.target.value),
23088
+ onBlur: commit,
23089
+ onKeyDown: (e) => {
23090
+ if (e.key === "Enter") commit();
23091
+ }
23092
+ }
23093
+ );
23094
+ }
23095
+ function cloneElement(template) {
23096
+ if (isTraitConfigObject(template)) {
23097
+ const blank = {};
23098
+ for (const k of Object.keys(template)) blank[k] = null;
23099
+ return blank;
23100
+ }
23101
+ if (Array.isArray(template)) return [];
23102
+ if (typeof template === "boolean") return false;
23103
+ if (typeof template === "number") return 0;
23104
+ return "";
23105
+ }
23106
+ var ArrayEditor;
23107
+ var init_ArrayEditor = __esm({
23108
+ "components/core/molecules/ArrayEditor.tsx"() {
23109
+ "use client";
23110
+ init_Stack();
23111
+ init_Button();
23112
+ init_Switch();
23113
+ init_Input();
23114
+ init_cn();
23115
+ ArrayEditor = ({ value, onChange, className }) => {
23116
+ const arr = value;
23117
+ const update = (idx, next) => {
23118
+ const copy = [...arr];
23119
+ copy[idx] = next;
23120
+ onChange(copy);
23121
+ };
23122
+ const remove = (idx) => {
23123
+ onChange(arr.filter((_, i) => i !== idx));
23124
+ };
23125
+ const add = () => {
23126
+ const template = arr.length > 0 ? arr[0] : "";
23127
+ onChange([...arr, cloneElement(template)]);
23128
+ };
23129
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("w-full", className), children: [
23130
+ arr.map((elem, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
23131
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(LeafControl, { value: elem, onChange: (next) => update(idx, next) }) }),
23132
+ /* @__PURE__ */ jsx(
23133
+ Button,
23134
+ {
23135
+ variant: "ghost",
23136
+ size: "sm",
23137
+ icon: "trash-2",
23138
+ onClick: () => remove(idx),
23139
+ "aria-label": "Remove item"
23140
+ }
23141
+ )
23142
+ ] }, idx)),
23143
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", icon: "plus", label: "Add item", onClick: add })
23144
+ ] });
23145
+ };
23146
+ }
23147
+ });
23148
+ function isTraitConfigObject2(v) {
23149
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23150
+ }
23151
+ function ScalarControl({
23152
+ fieldKey,
23153
+ value,
23154
+ onFieldChange
23155
+ }) {
23156
+ if (typeof value === "boolean") {
23157
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onFieldChange(fieldKey, c) });
23158
+ }
23159
+ if (typeof value === "number") {
23160
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23161
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23162
+ const commit2 = () => {
23163
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23164
+ onFieldChange(fieldKey, Number.isNaN(n) ? 0 : n);
23165
+ };
23166
+ return /* @__PURE__ */ jsx(
23167
+ Input,
23168
+ {
23169
+ inputType: "number",
23170
+ value: draft2,
23171
+ onChange: (e) => setDraft2(e.target.value),
23172
+ onBlur: commit2,
23173
+ onKeyDown: (e) => {
23174
+ if (e.key === "Enter") commit2();
23175
+ }
23176
+ }
23177
+ );
23178
+ }
23179
+ if (isTraitConfigObject2(value)) {
23180
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23181
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23182
+ const commit2 = () => {
23183
+ try {
23184
+ onFieldChange(fieldKey, JSON.parse(draft2));
23185
+ } catch {
23186
+ }
23187
+ };
23188
+ return /* @__PURE__ */ jsx(
23189
+ Input,
23190
+ {
23191
+ inputType: "text",
23192
+ value: draft2,
23193
+ onChange: (e) => setDraft2(e.target.value),
23194
+ onBlur: commit2,
23195
+ onKeyDown: (e) => {
23196
+ if (e.key === "Enter") commit2();
23197
+ }
23198
+ }
23199
+ );
23200
+ }
23201
+ if (Array.isArray(value)) {
23202
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23203
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23204
+ const commit2 = () => {
23205
+ try {
23206
+ onFieldChange(fieldKey, JSON.parse(draft2));
23207
+ } catch {
23208
+ }
23209
+ };
23210
+ return /* @__PURE__ */ jsx(
23211
+ Input,
23212
+ {
23213
+ inputType: "text",
23214
+ value: draft2,
23215
+ onChange: (e) => setDraft2(e.target.value),
23216
+ onBlur: commit2,
23217
+ onKeyDown: (e) => {
23218
+ if (e.key === "Enter") commit2();
23219
+ }
23220
+ }
23221
+ );
23222
+ }
23223
+ const [draft, setDraft] = React79__default.useState(value === null ? "" : String(value));
23224
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23225
+ const commit = () => {
23226
+ onFieldChange(fieldKey, draft);
23227
+ };
23228
+ return /* @__PURE__ */ jsx(
23229
+ Input,
23230
+ {
23231
+ inputType: "text",
23232
+ value: draft,
23233
+ onChange: (e) => setDraft(e.target.value),
23234
+ onBlur: commit,
23235
+ onKeyDown: (e) => {
23236
+ if (e.key === "Enter") commit();
23237
+ }
23238
+ }
23239
+ );
23240
+ }
23241
+ var ObjectEditor;
23242
+ var init_ObjectEditor = __esm({
23243
+ "components/core/molecules/ObjectEditor.tsx"() {
23244
+ "use client";
23245
+ init_Stack();
23246
+ init_Typography();
23247
+ init_Switch();
23248
+ init_Input();
23249
+ init_cn();
23250
+ ObjectEditor = ({ value, onChange, className }) => {
23251
+ const entries = Object.entries(value);
23252
+ const handleFieldChange = (k, next) => {
23253
+ onChange({ ...value, [k]: next });
23254
+ };
23255
+ if (entries.length === 0) {
23256
+ return /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: "Empty object" });
23257
+ }
23258
+ return /* @__PURE__ */ jsx(VStack, { gap: "xs", className: cn("w-full", className), children: entries.map(([k, v]) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
23259
+ /* @__PURE__ */ jsx("span", { className: "w-24 shrink-0 truncate", title: k, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: k }) }),
23260
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(ScalarControl, { fieldKey: k, value: v, onFieldChange: handleFieldChange }) })
23261
+ ] }, k)) });
23262
+ };
23263
+ }
23264
+ });
23265
+ function isTraitConfigObject3(v) {
23266
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23267
+ }
23268
+ function ValueControl({
23269
+ value,
23270
+ onChange
23271
+ }) {
23272
+ if (typeof value === "boolean") {
23273
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
23274
+ }
23275
+ if (typeof value === "number") {
23276
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23277
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23278
+ const commit2 = () => {
23279
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23280
+ onChange(Number.isNaN(n) ? 0 : n);
23281
+ };
23282
+ return /* @__PURE__ */ jsx(
23283
+ Input,
23284
+ {
23285
+ inputType: "number",
23286
+ value: draft2,
23287
+ onChange: (e) => setDraft2(e.target.value),
23288
+ onBlur: commit2,
23289
+ onKeyDown: (e) => {
23290
+ if (e.key === "Enter") commit2();
23291
+ }
23292
+ }
23293
+ );
23294
+ }
23295
+ if (isTraitConfigObject3(value) || Array.isArray(value)) {
23296
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23297
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23298
+ const commit2 = () => {
23299
+ try {
23300
+ onChange(JSON.parse(draft2));
23301
+ } catch {
23302
+ }
23303
+ };
23304
+ return /* @__PURE__ */ jsx(
23305
+ Input,
23306
+ {
23307
+ inputType: "text",
23308
+ value: draft2,
23309
+ onChange: (e) => setDraft2(e.target.value),
23310
+ onBlur: commit2,
23311
+ onKeyDown: (e) => {
23312
+ if (e.key === "Enter") commit2();
23313
+ }
23314
+ }
23315
+ );
23316
+ }
23317
+ const [draft, setDraft] = React79__default.useState(value === null ? "" : String(value));
23318
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23319
+ const commit = () => {
23320
+ onChange(draft);
23321
+ };
23322
+ return /* @__PURE__ */ jsx(
23323
+ Input,
23324
+ {
23325
+ inputType: "text",
23326
+ value: draft,
23327
+ onChange: (e) => setDraft(e.target.value),
23328
+ onBlur: commit,
23329
+ onKeyDown: (e) => {
23330
+ if (e.key === "Enter") commit();
23331
+ }
23332
+ }
23333
+ );
23334
+ }
23335
+ function KeyInput({
23336
+ currentKey,
23337
+ onRename
23338
+ }) {
23339
+ const [draft, setDraft] = React79__default.useState(currentKey);
23340
+ React79__default.useEffect(() => setDraft(currentKey), [currentKey]);
23341
+ const commit = () => {
23342
+ const trimmed = draft.trim();
23343
+ if (trimmed !== "" && trimmed !== currentKey) onRename(trimmed);
23344
+ else setDraft(currentKey);
23345
+ };
23346
+ return /* @__PURE__ */ jsx(
23347
+ Input,
23348
+ {
23349
+ inputType: "text",
23350
+ value: draft,
23351
+ onChange: (e) => setDraft(e.target.value),
23352
+ onBlur: commit,
23353
+ onKeyDown: (e) => {
23354
+ if (e.key === "Enter") commit();
23355
+ },
23356
+ className: "w-24 shrink-0 font-mono text-xs",
23357
+ placeholder: "key"
23358
+ }
23359
+ );
23360
+ }
23361
+ var MapEditor;
23362
+ var init_MapEditor = __esm({
23363
+ "components/core/molecules/MapEditor.tsx"() {
23364
+ "use client";
23365
+ init_Stack();
23366
+ init_Button();
23367
+ init_Input();
23368
+ init_Switch();
23369
+ init_cn();
23370
+ MapEditor = ({ value, onChange, className }) => {
23371
+ const entries = Object.entries(value);
23372
+ const updateKey = (oldKey, newKey) => {
23373
+ const next = {};
23374
+ for (const [k, v] of Object.entries(value)) {
23375
+ next[k === oldKey ? newKey : k] = v;
23376
+ }
23377
+ onChange(next);
23378
+ };
23379
+ const updateValue = (k, next) => {
23380
+ onChange({ ...value, [k]: next });
23381
+ };
23382
+ const remove = (k) => {
23383
+ const next = { ...value };
23384
+ delete next[k];
23385
+ onChange(next);
23386
+ };
23387
+ const add = () => {
23388
+ let key = "key";
23389
+ let i = 1;
23390
+ while (key in value) {
23391
+ key = `key${i}`;
23392
+ i++;
23393
+ }
23394
+ onChange({ ...value, [key]: "" });
23395
+ };
23396
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("w-full", className), children: [
23397
+ entries.map(([k, v]) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
23398
+ /* @__PURE__ */ jsx(KeyInput, { currentKey: k, onRename: (newKey) => updateKey(k, newKey) }),
23399
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(ValueControl, { value: v, onChange: (next) => updateValue(k, next) }) }),
23400
+ /* @__PURE__ */ jsx(
23401
+ Button,
23402
+ {
23403
+ variant: "ghost",
23404
+ size: "sm",
23405
+ icon: "trash-2",
23406
+ onClick: () => remove(k),
23407
+ "aria-label": "Remove entry"
23408
+ }
23409
+ )
23410
+ ] }, k)),
23411
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", icon: "plus", label: "Add entry", onClick: add })
23412
+ ] });
23413
+ };
23414
+ }
23415
+ });
23110
23416
  function fileIcon(name) {
23111
23417
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
23112
23418
  switch (ext) {
@@ -24668,7 +24974,7 @@ var init_WizardProgress = __esm({
24668
24974
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
24669
24975
  const isActive = index === currentStep;
24670
24976
  const isCompleted = index < currentStep;
24671
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
24977
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
24672
24978
  /* @__PURE__ */ jsx(
24673
24979
  "button",
24674
24980
  {
@@ -25185,8 +25491,9 @@ var init_FormSectionHeader = __esm({
25185
25491
  Box,
25186
25492
  {
25187
25493
  className: cn(
25188
- "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
25189
- isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
25494
+ "px-5 py-4 bg-muted/60 rounded-lg",
25495
+ "border border-border border-l-4 border-l-primary",
25496
+ isClickable && "cursor-pointer hover:bg-muted transition-colors",
25190
25497
  className
25191
25498
  ),
25192
25499
  onClick: isClickable ? onToggle : void 0,
@@ -25197,7 +25504,7 @@ var init_FormSectionHeader = __esm({
25197
25504
  {
25198
25505
  name: icon,
25199
25506
  size: "md",
25200
- className: "text-primary"
25507
+ className: "text-primary shrink-0"
25201
25508
  }
25202
25509
  ),
25203
25510
  statusIcon && /* @__PURE__ */ jsx(
@@ -25205,12 +25512,15 @@ var init_FormSectionHeader = __esm({
25205
25512
  {
25206
25513
  name: statusIcon,
25207
25514
  size: "md",
25208
- className: hasErrors ? "text-error" : "text-success"
25515
+ className: cn(
25516
+ "shrink-0",
25517
+ hasErrors ? "text-error" : "text-success"
25518
+ )
25209
25519
  }
25210
25520
  ),
25211
25521
  /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
25212
- /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
25213
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
25522
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", className: "text-foreground", children: title }),
25523
+ subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "leading-snug", children: subtitle })
25214
25524
  ] })
25215
25525
  ] }),
25216
25526
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -25219,9 +25529,9 @@ var init_FormSectionHeader = __esm({
25219
25529
  Icon,
25220
25530
  {
25221
25531
  name: "chevron-down",
25222
- size: "md",
25532
+ size: "sm",
25223
25533
  className: cn(
25224
- "text-muted-foreground transition-transform",
25534
+ "text-muted-foreground transition-transform duration-200 shrink-0",
25225
25535
  isCollapsed && "-rotate-90"
25226
25536
  )
25227
25537
  }
@@ -26012,9 +26322,9 @@ function ScoreDisplay({
26012
26322
  ...rest
26013
26323
  }) {
26014
26324
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
26015
- const [displayValue, setDisplayValue] = React81.useState(resolvedValue);
26016
- const [isAnimating, setIsAnimating] = React81.useState(false);
26017
- React81.useEffect(() => {
26325
+ const [displayValue, setDisplayValue] = React79.useState(resolvedValue);
26326
+ const [isAnimating, setIsAnimating] = React79.useState(false);
26327
+ React79.useEffect(() => {
26018
26328
  if (!animated || displayValue === resolvedValue) {
26019
26329
  setDisplayValue(resolvedValue);
26020
26330
  return;
@@ -26161,7 +26471,7 @@ function InventoryGrid({
26161
26471
  const eventBus = useEventBus();
26162
26472
  const slotCount = totalSlots ?? items.length;
26163
26473
  const emptySlotCount = Math.max(0, slotCount - items.length);
26164
- const handleSelect = React81.useCallback(
26474
+ const handleSelect = React79.useCallback(
26165
26475
  (id) => {
26166
26476
  onSelect?.(id);
26167
26477
  if (selectEvent) {
@@ -26447,31 +26757,31 @@ function GameCanvas2D({
26447
26757
  assetBaseUrl = "",
26448
26758
  className
26449
26759
  }) {
26450
- const canvasRef = React81.useRef(null);
26451
- const rafRef = React81.useRef(0);
26452
- const frameRef = React81.useRef(0);
26453
- const lastTimeRef = React81.useRef(0);
26454
- const imageCache = React81.useRef(/* @__PURE__ */ new Map());
26760
+ const canvasRef = React79.useRef(null);
26761
+ const rafRef = React79.useRef(0);
26762
+ const frameRef = React79.useRef(0);
26763
+ const lastTimeRef = React79.useRef(0);
26764
+ const imageCache = React79.useRef(/* @__PURE__ */ new Map());
26455
26765
  const emit = useEmitEvent();
26456
- const onDrawRef = React81.useRef(onDraw);
26766
+ const onDrawRef = React79.useRef(onDraw);
26457
26767
  onDrawRef.current = onDraw;
26458
- const onTickRef = React81.useRef(onTick);
26768
+ const onTickRef = React79.useRef(onTick);
26459
26769
  onTickRef.current = onTick;
26460
- const tickEventRef = React81.useRef(tickEvent);
26770
+ const tickEventRef = React79.useRef(tickEvent);
26461
26771
  tickEventRef.current = tickEvent;
26462
- const drawEventRef = React81.useRef(drawEvent);
26772
+ const drawEventRef = React79.useRef(drawEvent);
26463
26773
  drawEventRef.current = drawEvent;
26464
- const emitRef = React81.useRef(emit);
26774
+ const emitRef = React79.useRef(emit);
26465
26775
  emitRef.current = emit;
26466
- const assetBaseUrlRef = React81.useRef(assetBaseUrl);
26776
+ const assetBaseUrlRef = React79.useRef(assetBaseUrl);
26467
26777
  assetBaseUrlRef.current = assetBaseUrl;
26468
- const backgroundImageRef = React81.useRef(backgroundImage);
26778
+ const backgroundImageRef = React79.useRef(backgroundImage);
26469
26779
  backgroundImageRef.current = backgroundImage;
26470
- const widthRef = React81.useRef(width);
26780
+ const widthRef = React79.useRef(width);
26471
26781
  widthRef.current = width;
26472
- const heightRef = React81.useRef(height);
26782
+ const heightRef = React79.useRef(height);
26473
26783
  heightRef.current = height;
26474
- const loadImage = React81.useCallback((url) => {
26784
+ const loadImage = React79.useCallback((url) => {
26475
26785
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
26476
26786
  const cached = imageCache.current.get(fullUrl);
26477
26787
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -26483,7 +26793,7 @@ function GameCanvas2D({
26483
26793
  }
26484
26794
  return null;
26485
26795
  }, []);
26486
- React81.useEffect(() => {
26796
+ React79.useEffect(() => {
26487
26797
  const canvas = canvasRef.current;
26488
26798
  if (!canvas) return;
26489
26799
  const ctx = canvas.getContext("2d");
@@ -26838,7 +27148,7 @@ function TurnPanel({
26838
27148
  className
26839
27149
  }) {
26840
27150
  const eventBus = useEventBus();
26841
- const handleAction = React81.useCallback(
27151
+ const handleAction = React79.useCallback(
26842
27152
  (event) => {
26843
27153
  if (event) {
26844
27154
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -26984,7 +27294,7 @@ function UnitCommandBar({
26984
27294
  className
26985
27295
  }) {
26986
27296
  const eventBus = useEventBus();
26987
- const handleCommand = React81.useCallback(
27297
+ const handleCommand = React79.useCallback(
26988
27298
  (event) => {
26989
27299
  if (event) {
26990
27300
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -27469,7 +27779,7 @@ function GameMenu({
27469
27779
  } catch {
27470
27780
  }
27471
27781
  const eventBus = eventBusProp || eventBusFromHook;
27472
- const handleOptionClick = React81.useCallback(
27782
+ const handleOptionClick = React79.useCallback(
27473
27783
  (option) => {
27474
27784
  if (option.event && eventBus) {
27475
27785
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27583,7 +27893,7 @@ function GameOverScreen({
27583
27893
  } catch {
27584
27894
  }
27585
27895
  const eventBus = eventBusProp || eventBusFromHook;
27586
- const handleActionClick = React81.useCallback(
27896
+ const handleActionClick = React79.useCallback(
27587
27897
  (action) => {
27588
27898
  if (action.event && eventBus) {
27589
27899
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28599,7 +28909,7 @@ var init_StarRating = __esm({
28599
28909
  name: "star",
28600
28910
  className: cn(
28601
28911
  styles.star,
28602
- "text-muted-foreground",
28912
+ "text-foreground/30",
28603
28913
  "transition-colors duration-100"
28604
28914
  ),
28605
28915
  strokeWidth: 1.5
@@ -29082,8 +29392,8 @@ function TableView({
29082
29392
  }) {
29083
29393
  const eventBus = useEventBus();
29084
29394
  const { t } = useTranslate();
29085
- const [visibleCount, setVisibleCount] = React81__default.useState(pageSize > 0 ? pageSize : Infinity);
29086
- const [localSelected, setLocalSelected] = React81__default.useState(/* @__PURE__ */ new Set());
29395
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize > 0 ? pageSize : Infinity);
29396
+ const [localSelected, setLocalSelected] = React79__default.useState(/* @__PURE__ */ new Set());
29087
29397
  const colDefs = columns ?? fields ?? [];
29088
29398
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29089
29399
  const dnd = useDataDnd({
@@ -29278,12 +29588,12 @@ function TableView({
29278
29588
  ]
29279
29589
  }
29280
29590
  );
29281
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React81__default.Fragment, { children: rowInner }, id);
29591
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React79__default.Fragment, { children: rowInner }, id);
29282
29592
  };
29283
29593
  const items = data.map((row) => row);
29284
29594
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
29285
29595
  let runningIndex = 0;
29286
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
29596
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
29287
29597
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
29288
29598
  group.items.map((row) => renderRow(row, runningIndex++))
29289
29599
  ] }, gi)) });
@@ -30635,7 +30945,7 @@ var init_StepFlow = __esm({
30635
30945
  className
30636
30946
  }) => {
30637
30947
  if (orientation === "vertical") {
30638
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React81__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30948
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React79__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30639
30949
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
30640
30950
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30641
30951
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -30646,7 +30956,7 @@ var init_StepFlow = __esm({
30646
30956
  ] })
30647
30957
  ] }) }, index)) });
30648
30958
  }
30649
- 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(React81__default.Fragment, { children: [
30959
+ 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(React79__default.Fragment, { children: [
30650
30960
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
30651
30961
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30652
30962
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31401,11 +31711,19 @@ function LatticeSVG({
31401
31711
  function f2(n) {
31402
31712
  return n.toFixed(2);
31403
31713
  }
31404
- var VARIANT_MAP2, EdgeDecoration;
31714
+ var colorTokenVars, VARIANT_MAP2, EdgeDecoration;
31405
31715
  var init_EdgeDecoration = __esm({
31406
31716
  "components/core/molecules/EdgeDecoration.tsx"() {
31407
31717
  "use client";
31408
31718
  init_cn();
31719
+ colorTokenVars = {
31720
+ primary: "var(--color-primary)",
31721
+ secondary: "var(--color-secondary)",
31722
+ success: "var(--color-success)",
31723
+ warning: "var(--color-warning)",
31724
+ error: "var(--color-error)",
31725
+ muted: "var(--color-muted)"
31726
+ };
31409
31727
  VARIANT_MAP2 = {
31410
31728
  arch: ArchSVG,
31411
31729
  vine: VineSVG,
@@ -31415,13 +31733,14 @@ var init_EdgeDecoration = __esm({
31415
31733
  variant = "arch",
31416
31734
  side = "both",
31417
31735
  opacity = 0.15,
31418
- color = "var(--color-primary)",
31736
+ color = "primary",
31419
31737
  strokeWidth = 0.5,
31420
31738
  width = 15,
31421
31739
  className
31422
31740
  }) => {
31423
31741
  const id = useId();
31424
31742
  const Variant = VARIANT_MAP2[variant];
31743
+ const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
31425
31744
  const sides = side === "both" ? ["left", "right"] : [side];
31426
31745
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
31427
31746
  "svg",
@@ -31444,7 +31763,7 @@ var init_EdgeDecoration = __esm({
31444
31763
  facing: s,
31445
31764
  w: 200,
31446
31765
  h: 600,
31447
- color,
31766
+ color: resolvedColor,
31448
31767
  strokeWidth
31449
31768
  }
31450
31769
  )
@@ -31622,7 +31941,7 @@ var init_LikertScale = __esm({
31622
31941
  md: "text-base",
31623
31942
  lg: "text-lg"
31624
31943
  };
31625
- LikertScale = React81__default.forwardRef(
31944
+ LikertScale = React79__default.forwardRef(
31626
31945
  ({
31627
31946
  question,
31628
31947
  options = DEFAULT_LIKERT_OPTIONS,
@@ -31634,7 +31953,7 @@ var init_LikertScale = __esm({
31634
31953
  variant = "radios",
31635
31954
  className
31636
31955
  }, ref) => {
31637
- const groupId = React81__default.useId();
31956
+ const groupId = React79__default.useId();
31638
31957
  const eventBus = useEventBus();
31639
31958
  const handleSelect = useCallback(
31640
31959
  (next) => {
@@ -32784,7 +33103,6 @@ function BlockRow({
32784
33103
  onUpdate,
32785
33104
  onDelete,
32786
33105
  onDuplicate,
32787
- onInsertAfter,
32788
33106
  onChangeType
32789
33107
  }) {
32790
33108
  const { t } = useTranslate();
@@ -33060,34 +33378,16 @@ function BlockRow({
33060
33378
  "data-block-id": block.id,
33061
33379
  "data-block-type": block.type,
33062
33380
  children: [
33063
- !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
33064
- /* @__PURE__ */ jsx(
33065
- Button,
33066
- {
33067
- type: "button",
33068
- variant: "ghost",
33069
- "aria-label": t("richBlockEditor.insertParagraphBelow"),
33070
- className: cn(
33071
- "inline-flex h-6 w-6 items-center justify-center rounded-sm p-0 gap-0",
33072
- "text-muted-foreground hover:bg-muted hover:text-foreground",
33073
- "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
33074
- "transition-opacity"
33075
- ),
33076
- onClick: () => onInsertAfter("paragraph"),
33077
- children: /* @__PURE__ */ jsx(Icon, { name: "plus", className: "w-3.5 h-3.5" })
33078
- }
33079
- ),
33080
- /* @__PURE__ */ jsx(
33081
- BlockMenu,
33082
- {
33083
- block,
33084
- readOnly,
33085
- onDelete,
33086
- onDuplicate,
33087
- onChangeType
33088
- }
33089
- )
33090
- ] }),
33381
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { className: "flex w-8 shrink-0 items-center pt-1", children: /* @__PURE__ */ jsx(
33382
+ BlockMenu,
33383
+ {
33384
+ block,
33385
+ readOnly,
33386
+ onDelete,
33387
+ onDuplicate,
33388
+ onChangeType
33389
+ }
33390
+ ) }),
33091
33391
  /* @__PURE__ */ jsx(Box, { className: "min-w-0 flex-1", children: renderBody() })
33092
33392
  ]
33093
33393
  }
@@ -33210,12 +33510,6 @@ var init_RichBlockEditor = __esm({
33210
33510
  },
33211
33511
  [blocks, commit]
33212
33512
  );
33213
- const handleInsertAfter = useCallback(
33214
- (id, type) => {
33215
- commit(insertAfter(blocks, id, createBlock(type)));
33216
- },
33217
- [blocks, commit]
33218
- );
33219
33513
  const handleChangeType = useCallback(
33220
33514
  (id, type) => {
33221
33515
  commit(
@@ -33272,7 +33566,6 @@ var init_RichBlockEditor = __esm({
33272
33566
  onUpdate: (updater) => handleUpdate(block.id, updater),
33273
33567
  onDelete: () => handleDelete(block.id),
33274
33568
  onDuplicate: () => handleDuplicate(block.id),
33275
- onInsertAfter: (type) => handleInsertAfter(block.id, type),
33276
33569
  onChangeType: (type) => handleChangeType(block.id, type)
33277
33570
  },
33278
33571
  block.id
@@ -33942,7 +34235,7 @@ var init_DocBreadcrumb = __esm({
33942
34235
  "aria-label": t("aria.breadcrumb"),
33943
34236
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
33944
34237
  const isLast = idx === items.length - 1;
33945
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
34238
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
33946
34239
  idx > 0 && /* @__PURE__ */ jsx(
33947
34240
  Icon,
33948
34241
  {
@@ -33989,108 +34282,6 @@ var init_DocBreadcrumb = __esm({
33989
34282
  DocBreadcrumb.displayName = "DocBreadcrumb";
33990
34283
  }
33991
34284
  });
33992
- function DocCodeBlock({
33993
- code,
33994
- language,
33995
- title,
33996
- showLineNumbers = false,
33997
- className
33998
- }) {
33999
- const [copied, setCopied] = useState(false);
34000
- const handleCopy = useCallback(() => {
34001
- void navigator.clipboard.writeText(code).then(() => {
34002
- setCopied(true);
34003
- setTimeout(() => setCopied(false), 2e3);
34004
- });
34005
- }, [code]);
34006
- const lines = code.split("\n");
34007
- return /* @__PURE__ */ jsxs(
34008
- Box,
34009
- {
34010
- className: cn(
34011
- "rounded-container border border-border overflow-hidden",
34012
- className
34013
- ),
34014
- position: "relative",
34015
- children: [
34016
- title ? /* @__PURE__ */ jsxs(
34017
- HStack,
34018
- {
34019
- align: "center",
34020
- justify: "between",
34021
- className: "bg-muted px-4 py-2 border-b border-border",
34022
- children: [
34023
- /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "sm", children: [
34024
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: title }),
34025
- language ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: language }) : null
34026
- ] }),
34027
- /* @__PURE__ */ jsx(
34028
- Button,
34029
- {
34030
- variant: "ghost",
34031
- size: "sm",
34032
- onClick: handleCopy,
34033
- leftIcon: copied ? "check" : "copy",
34034
- children: copied ? "Copied!" : "Copy"
34035
- }
34036
- )
34037
- ]
34038
- }
34039
- ) : null,
34040
- !title ? /* @__PURE__ */ jsx(Box, { position: "absolute", className: "top-2 right-2 z-10", children: /* @__PURE__ */ jsx(
34041
- Button,
34042
- {
34043
- variant: "ghost",
34044
- size: "sm",
34045
- onClick: handleCopy,
34046
- leftIcon: copied ? "check" : "copy",
34047
- children: copied ? "Copied!" : "Copy"
34048
- }
34049
- ) }) : null,
34050
- /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "bg-foreground overflow-x-auto", children: [
34051
- showLineNumbers ? /* @__PURE__ */ jsx(
34052
- Box,
34053
- {
34054
- className: "py-4 pl-4 pr-3 select-none border-r border-border flex-shrink-0",
34055
- children: lines.map((_, i) => /* @__PURE__ */ jsx(
34056
- Typography,
34057
- {
34058
- variant: "caption",
34059
- color: "muted",
34060
- className: "block font-mono text-right leading-6",
34061
- as: "span",
34062
- children: i + 1
34063
- },
34064
- i
34065
- ))
34066
- }
34067
- ) : null,
34068
- /* @__PURE__ */ jsx(
34069
- Box,
34070
- {
34071
- as: "pre",
34072
- className: cn(
34073
- "p-4 font-mono text-sm text-background leading-6 flex-1 min-w-0",
34074
- !title && "pr-24"
34075
- ),
34076
- children: /* @__PURE__ */ jsx(Box, { as: "code", className: "whitespace-pre", children: code })
34077
- }
34078
- )
34079
- ] })
34080
- ]
34081
- }
34082
- );
34083
- }
34084
- var init_DocCodeBlock = __esm({
34085
- "components/core/molecules/DocCodeBlock.tsx"() {
34086
- "use client";
34087
- init_cn();
34088
- init_Box();
34089
- init_Stack();
34090
- init_Typography();
34091
- init_Button();
34092
- }
34093
- });
34094
34285
  function DocPagination({ prev, next, className }) {
34095
34286
  if (!prev && !next) return null;
34096
34287
  return /* @__PURE__ */ jsxs(
@@ -34527,17 +34718,25 @@ var init_DocTOC = __esm({
34527
34718
  DocTOC.displayName = "DocTOC";
34528
34719
  }
34529
34720
  });
34530
- var GradientDivider;
34721
+ var colorTokenVars2, GradientDivider;
34531
34722
  var init_GradientDivider = __esm({
34532
34723
  "components/core/molecules/GradientDivider.tsx"() {
34533
34724
  "use client";
34534
34725
  init_cn();
34535
34726
  init_Box();
34727
+ colorTokenVars2 = {
34728
+ primary: "var(--color-primary)",
34729
+ secondary: "var(--color-secondary)",
34730
+ success: "var(--color-success)",
34731
+ warning: "var(--color-warning)",
34732
+ error: "var(--color-error)",
34733
+ muted: "var(--color-muted)"
34734
+ };
34536
34735
  GradientDivider = ({
34537
34736
  color,
34538
34737
  className
34539
34738
  }) => {
34540
- const centerColor = color ?? "var(--color-primary)";
34739
+ const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
34541
34740
  return /* @__PURE__ */ jsx(
34542
34741
  Box,
34543
34742
  {
@@ -34906,7 +35105,7 @@ var init_MiniStateMachine = __esm({
34906
35105
  const x = 2 + i * (NODE_W + GAP2 + ARROW_W + GAP2);
34907
35106
  const tc = transitionCounts[s.name] ?? 0;
34908
35107
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
34909
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
35108
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
34910
35109
  /* @__PURE__ */ jsx(
34911
35110
  AvlState,
34912
35111
  {
@@ -35110,7 +35309,7 @@ var init_PageHeader = __esm({
35110
35309
  info: "bg-info/10 text-info"
35111
35310
  };
35112
35311
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
35113
- 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(React81__default.Fragment, { children: [
35312
+ 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(React79__default.Fragment, { children: [
35114
35313
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
35115
35314
  crumb.href ? /* @__PURE__ */ jsx(
35116
35315
  "a",
@@ -35219,7 +35418,7 @@ var init_FormSection = __esm({
35219
35418
  columns = 1,
35220
35419
  className
35221
35420
  }) => {
35222
- const [collapsed, setCollapsed] = React81__default.useState(defaultCollapsed);
35421
+ const [collapsed, setCollapsed] = React79__default.useState(defaultCollapsed);
35223
35422
  const { t } = useTranslate();
35224
35423
  const eventBus = useEventBus();
35225
35424
  const gridClass = {
@@ -35227,7 +35426,7 @@ var init_FormSection = __esm({
35227
35426
  2: "grid-cols-1 md:grid-cols-2",
35228
35427
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
35229
35428
  }[columns];
35230
- React81__default.useCallback(() => {
35429
+ React79__default.useCallback(() => {
35231
35430
  if (collapsible) {
35232
35431
  setCollapsed((prev) => !prev);
35233
35432
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -35334,8 +35533,8 @@ function TextLikeControl({
35334
35533
  onCommit
35335
35534
  }) {
35336
35535
  const initial = value === void 0 || value === null ? "" : String(value);
35337
- const [draft, setDraft] = React81__default.useState(initial);
35338
- React81__default.useEffect(() => setDraft(initial), [initial]);
35536
+ const [draft, setDraft] = React79__default.useState(initial);
35537
+ React79__default.useEffect(() => setDraft(initial), [initial]);
35339
35538
  const commit = () => {
35340
35539
  if (numeric) {
35341
35540
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -35357,6 +35556,9 @@ function TextLikeControl({
35357
35556
  }
35358
35557
  );
35359
35558
  }
35559
+ function isTraitConfigObject4(v) {
35560
+ return v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
35561
+ }
35360
35562
  function FieldControl({
35361
35563
  name,
35362
35564
  decl,
@@ -35366,6 +35568,7 @@ function FieldControl({
35366
35568
  }) {
35367
35569
  let control;
35368
35570
  const stringValue = typeof value === "string" ? value : void 0;
35571
+ const effectiveValue = value ?? decl.default;
35369
35572
  if (decl.type === "icon") {
35370
35573
  control = /* @__PURE__ */ jsx(IconPicker, { value: stringValue, onChange: (icon) => onChange(name, icon) });
35371
35574
  } else if (decl.type === "asset") {
@@ -35392,6 +35595,32 @@ function FieldControl({
35392
35595
  control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: true, value, onCommit: onChange });
35393
35596
  } else if (decl.type === "string") {
35394
35597
  control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, value, onCommit: onChange });
35598
+ } else if (decl.type.startsWith("[") || Array.isArray(effectiveValue)) {
35599
+ const arr = Array.isArray(effectiveValue) ? effectiveValue : [];
35600
+ control = /* @__PURE__ */ jsx(
35601
+ ArrayEditor,
35602
+ {
35603
+ value: arr,
35604
+ onChange: (next) => onChange(name, next)
35605
+ }
35606
+ );
35607
+ } else if (decl.type === "object" && isTraitConfigObject4(effectiveValue)) {
35608
+ control = /* @__PURE__ */ jsx(
35609
+ ObjectEditor,
35610
+ {
35611
+ value: effectiveValue,
35612
+ onChange: (next) => onChange(name, next)
35613
+ }
35614
+ );
35615
+ } else if (decl.type.startsWith("Map ") || !SCALAR_TYPES.has(decl.type) && isTraitConfigObject4(effectiveValue)) {
35616
+ const obj = isTraitConfigObject4(effectiveValue) ? effectiveValue : {};
35617
+ control = /* @__PURE__ */ jsx(
35618
+ MapEditor,
35619
+ {
35620
+ value: obj,
35621
+ onChange: (next) => onChange(name, next)
35622
+ }
35623
+ );
35395
35624
  } else {
35396
35625
  control = /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "muted", children: [
35397
35626
  decl.type,
@@ -35404,7 +35633,7 @@ function FieldControl({
35404
35633
  decl.description !== void 0 && decl.description !== "" && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: decl.description })
35405
35634
  ] });
35406
35635
  }
35407
- var TIER_ORDER, PropertyInspector;
35636
+ var TIER_ORDER, SCALAR_TYPES, PropertyInspector;
35408
35637
  var init_PropertyInspector = __esm({
35409
35638
  "components/core/molecules/PropertyInspector.tsx"() {
35410
35639
  "use client";
@@ -35418,7 +35647,11 @@ var init_PropertyInspector = __esm({
35418
35647
  init_FormSection();
35419
35648
  init_IconPicker();
35420
35649
  init_AssetPicker();
35650
+ init_ArrayEditor();
35651
+ init_ObjectEditor();
35652
+ init_MapEditor();
35421
35653
  TIER_ORDER = ["presentation", "domain", "policy", "infra", "internal"];
35654
+ SCALAR_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "icon", "asset"]);
35422
35655
  PropertyInspector = ({
35423
35656
  config,
35424
35657
  values,
@@ -36112,7 +36345,7 @@ var init_WizardContainer = __esm({
36112
36345
  const isCompleted = index < currentStep;
36113
36346
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36114
36347
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36115
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
36348
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
36116
36349
  /* @__PURE__ */ jsx(
36117
36350
  Button,
36118
36351
  {
@@ -37320,6 +37553,9 @@ var init_GraphCanvas = __esm({
37320
37553
  var init_molecules2 = __esm({
37321
37554
  "components/core/molecules/index.ts"() {
37322
37555
  init_ErrorBoundary();
37556
+ init_ArrayEditor();
37557
+ init_ObjectEditor();
37558
+ init_MapEditor();
37323
37559
  init_FileTree();
37324
37560
  init_FormField();
37325
37561
  init_EmptyState();
@@ -37418,7 +37654,6 @@ var init_molecules2 = __esm({
37418
37654
  init_BranchingLogicBuilder();
37419
37655
  init_VersionDiff();
37420
37656
  init_DocBreadcrumb();
37421
- init_DocCodeBlock();
37422
37657
  init_DocPagination();
37423
37658
  init_DocSearch();
37424
37659
  init_DocSidebar();
@@ -37445,7 +37680,6 @@ var init_molecules2 = __esm({
37445
37680
  init_SignaturePad();
37446
37681
  init_DocumentViewer();
37447
37682
  init_GraphCanvas();
37448
- init_CodeViewer();
37449
37683
  }
37450
37684
  });
37451
37685
 
@@ -38559,7 +38793,7 @@ var init_DialogueBubble = __esm({
38559
38793
  }
38560
38794
  });
38561
38795
  function extractTitle(children) {
38562
- if (!React81__default.isValidElement(children)) return void 0;
38796
+ if (!React79__default.isValidElement(children)) return void 0;
38563
38797
  const props = children.props;
38564
38798
  if (typeof props.title === "string") {
38565
38799
  return props.title;
@@ -38671,7 +38905,7 @@ function LinearView({
38671
38905
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
38672
38906
  const isDone = i < currentIdx;
38673
38907
  const isCurrent = i === currentIdx;
38674
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
38908
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
38675
38909
  i > 0 && /* @__PURE__ */ jsx(
38676
38910
  Typography,
38677
38911
  {
@@ -39629,12 +39863,12 @@ var init_Form = __esm({
39629
39863
  const isSchemaEntity = isOrbitalEntitySchema(entity);
39630
39864
  const resolvedEntity = isSchemaEntity ? entity : void 0;
39631
39865
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
39632
- const normalizedInitialData = React81__default.useMemo(() => {
39866
+ const normalizedInitialData = React79__default.useMemo(() => {
39633
39867
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
39634
39868
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
39635
39869
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
39636
39870
  }, [entity, initialData]);
39637
- const entityDerivedFields = React81__default.useMemo(() => {
39871
+ const entityDerivedFields = React79__default.useMemo(() => {
39638
39872
  if (fields && fields.length > 0) return void 0;
39639
39873
  if (!resolvedEntity) return void 0;
39640
39874
  return resolvedEntity.fields.map(
@@ -39654,16 +39888,16 @@ var init_Form = __esm({
39654
39888
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
39655
39889
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
39656
39890
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
39657
- const [formData, setFormData] = React81__default.useState(
39891
+ const [formData, setFormData] = React79__default.useState(
39658
39892
  normalizedInitialData
39659
39893
  );
39660
- const [collapsedSections, setCollapsedSections] = React81__default.useState(
39894
+ const [collapsedSections, setCollapsedSections] = React79__default.useState(
39661
39895
  /* @__PURE__ */ new Set()
39662
39896
  );
39663
- const [submitError, setSubmitError] = React81__default.useState(null);
39664
- const formRef = React81__default.useRef(null);
39897
+ const [submitError, setSubmitError] = React79__default.useState(null);
39898
+ const formRef = React79__default.useRef(null);
39665
39899
  const formMode = props.mode;
39666
- const mountedRef = React81__default.useRef(false);
39900
+ const mountedRef = React79__default.useRef(false);
39667
39901
  if (!mountedRef.current) {
39668
39902
  mountedRef.current = true;
39669
39903
  debug("forms", "mount", {
@@ -39676,7 +39910,7 @@ var init_Form = __esm({
39676
39910
  });
39677
39911
  }
39678
39912
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
39679
- const evalContext = React81__default.useMemo(
39913
+ const evalContext = React79__default.useMemo(
39680
39914
  () => ({
39681
39915
  formValues: formData,
39682
39916
  globalVariables: externalContext?.globalVariables ?? {},
@@ -39685,7 +39919,7 @@ var init_Form = __esm({
39685
39919
  }),
39686
39920
  [formData, externalContext]
39687
39921
  );
39688
- React81__default.useEffect(() => {
39922
+ React79__default.useEffect(() => {
39689
39923
  debug("forms", "initialData-sync", {
39690
39924
  mode: formMode,
39691
39925
  normalizedInitialData,
@@ -39696,7 +39930,7 @@ var init_Form = __esm({
39696
39930
  setFormData(normalizedInitialData);
39697
39931
  }
39698
39932
  }, [normalizedInitialData]);
39699
- const processCalculations = React81__default.useCallback(
39933
+ const processCalculations = React79__default.useCallback(
39700
39934
  (changedFieldId, newFormData) => {
39701
39935
  if (!hiddenCalculations.length) return;
39702
39936
  const context = {
@@ -39721,7 +39955,7 @@ var init_Form = __esm({
39721
39955
  },
39722
39956
  [hiddenCalculations, externalContext, eventBus]
39723
39957
  );
39724
- const checkViolations = React81__default.useCallback(
39958
+ const checkViolations = React79__default.useCallback(
39725
39959
  (changedFieldId, newFormData) => {
39726
39960
  if (!violationTriggers.length) return;
39727
39961
  const context = {
@@ -39759,7 +39993,7 @@ var init_Form = __esm({
39759
39993
  processCalculations(name, newFormData);
39760
39994
  checkViolations(name, newFormData);
39761
39995
  };
39762
- const isFieldVisible = React81__default.useCallback(
39996
+ const isFieldVisible = React79__default.useCallback(
39763
39997
  (fieldName) => {
39764
39998
  const condition = conditionalFields[fieldName];
39765
39999
  if (!condition) return true;
@@ -39767,7 +40001,7 @@ var init_Form = __esm({
39767
40001
  },
39768
40002
  [conditionalFields, evalContext]
39769
40003
  );
39770
- const isSectionVisible = React81__default.useCallback(
40004
+ const isSectionVisible = React79__default.useCallback(
39771
40005
  (section) => {
39772
40006
  if (!section.condition) return true;
39773
40007
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -39843,7 +40077,7 @@ var init_Form = __esm({
39843
40077
  eventBus.emit(`UI:${onCancel}`);
39844
40078
  }
39845
40079
  };
39846
- const renderField = React81__default.useCallback(
40080
+ const renderField = React79__default.useCallback(
39847
40081
  (field) => {
39848
40082
  const fieldName = field.name || field.field;
39849
40083
  if (!fieldName) return null;
@@ -39864,7 +40098,7 @@ var init_Form = __esm({
39864
40098
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
39865
40099
  );
39866
40100
  const effectiveFields = entityDerivedFields ?? fields;
39867
- const normalizedFields = React81__default.useMemo(() => {
40101
+ const normalizedFields = React79__default.useMemo(() => {
39868
40102
  if (!effectiveFields || effectiveFields.length === 0) return [];
39869
40103
  return effectiveFields.map((field) => {
39870
40104
  if (typeof field === "string") {
@@ -39887,7 +40121,7 @@ var init_Form = __esm({
39887
40121
  return field;
39888
40122
  });
39889
40123
  }, [effectiveFields, resolvedEntity]);
39890
- const schemaFields = React81__default.useMemo(() => {
40124
+ const schemaFields = React79__default.useMemo(() => {
39891
40125
  if (normalizedFields.length === 0) return null;
39892
40126
  if (isDebugEnabled()) {
39893
40127
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -39897,7 +40131,7 @@ var init_Form = __esm({
39897
40131
  }
39898
40132
  return normalizedFields.map(renderField).filter(Boolean);
39899
40133
  }, [normalizedFields, renderField, entityName, conditionalFields]);
39900
- const sectionElements = React81__default.useMemo(() => {
40134
+ const sectionElements = React79__default.useMemo(() => {
39901
40135
  if (!sections || sections.length === 0) return null;
39902
40136
  return sections.map((section) => {
39903
40137
  if (!isSectionVisible(section)) {
@@ -41179,7 +41413,7 @@ var init_List = __esm({
41179
41413
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
41180
41414
  return [];
41181
41415
  }, [entity]);
41182
- const getItemActions = React81__default.useCallback(
41416
+ const getItemActions = React79__default.useCallback(
41183
41417
  (item) => {
41184
41418
  if (!itemActions) return [];
41185
41419
  if (typeof itemActions === "function") {
@@ -41655,7 +41889,7 @@ var init_MediaGallery = __esm({
41655
41889
  [selectable, selectedItems, selectionEvent, eventBus]
41656
41890
  );
41657
41891
  const entityData = Array.isArray(entity) ? entity : [];
41658
- const items = React81__default.useMemo(() => {
41892
+ const items = React79__default.useMemo(() => {
41659
41893
  if (propItems) return propItems;
41660
41894
  if (entityData.length === 0) return [];
41661
41895
  return entityData.map((record, idx) => ({
@@ -41825,9 +42059,9 @@ function MiniMap({
41825
42059
  viewportRect,
41826
42060
  className
41827
42061
  }) {
41828
- const canvasRef = React81.useRef(null);
41829
- const frameRef = React81.useRef(0);
41830
- React81.useEffect(() => {
42062
+ const canvasRef = React79.useRef(null);
42063
+ const frameRef = React79.useRef(0);
42064
+ React79.useEffect(() => {
41831
42065
  const canvas = canvasRef.current;
41832
42066
  if (!canvas) return;
41833
42067
  const ctx = canvas.getContext("2d");
@@ -41909,7 +42143,7 @@ var init_MiniMap = __esm({
41909
42143
  }
41910
42144
  });
41911
42145
  function extractTitle2(children) {
41912
- if (!React81__default.isValidElement(children)) return void 0;
42146
+ if (!React79__default.isValidElement(children)) return void 0;
41913
42147
  const props = children.props;
41914
42148
  if (typeof props.title === "string") {
41915
42149
  return props.title;
@@ -42256,7 +42490,7 @@ function ResourceCounter({
42256
42490
  children: [
42257
42491
  icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
42258
42492
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
42259
- /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color), children: [
42493
+ /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color && (color in colorTokenClasses2 ? colorTokenClasses2[color] : color)), children: [
42260
42494
  value,
42261
42495
  max != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
42262
42496
  "/",
@@ -42267,10 +42501,18 @@ function ResourceCounter({
42267
42501
  }
42268
42502
  );
42269
42503
  }
42270
- var sizeMap15;
42504
+ var colorTokenClasses2, sizeMap15;
42271
42505
  var init_ResourceCounter = __esm({
42272
42506
  "components/game/atoms/ResourceCounter.tsx"() {
42273
42507
  init_cn();
42508
+ colorTokenClasses2 = {
42509
+ primary: "text-primary",
42510
+ secondary: "text-secondary",
42511
+ success: "text-success",
42512
+ warning: "text-warning",
42513
+ error: "text-error",
42514
+ muted: "text-muted-foreground"
42515
+ };
42274
42516
  sizeMap15 = {
42275
42517
  sm: { wrapper: "text-xs gap-1 px-1.5 py-0.5", icon: "text-sm" },
42276
42518
  md: { wrapper: "text-sm gap-1.5 px-2 py-1", icon: "text-base" },
@@ -42366,7 +42608,7 @@ var init_debugRegistry = __esm({
42366
42608
  }
42367
42609
  });
42368
42610
  function useDebugData() {
42369
- const [data, setData] = React81.useState(() => ({
42611
+ const [data, setData] = React79.useState(() => ({
42370
42612
  traits: [],
42371
42613
  ticks: [],
42372
42614
  guards: [],
@@ -42380,7 +42622,7 @@ function useDebugData() {
42380
42622
  },
42381
42623
  lastUpdate: Date.now()
42382
42624
  }));
42383
- React81.useEffect(() => {
42625
+ React79.useEffect(() => {
42384
42626
  const updateData = () => {
42385
42627
  setData({
42386
42628
  traits: getAllTraits(),
@@ -42489,12 +42731,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42489
42731
  return positions;
42490
42732
  }
42491
42733
  function WalkMinimap() {
42492
- const [walkStep, setWalkStep] = React81.useState(null);
42493
- const [traits2, setTraits] = React81.useState([]);
42494
- const [coveredEdges, setCoveredEdges] = React81.useState([]);
42495
- const [completedTraits, setCompletedTraits] = React81.useState(/* @__PURE__ */ new Set());
42496
- const prevTraitRef = React81.useRef(null);
42497
- React81.useEffect(() => {
42734
+ const [walkStep, setWalkStep] = React79.useState(null);
42735
+ const [traits2, setTraits] = React79.useState([]);
42736
+ const [coveredEdges, setCoveredEdges] = React79.useState([]);
42737
+ const [completedTraits, setCompletedTraits] = React79.useState(/* @__PURE__ */ new Set());
42738
+ const prevTraitRef = React79.useRef(null);
42739
+ React79.useEffect(() => {
42498
42740
  const interval = setInterval(() => {
42499
42741
  const w = window;
42500
42742
  const step = w.__orbitalWalkStep;
@@ -42930,15 +43172,15 @@ var init_EntitiesTab = __esm({
42930
43172
  });
42931
43173
  function EventFlowTab({ events: events2 }) {
42932
43174
  const { t } = useTranslate();
42933
- const [filter, setFilter] = React81.useState("all");
42934
- const containerRef = React81.useRef(null);
42935
- const [autoScroll, setAutoScroll] = React81.useState(true);
42936
- React81.useEffect(() => {
43175
+ const [filter, setFilter] = React79.useState("all");
43176
+ const containerRef = React79.useRef(null);
43177
+ const [autoScroll, setAutoScroll] = React79.useState(true);
43178
+ React79.useEffect(() => {
42937
43179
  if (autoScroll && containerRef.current) {
42938
43180
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42939
43181
  }
42940
43182
  }, [events2.length, autoScroll]);
42941
- const filteredEvents = React81.useMemo(() => {
43183
+ const filteredEvents = React79.useMemo(() => {
42942
43184
  if (filter === "all") return events2;
42943
43185
  return events2.filter((e) => e.type === filter);
42944
43186
  }, [events2, filter]);
@@ -43054,7 +43296,7 @@ var init_EventFlowTab = __esm({
43054
43296
  });
43055
43297
  function GuardsPanel({ guards }) {
43056
43298
  const { t } = useTranslate();
43057
- const [filter, setFilter] = React81.useState("all");
43299
+ const [filter, setFilter] = React79.useState("all");
43058
43300
  if (guards.length === 0) {
43059
43301
  return /* @__PURE__ */ jsx(
43060
43302
  EmptyState,
@@ -43067,7 +43309,7 @@ function GuardsPanel({ guards }) {
43067
43309
  }
43068
43310
  const passedCount = guards.filter((g) => g.result).length;
43069
43311
  const failedCount = guards.length - passedCount;
43070
- const filteredGuards = React81.useMemo(() => {
43312
+ const filteredGuards = React79.useMemo(() => {
43071
43313
  if (filter === "all") return guards;
43072
43314
  if (filter === "passed") return guards.filter((g) => g.result);
43073
43315
  return guards.filter((g) => !g.result);
@@ -43230,10 +43472,10 @@ function EffectBadge({ effect }) {
43230
43472
  }
43231
43473
  function TransitionTimeline({ transitions }) {
43232
43474
  const { t } = useTranslate();
43233
- const containerRef = React81.useRef(null);
43234
- const [autoScroll, setAutoScroll] = React81.useState(true);
43235
- const [expandedId, setExpandedId] = React81.useState(null);
43236
- React81.useEffect(() => {
43475
+ const containerRef = React79.useRef(null);
43476
+ const [autoScroll, setAutoScroll] = React79.useState(true);
43477
+ const [expandedId, setExpandedId] = React79.useState(null);
43478
+ React79.useEffect(() => {
43237
43479
  if (autoScroll && containerRef.current) {
43238
43480
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
43239
43481
  }
@@ -43513,9 +43755,9 @@ function getAllEvents(traits2) {
43513
43755
  function EventDispatcherTab({ traits: traits2, schema }) {
43514
43756
  const eventBus = useEventBus();
43515
43757
  const { t } = useTranslate();
43516
- const [log8, setLog] = React81.useState([]);
43517
- const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
43518
- React81.useEffect(() => {
43758
+ const [log8, setLog] = React79.useState([]);
43759
+ const prevStatesRef = React79.useRef(/* @__PURE__ */ new Map());
43760
+ React79.useEffect(() => {
43519
43761
  for (const trait of traits2) {
43520
43762
  const prev = prevStatesRef.current.get(trait.id);
43521
43763
  if (prev && prev !== trait.currentState) {
@@ -43684,10 +43926,10 @@ function VerifyModePanel({
43684
43926
  localCount
43685
43927
  }) {
43686
43928
  const { t } = useTranslate();
43687
- const [expanded, setExpanded] = React81.useState(true);
43688
- const scrollRef = React81.useRef(null);
43689
- const prevCountRef = React81.useRef(0);
43690
- React81.useEffect(() => {
43929
+ const [expanded, setExpanded] = React79.useState(true);
43930
+ const scrollRef = React79.useRef(null);
43931
+ const prevCountRef = React79.useRef(0);
43932
+ React79.useEffect(() => {
43691
43933
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43692
43934
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43693
43935
  }
@@ -43744,10 +43986,10 @@ function RuntimeDebugger({
43744
43986
  schema
43745
43987
  }) {
43746
43988
  const { t } = useTranslate();
43747
- const [isCollapsed, setIsCollapsed] = React81.useState(mode === "verify" ? true : defaultCollapsed);
43748
- const [isVisible, setIsVisible] = React81.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43989
+ const [isCollapsed, setIsCollapsed] = React79.useState(mode === "verify" ? true : defaultCollapsed);
43990
+ const [isVisible, setIsVisible] = React79.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43749
43991
  const debugData = useDebugData();
43750
- React81.useEffect(() => {
43992
+ React79.useEffect(() => {
43751
43993
  if (mode === "inline") return;
43752
43994
  return onDebugToggle((enabled) => {
43753
43995
  setIsVisible(enabled);
@@ -43756,7 +43998,7 @@ function RuntimeDebugger({
43756
43998
  }
43757
43999
  });
43758
44000
  }, [mode]);
43759
- React81.useEffect(() => {
44001
+ React79.useEffect(() => {
43760
44002
  if (mode === "inline") return;
43761
44003
  const handleKeyDown = (e) => {
43762
44004
  if (e.key === "`" && isVisible) {
@@ -44205,7 +44447,7 @@ function SequenceBar({
44205
44447
  onSlotRemove(index);
44206
44448
  }, [onSlotRemove, playing]);
44207
44449
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
44208
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
44450
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
44209
44451
  i > 0 && /* @__PURE__ */ jsx(
44210
44452
  Typography,
44211
44453
  {
@@ -45295,7 +45537,7 @@ var init_StatCard = __esm({
45295
45537
  const labelToUse = propLabel ?? propTitle;
45296
45538
  const eventBus = useEventBus();
45297
45539
  const { t } = useTranslate();
45298
- const handleActionClick = React81__default.useCallback(() => {
45540
+ const handleActionClick = React79__default.useCallback(() => {
45299
45541
  if (action?.event) {
45300
45542
  eventBus.emit(`UI:${action.event}`, {});
45301
45543
  }
@@ -45306,7 +45548,7 @@ var init_StatCard = __esm({
45306
45548
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
45307
45549
  const isLoading = externalLoading ?? false;
45308
45550
  const error = externalError;
45309
- const computeMetricValue = React81__default.useCallback(
45551
+ const computeMetricValue = React79__default.useCallback(
45310
45552
  (metric, items) => {
45311
45553
  if (metric.value !== void 0) {
45312
45554
  return metric.value;
@@ -45345,7 +45587,7 @@ var init_StatCard = __esm({
45345
45587
  },
45346
45588
  []
45347
45589
  );
45348
- const schemaStats = React81__default.useMemo(() => {
45590
+ const schemaStats = React79__default.useMemo(() => {
45349
45591
  if (!metrics || metrics.length === 0) return null;
45350
45592
  return metrics.map((metric) => ({
45351
45593
  label: metric.label,
@@ -45353,7 +45595,7 @@ var init_StatCard = __esm({
45353
45595
  format: metric.format
45354
45596
  }));
45355
45597
  }, [metrics, data, computeMetricValue]);
45356
- const calculatedTrend = React81__default.useMemo(() => {
45598
+ const calculatedTrend = React79__default.useMemo(() => {
45357
45599
  if (manualTrend !== void 0) return manualTrend;
45358
45600
  if (previousValue === void 0 || currentValue2 === void 0)
45359
45601
  return void 0;
@@ -45634,6 +45876,37 @@ var init_VariablePanel = __esm({
45634
45876
  VariablePanel.displayName = "VariablePanel";
45635
45877
  }
45636
45878
  });
45879
+ function StateJsonView({
45880
+ data,
45881
+ label,
45882
+ defaultExpanded = false,
45883
+ className
45884
+ }) {
45885
+ const { t } = useTranslate();
45886
+ const [expanded, setExpanded] = useState(defaultExpanded);
45887
+ const jsonString = JSON.stringify(data, null, 2);
45888
+ return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
45889
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
45890
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
45891
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
45892
+ ] }),
45893
+ expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
45894
+ Typography,
45895
+ {
45896
+ variant: "caption",
45897
+ className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
45898
+ children: jsonString
45899
+ }
45900
+ ) })
45901
+ ] });
45902
+ }
45903
+ var init_StateJsonView = __esm({
45904
+ "components/game/organisms/puzzles/state-architect/StateJsonView.tsx"() {
45905
+ init_atoms2();
45906
+ init_cn();
45907
+ StateJsonView.displayName = "StateJsonView";
45908
+ }
45909
+ });
45637
45910
  function layoutStates(states, width, height) {
45638
45911
  const cx = width / 2;
45639
45912
  const cy = height / 2;
@@ -45925,7 +46198,7 @@ function StateArchitectBoard({
45925
46198
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
45926
46199
  ] }, i))
45927
46200
  ] }),
45928
- resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
46201
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
45929
46202
  ] })
45930
46203
  ] }),
45931
46204
  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") }) }),
@@ -45962,7 +46235,7 @@ var init_StateArchitectBoard = __esm({
45962
46235
  init_StateNode();
45963
46236
  init_TransitionArrow();
45964
46237
  init_VariablePanel();
45965
- init_CodeView();
46238
+ init_StateJsonView();
45966
46239
  init_boardEntity();
45967
46240
  ENCOURAGEMENT_KEYS3 = [
45968
46241
  "puzzle.tryAgain1",
@@ -46042,7 +46315,7 @@ function StatusEffect({
46042
46315
  ),
46043
46316
  title: label,
46044
46317
  children: [
46045
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: icon }),
46318
+ /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }),
46046
46319
  duration !== void 0 && /* @__PURE__ */ jsx(
46047
46320
  "span",
46048
46321
  {
@@ -46073,6 +46346,7 @@ var sizeMap16, variantStyles9;
46073
46346
  var init_StatusEffect = __esm({
46074
46347
  "components/game/atoms/StatusEffect.tsx"() {
46075
46348
  init_cn();
46349
+ init_Icon();
46076
46350
  sizeMap16 = {
46077
46351
  sm: { container: "w-8 h-8", icon: "text-sm", badge: "text-xs -top-1 -right-1 w-4 h-4", timer: "text-[9px]" },
46078
46352
  md: { container: "w-10 h-10", icon: "text-base", badge: "text-xs -top-1 -right-1 w-5 h-5", timer: "text-xs" },
@@ -46358,7 +46632,7 @@ var init_Timeline = __esm({
46358
46632
  }) => {
46359
46633
  const { t } = useTranslate();
46360
46634
  const entityData = Array.isArray(entity) ? entity : [];
46361
- const items = React81__default.useMemo(() => {
46635
+ const items = React79__default.useMemo(() => {
46362
46636
  if (propItems) return propItems;
46363
46637
  if (entityData.length === 0) return [];
46364
46638
  return entityData.map((record, idx) => {
@@ -46515,7 +46789,7 @@ var init_TimerDisplay = __esm({
46515
46789
  }
46516
46790
  });
46517
46791
  function extractToastProps(children) {
46518
- if (!React81__default.isValidElement(children)) {
46792
+ if (!React79__default.isValidElement(children)) {
46519
46793
  if (typeof children === "string") {
46520
46794
  return { message: children };
46521
46795
  }
@@ -46553,7 +46827,7 @@ var init_ToastSlot = __esm({
46553
46827
  eventBus.emit("UI:CLOSE");
46554
46828
  };
46555
46829
  if (!isVisible) return null;
46556
- const isCustomContent = React81__default.isValidElement(children) && !message;
46830
+ const isCustomContent = React79__default.isValidElement(children) && !message;
46557
46831
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
46558
46832
  Toast,
46559
46833
  {
@@ -47073,14 +47347,20 @@ function XPBar({
47073
47347
  }) {
47074
47348
  const sizes = sizeMap18[size];
47075
47349
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
47076
- const [fillWidth, setFillWidth] = React81.useState(animated ? 0 : percentage);
47077
- React81.useEffect(() => {
47350
+ const [fillWidth, setFillWidth] = React79.useState(animated ? 0 : percentage);
47351
+ React79.useEffect(() => {
47078
47352
  if (!animated) {
47079
47353
  setFillWidth(percentage);
47080
47354
  return;
47081
47355
  }
47082
- const frame = requestAnimationFrame(() => setFillWidth(percentage));
47083
- return () => cancelAnimationFrame(frame);
47356
+ let frame2;
47357
+ const frame1 = requestAnimationFrame(() => {
47358
+ frame2 = requestAnimationFrame(() => setFillWidth(percentage));
47359
+ });
47360
+ return () => {
47361
+ cancelAnimationFrame(frame1);
47362
+ cancelAnimationFrame(frame2);
47363
+ };
47084
47364
  }, [animated, percentage]);
47085
47365
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
47086
47366
  level != null && /* @__PURE__ */ jsxs(
@@ -47118,7 +47398,7 @@ function XPBar({
47118
47398
  )
47119
47399
  }
47120
47400
  ),
47121
- showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground tabular-nums", sizes.text), children: [
47401
+ showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-foreground/70 tabular-nums", sizes.text), children: [
47122
47402
  current,
47123
47403
  " / ",
47124
47404
  max,
@@ -47141,12 +47421,12 @@ var init_XPBar = __esm({
47141
47421
  }
47142
47422
  });
47143
47423
  function lazyThree(name, loader) {
47144
- const Lazy = React81__default.lazy(() => loader().then((m) => ({ default: m[name] })));
47424
+ const Lazy = React79__default.lazy(() => loader().then((m) => ({ default: m[name] })));
47145
47425
  function ThreeWrapper(props) {
47146
- return React81__default.createElement(
47147
- React81__default.Suspense,
47426
+ return React79__default.createElement(
47427
+ React79__default.Suspense,
47148
47428
  { fallback: null },
47149
- React81__default.createElement(Lazy, props)
47429
+ React79__default.createElement(Lazy, props)
47150
47430
  );
47151
47431
  }
47152
47432
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -47194,8 +47474,6 @@ var init_component_registry_generated = __esm({
47194
47474
  init_ChoiceButton();
47195
47475
  init_ClassifierBoard();
47196
47476
  init_CodeBlock();
47197
- init_CodeView();
47198
- init_CodeViewer();
47199
47477
  init_CombatLog();
47200
47478
  init_ComboCounter();
47201
47479
  init_CommunityLinks();
@@ -47223,7 +47501,6 @@ var init_component_registry_generated = __esm({
47223
47501
  init_DialogueBox();
47224
47502
  init_DialogueBubble();
47225
47503
  init_DocBreadcrumb();
47226
- init_DocCodeBlock();
47227
47504
  init_DocPagination();
47228
47505
  init_DocSearch();
47229
47506
  init_DocSidebar();
@@ -47478,8 +47755,6 @@ var init_component_registry_generated = __esm({
47478
47755
  "ChoiceButton": ChoiceButton,
47479
47756
  "ClassifierBoard": ClassifierBoard,
47480
47757
  "CodeBlock": CodeBlock,
47481
- "CodeView": CodeView,
47482
- "CodeViewer": CodeViewer,
47483
47758
  "CombatLog": CombatLog,
47484
47759
  "ComboCounter": ComboCounter,
47485
47760
  "CommunityLinks": CommunityLinks,
@@ -47511,7 +47786,6 @@ var init_component_registry_generated = __esm({
47511
47786
  "Divider": DividerPattern,
47512
47787
  "DividerPattern": DividerPattern,
47513
47788
  "DocBreadcrumb": DocBreadcrumb,
47514
- "DocCodeBlock": DocCodeBlock,
47515
47789
  "DocPagination": DocPagination,
47516
47790
  "DocSearch": DocSearch,
47517
47791
  "DocSidebar": DocSidebar,
@@ -47762,7 +48036,7 @@ function SuspenseConfigProvider({
47762
48036
  config,
47763
48037
  children
47764
48038
  }) {
47765
- return React81__default.createElement(
48039
+ return React79__default.createElement(
47766
48040
  SuspenseConfigContext.Provider,
47767
48041
  { value: config },
47768
48042
  children
@@ -48252,7 +48526,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
48252
48526
  const key = `${parentId}-${index}-trait:${traitName}`;
48253
48527
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
48254
48528
  }
48255
- return /* @__PURE__ */ jsx(React81__default.Fragment, { children: child }, `${parentId}-${index}`);
48529
+ return /* @__PURE__ */ jsx(React79__default.Fragment, { children: child }, `${parentId}-${index}`);
48256
48530
  }
48257
48531
  if (!child || typeof child !== "object") return null;
48258
48532
  const childId = `${parentId}-${index}`;
@@ -48292,14 +48566,14 @@ function isPatternConfig(value) {
48292
48566
  if (value === null || value === void 0) return false;
48293
48567
  if (typeof value !== "object") return false;
48294
48568
  if (Array.isArray(value)) return false;
48295
- if (React81__default.isValidElement(value)) return false;
48569
+ if (React79__default.isValidElement(value)) return false;
48296
48570
  if (value instanceof Date) return false;
48297
48571
  if (typeof value === "function") return false;
48298
48572
  const record = value;
48299
48573
  return "type" in record && typeof record.type === "string";
48300
48574
  }
48301
48575
  function isPlainConfigObject(value) {
48302
- if (React81__default.isValidElement(value)) return false;
48576
+ if (React79__default.isValidElement(value)) return false;
48303
48577
  if (value instanceof Date) return false;
48304
48578
  const proto = Object.getPrototypeOf(value);
48305
48579
  return proto === Object.prototype || proto === null;
@@ -49459,7 +49733,7 @@ init_EventHandlerBoard();
49459
49733
  init_StateNode();
49460
49734
  init_TransitionArrow();
49461
49735
  init_VariablePanel();
49462
- init_CodeView();
49736
+ init_StateJsonView();
49463
49737
  init_StateArchitectBoard();
49464
49738
 
49465
49739
  // components/game/organisms/puzzles/simulator/index.ts
@@ -49910,4 +50184,4 @@ init_AboutPageTemplate();
49910
50184
  // components/index.ts
49911
50185
  init_cn();
49912
50186
 
49913
- export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CodeView, CodeViewer, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocCodeBlock, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };
50187
+ export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArrayEditor, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapEditor, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectEditor, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, toCodeLanguage, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };