@almadar/ui 4.36.0 → 4.38.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.
@@ -1,7 +1,7 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
- import * as React120 from 'react';
4
- import React120__default, { useContext, useMemo, useRef, useEffect, useCallback, createContext, useState, Suspense, lazy, useSyncExternalStore, useLayoutEffect, useId } from 'react';
3
+ import * as React121 from 'react';
4
+ import React121__default, { useContext, useMemo, useRef, useEffect, useCallback, createContext, useState, Suspense, lazy, useSyncExternalStore, useLayoutEffect, useId } from 'react';
5
5
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
6
6
  import * as LucideIcons from 'lucide-react';
7
7
  import { Loader2, X, AlertTriangle, Info, AlertCircle, CheckCircle, ChevronDown, List, Printer, ChevronRight, ChevronLeft, XCircle, Wrench, RotateCcw, Send, Code, FileText, WrapText, Check, Copy, Trash2, Menu as Menu$1, Search, Bell, LogOut, ChevronUp, MoreHorizontal, Bug, ZoomOut, ZoomIn, Download, Pause, Play, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ArrowRight, ArrowLeft, Eraser, SkipForward, TrendingUp, TrendingDown, Minus, ArrowUp, ArrowDown, MoreVertical, Circle, Clock, CheckCircle2, HelpCircle, FileQuestion, Inbox, Plus, User, Filter, Star, FileWarning, Camera, RefreshCw, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, MessageSquare, Flag, GitBranch, Trash, GitCommit, AlignLeft, Columns, Tag, DollarSign, Sun, Moon, Zap, Sword, Move, Heart, Shield, Coffee, Users } from 'lucide-react';
@@ -368,7 +368,7 @@ function resolveIconProp(value, sizeClass) {
368
368
  const IconComp = value;
369
369
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
370
370
  }
371
- if (React120__default.isValidElement(value)) {
371
+ if (React121__default.isValidElement(value)) {
372
372
  return value;
373
373
  }
374
374
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -444,7 +444,7 @@ var init_Button = __esm({
444
444
  md: "h-4 w-4",
445
445
  lg: "h-5 w-5"
446
446
  };
447
- Button = React120__default.forwardRef(
447
+ Button = React121__default.forwardRef(
448
448
  ({
449
449
  className,
450
450
  variant = "primary",
@@ -509,7 +509,7 @@ var Input;
509
509
  var init_Input = __esm({
510
510
  "components/atoms/Input.tsx"() {
511
511
  init_cn();
512
- Input = React120__default.forwardRef(
512
+ Input = React121__default.forwardRef(
513
513
  ({
514
514
  className,
515
515
  inputType,
@@ -627,7 +627,7 @@ var Label;
627
627
  var init_Label = __esm({
628
628
  "components/atoms/Label.tsx"() {
629
629
  init_cn();
630
- Label = React120__default.forwardRef(
630
+ Label = React121__default.forwardRef(
631
631
  ({ className, required, children, ...props }, ref) => {
632
632
  return /* @__PURE__ */ jsxs(
633
633
  "label",
@@ -653,7 +653,7 @@ var Textarea;
653
653
  var init_Textarea = __esm({
654
654
  "components/atoms/Textarea.tsx"() {
655
655
  init_cn();
656
- Textarea = React120__default.forwardRef(
656
+ Textarea = React121__default.forwardRef(
657
657
  ({ className, error, ...props }, ref) => {
658
658
  return /* @__PURE__ */ jsx(
659
659
  "textarea",
@@ -682,7 +682,7 @@ var Select;
682
682
  var init_Select = __esm({
683
683
  "components/atoms/Select.tsx"() {
684
684
  init_cn();
685
- Select = React120__default.forwardRef(
685
+ Select = React121__default.forwardRef(
686
686
  ({ className, options, placeholder, error, ...props }, ref) => {
687
687
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
688
688
  /* @__PURE__ */ jsxs(
@@ -724,7 +724,7 @@ var Checkbox;
724
724
  var init_Checkbox = __esm({
725
725
  "components/atoms/Checkbox.tsx"() {
726
726
  init_cn();
727
- Checkbox = React120__default.forwardRef(
727
+ Checkbox = React121__default.forwardRef(
728
728
  ({ className, label, id, ...props }, ref) => {
729
729
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
730
730
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -806,7 +806,7 @@ var init_Card = __esm({
806
806
  md: "shadow",
807
807
  lg: "shadow-lg"
808
808
  };
809
- Card = React120__default.forwardRef(
809
+ Card = React121__default.forwardRef(
810
810
  ({
811
811
  className,
812
812
  variant = "bordered",
@@ -842,9 +842,9 @@ var init_Card = __esm({
842
842
  }
843
843
  );
844
844
  Card.displayName = "Card";
845
- CardHeader = React120__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
845
+ CardHeader = React121__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
846
846
  CardHeader.displayName = "CardHeader";
847
- CardTitle = React120__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
847
+ CardTitle = React121__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
848
848
  "h3",
849
849
  {
850
850
  ref,
@@ -857,11 +857,11 @@ var init_Card = __esm({
857
857
  }
858
858
  ));
859
859
  CardTitle.displayName = "CardTitle";
860
- CardContent = React120__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
860
+ CardContent = React121__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
861
861
  CardContent.displayName = "CardContent";
862
862
  CardBody = CardContent;
863
863
  CardBody.displayName = "CardBody";
864
- CardFooter = React120__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
864
+ CardFooter = React121__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
865
865
  "div",
866
866
  {
867
867
  ref,
@@ -914,7 +914,7 @@ var init_Badge = __esm({
914
914
  md: "px-2.5 py-1 text-sm",
915
915
  lg: "px-3 py-1.5 text-base"
916
916
  };
917
- Badge = React120__default.forwardRef(
917
+ Badge = React121__default.forwardRef(
918
918
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
919
919
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
920
920
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -947,6 +947,7 @@ var variantStyles4, sizeStyles3, iconSizes, FilterPill;
947
947
  var init_FilterPill = __esm({
948
948
  "components/atoms/FilterPill.tsx"() {
949
949
  init_cn();
950
+ init_useEventBus();
950
951
  init_Icon();
951
952
  variantStyles4 = {
952
953
  default: [
@@ -986,7 +987,7 @@ var init_FilterPill = __esm({
986
987
  md: "w-3.5 h-3.5",
987
988
  lg: "w-4 h-4"
988
989
  };
989
- FilterPill = React120__default.forwardRef(
990
+ FilterPill = React121__default.forwardRef(
990
991
  ({
991
992
  className,
992
993
  variant = "default",
@@ -996,9 +997,21 @@ var init_FilterPill = __esm({
996
997
  onRemove,
997
998
  removable = true,
998
999
  onClick,
1000
+ clickEvent,
1001
+ removeEvent,
999
1002
  children,
1000
1003
  ...props
1001
1004
  }, ref) => {
1005
+ const eventBus = useEventBus();
1006
+ const payloadLabel = typeof children === "string" || typeof children === "number" ? children : label;
1007
+ const handleClick = useCallback(() => {
1008
+ onClick?.();
1009
+ if (clickEvent) eventBus.emit(`UI:${clickEvent}`, { label: payloadLabel });
1010
+ }, [onClick, clickEvent, eventBus, payloadLabel]);
1011
+ const handleRemove = useCallback(() => {
1012
+ onRemove?.();
1013
+ if (removeEvent) eventBus.emit(`UI:${removeEvent}`, { label: payloadLabel });
1014
+ }, [onRemove, removeEvent, eventBus, payloadLabel]);
1002
1015
  const XIcon = resolveIcon("x");
1003
1016
  const resolvedIcon = typeof icon === "string" ? (() => {
1004
1017
  const I = resolveIcon(icon);
@@ -1012,21 +1025,21 @@ var init_FilterPill = __esm({
1012
1025
  "inline-flex items-center gap-1 font-bold rounded-full",
1013
1026
  variantStyles4[variant],
1014
1027
  sizeStyles3[size],
1015
- onClick && "cursor-pointer",
1028
+ (onClick || clickEvent) && "cursor-pointer",
1016
1029
  className
1017
1030
  ),
1018
- onClick,
1031
+ onClick: onClick || clickEvent ? handleClick : void 0,
1019
1032
  ...props,
1020
1033
  children: [
1021
1034
  resolvedIcon,
1022
1035
  /* @__PURE__ */ jsx("span", { children: children ?? label }),
1023
- removable && onRemove && /* @__PURE__ */ jsx(
1036
+ removable && (onRemove || removeEvent) && /* @__PURE__ */ jsx(
1024
1037
  "button",
1025
1038
  {
1026
1039
  type: "button",
1027
1040
  onClick: (e) => {
1028
1041
  e.stopPropagation();
1029
- onRemove();
1042
+ handleRemove();
1030
1043
  },
1031
1044
  "aria-label": "Remove filter",
1032
1045
  className: cn(
@@ -1053,7 +1066,7 @@ var init_Spinner = __esm({
1053
1066
  md: "h-6 w-6",
1054
1067
  lg: "h-8 w-8"
1055
1068
  };
1056
- Spinner = React120__default.forwardRef(
1069
+ Spinner = React121__default.forwardRef(
1057
1070
  ({ className, size = "md", ...props }, ref) => {
1058
1071
  return /* @__PURE__ */ jsx(
1059
1072
  "div",
@@ -1334,7 +1347,7 @@ var init_Box = __esm({
1334
1347
  fixed: "fixed",
1335
1348
  sticky: "sticky"
1336
1349
  };
1337
- Box = React120__default.forwardRef(
1350
+ Box = React121__default.forwardRef(
1338
1351
  ({
1339
1352
  padding,
1340
1353
  paddingX,
@@ -1707,7 +1720,7 @@ var Radio;
1707
1720
  var init_Radio = __esm({
1708
1721
  "components/atoms/Radio.tsx"() {
1709
1722
  init_cn();
1710
- Radio = React120__default.forwardRef(
1723
+ Radio = React121__default.forwardRef(
1711
1724
  ({
1712
1725
  label,
1713
1726
  helperText,
@@ -1818,7 +1831,7 @@ var init_Switch = __esm({
1818
1831
  "components/atoms/Switch.tsx"() {
1819
1832
  "use client";
1820
1833
  init_cn();
1821
- Switch = React120.forwardRef(
1834
+ Switch = React121.forwardRef(
1822
1835
  ({
1823
1836
  checked,
1824
1837
  defaultChecked = false,
@@ -1829,10 +1842,10 @@ var init_Switch = __esm({
1829
1842
  name,
1830
1843
  className
1831
1844
  }, ref) => {
1832
- const [isChecked, setIsChecked] = React120.useState(
1845
+ const [isChecked, setIsChecked] = React121.useState(
1833
1846
  checked !== void 0 ? checked : defaultChecked
1834
1847
  );
1835
- React120.useEffect(() => {
1848
+ React121.useEffect(() => {
1836
1849
  if (checked !== void 0) {
1837
1850
  setIsChecked(checked);
1838
1851
  }
@@ -2717,8 +2730,8 @@ var init_LawReferenceTooltip = __esm({
2717
2730
  position = "top",
2718
2731
  className
2719
2732
  }) => {
2720
- const [isVisible, setIsVisible] = React120__default.useState(false);
2721
- const timeoutRef = React120__default.useRef(null);
2733
+ const [isVisible, setIsVisible] = React121__default.useState(false);
2734
+ const timeoutRef = React121__default.useRef(null);
2722
2735
  const handleMouseEnter = () => {
2723
2736
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2724
2737
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -2727,7 +2740,7 @@ var init_LawReferenceTooltip = __esm({
2727
2740
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2728
2741
  setIsVisible(false);
2729
2742
  };
2730
- React120__default.useEffect(() => {
2743
+ React121__default.useEffect(() => {
2731
2744
  return () => {
2732
2745
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
2733
2746
  };
@@ -2937,7 +2950,7 @@ var init_StatusDot = __esm({
2937
2950
  md: "w-2.5 h-2.5",
2938
2951
  lg: "w-3 h-3"
2939
2952
  };
2940
- StatusDot = React120__default.forwardRef(
2953
+ StatusDot = React121__default.forwardRef(
2941
2954
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
2942
2955
  return /* @__PURE__ */ jsx(
2943
2956
  "span",
@@ -2990,7 +3003,7 @@ var init_TrendIndicator = __esm({
2990
3003
  down: TrendingDown,
2991
3004
  flat: ArrowRight
2992
3005
  };
2993
- TrendIndicator = React120__default.forwardRef(
3006
+ TrendIndicator = React121__default.forwardRef(
2994
3007
  ({
2995
3008
  className,
2996
3009
  value,
@@ -3057,7 +3070,7 @@ var init_RangeSlider = __esm({
3057
3070
  md: "w-4 h-4",
3058
3071
  lg: "w-5 h-5"
3059
3072
  };
3060
- RangeSlider = React120__default.forwardRef(
3073
+ RangeSlider = React121__default.forwardRef(
3061
3074
  ({
3062
3075
  className,
3063
3076
  min = 0,
@@ -3653,7 +3666,7 @@ var init_ContentSection = __esm({
3653
3666
  md: "py-16",
3654
3667
  lg: "py-24"
3655
3668
  };
3656
- ContentSection = React120__default.forwardRef(
3669
+ ContentSection = React121__default.forwardRef(
3657
3670
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
3658
3671
  return /* @__PURE__ */ jsx(
3659
3672
  Box,
@@ -4187,7 +4200,7 @@ var init_AnimatedReveal = __esm({
4187
4200
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
4188
4201
  "none": {}
4189
4202
  };
4190
- AnimatedReveal = React120__default.forwardRef(
4203
+ AnimatedReveal = React121__default.forwardRef(
4191
4204
  ({
4192
4205
  trigger = "scroll",
4193
4206
  animation = "fade-up",
@@ -4347,7 +4360,7 @@ var init_AnimatedGraphic = __esm({
4347
4360
  "components/atoms/AnimatedGraphic.tsx"() {
4348
4361
  "use client";
4349
4362
  init_cn();
4350
- AnimatedGraphic = React120__default.forwardRef(
4363
+ AnimatedGraphic = React121__default.forwardRef(
4351
4364
  ({
4352
4365
  src,
4353
4366
  svgContent,
@@ -4370,7 +4383,7 @@ var init_AnimatedGraphic = __esm({
4370
4383
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
4371
4384
  const resolvedSvg = svgContent ?? fetchedSvg;
4372
4385
  const prevAnimateRef = useRef(animate);
4373
- const setRef = React120__default.useCallback(
4386
+ const setRef = React121__default.useCallback(
4374
4387
  (node) => {
4375
4388
  containerRef.current = node;
4376
4389
  if (typeof ref === "function") ref(node);
@@ -5183,7 +5196,7 @@ var init_ErrorBoundary = __esm({
5183
5196
  "use client";
5184
5197
  init_cn();
5185
5198
  init_ErrorState();
5186
- ErrorBoundary = class extends React120__default.Component {
5199
+ ErrorBoundary = class extends React121__default.Component {
5187
5200
  constructor(props) {
5188
5201
  super(props);
5189
5202
  __publicField(this, "reset", () => {
@@ -5604,8 +5617,8 @@ var init_Tooltip = __esm({
5604
5617
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
5605
5618
  };
5606
5619
  }, []);
5607
- const triggerElement = React120__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5608
- const trigger = React120__default.cloneElement(triggerElement, {
5620
+ const triggerElement = React121__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5621
+ const trigger = React121__default.cloneElement(triggerElement, {
5609
5622
  ref: triggerRef,
5610
5623
  onMouseEnter: handleMouseEnter,
5611
5624
  onMouseLeave: handleMouseLeave,
@@ -5726,8 +5739,8 @@ var init_Popover = __esm({
5726
5739
  onMouseEnter: handleOpen,
5727
5740
  onMouseLeave: handleClose
5728
5741
  };
5729
- const childElement = React120__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5730
- const triggerElement = React120__default.cloneElement(
5742
+ const childElement = React121__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
5743
+ const triggerElement = React121__default.cloneElement(
5731
5744
  childElement,
5732
5745
  {
5733
5746
  ref: triggerRef,
@@ -5844,8 +5857,8 @@ var init_Menu = __esm({
5844
5857
  "bottom-start": "top-full left-0 mt-2",
5845
5858
  "bottom-end": "top-full right-0 mt-2"
5846
5859
  };
5847
- const triggerChild = React120__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
5848
- const triggerElement = React120__default.cloneElement(
5860
+ const triggerChild = React121__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
5861
+ const triggerElement = React121__default.cloneElement(
5849
5862
  triggerChild,
5850
5863
  {
5851
5864
  ref: triggerRef,
@@ -6364,7 +6377,7 @@ var init_MapView = __esm({
6364
6377
  shadowSize: [41, 41]
6365
6378
  });
6366
6379
  L.Marker.prototype.options.icon = defaultIcon;
6367
- const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback120, useState: useState102 } = React120__default;
6380
+ const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback122, useState: useState102 } = React121__default;
6368
6381
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
6369
6382
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
6370
6383
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -6410,7 +6423,7 @@ var init_MapView = __esm({
6410
6423
  }) {
6411
6424
  const eventBus = useEventBus2();
6412
6425
  const [clickedPosition, setClickedPosition] = useState102(null);
6413
- const handleMapClick = useCallback120((lat, lng) => {
6426
+ const handleMapClick = useCallback122((lat, lng) => {
6414
6427
  if (showClickedPin) {
6415
6428
  setClickedPosition({ lat, lng });
6416
6429
  }
@@ -6419,7 +6432,7 @@ var init_MapView = __esm({
6419
6432
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
6420
6433
  }
6421
6434
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
6422
- const handleMarkerClick = useCallback120((marker) => {
6435
+ const handleMarkerClick = useCallback122((marker) => {
6423
6436
  onMarkerClick?.(marker);
6424
6437
  if (markerClickEvent) {
6425
6438
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -6610,7 +6623,7 @@ function InputPattern({
6610
6623
  fieldName
6611
6624
  }) {
6612
6625
  const { emit } = useEventBus();
6613
- const [localValue, setLocalValue] = React120__default.useState(value);
6626
+ const [localValue, setLocalValue] = React121__default.useState(value);
6614
6627
  const handleChange = (e) => {
6615
6628
  setLocalValue(e.target.value);
6616
6629
  if (onChange) {
@@ -6648,7 +6661,7 @@ function TextareaPattern({
6648
6661
  fieldName
6649
6662
  }) {
6650
6663
  const { emit } = useEventBus();
6651
- const [localValue, setLocalValue] = React120__default.useState(value);
6664
+ const [localValue, setLocalValue] = React121__default.useState(value);
6652
6665
  const handleChange = (e) => {
6653
6666
  setLocalValue(e.target.value);
6654
6667
  if (onChange) {
@@ -6680,7 +6693,7 @@ function SelectPattern({
6680
6693
  fieldName
6681
6694
  }) {
6682
6695
  const { emit } = useEventBus();
6683
- const [localValue, setLocalValue] = React120__default.useState(value);
6696
+ const [localValue, setLocalValue] = React121__default.useState(value);
6684
6697
  const handleChange = (e) => {
6685
6698
  setLocalValue(e.target.value);
6686
6699
  if (onChange) {
@@ -6709,7 +6722,7 @@ function CheckboxPattern({
6709
6722
  className
6710
6723
  }) {
6711
6724
  const { emit } = useEventBus();
6712
- const [localChecked, setLocalChecked] = React120__default.useState(checked);
6725
+ const [localChecked, setLocalChecked] = React121__default.useState(checked);
6713
6726
  const handleChange = (e) => {
6714
6727
  setLocalChecked(e.target.checked);
6715
6728
  if (onChange) {
@@ -7018,9 +7031,9 @@ function ControlButton({
7018
7031
  className
7019
7032
  }) {
7020
7033
  const eventBus = useEventBus();
7021
- const [isPressed, setIsPressed] = React120.useState(false);
7034
+ const [isPressed, setIsPressed] = React121.useState(false);
7022
7035
  const actualPressed = pressed ?? isPressed;
7023
- const handlePointerDown = React120.useCallback(
7036
+ const handlePointerDown = React121.useCallback(
7024
7037
  (e) => {
7025
7038
  e.preventDefault();
7026
7039
  if (disabled) return;
@@ -7030,7 +7043,7 @@ function ControlButton({
7030
7043
  },
7031
7044
  [disabled, pressEvent, eventBus, onPress]
7032
7045
  );
7033
- const handlePointerUp = React120.useCallback(
7046
+ const handlePointerUp = React121.useCallback(
7034
7047
  (e) => {
7035
7048
  e.preventDefault();
7036
7049
  if (disabled) return;
@@ -7040,7 +7053,7 @@ function ControlButton({
7040
7053
  },
7041
7054
  [disabled, releaseEvent, eventBus, onRelease]
7042
7055
  );
7043
- const handlePointerLeave = React120.useCallback(
7056
+ const handlePointerLeave = React121.useCallback(
7044
7057
  (e) => {
7045
7058
  if (isPressed) {
7046
7059
  setIsPressed(false);
@@ -7113,8 +7126,8 @@ function ActionButtons({
7113
7126
  disabled
7114
7127
  }) {
7115
7128
  const eventBus = useEventBus();
7116
- const [activeButtons, setActiveButtons] = React120.useState(/* @__PURE__ */ new Set());
7117
- const handlePress = React120.useCallback(
7129
+ const [activeButtons, setActiveButtons] = React121.useState(/* @__PURE__ */ new Set());
7130
+ const handlePress = React121.useCallback(
7118
7131
  (id) => {
7119
7132
  setActiveButtons((prev) => new Set(prev).add(id));
7120
7133
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7122,7 +7135,7 @@ function ActionButtons({
7122
7135
  },
7123
7136
  [actionEvent, eventBus, onAction]
7124
7137
  );
7125
- const handleRelease = React120.useCallback(
7138
+ const handleRelease = React121.useCallback(
7126
7139
  (id) => {
7127
7140
  setActiveButtons((prev) => {
7128
7141
  const next = new Set(prev);
@@ -9056,7 +9069,7 @@ var init_MarkdownContent = __esm({
9056
9069
  init_Box();
9057
9070
  init_useTranslate();
9058
9071
  init_cn();
9059
- MarkdownContent = React120__default.memo(
9072
+ MarkdownContent = React121__default.memo(
9060
9073
  ({ content, direction, className }) => {
9061
9074
  const { t: _t } = useTranslate();
9062
9075
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -9273,7 +9286,7 @@ var init_CodeBlock = __esm({
9273
9286
  loloStyle = { ...dark, ...loloStyleOverrides };
9274
9287
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
9275
9288
  HIDDEN_LINE_NUMBERS = { display: "none" };
9276
- CodeBlock = React120__default.memo(
9289
+ CodeBlock = React121__default.memo(
9277
9290
  ({
9278
9291
  code: rawCode,
9279
9292
  language = "text",
@@ -10582,7 +10595,7 @@ var init_StateMachineView = __esm({
10582
10595
  style: { top: title ? 30 : 0 },
10583
10596
  children: [
10584
10597
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
10585
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React120__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
10598
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React121__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
10586
10599
  StateNode,
10587
10600
  {
10588
10601
  state,
@@ -16547,7 +16560,7 @@ function CraftingRecipe({
16547
16560
  className
16548
16561
  }) {
16549
16562
  const eventBus = useEventBus();
16550
- const handleCraft = React120.useCallback(() => {
16563
+ const handleCraft = React121.useCallback(() => {
16551
16564
  onCraft?.();
16552
16565
  if (craftEvent) {
16553
16566
  eventBus.emit(craftEvent, { output: output.label });
@@ -16564,7 +16577,7 @@ function CraftingRecipe({
16564
16577
  children: [
16565
16578
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
16566
16579
  const hasSufficient = ingredient.available >= ingredient.required;
16567
- return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
16580
+ return /* @__PURE__ */ jsxs(React121.Fragment, { children: [
16568
16581
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
16569
16582
  ItemSlot,
16570
16583
  {
@@ -16858,8 +16871,8 @@ function DPad({
16858
16871
  }) {
16859
16872
  const eventBus = useEventBus();
16860
16873
  const sizes = sizeMap6[size];
16861
- const [activeDirections, setActiveDirections] = React120.useState(/* @__PURE__ */ new Set());
16862
- const handlePress = React120.useCallback(
16874
+ const [activeDirections, setActiveDirections] = React121.useState(/* @__PURE__ */ new Set());
16875
+ const handlePress = React121.useCallback(
16863
16876
  (direction) => {
16864
16877
  setActiveDirections((prev) => new Set(prev).add(direction));
16865
16878
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -16867,7 +16880,7 @@ function DPad({
16867
16880
  },
16868
16881
  [directionEvent, eventBus, onDirection]
16869
16882
  );
16870
- const handleRelease = React120.useCallback(
16883
+ const handleRelease = React121.useCallback(
16871
16884
  (direction) => {
16872
16885
  setActiveDirections((prev) => {
16873
16886
  const next = new Set(prev);
@@ -17874,13 +17887,13 @@ function DataList({
17874
17887
  }) {
17875
17888
  const eventBus = useEventBus();
17876
17889
  const { t } = useTranslate();
17877
- const [visibleCount, setVisibleCount] = React120__default.useState(pageSize || Infinity);
17890
+ const [visibleCount, setVisibleCount] = React121__default.useState(pageSize || Infinity);
17878
17891
  const fieldDefs = fields ?? columns ?? [];
17879
17892
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
17880
17893
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
17881
17894
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
17882
17895
  const hasRenderProp = typeof children === "function";
17883
- React120__default.useEffect(() => {
17896
+ React121__default.useEffect(() => {
17884
17897
  const renderItemTypeOf = typeof schemaRenderItem;
17885
17898
  const childrenTypeOf = typeof children;
17886
17899
  if (data.length > 0 && !hasRenderProp) {
@@ -17936,7 +17949,7 @@ function DataList({
17936
17949
  const items2 = data.map((item) => item);
17937
17950
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
17938
17951
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
17939
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
17952
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
17940
17953
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
17941
17954
  group.items.map((itemData, index) => {
17942
17955
  const id = itemData.id || `${gi}-${index}`;
@@ -18127,7 +18140,7 @@ function DataList({
18127
18140
  className
18128
18141
  ),
18129
18142
  children: [
18130
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
18143
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
18131
18144
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
18132
18145
  group.items.map(
18133
18146
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -19411,7 +19424,7 @@ var init_WizardProgress = __esm({
19411
19424
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
19412
19425
  const isActive = index === currentStep;
19413
19426
  const isCompleted = index < currentStep;
19414
- return /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
19427
+ return /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
19415
19428
  /* @__PURE__ */ jsx(
19416
19429
  "button",
19417
19430
  {
@@ -20311,9 +20324,9 @@ function ScoreDisplay({
20311
20324
  ...rest
20312
20325
  }) {
20313
20326
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
20314
- const [displayValue, setDisplayValue] = React120.useState(resolvedValue);
20315
- const [isAnimating, setIsAnimating] = React120.useState(false);
20316
- React120.useEffect(() => {
20327
+ const [displayValue, setDisplayValue] = React121.useState(resolvedValue);
20328
+ const [isAnimating, setIsAnimating] = React121.useState(false);
20329
+ React121.useEffect(() => {
20317
20330
  if (!animated || displayValue === resolvedValue) {
20318
20331
  setDisplayValue(resolvedValue);
20319
20332
  return;
@@ -20463,7 +20476,7 @@ function InventoryGrid({
20463
20476
  const eventBus = useEventBus();
20464
20477
  const slotCount = totalSlots ?? items.length;
20465
20478
  const emptySlotCount = Math.max(0, slotCount - items.length);
20466
- const handleSelect = React120.useCallback(
20479
+ const handleSelect = React121.useCallback(
20467
20480
  (id) => {
20468
20481
  onSelect?.(id);
20469
20482
  if (selectEvent) {
@@ -20745,15 +20758,15 @@ function GameCanvas2D({
20745
20758
  fps = 60,
20746
20759
  className
20747
20760
  }) {
20748
- const canvasRef = React120.useRef(null);
20749
- const rafRef = React120.useRef(0);
20750
- const frameRef = React120.useRef(0);
20751
- const lastTimeRef = React120.useRef(0);
20752
- const onDrawRef = React120.useRef(onDraw);
20761
+ const canvasRef = React121.useRef(null);
20762
+ const rafRef = React121.useRef(0);
20763
+ const frameRef = React121.useRef(0);
20764
+ const lastTimeRef = React121.useRef(0);
20765
+ const onDrawRef = React121.useRef(onDraw);
20753
20766
  onDrawRef.current = onDraw;
20754
- const onTickRef = React120.useRef(onTick);
20767
+ const onTickRef = React121.useRef(onTick);
20755
20768
  onTickRef.current = onTick;
20756
- React120.useEffect(() => {
20769
+ React121.useEffect(() => {
20757
20770
  const canvas = canvasRef.current;
20758
20771
  if (!canvas) return;
20759
20772
  const ctx = canvas.getContext("2d");
@@ -21094,7 +21107,7 @@ function TurnPanel({
21094
21107
  className
21095
21108
  }) {
21096
21109
  const eventBus = useEventBus();
21097
- const handleAction = React120.useCallback(
21110
+ const handleAction = React121.useCallback(
21098
21111
  (event) => {
21099
21112
  if (event) {
21100
21113
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -21240,7 +21253,7 @@ function UnitCommandBar({
21240
21253
  className
21241
21254
  }) {
21242
21255
  const eventBus = useEventBus();
21243
- const handleCommand = React120.useCallback(
21256
+ const handleCommand = React121.useCallback(
21244
21257
  (event) => {
21245
21258
  if (event) {
21246
21259
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -21725,7 +21738,7 @@ function GameMenu({
21725
21738
  } catch {
21726
21739
  }
21727
21740
  const eventBus = eventBusProp || eventBusFromHook;
21728
- const handleOptionClick = React120.useCallback(
21741
+ const handleOptionClick = React121.useCallback(
21729
21742
  (option) => {
21730
21743
  if (option.event && eventBus) {
21731
21744
  eventBus.emit(`UI:${option.event}`, { option });
@@ -21839,7 +21852,7 @@ function GameOverScreen({
21839
21852
  } catch {
21840
21853
  }
21841
21854
  const eventBus = eventBusProp || eventBusFromHook;
21842
- const handleActionClick = React120.useCallback(
21855
+ const handleActionClick = React121.useCallback(
21843
21856
  (action) => {
21844
21857
  if (action.event && eventBus) {
21845
21858
  eventBus.emit(`UI:${action.event}`, { action });
@@ -24970,7 +24983,7 @@ var init_StepFlow = __esm({
24970
24983
  className
24971
24984
  }) => {
24972
24985
  if (orientation === "vertical") {
24973
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React120__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
24986
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React121__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
24974
24987
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
24975
24988
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
24976
24989
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -24981,7 +24994,7 @@ var init_StepFlow = __esm({
24981
24994
  ] })
24982
24995
  ] }) }, index)) });
24983
24996
  }
24984
- 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(React120__default.Fragment, { children: [
24997
+ 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(React121__default.Fragment, { children: [
24985
24998
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
24986
24999
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
24987
25000
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -25789,6 +25802,7 @@ var init_VoteStack = __esm({
25789
25802
  "components/molecules/VoteStack.tsx"() {
25790
25803
  "use client";
25791
25804
  init_cn();
25805
+ init_useEventBus();
25792
25806
  sizeStyles12 = {
25793
25807
  sm: {
25794
25808
  button: "w-7 h-7",
@@ -25810,6 +25824,7 @@ var init_VoteStack = __esm({
25810
25824
  count,
25811
25825
  userVote = null,
25812
25826
  onVote,
25827
+ voteEvent,
25813
25828
  disabled = false,
25814
25829
  size = "md",
25815
25830
  variant = "vertical",
@@ -25819,12 +25834,21 @@ var init_VoteStack = __esm({
25819
25834
  const styles = sizeStyles12[size];
25820
25835
  const isUp = userVote === "up";
25821
25836
  const isDown = userVote === "down";
25837
+ const eventBus = useEventBus();
25822
25838
  const handleUp = useCallback(() => {
25823
- onVote?.(isUp ? null : "up");
25824
- }, [isUp, onVote]);
25839
+ const next = isUp ? null : "up";
25840
+ onVote?.(next);
25841
+ if (voteEvent) {
25842
+ eventBus.emit(`UI:${voteEvent}`, { next });
25843
+ }
25844
+ }, [isUp, onVote, voteEvent, eventBus]);
25825
25845
  const handleDown = useCallback(() => {
25826
- onVote?.(isDown ? null : "down");
25827
- }, [isDown, onVote]);
25846
+ const next = isDown ? null : "down";
25847
+ onVote?.(next);
25848
+ if (voteEvent) {
25849
+ eventBus.emit(`UI:${voteEvent}`, { next });
25850
+ }
25851
+ }, [isDown, onVote, voteEvent, eventBus]);
25828
25852
  return /* @__PURE__ */ jsxs(
25829
25853
  "div",
25830
25854
  {
@@ -25911,6 +25935,7 @@ var init_LikertScale = __esm({
25911
25935
  "components/molecules/LikertScale.tsx"() {
25912
25936
  "use client";
25913
25937
  init_cn();
25938
+ init_useEventBus();
25914
25939
  init_Box();
25915
25940
  init_Button();
25916
25941
  init_Label();
@@ -25937,24 +25962,29 @@ var init_LikertScale = __esm({
25937
25962
  md: "text-base",
25938
25963
  lg: "text-lg"
25939
25964
  };
25940
- LikertScale = React120__default.forwardRef(
25965
+ LikertScale = React121__default.forwardRef(
25941
25966
  ({
25942
25967
  question,
25943
25968
  options = DEFAULT_LIKERT_OPTIONS,
25944
25969
  value = null,
25945
25970
  onChange,
25971
+ changeEvent,
25946
25972
  disabled = false,
25947
25973
  size = "md",
25948
25974
  variant = "radios",
25949
25975
  className
25950
25976
  }, ref) => {
25951
- const groupId = React120__default.useId();
25977
+ const groupId = React121__default.useId();
25978
+ const eventBus = useEventBus();
25952
25979
  const handleSelect = useCallback(
25953
25980
  (next) => {
25954
25981
  if (disabled) return;
25955
25982
  onChange?.(next);
25983
+ if (changeEvent) {
25984
+ eventBus.emit(`UI:${changeEvent}`, { value: next });
25985
+ }
25956
25986
  },
25957
- [disabled, onChange]
25987
+ [disabled, onChange, changeEvent, eventBus]
25958
25988
  );
25959
25989
  return /* @__PURE__ */ jsxs(
25960
25990
  Box,
@@ -26076,6 +26106,7 @@ var init_MatrixQuestion = __esm({
26076
26106
  init_Typography();
26077
26107
  init_Box();
26078
26108
  init_Radio();
26109
+ init_useEventBus();
26079
26110
  DEFAULT_MATRIX_COLUMNS = [
26080
26111
  { value: 1, label: "Strongly Disagree" },
26081
26112
  { value: 2, label: "Disagree" },
@@ -26101,6 +26132,7 @@ var init_MatrixQuestion = __esm({
26101
26132
  columns = DEFAULT_MATRIX_COLUMNS,
26102
26133
  values,
26103
26134
  onChange,
26135
+ changeEvent,
26104
26136
  disabled = false,
26105
26137
  size = "md",
26106
26138
  className
@@ -26108,12 +26140,16 @@ var init_MatrixQuestion = __esm({
26108
26140
  const styles = sizeStyles13[size];
26109
26141
  const safeRows = rows ?? [];
26110
26142
  const safeValues = values ?? {};
26143
+ const eventBus = useEventBus();
26111
26144
  const handleChange = useCallback(
26112
26145
  (rowId, value) => {
26113
26146
  if (disabled) return;
26114
26147
  onChange?.(rowId, value);
26148
+ if (changeEvent) {
26149
+ eventBus.emit(`UI:${changeEvent}`, { rowId, value });
26150
+ }
26115
26151
  },
26116
- [onChange, disabled]
26152
+ [onChange, changeEvent, eventBus, disabled]
26117
26153
  );
26118
26154
  return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
26119
26155
  title && /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "mb-3", children: title }),
@@ -26218,8 +26254,10 @@ var init_QrScanner = __esm({
26218
26254
  "use client";
26219
26255
  init_cn();
26220
26256
  init_atoms();
26257
+ init_useEventBus();
26221
26258
  QrScanner = ({
26222
26259
  onScan,
26260
+ scanEvent,
26223
26261
  onError,
26224
26262
  facingMode = "environment",
26225
26263
  paused = false,
@@ -26228,6 +26266,7 @@ var init_QrScanner = __esm({
26228
26266
  fallback,
26229
26267
  className
26230
26268
  }) => {
26269
+ const eventBus = useEventBus();
26231
26270
  const videoRef = useRef(null);
26232
26271
  const streamRef = useRef(null);
26233
26272
  const scanIntervalRef = useRef(null);
@@ -26305,12 +26344,16 @@ var init_QrScanner = __esm({
26305
26344
  setIsPaused((p2) => !p2);
26306
26345
  }, []);
26307
26346
  const handleMockScan = useCallback(() => {
26308
- onScan?.({
26347
+ const result = {
26309
26348
  text: "https://example.com/mock-qr",
26310
26349
  format: "QR_CODE",
26311
26350
  timestamp: Date.now()
26312
- });
26313
- }, [onScan]);
26351
+ };
26352
+ onScan?.(result);
26353
+ if (scanEvent) {
26354
+ eventBus.emit(`UI:${scanEvent}`, { ...result });
26355
+ }
26356
+ }, [onScan, scanEvent, eventBus]);
26314
26357
  const videoExtraProps = {
26315
26358
  playsInline: true,
26316
26359
  muted: true
@@ -26436,6 +26479,7 @@ var formatPriceDelta, constraintHint, validateSelection, OptionConstraintGroup;
26436
26479
  var init_OptionConstraintGroup = __esm({
26437
26480
  "components/molecules/OptionConstraintGroup.tsx"() {
26438
26481
  init_cn();
26482
+ init_useEventBus();
26439
26483
  init_Typography();
26440
26484
  init_Box();
26441
26485
  init_Label();
@@ -26486,25 +26530,32 @@ var init_OptionConstraintGroup = __esm({
26486
26530
  constraint,
26487
26531
  selected = [],
26488
26532
  onChange,
26533
+ changeEvent,
26489
26534
  size = "md",
26490
26535
  className
26491
26536
  }) => {
26537
+ const eventBus = useEventBus();
26492
26538
  const hint = constraintHint(constraint);
26493
26539
  const error = validateSelection(selected, constraint);
26494
26540
  const inputName = `option-${groupId}`;
26495
26541
  const labelTextSize = size === "sm" ? "text-sm" : "text-base";
26496
26542
  const optionGap = size === "sm" ? "gap-2" : "gap-2.5";
26543
+ const emitChange = useCallback((next) => {
26544
+ onChange?.(next);
26545
+ if (changeEvent) {
26546
+ eventBus.emit(`UI:${changeEvent}`, { selected: next });
26547
+ }
26548
+ }, [onChange, changeEvent, eventBus]);
26497
26549
  const toggle = (optionId, checked) => {
26498
- if (!onChange) return;
26499
26550
  if (constraint.type === "single") {
26500
- onChange(checked ? [optionId] : []);
26551
+ emitChange(checked ? [optionId] : []);
26501
26552
  return;
26502
26553
  }
26503
26554
  if (checked) {
26504
26555
  if (selected.includes(optionId)) return;
26505
- onChange([...selected, optionId]);
26556
+ emitChange([...selected, optionId]);
26506
26557
  } else {
26507
- onChange(selected.filter((id) => id !== optionId));
26558
+ emitChange(selected.filter((id) => id !== optionId));
26508
26559
  }
26509
26560
  };
26510
26561
  return /* @__PURE__ */ jsxs(
@@ -26628,6 +26679,7 @@ var init_PositionedCanvas = __esm({
26628
26679
  "components/molecules/PositionedCanvas.tsx"() {
26629
26680
  "use client";
26630
26681
  init_cn();
26682
+ init_useEventBus();
26631
26683
  init_atoms();
26632
26684
  STATUS_CLASSES = {
26633
26685
  empty: "bg-surface border-border text-foreground",
@@ -26651,11 +26703,14 @@ var init_PositionedCanvas = __esm({
26651
26703
  editable = false,
26652
26704
  onSelect,
26653
26705
  onMove,
26706
+ selectEvent,
26707
+ moveEvent,
26654
26708
  className
26655
26709
  }) => {
26656
26710
  const containerRef = useRef(null);
26657
26711
  const dragRef = useRef(null);
26658
26712
  const [draggingId, setDraggingId] = useState(null);
26713
+ const eventBus = useEventBus();
26659
26714
  const items = Array.isArray(itemsProp) ? itemsProp : [];
26660
26715
  const handlePointerDown = useCallback(
26661
26716
  (e, item) => {
@@ -26689,8 +26744,11 @@ var init_PositionedCanvas = __esm({
26689
26744
  const clampedY = Math.max(0, Math.min(height - itemHeight, newY));
26690
26745
  drag.moved = true;
26691
26746
  onMove?.(drag.id, clampedX, clampedY);
26747
+ if (moveEvent) {
26748
+ eventBus.emit(`UI:${moveEvent}`, { id: drag.id, x: clampedX, y: clampedY });
26749
+ }
26692
26750
  },
26693
- [width, height, onMove]
26751
+ [width, height, onMove, moveEvent, eventBus]
26694
26752
  );
26695
26753
  const handlePointerUp = useCallback(
26696
26754
  (e, item) => {
@@ -26706,17 +26764,23 @@ var init_PositionedCanvas = __esm({
26706
26764
  if (!wasDrag) {
26707
26765
  const next = selectedId === item.id ? null : item.id;
26708
26766
  onSelect?.(next);
26767
+ if (selectEvent) {
26768
+ eventBus.emit(`UI:${selectEvent}`, { id: next });
26769
+ }
26709
26770
  }
26710
26771
  },
26711
- [selectedId, onSelect]
26772
+ [selectedId, onSelect, selectEvent, eventBus]
26712
26773
  );
26713
26774
  const handleContainerClick = useCallback(
26714
26775
  (e) => {
26715
26776
  if (e.target === e.currentTarget) {
26716
26777
  onSelect?.(null);
26778
+ if (selectEvent) {
26779
+ eventBus.emit(`UI:${selectEvent}`, { id: null });
26780
+ }
26717
26781
  }
26718
26782
  },
26719
- [onSelect]
26783
+ [onSelect, selectEvent, eventBus]
26720
26784
  );
26721
26785
  return /* @__PURE__ */ jsx(
26722
26786
  Box,
@@ -27347,6 +27411,7 @@ var init_RichBlockEditor = __esm({
27347
27411
  init_Box();
27348
27412
  init_Divider();
27349
27413
  init_Input();
27414
+ init_useEventBus();
27350
27415
  TOOLBAR_ENTRIES = [
27351
27416
  { type: "paragraph", label: "Text", icon: Type },
27352
27417
  { type: "heading-1", label: "H1", icon: Heading1 },
@@ -27385,6 +27450,7 @@ var init_RichBlockEditor = __esm({
27385
27450
  RichBlockEditor = ({
27386
27451
  initialBlocks,
27387
27452
  onChange,
27453
+ changeEvent,
27388
27454
  readOnly = false,
27389
27455
  placeholder,
27390
27456
  showToolbar = true,
@@ -27397,10 +27463,17 @@ var init_RichBlockEditor = __esm({
27397
27463
  useEffect(() => {
27398
27464
  onChangeRef.current = onChange;
27399
27465
  }, [onChange]);
27466
+ const eventBus = useEventBus();
27467
+ const changeEventRef = useRef(changeEvent);
27468
+ useEffect(() => {
27469
+ changeEventRef.current = changeEvent;
27470
+ }, [changeEvent]);
27400
27471
  const commit = useCallback((next) => {
27401
27472
  setBlocks(next);
27402
27473
  onChangeRef.current?.(next);
27403
- }, []);
27474
+ const evt = changeEventRef.current;
27475
+ if (evt) eventBus.emit(`UI:${evt}`, { blocks: next });
27476
+ }, [eventBus]);
27404
27477
  const handleAppend = useCallback(
27405
27478
  (type) => {
27406
27479
  if (readOnly) return;
@@ -27514,6 +27587,7 @@ var init_ReplyTree = __esm({
27514
27587
  "components/molecules/ReplyTree.tsx"() {
27515
27588
  "use client";
27516
27589
  init_cn();
27590
+ init_useEventBus();
27517
27591
  init_atoms();
27518
27592
  init_VoteStack();
27519
27593
  ReplyTreeNode = ({
@@ -27526,26 +27600,35 @@ var init_ReplyTree = __esm({
27526
27600
  onReply,
27527
27601
  onFlag,
27528
27602
  onContinueThread,
27603
+ voteEvent,
27604
+ replyEvent,
27605
+ flagEvent,
27606
+ continueThreadEvent,
27529
27607
  showActions
27530
27608
  }) => {
27609
+ const eventBus = useEventBus();
27531
27610
  const hasReplies = !!node.replies && node.replies.length > 0;
27532
27611
  const isCollapsed = collapsedSet.has(node.id);
27533
27612
  const atMaxDepth = depth >= maxDepth;
27534
27613
  const handleVote = useCallback(
27535
27614
  (next) => {
27536
27615
  onVote?.(node.id, next);
27616
+ if (voteEvent) eventBus.emit(`UI:${voteEvent}`, { nodeId: node.id, vote: next });
27537
27617
  },
27538
- [node.id, onVote]
27618
+ [node.id, onVote, voteEvent, eventBus]
27539
27619
  );
27540
27620
  const handleReply = useCallback(() => {
27541
27621
  onReply?.(node.id);
27542
- }, [node.id, onReply]);
27622
+ if (replyEvent) eventBus.emit(`UI:${replyEvent}`, { parentNodeId: node.id });
27623
+ }, [node.id, onReply, replyEvent, eventBus]);
27543
27624
  const handleFlag = useCallback(() => {
27544
27625
  onFlag?.(node.id);
27545
- }, [node.id, onFlag]);
27626
+ if (flagEvent) eventBus.emit(`UI:${flagEvent}`, { nodeId: node.id });
27627
+ }, [node.id, onFlag, flagEvent, eventBus]);
27546
27628
  const handleContinue = useCallback(() => {
27547
27629
  onContinueThread?.(node.id);
27548
- }, [node.id, onContinueThread]);
27630
+ if (continueThreadEvent) eventBus.emit(`UI:${continueThreadEvent}`, { nodeId: node.id });
27631
+ }, [node.id, onContinueThread, continueThreadEvent, eventBus]);
27549
27632
  const handleToggle = useCallback(() => {
27550
27633
  toggleCollapse(node.id);
27551
27634
  }, [node.id, toggleCollapse]);
@@ -27649,6 +27732,10 @@ var init_ReplyTree = __esm({
27649
27732
  onReply,
27650
27733
  onFlag,
27651
27734
  onContinueThread,
27735
+ voteEvent,
27736
+ replyEvent,
27737
+ flagEvent,
27738
+ continueThreadEvent,
27652
27739
  showActions
27653
27740
  },
27654
27741
  child.id
@@ -27663,6 +27750,10 @@ var init_ReplyTree = __esm({
27663
27750
  onReply,
27664
27751
  onFlag,
27665
27752
  onContinueThread,
27753
+ voteEvent,
27754
+ replyEvent,
27755
+ flagEvent,
27756
+ continueThreadEvent,
27666
27757
  showActions = true,
27667
27758
  className
27668
27759
  }) => {
@@ -27697,6 +27788,10 @@ var init_ReplyTree = __esm({
27697
27788
  onReply,
27698
27789
  onFlag,
27699
27790
  onContinueThread,
27791
+ voteEvent,
27792
+ replyEvent,
27793
+ flagEvent,
27794
+ continueThreadEvent,
27700
27795
  showActions
27701
27796
  },
27702
27797
  node.id
@@ -27735,6 +27830,7 @@ var init_BranchingLogicBuilder = __esm({
27735
27830
  init_Card();
27736
27831
  init_FilterPill();
27737
27832
  init_Box();
27833
+ init_useEventBus();
27738
27834
  init_cn();
27739
27835
  END_OF_SURVEY = "end-of-survey";
27740
27836
  OPERATOR_OPTIONS = [
@@ -28036,23 +28132,30 @@ var init_BranchingLogicBuilder = __esm({
28036
28132
  ) });
28037
28133
  };
28038
28134
  BranchingLogicBuilder = ({
28039
- questions,
28135
+ questions: questionsProp,
28040
28136
  rules: rulesProp,
28041
28137
  onRulesChange,
28138
+ rulesChangeEvent,
28042
28139
  readOnly = false,
28043
28140
  className
28044
28141
  }) => {
28045
- const [rules, setRules] = useState(rulesProp);
28142
+ const eventBus = useEventBus();
28143
+ const questions = Array.isArray(questionsProp) ? questionsProp : [];
28144
+ const rulesInitial = Array.isArray(rulesProp) ? rulesProp : [];
28145
+ const [rules, setRules] = useState([...rulesInitial]);
28046
28146
  const [view, setView] = useState("edit");
28047
28147
  useEffect(() => {
28048
- setRules(rulesProp);
28148
+ setRules(Array.isArray(rulesProp) ? [...rulesProp] : []);
28049
28149
  }, [rulesProp]);
28050
28150
  const updateRules = useCallback(
28051
28151
  (next) => {
28052
28152
  setRules(next);
28053
28153
  onRulesChange?.(next);
28154
+ if (rulesChangeEvent) {
28155
+ eventBus.emit(`UI:${rulesChangeEvent}`, { rules: next });
28156
+ }
28054
28157
  },
28055
- [onRulesChange]
28158
+ [onRulesChange, rulesChangeEvent, eventBus]
28056
28159
  );
28057
28160
  const handleAddRule = useCallback(() => {
28058
28161
  const firstQ = questions[0];
@@ -28206,6 +28309,7 @@ var init_VersionDiff = __esm({
28206
28309
  "components/molecules/VersionDiff.tsx"() {
28207
28310
  "use client";
28208
28311
  init_cn();
28312
+ init_useEventBus();
28209
28313
  init_atoms();
28210
28314
  init_Stack();
28211
28315
  INLINE_STYLES = {
@@ -28215,16 +28319,21 @@ var init_VersionDiff = __esm({
28215
28319
  context: { bg: "", prefix: " ", text: "text-muted-foreground" }
28216
28320
  };
28217
28321
  VersionDiff = ({
28218
- revisions,
28322
+ revisions: revisionsProp,
28219
28323
  beforeId,
28220
28324
  afterId,
28221
28325
  view = "side-by-side",
28222
28326
  onSelectBefore,
28223
28327
  onSelectAfter,
28224
28328
  onRevert,
28329
+ selectBeforeEvent,
28330
+ selectAfterEvent,
28331
+ revertEvent,
28225
28332
  language,
28226
28333
  className
28227
28334
  }) => {
28335
+ const eventBus = useEventBus();
28336
+ const revisions = Array.isArray(revisionsProp) ? revisionsProp : [];
28228
28337
  const fallbackBefore = revisions[0]?.id ?? "";
28229
28338
  const fallbackAfter = revisions[1]?.id ?? revisions[0]?.id ?? "";
28230
28339
  const [internalBefore, setInternalBefore] = useState(beforeId ?? fallbackBefore);
@@ -28259,23 +28368,28 @@ var init_VersionDiff = __esm({
28259
28368
  const id = e.target.value;
28260
28369
  setInternalBefore(id);
28261
28370
  onSelectBefore?.(id);
28371
+ if (selectBeforeEvent) eventBus.emit(`UI:${selectBeforeEvent}`, { id });
28262
28372
  },
28263
- [onSelectBefore]
28373
+ [onSelectBefore, selectBeforeEvent, eventBus]
28264
28374
  );
28265
28375
  const handleAfterChange = useCallback(
28266
28376
  (e) => {
28267
28377
  const id = e.target.value;
28268
28378
  setInternalAfter(id);
28269
28379
  onSelectAfter?.(id);
28380
+ if (selectAfterEvent) eventBus.emit(`UI:${selectAfterEvent}`, { id });
28270
28381
  },
28271
- [onSelectAfter]
28382
+ [onSelectAfter, selectAfterEvent, eventBus]
28272
28383
  );
28273
28384
  const handleViewToggle = useCallback(() => {
28274
28385
  setInternalView((v) => v === "side-by-side" ? "inline" : "side-by-side");
28275
28386
  }, []);
28276
28387
  const handleRevert = useCallback(() => {
28277
- if (beforeRev) onRevert?.(beforeRev.id);
28278
- }, [beforeRev, onRevert]);
28388
+ if (beforeRev) {
28389
+ onRevert?.(beforeRev.id);
28390
+ if (revertEvent) eventBus.emit(`UI:${revertEvent}`, { id: beforeRev.id });
28391
+ }
28392
+ }, [beforeRev, onRevert, revertEvent, eventBus]);
28279
28393
  const options = useMemo(
28280
28394
  () => revisions.map((r) => ({ value: r.id, label: r.label })),
28281
28395
  [revisions]
@@ -28340,7 +28454,7 @@ var init_VersionDiff = __esm({
28340
28454
  "aria-label": activeView === "side-by-side" ? "Switch to inline view" : "Switch to side-by-side view"
28341
28455
  }
28342
28456
  ),
28343
- onRevert && /* @__PURE__ */ jsx(
28457
+ (onRevert || revertEvent) && /* @__PURE__ */ jsx(
28344
28458
  Button,
28345
28459
  {
28346
28460
  variant: "ghost",
@@ -29860,7 +29974,7 @@ var init_DocumentViewer = __esm({
29860
29974
  }
29861
29975
  });
29862
29976
  function extractTitle(children) {
29863
- if (!React120__default.isValidElement(children)) return void 0;
29977
+ if (!React121__default.isValidElement(children)) return void 0;
29864
29978
  const props = children.props;
29865
29979
  if (typeof props.title === "string") {
29866
29980
  return props.title;
@@ -29972,7 +30086,7 @@ function LinearView({
29972
30086
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
29973
30087
  const isDone = i < currentIdx;
29974
30088
  const isCurrent = i === currentIdx;
29975
- return /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
30089
+ return /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
29976
30090
  i > 0 && /* @__PURE__ */ jsx(
29977
30091
  Typography,
29978
30092
  {
@@ -30756,12 +30870,12 @@ var init_Form = __esm({
30756
30870
  const isSchemaEntity = isOrbitalEntitySchema(entity);
30757
30871
  const resolvedEntity = isSchemaEntity ? entity : void 0;
30758
30872
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
30759
- const normalizedInitialData = React120__default.useMemo(() => {
30873
+ const normalizedInitialData = React121__default.useMemo(() => {
30760
30874
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
30761
30875
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
30762
30876
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
30763
30877
  }, [entity, initialData]);
30764
- const entityDerivedFields = React120__default.useMemo(() => {
30878
+ const entityDerivedFields = React121__default.useMemo(() => {
30765
30879
  if (fields && fields.length > 0) return void 0;
30766
30880
  if (!resolvedEntity) return void 0;
30767
30881
  return resolvedEntity.fields.map(
@@ -30780,16 +30894,16 @@ var init_Form = __esm({
30780
30894
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
30781
30895
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
30782
30896
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
30783
- const [formData, setFormData] = React120__default.useState(
30897
+ const [formData, setFormData] = React121__default.useState(
30784
30898
  normalizedInitialData
30785
30899
  );
30786
- const [collapsedSections, setCollapsedSections] = React120__default.useState(
30900
+ const [collapsedSections, setCollapsedSections] = React121__default.useState(
30787
30901
  /* @__PURE__ */ new Set()
30788
30902
  );
30789
- const [submitError, setSubmitError] = React120__default.useState(null);
30790
- const formRef = React120__default.useRef(null);
30903
+ const [submitError, setSubmitError] = React121__default.useState(null);
30904
+ const formRef = React121__default.useRef(null);
30791
30905
  const formMode = props.mode;
30792
- const mountedRef = React120__default.useRef(false);
30906
+ const mountedRef = React121__default.useRef(false);
30793
30907
  if (!mountedRef.current) {
30794
30908
  mountedRef.current = true;
30795
30909
  debug("forms", "mount", {
@@ -30802,7 +30916,7 @@ var init_Form = __esm({
30802
30916
  });
30803
30917
  }
30804
30918
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
30805
- const evalContext = React120__default.useMemo(
30919
+ const evalContext = React121__default.useMemo(
30806
30920
  () => ({
30807
30921
  formValues: formData,
30808
30922
  globalVariables: externalContext?.globalVariables ?? {},
@@ -30811,7 +30925,7 @@ var init_Form = __esm({
30811
30925
  }),
30812
30926
  [formData, externalContext]
30813
30927
  );
30814
- React120__default.useEffect(() => {
30928
+ React121__default.useEffect(() => {
30815
30929
  debug("forms", "initialData-sync", {
30816
30930
  mode: formMode,
30817
30931
  normalizedInitialData,
@@ -30822,7 +30936,7 @@ var init_Form = __esm({
30822
30936
  setFormData(normalizedInitialData);
30823
30937
  }
30824
30938
  }, [normalizedInitialData]);
30825
- const processCalculations = React120__default.useCallback(
30939
+ const processCalculations = React121__default.useCallback(
30826
30940
  (changedFieldId, newFormData) => {
30827
30941
  if (!hiddenCalculations.length) return;
30828
30942
  const context = {
@@ -30847,7 +30961,7 @@ var init_Form = __esm({
30847
30961
  },
30848
30962
  [hiddenCalculations, externalContext, eventBus]
30849
30963
  );
30850
- const checkViolations = React120__default.useCallback(
30964
+ const checkViolations = React121__default.useCallback(
30851
30965
  (changedFieldId, newFormData) => {
30852
30966
  if (!violationTriggers.length) return;
30853
30967
  const context = {
@@ -30885,7 +30999,7 @@ var init_Form = __esm({
30885
30999
  processCalculations(name, newFormData);
30886
31000
  checkViolations(name, newFormData);
30887
31001
  };
30888
- const isFieldVisible = React120__default.useCallback(
31002
+ const isFieldVisible = React121__default.useCallback(
30889
31003
  (fieldName) => {
30890
31004
  const condition = conditionalFields[fieldName];
30891
31005
  if (!condition) return true;
@@ -30893,7 +31007,7 @@ var init_Form = __esm({
30893
31007
  },
30894
31008
  [conditionalFields, evalContext]
30895
31009
  );
30896
- const isSectionVisible = React120__default.useCallback(
31010
+ const isSectionVisible = React121__default.useCallback(
30897
31011
  (section) => {
30898
31012
  if (!section.condition) return true;
30899
31013
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -30969,7 +31083,7 @@ var init_Form = __esm({
30969
31083
  eventBus.emit(`UI:${onCancel}`);
30970
31084
  }
30971
31085
  };
30972
- const renderField = React120__default.useCallback(
31086
+ const renderField = React121__default.useCallback(
30973
31087
  (field) => {
30974
31088
  const fieldName = field.name || field.field;
30975
31089
  if (!fieldName) return null;
@@ -30990,7 +31104,7 @@ var init_Form = __esm({
30990
31104
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
30991
31105
  );
30992
31106
  const effectiveFields = entityDerivedFields ?? fields;
30993
- const normalizedFields = React120__default.useMemo(() => {
31107
+ const normalizedFields = React121__default.useMemo(() => {
30994
31108
  if (!effectiveFields || effectiveFields.length === 0) return [];
30995
31109
  return effectiveFields.map((field) => {
30996
31110
  if (typeof field === "string") {
@@ -31012,7 +31126,7 @@ var init_Form = __esm({
31012
31126
  return field;
31013
31127
  });
31014
31128
  }, [effectiveFields, resolvedEntity]);
31015
- const schemaFields = React120__default.useMemo(() => {
31129
+ const schemaFields = React121__default.useMemo(() => {
31016
31130
  if (normalizedFields.length === 0) return null;
31017
31131
  if (isDebugEnabled()) {
31018
31132
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -31022,7 +31136,7 @@ var init_Form = __esm({
31022
31136
  }
31023
31137
  return normalizedFields.map(renderField).filter(Boolean);
31024
31138
  }, [normalizedFields, renderField, entityName, conditionalFields]);
31025
- const sectionElements = React120__default.useMemo(() => {
31139
+ const sectionElements = React121__default.useMemo(() => {
31026
31140
  if (!sections || sections.length === 0) return null;
31027
31141
  return sections.map((section) => {
31028
31142
  if (!isSectionVisible(section)) {
@@ -32554,7 +32668,7 @@ var init_List = __esm({
32554
32668
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
32555
32669
  return [];
32556
32670
  }, [entity]);
32557
- const getItemActions = React120__default.useCallback(
32671
+ const getItemActions = React121__default.useCallback(
32558
32672
  (item) => {
32559
32673
  if (!itemActions) return [];
32560
32674
  if (typeof itemActions === "function") {
@@ -32991,7 +33105,7 @@ var init_MediaGallery = __esm({
32991
33105
  [selectable, selectedItems, selectionEvent, eventBus]
32992
33106
  );
32993
33107
  const entityData = Array.isArray(entity) ? entity : [];
32994
- const items = React120__default.useMemo(() => {
33108
+ const items = React121__default.useMemo(() => {
32995
33109
  if (propItems) return propItems;
32996
33110
  if (entityData.length === 0) return [];
32997
33111
  return entityData.map((record, idx) => ({
@@ -33164,9 +33278,9 @@ function MiniMap({
33164
33278
  viewportRect,
33165
33279
  className
33166
33280
  }) {
33167
- const canvasRef = React120.useRef(null);
33168
- const frameRef = React120.useRef(0);
33169
- React120.useEffect(() => {
33281
+ const canvasRef = React121.useRef(null);
33282
+ const frameRef = React121.useRef(0);
33283
+ React121.useEffect(() => {
33170
33284
  const canvas = canvasRef.current;
33171
33285
  if (!canvas) return;
33172
33286
  const ctx = canvas.getContext("2d");
@@ -33248,7 +33362,7 @@ var init_MiniMap = __esm({
33248
33362
  }
33249
33363
  });
33250
33364
  function extractTitle2(children) {
33251
- if (!React120__default.isValidElement(children)) return void 0;
33365
+ if (!React121__default.isValidElement(children)) return void 0;
33252
33366
  const props = children.props;
33253
33367
  if (typeof props.title === "string") {
33254
33368
  return props.title;
@@ -33961,7 +34075,7 @@ var init_PageHeader = __esm({
33961
34075
  info: "bg-info/10 text-info"
33962
34076
  };
33963
34077
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
33964
- 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(React120__default.Fragment, { children: [
34078
+ 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(React121__default.Fragment, { children: [
33965
34079
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
33966
34080
  crumb.href ? /* @__PURE__ */ jsx(
33967
34081
  "a",
@@ -34180,7 +34294,7 @@ var init_debugRegistry = __esm({
34180
34294
  }
34181
34295
  });
34182
34296
  function useDebugData() {
34183
- const [data, setData] = React120.useState(() => ({
34297
+ const [data, setData] = React121.useState(() => ({
34184
34298
  traits: [],
34185
34299
  ticks: [],
34186
34300
  guards: [],
@@ -34194,7 +34308,7 @@ function useDebugData() {
34194
34308
  },
34195
34309
  lastUpdate: Date.now()
34196
34310
  }));
34197
- React120.useEffect(() => {
34311
+ React121.useEffect(() => {
34198
34312
  const updateData = () => {
34199
34313
  setData({
34200
34314
  traits: getAllTraits(),
@@ -34303,12 +34417,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
34303
34417
  return positions;
34304
34418
  }
34305
34419
  function WalkMinimap() {
34306
- const [walkStep, setWalkStep] = React120.useState(null);
34307
- const [traits2, setTraits] = React120.useState([]);
34308
- const [coveredEdges, setCoveredEdges] = React120.useState([]);
34309
- const [completedTraits, setCompletedTraits] = React120.useState(/* @__PURE__ */ new Set());
34310
- const prevTraitRef = React120.useRef(null);
34311
- React120.useEffect(() => {
34420
+ const [walkStep, setWalkStep] = React121.useState(null);
34421
+ const [traits2, setTraits] = React121.useState([]);
34422
+ const [coveredEdges, setCoveredEdges] = React121.useState([]);
34423
+ const [completedTraits, setCompletedTraits] = React121.useState(/* @__PURE__ */ new Set());
34424
+ const prevTraitRef = React121.useRef(null);
34425
+ React121.useEffect(() => {
34312
34426
  const interval = setInterval(() => {
34313
34427
  const w = window;
34314
34428
  const step = w.__orbitalWalkStep;
@@ -34755,15 +34869,15 @@ var init_EntitiesTab = __esm({
34755
34869
  }
34756
34870
  });
34757
34871
  function EventFlowTab({ events: events2 }) {
34758
- const [filter, setFilter] = React120.useState("all");
34759
- const containerRef = React120.useRef(null);
34760
- const [autoScroll, setAutoScroll] = React120.useState(true);
34761
- React120.useEffect(() => {
34872
+ const [filter, setFilter] = React121.useState("all");
34873
+ const containerRef = React121.useRef(null);
34874
+ const [autoScroll, setAutoScroll] = React121.useState(true);
34875
+ React121.useEffect(() => {
34762
34876
  if (autoScroll && containerRef.current) {
34763
34877
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
34764
34878
  }
34765
34879
  }, [events2.length, autoScroll]);
34766
- const filteredEvents = React120.useMemo(() => {
34880
+ const filteredEvents = React121.useMemo(() => {
34767
34881
  if (filter === "all") return events2;
34768
34882
  return events2.filter((e) => e.type === filter);
34769
34883
  }, [events2, filter]);
@@ -34882,7 +34996,7 @@ var init_EventFlowTab = __esm({
34882
34996
  }
34883
34997
  });
34884
34998
  function GuardsPanel({ guards }) {
34885
- const [filter, setFilter] = React120.useState("all");
34999
+ const [filter, setFilter] = React121.useState("all");
34886
35000
  if (guards.length === 0) {
34887
35001
  return /* @__PURE__ */ jsx(
34888
35002
  EmptyState,
@@ -34895,7 +35009,7 @@ function GuardsPanel({ guards }) {
34895
35009
  }
34896
35010
  const passedCount = guards.filter((g) => g.result).length;
34897
35011
  const failedCount = guards.length - passedCount;
34898
- const filteredGuards = React120.useMemo(() => {
35012
+ const filteredGuards = React121.useMemo(() => {
34899
35013
  if (filter === "all") return guards;
34900
35014
  if (filter === "passed") return guards.filter((g) => g.result);
34901
35015
  return guards.filter((g) => !g.result);
@@ -35056,10 +35170,10 @@ function EffectBadge({ effect }) {
35056
35170
  ] });
35057
35171
  }
35058
35172
  function TransitionTimeline({ transitions }) {
35059
- const containerRef = React120.useRef(null);
35060
- const [autoScroll, setAutoScroll] = React120.useState(true);
35061
- const [expandedId, setExpandedId] = React120.useState(null);
35062
- React120.useEffect(() => {
35173
+ const containerRef = React121.useRef(null);
35174
+ const [autoScroll, setAutoScroll] = React121.useState(true);
35175
+ const [expandedId, setExpandedId] = React121.useState(null);
35176
+ React121.useEffect(() => {
35063
35177
  if (autoScroll && containerRef.current) {
35064
35178
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
35065
35179
  }
@@ -35345,9 +35459,9 @@ function getAllEvents(traits2) {
35345
35459
  }
35346
35460
  function EventDispatcherTab({ traits: traits2, schema }) {
35347
35461
  const eventBus = useEventBus();
35348
- const [log3, setLog] = React120.useState([]);
35349
- const prevStatesRef = React120.useRef(/* @__PURE__ */ new Map());
35350
- React120.useEffect(() => {
35462
+ const [log3, setLog] = React121.useState([]);
35463
+ const prevStatesRef = React121.useRef(/* @__PURE__ */ new Map());
35464
+ React121.useEffect(() => {
35351
35465
  for (const trait of traits2) {
35352
35466
  const prev = prevStatesRef.current.get(trait.id);
35353
35467
  if (prev && prev !== trait.currentState) {
@@ -35517,10 +35631,10 @@ function VerifyModePanel({
35517
35631
  serverCount,
35518
35632
  localCount
35519
35633
  }) {
35520
- const [expanded, setExpanded] = React120.useState(true);
35521
- const scrollRef = React120.useRef(null);
35522
- const prevCountRef = React120.useRef(0);
35523
- React120.useEffect(() => {
35634
+ const [expanded, setExpanded] = React121.useState(true);
35635
+ const scrollRef = React121.useRef(null);
35636
+ const prevCountRef = React121.useRef(0);
35637
+ React121.useEffect(() => {
35524
35638
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
35525
35639
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
35526
35640
  }
@@ -35586,10 +35700,10 @@ function RuntimeDebugger({
35586
35700
  defaultTab,
35587
35701
  schema
35588
35702
  }) {
35589
- const [isCollapsed, setIsCollapsed] = React120.useState(mode === "verify" ? true : defaultCollapsed);
35590
- const [isVisible, setIsVisible] = React120.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
35703
+ const [isCollapsed, setIsCollapsed] = React121.useState(mode === "verify" ? true : defaultCollapsed);
35704
+ const [isVisible, setIsVisible] = React121.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
35591
35705
  const debugData = useDebugData();
35592
- React120.useEffect(() => {
35706
+ React121.useEffect(() => {
35593
35707
  if (mode === "inline") return;
35594
35708
  return onDebugToggle((enabled) => {
35595
35709
  setIsVisible(enabled);
@@ -35598,7 +35712,7 @@ function RuntimeDebugger({
35598
35712
  }
35599
35713
  });
35600
35714
  }, [mode]);
35601
- React120.useEffect(() => {
35715
+ React121.useEffect(() => {
35602
35716
  if (mode === "inline") return;
35603
35717
  const handleKeyDown = (e) => {
35604
35718
  if (e.key === "`" && isVisible) {
@@ -36147,7 +36261,7 @@ function SequenceBar({
36147
36261
  onSlotRemove(index);
36148
36262
  }, [onSlotRemove, playing]);
36149
36263
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
36150
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
36264
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
36151
36265
  i > 0 && /* @__PURE__ */ jsx(
36152
36266
  Typography,
36153
36267
  {
@@ -37603,7 +37717,7 @@ var init_StatCard2 = __esm({
37603
37717
  const labelToUse = propLabel ?? propTitle;
37604
37718
  const eventBus = useEventBus();
37605
37719
  const { t } = useTranslate();
37606
- const handleActionClick = React120__default.useCallback(() => {
37720
+ const handleActionClick = React121__default.useCallback(() => {
37607
37721
  if (action?.event) {
37608
37722
  eventBus.emit(`UI:${action.event}`, {});
37609
37723
  }
@@ -37614,7 +37728,7 @@ var init_StatCard2 = __esm({
37614
37728
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
37615
37729
  const isLoading = externalLoading ?? false;
37616
37730
  const error = externalError;
37617
- const computeMetricValue = React120__default.useCallback(
37731
+ const computeMetricValue = React121__default.useCallback(
37618
37732
  (metric, items) => {
37619
37733
  if (metric.value !== void 0) {
37620
37734
  return metric.value;
@@ -37653,7 +37767,7 @@ var init_StatCard2 = __esm({
37653
37767
  },
37654
37768
  []
37655
37769
  );
37656
- const schemaStats = React120__default.useMemo(() => {
37770
+ const schemaStats = React121__default.useMemo(() => {
37657
37771
  if (!metrics || metrics.length === 0) return null;
37658
37772
  return metrics.map((metric) => ({
37659
37773
  label: metric.label,
@@ -37661,7 +37775,7 @@ var init_StatCard2 = __esm({
37661
37775
  format: metric.format
37662
37776
  }));
37663
37777
  }, [metrics, data, computeMetricValue]);
37664
- const calculatedTrend = React120__default.useMemo(() => {
37778
+ const calculatedTrend = React121__default.useMemo(() => {
37665
37779
  if (manualTrend !== void 0) return manualTrend;
37666
37780
  if (previousValue === void 0 || currentValue === void 0)
37667
37781
  return void 0;
@@ -38716,7 +38830,7 @@ var init_Timeline = __esm({
38716
38830
  }) => {
38717
38831
  const { t } = useTranslate();
38718
38832
  const entityData = Array.isArray(entity) ? entity : [];
38719
- const items = React120__default.useMemo(() => {
38833
+ const items = React121__default.useMemo(() => {
38720
38834
  if (propItems) return propItems;
38721
38835
  if (entityData.length === 0) return [];
38722
38836
  return entityData.map((record, idx) => {
@@ -38873,7 +38987,7 @@ var init_TimerDisplay = __esm({
38873
38987
  }
38874
38988
  });
38875
38989
  function extractToastProps(children) {
38876
- if (!React120__default.isValidElement(children)) {
38990
+ if (!React121__default.isValidElement(children)) {
38877
38991
  if (typeof children === "string") {
38878
38992
  return { message: children };
38879
38993
  }
@@ -38911,7 +39025,7 @@ var init_ToastSlot = __esm({
38911
39025
  eventBus.emit("UI:CLOSE");
38912
39026
  };
38913
39027
  if (!isVisible) return null;
38914
- const isCustomContent = React120__default.isValidElement(children) && !message;
39028
+ const isCustomContent = React121__default.isValidElement(children) && !message;
38915
39029
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
38916
39030
  Toast,
38917
39031
  {
@@ -39180,7 +39294,7 @@ var init_WizardContainer = __esm({
39180
39294
  const isCompleted = index < currentStep;
39181
39295
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
39182
39296
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
39183
- return /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
39297
+ return /* @__PURE__ */ jsxs(React121__default.Fragment, { children: [
39184
39298
  /* @__PURE__ */ jsx(
39185
39299
  Button,
39186
39300
  {
@@ -39630,12 +39744,12 @@ var init_XPBar = __esm({
39630
39744
  }
39631
39745
  });
39632
39746
  function lazyThree(name, loader) {
39633
- const Lazy = React120__default.lazy(() => loader().then((m) => ({ default: m[name] })));
39747
+ const Lazy = React121__default.lazy(() => loader().then((m) => ({ default: m[name] })));
39634
39748
  function ThreeWrapper(props) {
39635
- return React120__default.createElement(
39636
- React120__default.Suspense,
39749
+ return React121__default.createElement(
39750
+ React121__default.Suspense,
39637
39751
  { fallback: null },
39638
- React120__default.createElement(Lazy, props)
39752
+ React121__default.createElement(Lazy, props)
39639
39753
  );
39640
39754
  }
39641
39755
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -40123,7 +40237,7 @@ function SuspenseConfigProvider({
40123
40237
  config,
40124
40238
  children
40125
40239
  }) {
40126
- return React120__default.createElement(
40240
+ return React121__default.createElement(
40127
40241
  SuspenseConfigContext.Provider,
40128
40242
  { value: config },
40129
40243
  children
@@ -40606,7 +40720,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
40606
40720
  const key = `${parentId}-${index}-trait:${traitName}`;
40607
40721
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
40608
40722
  }
40609
- return /* @__PURE__ */ jsx(React120__default.Fragment, { children: child }, `${parentId}-${index}`);
40723
+ return /* @__PURE__ */ jsx(React121__default.Fragment, { children: child }, `${parentId}-${index}`);
40610
40724
  }
40611
40725
  if (!child || typeof child !== "object") return null;
40612
40726
  const childId = `${parentId}-${index}`;
@@ -40643,14 +40757,14 @@ function isPatternConfig(value) {
40643
40757
  if (value === null || value === void 0) return false;
40644
40758
  if (typeof value !== "object") return false;
40645
40759
  if (Array.isArray(value)) return false;
40646
- if (React120__default.isValidElement(value)) return false;
40760
+ if (React121__default.isValidElement(value)) return false;
40647
40761
  if (value instanceof Date) return false;
40648
40762
  if (typeof value === "function") return false;
40649
40763
  const record = value;
40650
40764
  return "type" in record && typeof record.type === "string";
40651
40765
  }
40652
40766
  function isPlainConfigObject(value) {
40653
- if (React120__default.isValidElement(value)) return false;
40767
+ if (React121__default.isValidElement(value)) return false;
40654
40768
  if (value instanceof Date) return false;
40655
40769
  const proto = Object.getPrototypeOf(value);
40656
40770
  return proto === Object.prototype || proto === null;
@@ -41094,7 +41208,7 @@ var FormSection = ({
41094
41208
  columns = 1,
41095
41209
  className
41096
41210
  }) => {
41097
- const [collapsed, setCollapsed] = React120__default.useState(defaultCollapsed);
41211
+ const [collapsed, setCollapsed] = React121__default.useState(defaultCollapsed);
41098
41212
  const { t } = useTranslate();
41099
41213
  const eventBus = useEventBus();
41100
41214
  const gridClass = {
@@ -41102,7 +41216,7 @@ var FormSection = ({
41102
41216
  2: "grid-cols-1 md:grid-cols-2",
41103
41217
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
41104
41218
  }[columns];
41105
- React120__default.useCallback(() => {
41219
+ React121__default.useCallback(() => {
41106
41220
  if (collapsible) {
41107
41221
  setCollapsed((prev) => !prev);
41108
41222
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });