@almadar/ui 4.49.0 → 4.50.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,5 +1,5 @@
1
- import * as React136 from 'react';
2
- import React136__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React81 from 'react';
2
+ import React81__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -36,6 +36,9 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isInlineTrait } from '@almadar/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
40
+ import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
+ import { CSS } from '@dnd-kit/utilities';
39
42
  import { Handle, Position } from '@xyflow/react';
40
43
  import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
41
44
 
@@ -684,7 +687,7 @@ var init_Box = __esm({
684
687
  fixed: "fixed",
685
688
  sticky: "sticky"
686
689
  };
687
- Box = React136__default.forwardRef(
690
+ Box = React81__default.forwardRef(
688
691
  ({
689
692
  padding,
690
693
  paddingX,
@@ -1383,7 +1386,7 @@ function resolveIconProp(value, sizeClass) {
1383
1386
  const IconComp = value;
1384
1387
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1385
1388
  }
1386
- if (React136__default.isValidElement(value)) {
1389
+ if (React81__default.isValidElement(value)) {
1387
1390
  return value;
1388
1391
  }
1389
1392
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1459,7 +1462,7 @@ var init_Button = __esm({
1459
1462
  md: "h-4 w-4",
1460
1463
  lg: "h-5 w-5"
1461
1464
  };
1462
- Button = React136__default.forwardRef(
1465
+ Button = React81__default.forwardRef(
1463
1466
  ({
1464
1467
  className,
1465
1468
  variant = "primary",
@@ -1562,7 +1565,7 @@ var init_Badge = __esm({
1562
1565
  md: "px-2.5 py-1 text-sm",
1563
1566
  lg: "px-3 py-1.5 text-base"
1564
1567
  };
1565
- Badge = React136__default.forwardRef(
1568
+ Badge = React81__default.forwardRef(
1566
1569
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1567
1570
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1568
1571
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -1856,7 +1859,7 @@ var init_SvgFlow = __esm({
1856
1859
  opacity = 1,
1857
1860
  className
1858
1861
  }) => {
1859
- const markerId = React136__default.useMemo(() => {
1862
+ const markerId = React81__default.useMemo(() => {
1860
1863
  flowIdCounter += 1;
1861
1864
  return `almadar-flow-arrow-${flowIdCounter}`;
1862
1865
  }, []);
@@ -2399,7 +2402,7 @@ var init_SvgRing = __esm({
2399
2402
  className,
2400
2403
  label
2401
2404
  }) => {
2402
- const gradientId = React136__default.useMemo(() => {
2405
+ const gradientId = React81__default.useMemo(() => {
2403
2406
  ringIdCounter += 1;
2404
2407
  return `almadar-ring-glow-${ringIdCounter}`;
2405
2408
  }, []);
@@ -2560,7 +2563,7 @@ var Input;
2560
2563
  var init_Input = __esm({
2561
2564
  "components/atoms/Input.tsx"() {
2562
2565
  init_cn();
2563
- Input = React136__default.forwardRef(
2566
+ Input = React81__default.forwardRef(
2564
2567
  ({
2565
2568
  className,
2566
2569
  inputType,
@@ -2678,7 +2681,7 @@ var Label;
2678
2681
  var init_Label = __esm({
2679
2682
  "components/atoms/Label.tsx"() {
2680
2683
  init_cn();
2681
- Label = React136__default.forwardRef(
2684
+ Label = React81__default.forwardRef(
2682
2685
  ({ className, required, children, ...props }, ref) => {
2683
2686
  return /* @__PURE__ */ jsxs(
2684
2687
  "label",
@@ -2704,7 +2707,7 @@ var Textarea;
2704
2707
  var init_Textarea = __esm({
2705
2708
  "components/atoms/Textarea.tsx"() {
2706
2709
  init_cn();
2707
- Textarea = React136__default.forwardRef(
2710
+ Textarea = React81__default.forwardRef(
2708
2711
  ({ className, error, ...props }, ref) => {
2709
2712
  return /* @__PURE__ */ jsx(
2710
2713
  "textarea",
@@ -2733,7 +2736,7 @@ var Select;
2733
2736
  var init_Select = __esm({
2734
2737
  "components/atoms/Select.tsx"() {
2735
2738
  init_cn();
2736
- Select = React136__default.forwardRef(
2739
+ Select = React81__default.forwardRef(
2737
2740
  ({ className, options, placeholder, error, ...props }, ref) => {
2738
2741
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2739
2742
  /* @__PURE__ */ jsxs(
@@ -2775,7 +2778,7 @@ var Checkbox;
2775
2778
  var init_Checkbox = __esm({
2776
2779
  "components/atoms/Checkbox.tsx"() {
2777
2780
  init_cn();
2778
- Checkbox = React136__default.forwardRef(
2781
+ Checkbox = React81__default.forwardRef(
2779
2782
  ({ className, label, id, ...props }, ref) => {
2780
2783
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2781
2784
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2857,7 +2860,7 @@ var init_Card = __esm({
2857
2860
  md: "shadow",
2858
2861
  lg: "shadow-lg"
2859
2862
  };
2860
- Card = React136__default.forwardRef(
2863
+ Card = React81__default.forwardRef(
2861
2864
  ({
2862
2865
  className,
2863
2866
  variant = "bordered",
@@ -2893,9 +2896,9 @@ var init_Card = __esm({
2893
2896
  }
2894
2897
  );
2895
2898
  Card.displayName = "Card";
2896
- CardHeader = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2899
+ CardHeader = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2897
2900
  CardHeader.displayName = "CardHeader";
2898
- CardTitle = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2901
+ CardTitle = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2899
2902
  "h3",
2900
2903
  {
2901
2904
  ref,
@@ -2908,11 +2911,11 @@ var init_Card = __esm({
2908
2911
  }
2909
2912
  ));
2910
2913
  CardTitle.displayName = "CardTitle";
2911
- CardContent = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2914
+ CardContent = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2912
2915
  CardContent.displayName = "CardContent";
2913
2916
  CardBody = CardContent;
2914
2917
  CardBody.displayName = "CardBody";
2915
- CardFooter = React136__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2918
+ CardFooter = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2916
2919
  "div",
2917
2920
  {
2918
2921
  ref,
@@ -2967,7 +2970,7 @@ var init_FilterPill = __esm({
2967
2970
  md: "w-3.5 h-3.5",
2968
2971
  lg: "w-4 h-4"
2969
2972
  };
2970
- FilterPill = React136__default.forwardRef(
2973
+ FilterPill = React81__default.forwardRef(
2971
2974
  ({
2972
2975
  className,
2973
2976
  variant = "default",
@@ -3046,7 +3049,7 @@ var init_Spinner = __esm({
3046
3049
  md: "h-6 w-6",
3047
3050
  lg: "h-8 w-8"
3048
3051
  };
3049
- Spinner = React136__default.forwardRef(
3052
+ Spinner = React81__default.forwardRef(
3050
3053
  ({ className, size = "md", ...props }, ref) => {
3051
3054
  return /* @__PURE__ */ jsx(
3052
3055
  "div",
@@ -3494,7 +3497,7 @@ var Radio;
3494
3497
  var init_Radio = __esm({
3495
3498
  "components/atoms/Radio.tsx"() {
3496
3499
  init_cn();
3497
- Radio = React136__default.forwardRef(
3500
+ Radio = React81__default.forwardRef(
3498
3501
  ({
3499
3502
  label,
3500
3503
  helperText,
@@ -3605,7 +3608,7 @@ var init_Switch = __esm({
3605
3608
  "components/atoms/Switch.tsx"() {
3606
3609
  "use client";
3607
3610
  init_cn();
3608
- Switch = React136.forwardRef(
3611
+ Switch = React81.forwardRef(
3609
3612
  ({
3610
3613
  checked,
3611
3614
  defaultChecked = false,
@@ -3616,10 +3619,10 @@ var init_Switch = __esm({
3616
3619
  name,
3617
3620
  className
3618
3621
  }, ref) => {
3619
- const [isChecked, setIsChecked] = React136.useState(
3622
+ const [isChecked, setIsChecked] = React81.useState(
3620
3623
  checked !== void 0 ? checked : defaultChecked
3621
3624
  );
3622
- React136.useEffect(() => {
3625
+ React81.useEffect(() => {
3623
3626
  if (checked !== void 0) {
3624
3627
  setIsChecked(checked);
3625
3628
  }
@@ -4039,8 +4042,8 @@ var init_LawReferenceTooltip = __esm({
4039
4042
  position = "top",
4040
4043
  className
4041
4044
  }) => {
4042
- const [isVisible, setIsVisible] = React136__default.useState(false);
4043
- const timeoutRef = React136__default.useRef(null);
4045
+ const [isVisible, setIsVisible] = React81__default.useState(false);
4046
+ const timeoutRef = React81__default.useRef(null);
4044
4047
  const handleMouseEnter = () => {
4045
4048
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4046
4049
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4049,7 +4052,7 @@ var init_LawReferenceTooltip = __esm({
4049
4052
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4050
4053
  setIsVisible(false);
4051
4054
  };
4052
- React136__default.useEffect(() => {
4055
+ React81__default.useEffect(() => {
4053
4056
  return () => {
4054
4057
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4055
4058
  };
@@ -4259,7 +4262,7 @@ var init_StatusDot = __esm({
4259
4262
  md: "w-2.5 h-2.5",
4260
4263
  lg: "w-3 h-3"
4261
4264
  };
4262
- StatusDot = React136__default.forwardRef(
4265
+ StatusDot = React81__default.forwardRef(
4263
4266
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4264
4267
  return /* @__PURE__ */ jsx(
4265
4268
  "span",
@@ -4312,7 +4315,7 @@ var init_TrendIndicator = __esm({
4312
4315
  down: TrendingDown,
4313
4316
  flat: ArrowRight
4314
4317
  };
4315
- TrendIndicator = React136__default.forwardRef(
4318
+ TrendIndicator = React81__default.forwardRef(
4316
4319
  ({
4317
4320
  className,
4318
4321
  value,
@@ -4379,7 +4382,7 @@ var init_RangeSlider = __esm({
4379
4382
  md: "w-4 h-4",
4380
4383
  lg: "w-5 h-5"
4381
4384
  };
4382
- RangeSlider = React136__default.forwardRef(
4385
+ RangeSlider = React81__default.forwardRef(
4383
4386
  ({
4384
4387
  className,
4385
4388
  min = 0,
@@ -4947,7 +4950,7 @@ var init_ContentSection = __esm({
4947
4950
  md: "py-16",
4948
4951
  lg: "py-24"
4949
4952
  };
4950
- ContentSection = React136__default.forwardRef(
4953
+ ContentSection = React81__default.forwardRef(
4951
4954
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4952
4955
  return /* @__PURE__ */ jsx(
4953
4956
  Box,
@@ -5481,7 +5484,7 @@ var init_AnimatedReveal = __esm({
5481
5484
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5482
5485
  "none": {}
5483
5486
  };
5484
- AnimatedReveal = React136__default.forwardRef(
5487
+ AnimatedReveal = React81__default.forwardRef(
5485
5488
  ({
5486
5489
  trigger = "scroll",
5487
5490
  animation = "fade-up",
@@ -5641,7 +5644,7 @@ var init_AnimatedGraphic = __esm({
5641
5644
  "components/atoms/AnimatedGraphic.tsx"() {
5642
5645
  "use client";
5643
5646
  init_cn();
5644
- AnimatedGraphic = React136__default.forwardRef(
5647
+ AnimatedGraphic = React81__default.forwardRef(
5645
5648
  ({
5646
5649
  src,
5647
5650
  svgContent,
@@ -5664,7 +5667,7 @@ var init_AnimatedGraphic = __esm({
5664
5667
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5665
5668
  const resolvedSvg = svgContent ?? fetchedSvg;
5666
5669
  const prevAnimateRef = useRef(animate);
5667
- const setRef = React136__default.useCallback(
5670
+ const setRef = React81__default.useCallback(
5668
5671
  (node) => {
5669
5672
  containerRef.current = node;
5670
5673
  if (typeof ref === "function") ref(node);
@@ -5889,9 +5892,9 @@ function ScoreDisplay({
5889
5892
  ...rest
5890
5893
  }) {
5891
5894
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
5892
- const [displayValue, setDisplayValue] = React136.useState(resolvedValue);
5893
- const [isAnimating, setIsAnimating] = React136.useState(false);
5894
- React136.useEffect(() => {
5895
+ const [displayValue, setDisplayValue] = React81.useState(resolvedValue);
5896
+ const [isAnimating, setIsAnimating] = React81.useState(false);
5897
+ React81.useEffect(() => {
5895
5898
  if (!animated || displayValue === resolvedValue) {
5896
5899
  setDisplayValue(resolvedValue);
5897
5900
  return;
@@ -5961,9 +5964,9 @@ function ControlButton({
5961
5964
  className
5962
5965
  }) {
5963
5966
  const eventBus = useEventBus();
5964
- const [isPressed, setIsPressed] = React136.useState(false);
5967
+ const [isPressed, setIsPressed] = React81.useState(false);
5965
5968
  const actualPressed = pressed ?? isPressed;
5966
- const handlePointerDown = React136.useCallback(
5969
+ const handlePointerDown = React81.useCallback(
5967
5970
  (e) => {
5968
5971
  e.preventDefault();
5969
5972
  if (disabled) return;
@@ -5973,7 +5976,7 @@ function ControlButton({
5973
5976
  },
5974
5977
  [disabled, pressEvent, eventBus, onPress]
5975
5978
  );
5976
- const handlePointerUp = React136.useCallback(
5979
+ const handlePointerUp = React81.useCallback(
5977
5980
  (e) => {
5978
5981
  e.preventDefault();
5979
5982
  if (disabled) return;
@@ -5983,7 +5986,7 @@ function ControlButton({
5983
5986
  },
5984
5987
  [disabled, releaseEvent, eventBus, onRelease]
5985
5988
  );
5986
- const handlePointerLeave = React136.useCallback(
5989
+ const handlePointerLeave = React81.useCallback(
5987
5990
  (e) => {
5988
5991
  if (isPressed) {
5989
5992
  setIsPressed(false);
@@ -6889,9 +6892,9 @@ function MiniMap({
6889
6892
  viewportRect,
6890
6893
  className
6891
6894
  }) {
6892
- const canvasRef = React136.useRef(null);
6893
- const frameRef = React136.useRef(0);
6894
- React136.useEffect(() => {
6895
+ const canvasRef = React81.useRef(null);
6896
+ const frameRef = React81.useRef(0);
6897
+ React81.useEffect(() => {
6895
6898
  const canvas = canvasRef.current;
6896
6899
  if (!canvas) return;
6897
6900
  const ctx = canvas.getContext("2d");
@@ -7185,7 +7188,7 @@ var init_ErrorBoundary = __esm({
7185
7188
  "use client";
7186
7189
  init_cn();
7187
7190
  init_ErrorState();
7188
- ErrorBoundary = class extends React136__default.Component {
7191
+ ErrorBoundary = class extends React81__default.Component {
7189
7192
  constructor(props) {
7190
7193
  super(props);
7191
7194
  __publicField(this, "reset", () => {
@@ -8616,8 +8619,8 @@ var init_Tooltip = __esm({
8616
8619
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
8617
8620
  };
8618
8621
  }, []);
8619
- const triggerElement = React136__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8620
- const trigger = React136__default.cloneElement(triggerElement, {
8622
+ const triggerElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8623
+ const trigger = React81__default.cloneElement(triggerElement, {
8621
8624
  ref: triggerRef,
8622
8625
  onMouseEnter: handleMouseEnter,
8623
8626
  onMouseLeave: handleMouseLeave,
@@ -8738,8 +8741,8 @@ var init_Popover = __esm({
8738
8741
  onMouseEnter: handleOpen,
8739
8742
  onMouseLeave: handleClose
8740
8743
  };
8741
- const childElement = React136__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8742
- const triggerElement = React136__default.cloneElement(
8744
+ const childElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8745
+ const triggerElement = React81__default.cloneElement(
8743
8746
  childElement,
8744
8747
  {
8745
8748
  ref: triggerRef,
@@ -8856,8 +8859,8 @@ var init_Menu = __esm({
8856
8859
  "bottom-start": "top-full left-0 mt-2",
8857
8860
  "bottom-end": "top-full right-0 mt-2"
8858
8861
  };
8859
- const triggerChild = React136__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8860
- const triggerElement = React136__default.cloneElement(
8862
+ const triggerChild = React81__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8863
+ const triggerElement = React81__default.cloneElement(
8861
8864
  triggerChild,
8862
8865
  {
8863
8866
  ref: triggerRef,
@@ -9273,7 +9276,7 @@ var init_MapView = __esm({
9273
9276
  shadowSize: [41, 41]
9274
9277
  });
9275
9278
  L.Marker.prototype.options.icon = defaultIcon;
9276
- const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback110, useState: useState95 } = React136__default;
9279
+ const { useEffect: useEffect67, useRef: useRef65, useCallback: useCallback110, useState: useState95 } = React81__default;
9277
9280
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9278
9281
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9279
9282
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -9519,7 +9522,7 @@ function InputPattern({
9519
9522
  fieldName
9520
9523
  }) {
9521
9524
  const { emit } = useEventBus();
9522
- const [localValue, setLocalValue] = React136__default.useState(value);
9525
+ const [localValue, setLocalValue] = React81__default.useState(value);
9523
9526
  const handleChange = (e) => {
9524
9527
  setLocalValue(e.target.value);
9525
9528
  if (onChange) {
@@ -9557,7 +9560,7 @@ function TextareaPattern({
9557
9560
  fieldName
9558
9561
  }) {
9559
9562
  const { emit } = useEventBus();
9560
- const [localValue, setLocalValue] = React136__default.useState(value);
9563
+ const [localValue, setLocalValue] = React81__default.useState(value);
9561
9564
  const handleChange = (e) => {
9562
9565
  setLocalValue(e.target.value);
9563
9566
  if (onChange) {
@@ -9589,7 +9592,7 @@ function SelectPattern({
9589
9592
  fieldName
9590
9593
  }) {
9591
9594
  const { emit } = useEventBus();
9592
- const [localValue, setLocalValue] = React136__default.useState(value);
9595
+ const [localValue, setLocalValue] = React81__default.useState(value);
9593
9596
  const handleChange = (e) => {
9594
9597
  setLocalValue(e.target.value);
9595
9598
  if (onChange) {
@@ -9618,7 +9621,7 @@ function CheckboxPattern({
9618
9621
  className
9619
9622
  }) {
9620
9623
  const { emit } = useEventBus();
9621
- const [localChecked, setLocalChecked] = React136__default.useState(checked);
9624
+ const [localChecked, setLocalChecked] = React81__default.useState(checked);
9622
9625
  const handleChange = (e) => {
9623
9626
  setLocalChecked(e.target.checked);
9624
9627
  if (onChange) {
@@ -9849,8 +9852,8 @@ function ActionButtons({
9849
9852
  disabled
9850
9853
  }) {
9851
9854
  const eventBus = useEventBus();
9852
- const [activeButtons, setActiveButtons] = React136.useState(/* @__PURE__ */ new Set());
9853
- const handlePress = React136.useCallback(
9855
+ const [activeButtons, setActiveButtons] = React81.useState(/* @__PURE__ */ new Set());
9856
+ const handlePress = React81.useCallback(
9854
9857
  (id) => {
9855
9858
  setActiveButtons((prev) => new Set(prev).add(id));
9856
9859
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9858,7 +9861,7 @@ function ActionButtons({
9858
9861
  },
9859
9862
  [actionEvent, eventBus, onAction]
9860
9863
  );
9861
- const handleRelease = React136.useCallback(
9864
+ const handleRelease = React81.useCallback(
9862
9865
  (id) => {
9863
9866
  setActiveButtons((prev) => {
9864
9867
  const next = new Set(prev);
@@ -12709,7 +12712,7 @@ var init_MarkdownContent = __esm({
12709
12712
  init_Box();
12710
12713
  init_useTranslate();
12711
12714
  init_cn();
12712
- MarkdownContent = React136__default.memo(
12715
+ MarkdownContent = React81__default.memo(
12713
12716
  ({ content, direction, className }) => {
12714
12717
  const { t: _t } = useTranslate();
12715
12718
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12927,7 +12930,7 @@ var init_CodeBlock = __esm({
12927
12930
  log8 = createLogger("almadar:ui:markdown-code");
12928
12931
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12929
12932
  HIDDEN_LINE_NUMBERS = { display: "none" };
12930
- CodeBlock = React136__default.memo(
12933
+ CodeBlock = React81__default.memo(
12931
12934
  ({
12932
12935
  code: rawCode,
12933
12936
  language = "text",
@@ -14236,7 +14239,7 @@ var init_StateMachineView = __esm({
14236
14239
  style: { top: title ? 30 : 0 },
14237
14240
  children: [
14238
14241
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
14239
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React136__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14242
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React81__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14240
14243
  StateNode,
14241
14244
  {
14242
14245
  state,
@@ -20680,7 +20683,7 @@ function CraftingRecipe({
20680
20683
  className
20681
20684
  }) {
20682
20685
  const eventBus = useEventBus();
20683
- const handleCraft = React136.useCallback(() => {
20686
+ const handleCraft = React81.useCallback(() => {
20684
20687
  onCraft?.();
20685
20688
  if (craftEvent) {
20686
20689
  eventBus.emit(craftEvent, { output: output.label });
@@ -20697,7 +20700,7 @@ function CraftingRecipe({
20697
20700
  children: [
20698
20701
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
20699
20702
  const hasSufficient = ingredient.available >= ingredient.required;
20700
- return /* @__PURE__ */ jsxs(React136.Fragment, { children: [
20703
+ return /* @__PURE__ */ jsxs(React81.Fragment, { children: [
20701
20704
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
20702
20705
  ItemSlot,
20703
20706
  {
@@ -20760,8 +20763,8 @@ function DPad({
20760
20763
  }) {
20761
20764
  const eventBus = useEventBus();
20762
20765
  const sizes = sizeMap15[size];
20763
- const [activeDirections, setActiveDirections] = React136.useState(/* @__PURE__ */ new Set());
20764
- const handlePress = React136.useCallback(
20766
+ const [activeDirections, setActiveDirections] = React81.useState(/* @__PURE__ */ new Set());
20767
+ const handlePress = React81.useCallback(
20765
20768
  (direction) => {
20766
20769
  setActiveDirections((prev) => new Set(prev).add(direction));
20767
20770
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -20769,7 +20772,7 @@ function DPad({
20769
20772
  },
20770
20773
  [directionEvent, eventBus, onDirection]
20771
20774
  );
20772
- const handleRelease = React136.useCallback(
20775
+ const handleRelease = React81.useCallback(
20773
20776
  (direction) => {
20774
20777
  setActiveDirections((prev) => {
20775
20778
  const next = new Set(prev);
@@ -21269,6 +21272,192 @@ var init_DashboardLayout = __esm({
21269
21272
  NavLink.displayName = "NavLink";
21270
21273
  }
21271
21274
  });
21275
+ function useDataDnd(args) {
21276
+ const {
21277
+ dragGroup,
21278
+ accepts,
21279
+ sortable,
21280
+ dropEvent,
21281
+ reorderEvent,
21282
+ dndItemIdField = "id",
21283
+ items,
21284
+ layout
21285
+ } = args;
21286
+ const enabled = Boolean(dragGroup || accepts || sortable);
21287
+ const eventBus = useEventBus();
21288
+ const parentRoot = React81__default.useContext(RootCtx);
21289
+ const isRoot = enabled && parentRoot === null;
21290
+ const [localOrder, setLocalOrder] = React81__default.useState(null);
21291
+ const orderedItems = localOrder ?? items;
21292
+ React81__default.useEffect(() => {
21293
+ setLocalOrder(null);
21294
+ }, [items]);
21295
+ const itemIds = React81__default.useMemo(
21296
+ () => orderedItems.map((it, idx) => {
21297
+ const raw = it[dndItemIdField];
21298
+ return raw ?? `__idx_${idx}`;
21299
+ }),
21300
+ [orderedItems, dndItemIdField]
21301
+ );
21302
+ const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
21303
+ const registerZone = React81__default.useCallback((zoneId2, meta2) => {
21304
+ zonesRef.current.set(zoneId2, meta2);
21305
+ }, []);
21306
+ const unregisterZone = React81__default.useCallback((zoneId2) => {
21307
+ zonesRef.current.delete(zoneId2);
21308
+ }, []);
21309
+ const zoneId = React81__default.useId();
21310
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
21311
+ const meta = React81__default.useMemo(
21312
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
21313
+ [ownGroup, dropEvent, reorderEvent, itemIds]
21314
+ );
21315
+ React81__default.useEffect(() => {
21316
+ const target = isRoot ? null : parentRoot;
21317
+ if (!target) {
21318
+ zonesRef.current.set(zoneId, meta);
21319
+ return () => zonesRef.current.delete(zoneId);
21320
+ }
21321
+ target.registerZone(zoneId, meta);
21322
+ return () => target.unregisterZone(zoneId);
21323
+ }, [parentRoot, isRoot, zoneId, meta]);
21324
+ const sensors = useSensors(
21325
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21326
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21327
+ );
21328
+ const findZoneByItem = React81__default.useCallback(
21329
+ (id) => {
21330
+ for (const z of zonesRef.current.values()) {
21331
+ if (z.itemIds.includes(id)) return z;
21332
+ }
21333
+ return void 0;
21334
+ },
21335
+ []
21336
+ );
21337
+ const findZoneByGroup = React81__default.useCallback(
21338
+ (group) => {
21339
+ for (const z of zonesRef.current.values()) {
21340
+ if (z.group === group) return z;
21341
+ }
21342
+ return void 0;
21343
+ },
21344
+ []
21345
+ );
21346
+ const handleDragEnd = React81__default.useCallback(
21347
+ (event) => {
21348
+ const { active, over } = event;
21349
+ if (!over) return;
21350
+ const sourceZone = findZoneByItem(active.id);
21351
+ const overData = over.data?.current;
21352
+ const targetGroup = overData?.dndGroup;
21353
+ if (!sourceZone || !targetGroup) return;
21354
+ const targetZone = findZoneByGroup(targetGroup);
21355
+ if (!targetZone) return;
21356
+ if (sourceZone.group !== targetZone.group) {
21357
+ if (targetZone.dropEvent) {
21358
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
21359
+ eventBus.emit(targetZone.dropEvent, {
21360
+ id: String(active.id),
21361
+ sourceGroup: sourceZone.group,
21362
+ targetGroup: targetZone.group,
21363
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
21364
+ });
21365
+ }
21366
+ return;
21367
+ }
21368
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
21369
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
21370
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
21371
+ if (sourceZone.group === ownGroup) {
21372
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
21373
+ setLocalOrder(reordered);
21374
+ }
21375
+ if (sourceZone.reorderEvent) {
21376
+ eventBus.emit(sourceZone.reorderEvent, {
21377
+ id: String(active.id),
21378
+ oldIndex,
21379
+ newIndex
21380
+ });
21381
+ }
21382
+ },
21383
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21384
+ );
21385
+ const SortableItem = React81__default.useCallback(
21386
+ ({ id, children }) => {
21387
+ const {
21388
+ attributes,
21389
+ listeners: listeners6,
21390
+ setNodeRef,
21391
+ transform,
21392
+ transition,
21393
+ isDragging
21394
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
21395
+ const style = {
21396
+ transform: CSS.Transform.toString(transform),
21397
+ transition,
21398
+ opacity: isDragging ? 0.4 : 1,
21399
+ cursor: enabled ? "grab" : void 0
21400
+ };
21401
+ return /* @__PURE__ */ jsx(
21402
+ Box,
21403
+ {
21404
+ className: "touch-none",
21405
+ ref: setNodeRef,
21406
+ style,
21407
+ ...attributes,
21408
+ ...listeners6,
21409
+ children
21410
+ }
21411
+ );
21412
+ },
21413
+ [ownGroup, enabled]
21414
+ );
21415
+ const DropZoneShell = ({ children }) => {
21416
+ const { setNodeRef, isOver } = useDroppable({
21417
+ id: `dnd-zone-${zoneId}`,
21418
+ data: { dndGroup: ownGroup }
21419
+ });
21420
+ return /* @__PURE__ */ jsx(
21421
+ Box,
21422
+ {
21423
+ ref: setNodeRef,
21424
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21425
+ children
21426
+ }
21427
+ );
21428
+ };
21429
+ const rootContextValue = React81__default.useMemo(
21430
+ () => ({ registerZone, unregisterZone }),
21431
+ [registerZone, unregisterZone]
21432
+ );
21433
+ const wrapContainer = React81__default.useCallback(
21434
+ (children) => {
21435
+ if (!enabled) return children;
21436
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21437
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21438
+ if (isRoot) {
21439
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21440
+ }
21441
+ return inner;
21442
+ },
21443
+ [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21444
+ );
21445
+ return {
21446
+ enabled,
21447
+ wrapContainer,
21448
+ SortableItem,
21449
+ orderedItems
21450
+ };
21451
+ }
21452
+ var RootCtx;
21453
+ var init_useDataDnd = __esm({
21454
+ "components/molecules/useDataDnd.tsx"() {
21455
+ "use client";
21456
+ init_useEventBus();
21457
+ init_Box();
21458
+ RootCtx = React81__default.createContext(null);
21459
+ }
21460
+ });
21272
21461
  function fieldLabel2(key) {
21273
21462
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21274
21463
  }
@@ -21332,14 +21521,31 @@ function DataGrid({
21332
21521
  hasMore,
21333
21522
  children,
21334
21523
  pageSize = 0,
21335
- renderItem: schemaRenderItem
21524
+ renderItem: schemaRenderItem,
21525
+ dragGroup,
21526
+ accepts,
21527
+ sortable,
21528
+ dropEvent,
21529
+ reorderEvent,
21530
+ dndItemIdField
21336
21531
  }) {
21337
21532
  const eventBus = useEventBus();
21338
21533
  const { t } = useTranslate();
21339
21534
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
21340
21535
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
21341
21536
  const fieldDefs = fields ?? columns ?? [];
21342
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21537
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21538
+ const dnd = useDataDnd({
21539
+ items: allDataRaw,
21540
+ layout: "grid",
21541
+ dragGroup,
21542
+ accepts,
21543
+ sortable,
21544
+ dropEvent,
21545
+ reorderEvent,
21546
+ dndItemIdField
21547
+ });
21548
+ const allData = dnd.orderedItems;
21343
21549
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21344
21550
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21345
21551
  const toggleSelection = useCallback((id) => {
@@ -21411,196 +21617,205 @@ function DataGrid({
21411
21617
  const allIds = data.map((item, i) => item.id || String(i));
21412
21618
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
21413
21619
  const someSelected = selectedIds.size > 0;
21414
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21415
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21620
+ const idFieldName = dndItemIdField ?? "id";
21621
+ return dnd.wrapContainer(
21622
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21623
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21624
+ /* @__PURE__ */ jsx(
21625
+ "input",
21626
+ {
21627
+ type: "checkbox",
21628
+ checked: allSelected,
21629
+ onChange: toggleAll,
21630
+ className: "w-4 h-4 accent-primary",
21631
+ "aria-label": "Select all"
21632
+ }
21633
+ ),
21634
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21635
+ selectedIds.size,
21636
+ " ",
21637
+ t("common.selected") || "selected"
21638
+ ] })
21639
+ ] }),
21416
21640
  /* @__PURE__ */ jsx(
21417
- "input",
21641
+ Box,
21418
21642
  {
21419
- type: "checkbox",
21420
- checked: allSelected,
21421
- onChange: toggleAll,
21422
- className: "w-4 h-4 accent-primary",
21423
- "aria-label": "Select all"
21424
- }
21425
- ),
21426
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21427
- selectedIds.size,
21428
- " ",
21429
- t("common.selected") || "selected"
21430
- ] })
21431
- ] }),
21432
- /* @__PURE__ */ jsx(
21433
- Box,
21434
- {
21435
- className: cn("grid", gapStyles6[gap], colsClass, className),
21436
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21437
- children: data.map((item, index) => {
21438
- const itemData = item;
21439
- const id = itemData.id || String(index);
21440
- const isSelected = selectedIds.has(id);
21441
- if (hasRenderProp) {
21442
- return /* @__PURE__ */ jsx(
21443
- Box,
21444
- {
21445
- "data-entity-row": true,
21446
- "data-entity-id": id,
21447
- className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21448
- children: children(itemData, index)
21449
- },
21450
- id
21451
- );
21452
- }
21453
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21454
- return /* @__PURE__ */ jsxs(
21455
- Box,
21456
- {
21457
- "data-entity-row": true,
21458
- "data-entity-id": id,
21459
- className: cn(
21460
- "bg-card rounded-lg",
21461
- "border border-border",
21462
- "shadow-sm hover:shadow-lg",
21463
- "hover:border-primary transition-all",
21464
- "flex flex-col",
21465
- isSelected && "ring-2 ring-primary border-primary"
21466
- ),
21467
- children: [
21468
- imageField && (() => {
21469
- const imgUrl = getNestedValue(itemData, imageField);
21470
- if (!imgUrl || typeof imgUrl !== "string") return null;
21471
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21472
- "img",
21473
- {
21474
- src: imgUrl,
21475
- alt: titleValue !== void 0 ? String(titleValue) : "",
21476
- className: "w-full h-full object-cover",
21477
- loading: "lazy"
21478
- }
21479
- ) });
21480
- })(),
21481
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21482
- selectable && /* @__PURE__ */ jsx(
21483
- "input",
21484
- {
21485
- type: "checkbox",
21486
- checked: isSelected,
21487
- onChange: () => toggleSelection(id),
21488
- onClick: (e) => e.stopPropagation(),
21489
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21490
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21491
- }
21643
+ className: cn("grid", gapStyles6[gap], colsClass, className),
21644
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21645
+ children: data.map((item, index) => {
21646
+ const itemData = item;
21647
+ const id = itemData.id || String(index);
21648
+ const isSelected = selectedIds.has(id);
21649
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21650
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21651
+ if (hasRenderProp) {
21652
+ return wrapDnd(
21653
+ /* @__PURE__ */ jsx(
21654
+ Box,
21655
+ {
21656
+ "data-entity-row": true,
21657
+ "data-entity-id": id,
21658
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21659
+ children: children(itemData, index)
21660
+ },
21661
+ id
21662
+ )
21663
+ );
21664
+ }
21665
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21666
+ return wrapDnd(
21667
+ /* @__PURE__ */ jsxs(
21668
+ Box,
21669
+ {
21670
+ "data-entity-row": true,
21671
+ "data-entity-id": id,
21672
+ className: cn(
21673
+ "bg-card rounded-lg",
21674
+ "border border-border",
21675
+ "shadow-sm hover:shadow-lg",
21676
+ "hover:border-primary transition-all",
21677
+ "flex flex-col",
21678
+ isSelected && "ring-2 ring-primary border-primary"
21492
21679
  ),
21493
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21494
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21495
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21496
- /* @__PURE__ */ jsx(
21497
- Typography,
21680
+ children: [
21681
+ imageField && (() => {
21682
+ const imgUrl = getNestedValue(itemData, imageField);
21683
+ if (!imgUrl || typeof imgUrl !== "string") return null;
21684
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21685
+ "img",
21498
21686
  {
21499
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21500
- className: "font-semibold truncate",
21501
- children: String(titleValue)
21687
+ src: imgUrl,
21688
+ alt: titleValue !== void 0 ? String(titleValue) : "",
21689
+ className: "w-full h-full object-cover",
21690
+ loading: "lazy"
21502
21691
  }
21503
- )
21504
- ] }),
21505
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21506
- const val = getNestedValue(itemData, field.name);
21507
- if (val === void 0 || val === null) return null;
21508
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21509
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21510
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21511
- ] }, field.name);
21512
- }) })
21513
- ] }),
21514
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21515
- Button,
21516
- {
21517
- variant: "ghost",
21518
- size: "sm",
21519
- onClick: handleActionClick(action, itemData),
21520
- "data-testid": `action-${action.event}`,
21521
- "data-row-id": String(itemData.id),
21522
- className: "text-error hover:text-error hover:bg-error/10 px-2",
21523
- children: [
21524
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21525
- action.label
21526
- ]
21527
- },
21528
- idx
21529
- )) })
21530
- ] }) }),
21531
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21532
- const value = getNestedValue(itemData, field.name);
21533
- if (value === void 0 || value === null || value === "") return null;
21534
- if (field.format === "boolean") {
21535
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21536
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21537
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21538
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21692
+ ) });
21693
+ })(),
21694
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21695
+ selectable && /* @__PURE__ */ jsx(
21696
+ "input",
21697
+ {
21698
+ type: "checkbox",
21699
+ checked: isSelected,
21700
+ onChange: () => toggleSelection(id),
21701
+ onClick: (e) => e.stopPropagation(),
21702
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21703
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21704
+ }
21705
+ ),
21706
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21707
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21708
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21709
+ /* @__PURE__ */ jsx(
21710
+ Typography,
21711
+ {
21712
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21713
+ className: "font-semibold truncate",
21714
+ children: String(titleValue)
21715
+ }
21716
+ )
21717
+ ] }),
21718
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21719
+ const val = getNestedValue(itemData, field.name);
21720
+ if (val === void 0 || val === null) return null;
21721
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21722
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21723
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21724
+ ] }, field.name);
21725
+ }) })
21539
21726
  ] }),
21540
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21541
- ] }, field.name);
21542
- }
21543
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21544
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21545
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21546
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21547
- ] }),
21548
- /* @__PURE__ */ jsx(
21549
- Typography,
21550
- {
21551
- variant: field.variant === "caption" ? "caption" : "small",
21552
- className: "text-right truncate max-w-[60%]",
21553
- children: formatValue(value, field.format)
21727
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21728
+ Button,
21729
+ {
21730
+ variant: "ghost",
21731
+ size: "sm",
21732
+ onClick: handleActionClick(action, itemData),
21733
+ "data-testid": `action-${action.event}`,
21734
+ "data-row-id": String(itemData.id),
21735
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21736
+ children: [
21737
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21738
+ action.label
21739
+ ]
21740
+ },
21741
+ idx
21742
+ )) })
21743
+ ] }) }),
21744
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21745
+ const value = getNestedValue(itemData, field.name);
21746
+ if (value === void 0 || value === null || value === "") return null;
21747
+ if (field.format === "boolean") {
21748
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21749
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21750
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21751
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21752
+ ] }),
21753
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21754
+ ] }, field.name);
21554
21755
  }
21555
- )
21556
- ] }, field.name);
21557
- }) }) }),
21558
- primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
21559
- Button,
21560
- {
21561
- variant: action.variant === "primary" ? "primary" : "ghost",
21562
- size: "sm",
21563
- onClick: handleActionClick(action, itemData),
21564
- "data-testid": `action-${action.event}`,
21565
- "data-row-id": String(itemData.id),
21566
- children: [
21567
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21568
- action.label
21569
- ]
21570
- },
21571
- idx
21572
- )) }) })
21573
- ]
21574
- },
21575
- id
21576
- );
21577
- })
21578
- }
21579
- ),
21580
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21581
- Button,
21582
- {
21583
- variant: "ghost",
21584
- size: "sm",
21585
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21586
- children: [
21587
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21588
- t("common.showMore"),
21589
- " (",
21590
- allData.length - visibleCount,
21591
- " remaining)"
21592
- ]
21593
- }
21594
- ) }),
21595
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21596
- InfiniteScrollSentinel,
21597
- {
21598
- loadMoreEvent,
21599
- isLoading,
21600
- hasMore
21601
- }
21602
- )
21603
- ] });
21756
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21757
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21758
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21759
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21760
+ ] }),
21761
+ /* @__PURE__ */ jsx(
21762
+ Typography,
21763
+ {
21764
+ variant: field.variant === "caption" ? "caption" : "small",
21765
+ className: "text-right truncate max-w-[60%]",
21766
+ children: formatValue(value, field.format)
21767
+ }
21768
+ )
21769
+ ] }, field.name);
21770
+ }) }) }),
21771
+ primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
21772
+ Button,
21773
+ {
21774
+ variant: action.variant === "primary" ? "primary" : "ghost",
21775
+ size: "sm",
21776
+ onClick: handleActionClick(action, itemData),
21777
+ "data-testid": `action-${action.event}`,
21778
+ "data-row-id": String(itemData.id),
21779
+ children: [
21780
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21781
+ action.label
21782
+ ]
21783
+ },
21784
+ idx
21785
+ )) }) })
21786
+ ]
21787
+ },
21788
+ id
21789
+ )
21790
+ );
21791
+ })
21792
+ }
21793
+ ),
21794
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21795
+ Button,
21796
+ {
21797
+ variant: "ghost",
21798
+ size: "sm",
21799
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21800
+ children: [
21801
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21802
+ t("common.showMore"),
21803
+ " (",
21804
+ allData.length - visibleCount,
21805
+ " remaining)"
21806
+ ]
21807
+ }
21808
+ ) }),
21809
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21810
+ InfiniteScrollSentinel,
21811
+ {
21812
+ loadMoreEvent,
21813
+ isLoading,
21814
+ hasMore
21815
+ }
21816
+ )
21817
+ ] })
21818
+ );
21604
21819
  }
21605
21820
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
21606
21821
  var init_DataGrid = __esm({
@@ -21617,6 +21832,7 @@ var init_DataGrid = __esm({
21617
21832
  init_Button();
21618
21833
  init_Icon();
21619
21834
  init_InfiniteScrollSentinel();
21835
+ init_useDataDnd();
21620
21836
  dataGridLog = createLogger("almadar:ui:data-grid");
21621
21837
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
21622
21838
  "default",
@@ -21711,17 +21927,34 @@ function DataList({
21711
21927
  hasMore,
21712
21928
  children,
21713
21929
  pageSize = 5,
21714
- renderItem: schemaRenderItem
21930
+ renderItem: schemaRenderItem,
21931
+ dragGroup,
21932
+ accepts,
21933
+ sortable: sortableProp,
21934
+ dropEvent,
21935
+ reorderEvent: dndReorderEvent,
21936
+ dndItemIdField
21715
21937
  }) {
21716
21938
  const eventBus = useEventBus();
21717
21939
  const { t } = useTranslate();
21718
- const [visibleCount, setVisibleCount] = React136__default.useState(pageSize || Infinity);
21940
+ const [visibleCount, setVisibleCount] = React81__default.useState(pageSize || Infinity);
21719
21941
  const fieldDefs = fields ?? columns ?? [];
21720
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21942
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21943
+ const dnd = useDataDnd({
21944
+ items: allDataRaw,
21945
+ layout: "list",
21946
+ dragGroup,
21947
+ accepts,
21948
+ sortable: sortableProp,
21949
+ dropEvent,
21950
+ reorderEvent: dndReorderEvent,
21951
+ dndItemIdField
21952
+ });
21953
+ const allData = dnd.orderedItems;
21721
21954
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21722
21955
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21723
21956
  const hasRenderProp = typeof children === "function";
21724
- React136__default.useEffect(() => {
21957
+ React81__default.useEffect(() => {
21725
21958
  const renderItemTypeOf = typeof schemaRenderItem;
21726
21959
  const childrenTypeOf = typeof children;
21727
21960
  if (data.length > 0 && !hasRenderProp) {
@@ -21777,7 +22010,7 @@ function DataList({
21777
22010
  const items2 = data.map((item) => item);
21778
22011
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21779
22012
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21780
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
22013
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
21781
22014
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21782
22015
  group.items.map((itemData, index) => {
21783
22016
  const id = itemData.id || `${gi}-${index}`;
@@ -21825,18 +22058,112 @@ function DataList({
21825
22058
  }
21826
22059
  const items = data.map((item) => item);
21827
22060
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
22061
+ const idFieldName = dndItemIdField ?? "id";
21828
22062
  const renderItem = (itemData, index, isLast) => {
22063
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
22064
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21829
22065
  if (hasRenderProp) {
21830
22066
  const id2 = itemData.id || String(index);
21831
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21832
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21833
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21834
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21835
- HStack,
21836
- {
21837
- gap: "xs",
21838
- className: "flex-shrink-0",
21839
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
22067
+ return wrapDnd(
22068
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
22069
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
22070
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
22071
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
22072
+ HStack,
22073
+ {
22074
+ gap: "xs",
22075
+ className: "flex-shrink-0",
22076
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
22077
+ Button,
22078
+ {
22079
+ variant: action.variant ?? "ghost",
22080
+ size: "sm",
22081
+ onClick: handleActionClick(action, itemData),
22082
+ "data-testid": `action-${action.event}`,
22083
+ "data-row-id": String(itemData.id),
22084
+ className: cn(
22085
+ action.variant === "danger" && "text-error hover:bg-error/10"
22086
+ ),
22087
+ children: [
22088
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
22089
+ action.label
22090
+ ]
22091
+ },
22092
+ idx
22093
+ ))
22094
+ }
22095
+ )
22096
+ ] }),
22097
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
22098
+ ] }, id2)
22099
+ );
22100
+ }
22101
+ const id = itemData.id || String(index);
22102
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
22103
+ return wrapDnd(
22104
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
22105
+ /* @__PURE__ */ jsxs(
22106
+ Box,
22107
+ {
22108
+ className: cn(
22109
+ "group flex items-center gap-4 transition-all duration-200",
22110
+ isCompact ? "px-4 py-2" : "px-6 py-4",
22111
+ "hover:bg-muted/80",
22112
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
22113
+ ),
22114
+ children: [
22115
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
22116
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
22117
+ titleField?.icon && /* @__PURE__ */ jsx(
22118
+ Icon,
22119
+ {
22120
+ name: titleField.icon,
22121
+ size: isCompact ? "xs" : "sm",
22122
+ className: "text-primary flex-shrink-0"
22123
+ }
22124
+ ),
22125
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
22126
+ Typography,
22127
+ {
22128
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
22129
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
22130
+ children: String(titleValue)
22131
+ }
22132
+ ),
22133
+ badgeFields.map((field) => {
22134
+ const val = getNestedValue(itemData, field.name);
22135
+ if (val === void 0 || val === null) return null;
22136
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
22137
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
22138
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
22139
+ ] }, field.name);
22140
+ })
22141
+ ] }),
22142
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
22143
+ const value = getNestedValue(itemData, field.name);
22144
+ if (value === void 0 || value === null || value === "") return null;
22145
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
22146
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
22147
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
22148
+ field.label ?? fieldLabel3(field.name),
22149
+ ":"
22150
+ ] }),
22151
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
22152
+ ] }, field.name);
22153
+ }) }),
22154
+ progressFields.map((field) => {
22155
+ const value = getNestedValue(itemData, field.name);
22156
+ if (typeof value !== "number") return null;
22157
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
22158
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
22159
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
22160
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
22161
+ ] }),
22162
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
22163
+ ] }, field.name);
22164
+ })
22165
+ ] }),
22166
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21840
22167
  Button,
21841
22168
  {
21842
22169
  variant: action.variant ?? "ghost",
@@ -21853,141 +22180,56 @@ function DataList({
21853
22180
  ]
21854
22181
  },
21855
22182
  idx
21856
- ))
21857
- }
21858
- )
21859
- ] }),
22183
+ )) })
22184
+ ]
22185
+ }
22186
+ ),
21860
22187
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21861
- ] }, id2);
21862
- }
21863
- const id = itemData.id || String(index);
21864
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21865
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21866
- /* @__PURE__ */ jsxs(
21867
- Box,
21868
- {
21869
- className: cn(
21870
- "group flex items-center gap-4 transition-all duration-200",
21871
- isCompact ? "px-4 py-2" : "px-6 py-4",
21872
- "hover:bg-muted/80",
21873
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21874
- ),
21875
- children: [
21876
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21877
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21878
- titleField?.icon && /* @__PURE__ */ jsx(
21879
- Icon,
21880
- {
21881
- name: titleField.icon,
21882
- size: isCompact ? "xs" : "sm",
21883
- className: "text-primary flex-shrink-0"
21884
- }
21885
- ),
21886
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21887
- Typography,
21888
- {
21889
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21890
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21891
- children: String(titleValue)
21892
- }
21893
- ),
21894
- badgeFields.map((field) => {
21895
- const val = getNestedValue(itemData, field.name);
21896
- if (val === void 0 || val === null) return null;
21897
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21898
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21899
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21900
- ] }, field.name);
21901
- })
21902
- ] }),
21903
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21904
- const value = getNestedValue(itemData, field.name);
21905
- if (value === void 0 || value === null || value === "") return null;
21906
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21907
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21908
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21909
- field.label ?? fieldLabel3(field.name),
21910
- ":"
21911
- ] }),
21912
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21913
- ] }, field.name);
21914
- }) }),
21915
- progressFields.map((field) => {
21916
- const value = getNestedValue(itemData, field.name);
21917
- if (typeof value !== "number") return null;
21918
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21919
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21920
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21921
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21922
- ] }),
21923
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21924
- ] }, field.name);
21925
- })
21926
- ] }),
21927
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21928
- Button,
21929
- {
21930
- variant: action.variant ?? "ghost",
21931
- size: "sm",
21932
- onClick: handleActionClick(action, itemData),
21933
- "data-testid": `action-${action.event}`,
21934
- "data-row-id": String(itemData.id),
21935
- className: cn(
21936
- action.variant === "danger" && "text-error hover:bg-error/10"
21937
- ),
21938
- children: [
21939
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21940
- action.label
21941
- ]
21942
- },
21943
- idx
21944
- )) })
21945
- ]
21946
- }
21947
- ),
21948
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21949
- ] }, id);
22188
+ ] }, id)
22189
+ );
21950
22190
  };
21951
- return /* @__PURE__ */ jsxs(
21952
- Box,
21953
- {
21954
- className: cn(
21955
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21956
- !isCard && gapClass,
21957
- className
21958
- ),
21959
- children: [
21960
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
21961
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21962
- group.items.map(
21963
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
22191
+ return dnd.wrapContainer(
22192
+ /* @__PURE__ */ jsxs(
22193
+ Box,
22194
+ {
22195
+ className: cn(
22196
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
22197
+ !isCard && gapClass,
22198
+ className
22199
+ ),
22200
+ children: [
22201
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22202
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
22203
+ group.items.map(
22204
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
22205
+ )
22206
+ ] }, gi)),
22207
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
22208
+ Button,
22209
+ {
22210
+ variant: "ghost",
22211
+ size: "sm",
22212
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
22213
+ children: [
22214
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
22215
+ t("common.showMore"),
22216
+ " (",
22217
+ allData.length - visibleCount,
22218
+ " remaining)"
22219
+ ]
22220
+ }
22221
+ ) }),
22222
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
22223
+ InfiniteScrollSentinel,
22224
+ {
22225
+ loadMoreEvent,
22226
+ isLoading,
22227
+ hasMore
22228
+ }
21964
22229
  )
21965
- ] }, gi)),
21966
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21967
- Button,
21968
- {
21969
- variant: "ghost",
21970
- size: "sm",
21971
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21972
- children: [
21973
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21974
- t("common.showMore"),
21975
- " (",
21976
- allData.length - visibleCount,
21977
- " remaining)"
21978
- ]
21979
- }
21980
- ) }),
21981
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21982
- InfiniteScrollSentinel,
21983
- {
21984
- loadMoreEvent,
21985
- isLoading,
21986
- hasMore
21987
- }
21988
- )
21989
- ]
21990
- }
22230
+ ]
22231
+ }
22232
+ )
21991
22233
  );
21992
22234
  }
21993
22235
  var dataListLog;
@@ -22007,6 +22249,7 @@ var init_DataList = __esm({
22007
22249
  init_ProgressBar();
22008
22250
  init_Divider();
22009
22251
  init_InfiniteScrollSentinel();
22252
+ init_useDataDnd();
22010
22253
  dataListLog = createLogger("almadar:ui:data-list");
22011
22254
  DataList.displayName = "DataList";
22012
22255
  }
@@ -23257,7 +23500,7 @@ var init_WizardProgress = __esm({
23257
23500
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
23258
23501
  const isActive = index === currentStep;
23259
23502
  const isCompleted = index < currentStep;
23260
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
23503
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
23261
23504
  /* @__PURE__ */ jsx(
23262
23505
  "button",
23263
23506
  {
@@ -24168,7 +24411,7 @@ function InventoryGrid({
24168
24411
  const eventBus = useEventBus();
24169
24412
  const slotCount = totalSlots ?? items.length;
24170
24413
  const emptySlotCount = Math.max(0, slotCount - items.length);
24171
- const handleSelect = React136.useCallback(
24414
+ const handleSelect = React81.useCallback(
24172
24415
  (id) => {
24173
24416
  onSelect?.(id);
24174
24417
  if (selectEvent) {
@@ -24381,15 +24624,15 @@ function GameCanvas2D({
24381
24624
  fps = 60,
24382
24625
  className
24383
24626
  }) {
24384
- const canvasRef = React136.useRef(null);
24385
- const rafRef = React136.useRef(0);
24386
- const frameRef = React136.useRef(0);
24387
- const lastTimeRef = React136.useRef(0);
24388
- const onDrawRef = React136.useRef(onDraw);
24627
+ const canvasRef = React81.useRef(null);
24628
+ const rafRef = React81.useRef(0);
24629
+ const frameRef = React81.useRef(0);
24630
+ const lastTimeRef = React81.useRef(0);
24631
+ const onDrawRef = React81.useRef(onDraw);
24389
24632
  onDrawRef.current = onDraw;
24390
- const onTickRef = React136.useRef(onTick);
24633
+ const onTickRef = React81.useRef(onTick);
24391
24634
  onTickRef.current = onTick;
24392
- React136.useEffect(() => {
24635
+ React81.useEffect(() => {
24393
24636
  const canvas = canvasRef.current;
24394
24637
  if (!canvas) return;
24395
24638
  const ctx = canvas.getContext("2d");
@@ -24678,7 +24921,7 @@ function TurnPanel({
24678
24921
  className
24679
24922
  }) {
24680
24923
  const eventBus = useEventBus();
24681
- const handleAction = React136.useCallback(
24924
+ const handleAction = React81.useCallback(
24682
24925
  (event) => {
24683
24926
  if (event) {
24684
24927
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -24824,7 +25067,7 @@ function UnitCommandBar({
24824
25067
  className
24825
25068
  }) {
24826
25069
  const eventBus = useEventBus();
24827
- const handleCommand = React136.useCallback(
25070
+ const handleCommand = React81.useCallback(
24828
25071
  (event) => {
24829
25072
  if (event) {
24830
25073
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25309,7 +25552,7 @@ function GameMenu({
25309
25552
  } catch {
25310
25553
  }
25311
25554
  const eventBus = eventBusProp || eventBusFromHook;
25312
- const handleOptionClick = React136.useCallback(
25555
+ const handleOptionClick = React81.useCallback(
25313
25556
  (option) => {
25314
25557
  if (option.event && eventBus) {
25315
25558
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25423,7 +25666,7 @@ function GameOverScreen({
25423
25666
  } catch {
25424
25667
  }
25425
25668
  const eventBus = eventBusProp || eventBusFromHook;
25426
- const handleActionClick = React136.useCallback(
25669
+ const handleActionClick = React81.useCallback(
25427
25670
  (action) => {
25428
25671
  if (action.event && eventBus) {
25429
25672
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28050,7 +28293,7 @@ var init_StepFlow = __esm({
28050
28293
  className
28051
28294
  }) => {
28052
28295
  if (orientation === "vertical") {
28053
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React136__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
28296
+ 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: [
28054
28297
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
28055
28298
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28056
28299
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -28061,7 +28304,7 @@ var init_StepFlow = __esm({
28061
28304
  ] })
28062
28305
  ] }) }, index)) });
28063
28306
  }
28064
- 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(React136__default.Fragment, { children: [
28307
+ 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: [
28065
28308
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
28066
28309
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28067
28310
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28943,7 +29186,7 @@ var init_LikertScale = __esm({
28943
29186
  md: "text-base",
28944
29187
  lg: "text-lg"
28945
29188
  };
28946
- LikertScale = React136__default.forwardRef(
29189
+ LikertScale = React81__default.forwardRef(
28947
29190
  ({
28948
29191
  question,
28949
29192
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28955,7 +29198,7 @@ var init_LikertScale = __esm({
28955
29198
  variant = "radios",
28956
29199
  className
28957
29200
  }, ref) => {
28958
- const groupId = React136__default.useId();
29201
+ const groupId = React81__default.useId();
28959
29202
  const eventBus = useEventBus();
28960
29203
  const handleSelect = useCallback(
28961
29204
  (next) => {
@@ -31181,7 +31424,7 @@ var init_DocBreadcrumb = __esm({
31181
31424
  "aria-label": "Breadcrumb",
31182
31425
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
31183
31426
  const isLast = idx === items.length - 1;
31184
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
31427
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
31185
31428
  idx > 0 && /* @__PURE__ */ jsx(
31186
31429
  Icon,
31187
31430
  {
@@ -32071,7 +32314,7 @@ var init_MiniStateMachine = __esm({
32071
32314
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
32072
32315
  const tc = transitionCounts[s.name] ?? 0;
32073
32316
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
32074
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
32317
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
32075
32318
  /* @__PURE__ */ jsx(
32076
32319
  AvlState,
32077
32320
  {
@@ -33448,7 +33691,7 @@ var init_DocumentViewer = __esm({
33448
33691
  }
33449
33692
  });
33450
33693
  function extractTitle(children) {
33451
- if (!React136__default.isValidElement(children)) return void 0;
33694
+ if (!React81__default.isValidElement(children)) return void 0;
33452
33695
  const props = children.props;
33453
33696
  if (typeof props.title === "string") {
33454
33697
  return props.title;
@@ -33503,7 +33746,7 @@ function LinearView({
33503
33746
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
33504
33747
  const isDone = i < currentIdx;
33505
33748
  const isCurrent = i === currentIdx;
33506
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
33749
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
33507
33750
  i > 0 && /* @__PURE__ */ jsx(
33508
33751
  Typography,
33509
33752
  {
@@ -34403,12 +34646,12 @@ var init_Form = __esm({
34403
34646
  const isSchemaEntity = isOrbitalEntitySchema(entity);
34404
34647
  const resolvedEntity = isSchemaEntity ? entity : void 0;
34405
34648
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
34406
- const normalizedInitialData = React136__default.useMemo(() => {
34649
+ const normalizedInitialData = React81__default.useMemo(() => {
34407
34650
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
34408
34651
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
34409
34652
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
34410
34653
  }, [entity, initialData]);
34411
- const entityDerivedFields = React136__default.useMemo(() => {
34654
+ const entityDerivedFields = React81__default.useMemo(() => {
34412
34655
  if (fields && fields.length > 0) return void 0;
34413
34656
  if (!resolvedEntity) return void 0;
34414
34657
  return resolvedEntity.fields.map(
@@ -34427,16 +34670,16 @@ var init_Form = __esm({
34427
34670
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
34428
34671
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
34429
34672
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
34430
- const [formData, setFormData] = React136__default.useState(
34673
+ const [formData, setFormData] = React81__default.useState(
34431
34674
  normalizedInitialData
34432
34675
  );
34433
- const [collapsedSections, setCollapsedSections] = React136__default.useState(
34676
+ const [collapsedSections, setCollapsedSections] = React81__default.useState(
34434
34677
  /* @__PURE__ */ new Set()
34435
34678
  );
34436
- const [submitError, setSubmitError] = React136__default.useState(null);
34437
- const formRef = React136__default.useRef(null);
34679
+ const [submitError, setSubmitError] = React81__default.useState(null);
34680
+ const formRef = React81__default.useRef(null);
34438
34681
  const formMode = props.mode;
34439
- const mountedRef = React136__default.useRef(false);
34682
+ const mountedRef = React81__default.useRef(false);
34440
34683
  if (!mountedRef.current) {
34441
34684
  mountedRef.current = true;
34442
34685
  debug("forms", "mount", {
@@ -34449,7 +34692,7 @@ var init_Form = __esm({
34449
34692
  });
34450
34693
  }
34451
34694
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
34452
- const evalContext = React136__default.useMemo(
34695
+ const evalContext = React81__default.useMemo(
34453
34696
  () => ({
34454
34697
  formValues: formData,
34455
34698
  globalVariables: externalContext?.globalVariables ?? {},
@@ -34458,7 +34701,7 @@ var init_Form = __esm({
34458
34701
  }),
34459
34702
  [formData, externalContext]
34460
34703
  );
34461
- React136__default.useEffect(() => {
34704
+ React81__default.useEffect(() => {
34462
34705
  debug("forms", "initialData-sync", {
34463
34706
  mode: formMode,
34464
34707
  normalizedInitialData,
@@ -34469,7 +34712,7 @@ var init_Form = __esm({
34469
34712
  setFormData(normalizedInitialData);
34470
34713
  }
34471
34714
  }, [normalizedInitialData]);
34472
- const processCalculations = React136__default.useCallback(
34715
+ const processCalculations = React81__default.useCallback(
34473
34716
  (changedFieldId, newFormData) => {
34474
34717
  if (!hiddenCalculations.length) return;
34475
34718
  const context = {
@@ -34494,7 +34737,7 @@ var init_Form = __esm({
34494
34737
  },
34495
34738
  [hiddenCalculations, externalContext, eventBus]
34496
34739
  );
34497
- const checkViolations = React136__default.useCallback(
34740
+ const checkViolations = React81__default.useCallback(
34498
34741
  (changedFieldId, newFormData) => {
34499
34742
  if (!violationTriggers.length) return;
34500
34743
  const context = {
@@ -34532,7 +34775,7 @@ var init_Form = __esm({
34532
34775
  processCalculations(name, newFormData);
34533
34776
  checkViolations(name, newFormData);
34534
34777
  };
34535
- const isFieldVisible = React136__default.useCallback(
34778
+ const isFieldVisible = React81__default.useCallback(
34536
34779
  (fieldName) => {
34537
34780
  const condition = conditionalFields[fieldName];
34538
34781
  if (!condition) return true;
@@ -34540,7 +34783,7 @@ var init_Form = __esm({
34540
34783
  },
34541
34784
  [conditionalFields, evalContext]
34542
34785
  );
34543
- const isSectionVisible = React136__default.useCallback(
34786
+ const isSectionVisible = React81__default.useCallback(
34544
34787
  (section) => {
34545
34788
  if (!section.condition) return true;
34546
34789
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -34616,7 +34859,7 @@ var init_Form = __esm({
34616
34859
  eventBus.emit(`UI:${onCancel}`);
34617
34860
  }
34618
34861
  };
34619
- const renderField = React136__default.useCallback(
34862
+ const renderField = React81__default.useCallback(
34620
34863
  (field) => {
34621
34864
  const fieldName = field.name || field.field;
34622
34865
  if (!fieldName) return null;
@@ -34637,7 +34880,7 @@ var init_Form = __esm({
34637
34880
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
34638
34881
  );
34639
34882
  const effectiveFields = entityDerivedFields ?? fields;
34640
- const normalizedFields = React136__default.useMemo(() => {
34883
+ const normalizedFields = React81__default.useMemo(() => {
34641
34884
  if (!effectiveFields || effectiveFields.length === 0) return [];
34642
34885
  return effectiveFields.map((field) => {
34643
34886
  if (typeof field === "string") {
@@ -34659,7 +34902,7 @@ var init_Form = __esm({
34659
34902
  return field;
34660
34903
  });
34661
34904
  }, [effectiveFields, resolvedEntity]);
34662
- const schemaFields = React136__default.useMemo(() => {
34905
+ const schemaFields = React81__default.useMemo(() => {
34663
34906
  if (normalizedFields.length === 0) return null;
34664
34907
  if (isDebugEnabled()) {
34665
34908
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -34669,7 +34912,7 @@ var init_Form = __esm({
34669
34912
  }
34670
34913
  return normalizedFields.map(renderField).filter(Boolean);
34671
34914
  }, [normalizedFields, renderField, entityName, conditionalFields]);
34672
- const sectionElements = React136__default.useMemo(() => {
34915
+ const sectionElements = React81__default.useMemo(() => {
34673
34916
  if (!sections || sections.length === 0) return null;
34674
34917
  return sections.map((section) => {
34675
34918
  if (!isSectionVisible(section)) {
@@ -36395,7 +36638,7 @@ var init_List = __esm({
36395
36638
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
36396
36639
  return [];
36397
36640
  }, [entity]);
36398
- const getItemActions = React136__default.useCallback(
36641
+ const getItemActions = React81__default.useCallback(
36399
36642
  (item) => {
36400
36643
  if (!itemActions) return [];
36401
36644
  if (typeof itemActions === "function") {
@@ -36868,7 +37111,7 @@ var init_MediaGallery = __esm({
36868
37111
  [selectable, selectedItems, selectionEvent, eventBus]
36869
37112
  );
36870
37113
  const entityData = Array.isArray(entity) ? entity : [];
36871
- const items = React136__default.useMemo(() => {
37114
+ const items = React81__default.useMemo(() => {
36872
37115
  if (propItems) return propItems;
36873
37116
  if (entityData.length === 0) return [];
36874
37117
  return entityData.map((record, idx) => ({
@@ -37032,7 +37275,7 @@ var init_MediaGallery = __esm({
37032
37275
  }
37033
37276
  });
37034
37277
  function extractTitle2(children) {
37035
- if (!React136__default.isValidElement(children)) return void 0;
37278
+ if (!React81__default.isValidElement(children)) return void 0;
37036
37279
  const props = children.props;
37037
37280
  if (typeof props.title === "string") {
37038
37281
  return props.title;
@@ -37745,7 +37988,7 @@ var init_PageHeader = __esm({
37745
37988
  info: "bg-info/10 text-info"
37746
37989
  };
37747
37990
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37748
- 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(React136__default.Fragment, { children: [
37991
+ 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: [
37749
37992
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37750
37993
  crumb.href ? /* @__PURE__ */ jsx(
37751
37994
  "a",
@@ -38041,7 +38284,7 @@ var init_debugRegistry = __esm({
38041
38284
  }
38042
38285
  });
38043
38286
  function useDebugData() {
38044
- const [data, setData] = React136.useState(() => ({
38287
+ const [data, setData] = React81.useState(() => ({
38045
38288
  traits: [],
38046
38289
  ticks: [],
38047
38290
  guards: [],
@@ -38055,7 +38298,7 @@ function useDebugData() {
38055
38298
  },
38056
38299
  lastUpdate: Date.now()
38057
38300
  }));
38058
- React136.useEffect(() => {
38301
+ React81.useEffect(() => {
38059
38302
  const updateData = () => {
38060
38303
  setData({
38061
38304
  traits: getAllTraits(),
@@ -38164,12 +38407,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
38164
38407
  return positions;
38165
38408
  }
38166
38409
  function WalkMinimap() {
38167
- const [walkStep, setWalkStep] = React136.useState(null);
38168
- const [traits2, setTraits] = React136.useState([]);
38169
- const [coveredEdges, setCoveredEdges] = React136.useState([]);
38170
- const [completedTraits, setCompletedTraits] = React136.useState(/* @__PURE__ */ new Set());
38171
- const prevTraitRef = React136.useRef(null);
38172
- React136.useEffect(() => {
38410
+ const [walkStep, setWalkStep] = React81.useState(null);
38411
+ const [traits2, setTraits] = React81.useState([]);
38412
+ const [coveredEdges, setCoveredEdges] = React81.useState([]);
38413
+ const [completedTraits, setCompletedTraits] = React81.useState(/* @__PURE__ */ new Set());
38414
+ const prevTraitRef = React81.useRef(null);
38415
+ React81.useEffect(() => {
38173
38416
  const interval = setInterval(() => {
38174
38417
  const w = window;
38175
38418
  const step = w.__orbitalWalkStep;
@@ -38616,15 +38859,15 @@ var init_EntitiesTab = __esm({
38616
38859
  }
38617
38860
  });
38618
38861
  function EventFlowTab({ events: events2 }) {
38619
- const [filter, setFilter] = React136.useState("all");
38620
- const containerRef = React136.useRef(null);
38621
- const [autoScroll, setAutoScroll] = React136.useState(true);
38622
- React136.useEffect(() => {
38862
+ const [filter, setFilter] = React81.useState("all");
38863
+ const containerRef = React81.useRef(null);
38864
+ const [autoScroll, setAutoScroll] = React81.useState(true);
38865
+ React81.useEffect(() => {
38623
38866
  if (autoScroll && containerRef.current) {
38624
38867
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38625
38868
  }
38626
38869
  }, [events2.length, autoScroll]);
38627
- const filteredEvents = React136.useMemo(() => {
38870
+ const filteredEvents = React81.useMemo(() => {
38628
38871
  if (filter === "all") return events2;
38629
38872
  return events2.filter((e) => e.type === filter);
38630
38873
  }, [events2, filter]);
@@ -38743,7 +38986,7 @@ var init_EventFlowTab = __esm({
38743
38986
  }
38744
38987
  });
38745
38988
  function GuardsPanel({ guards }) {
38746
- const [filter, setFilter] = React136.useState("all");
38989
+ const [filter, setFilter] = React81.useState("all");
38747
38990
  if (guards.length === 0) {
38748
38991
  return /* @__PURE__ */ jsx(
38749
38992
  EmptyState,
@@ -38756,7 +38999,7 @@ function GuardsPanel({ guards }) {
38756
38999
  }
38757
39000
  const passedCount = guards.filter((g) => g.result).length;
38758
39001
  const failedCount = guards.length - passedCount;
38759
- const filteredGuards = React136.useMemo(() => {
39002
+ const filteredGuards = React81.useMemo(() => {
38760
39003
  if (filter === "all") return guards;
38761
39004
  if (filter === "passed") return guards.filter((g) => g.result);
38762
39005
  return guards.filter((g) => !g.result);
@@ -38917,10 +39160,10 @@ function EffectBadge({ effect }) {
38917
39160
  ] });
38918
39161
  }
38919
39162
  function TransitionTimeline({ transitions }) {
38920
- const containerRef = React136.useRef(null);
38921
- const [autoScroll, setAutoScroll] = React136.useState(true);
38922
- const [expandedId, setExpandedId] = React136.useState(null);
38923
- React136.useEffect(() => {
39163
+ const containerRef = React81.useRef(null);
39164
+ const [autoScroll, setAutoScroll] = React81.useState(true);
39165
+ const [expandedId, setExpandedId] = React81.useState(null);
39166
+ React81.useEffect(() => {
38924
39167
  if (autoScroll && containerRef.current) {
38925
39168
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38926
39169
  }
@@ -39206,9 +39449,9 @@ function getAllEvents(traits2) {
39206
39449
  }
39207
39450
  function EventDispatcherTab({ traits: traits2, schema }) {
39208
39451
  const eventBus = useEventBus();
39209
- const [log12, setLog] = React136.useState([]);
39210
- const prevStatesRef = React136.useRef(/* @__PURE__ */ new Map());
39211
- React136.useEffect(() => {
39452
+ const [log12, setLog] = React81.useState([]);
39453
+ const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
39454
+ React81.useEffect(() => {
39212
39455
  for (const trait of traits2) {
39213
39456
  const prev = prevStatesRef.current.get(trait.id);
39214
39457
  if (prev && prev !== trait.currentState) {
@@ -39378,10 +39621,10 @@ function VerifyModePanel({
39378
39621
  serverCount,
39379
39622
  localCount
39380
39623
  }) {
39381
- const [expanded, setExpanded] = React136.useState(true);
39382
- const scrollRef = React136.useRef(null);
39383
- const prevCountRef = React136.useRef(0);
39384
- React136.useEffect(() => {
39624
+ const [expanded, setExpanded] = React81.useState(true);
39625
+ const scrollRef = React81.useRef(null);
39626
+ const prevCountRef = React81.useRef(0);
39627
+ React81.useEffect(() => {
39385
39628
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
39386
39629
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
39387
39630
  }
@@ -39447,10 +39690,10 @@ function RuntimeDebugger({
39447
39690
  defaultTab,
39448
39691
  schema
39449
39692
  }) {
39450
- const [isCollapsed, setIsCollapsed] = React136.useState(mode === "verify" ? true : defaultCollapsed);
39451
- const [isVisible, setIsVisible] = React136.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39693
+ const [isCollapsed, setIsCollapsed] = React81.useState(mode === "verify" ? true : defaultCollapsed);
39694
+ const [isVisible, setIsVisible] = React81.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39452
39695
  const debugData = useDebugData();
39453
- React136.useEffect(() => {
39696
+ React81.useEffect(() => {
39454
39697
  if (mode === "inline") return;
39455
39698
  return onDebugToggle((enabled) => {
39456
39699
  setIsVisible(enabled);
@@ -39459,7 +39702,7 @@ function RuntimeDebugger({
39459
39702
  }
39460
39703
  });
39461
39704
  }, [mode]);
39462
- React136.useEffect(() => {
39705
+ React81.useEffect(() => {
39463
39706
  if (mode === "inline") return;
39464
39707
  const handleKeyDown = (e) => {
39465
39708
  if (e.key === "`" && isVisible) {
@@ -40008,7 +40251,7 @@ function SequenceBar({
40008
40251
  onSlotRemove(index);
40009
40252
  }, [onSlotRemove, playing]);
40010
40253
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
40011
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
40254
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
40012
40255
  i > 0 && /* @__PURE__ */ jsx(
40013
40256
  Typography,
40014
40257
  {
@@ -41409,7 +41652,7 @@ var init_StatCard = __esm({
41409
41652
  const labelToUse = propLabel ?? propTitle;
41410
41653
  const eventBus = useEventBus();
41411
41654
  const { t } = useTranslate();
41412
- const handleActionClick = React136__default.useCallback(() => {
41655
+ const handleActionClick = React81__default.useCallback(() => {
41413
41656
  if (action?.event) {
41414
41657
  eventBus.emit(`UI:${action.event}`, {});
41415
41658
  }
@@ -41420,7 +41663,7 @@ var init_StatCard = __esm({
41420
41663
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41421
41664
  const isLoading = externalLoading ?? false;
41422
41665
  const error = externalError;
41423
- const computeMetricValue = React136__default.useCallback(
41666
+ const computeMetricValue = React81__default.useCallback(
41424
41667
  (metric, items) => {
41425
41668
  if (metric.value !== void 0) {
41426
41669
  return metric.value;
@@ -41459,7 +41702,7 @@ var init_StatCard = __esm({
41459
41702
  },
41460
41703
  []
41461
41704
  );
41462
- const schemaStats = React136__default.useMemo(() => {
41705
+ const schemaStats = React81__default.useMemo(() => {
41463
41706
  if (!metrics || metrics.length === 0) return null;
41464
41707
  return metrics.map((metric) => ({
41465
41708
  label: metric.label,
@@ -41467,7 +41710,7 @@ var init_StatCard = __esm({
41467
41710
  format: metric.format
41468
41711
  }));
41469
41712
  }, [metrics, data, computeMetricValue]);
41470
- const calculatedTrend = React136__default.useMemo(() => {
41713
+ const calculatedTrend = React81__default.useMemo(() => {
41471
41714
  if (manualTrend !== void 0) return manualTrend;
41472
41715
  if (previousValue === void 0 || currentValue === void 0)
41473
41716
  return void 0;
@@ -42603,7 +42846,7 @@ var init_Timeline = __esm({
42603
42846
  }) => {
42604
42847
  const { t } = useTranslate();
42605
42848
  const entityData = Array.isArray(entity) ? entity : [];
42606
- const items = React136__default.useMemo(() => {
42849
+ const items = React81__default.useMemo(() => {
42607
42850
  if (propItems) return propItems;
42608
42851
  if (entityData.length === 0) return [];
42609
42852
  return entityData.map((record, idx) => {
@@ -42710,7 +42953,7 @@ var init_Timeline = __esm({
42710
42953
  }
42711
42954
  });
42712
42955
  function extractToastProps(children) {
42713
- if (!React136__default.isValidElement(children)) {
42956
+ if (!React81__default.isValidElement(children)) {
42714
42957
  if (typeof children === "string") {
42715
42958
  return { message: children };
42716
42959
  }
@@ -42748,7 +42991,7 @@ var init_ToastSlot = __esm({
42748
42991
  eventBus.emit("UI:CLOSE");
42749
42992
  };
42750
42993
  if (!isVisible) return null;
42751
- const isCustomContent = React136__default.isValidElement(children) && !message;
42994
+ const isCustomContent = React81__default.isValidElement(children) && !message;
42752
42995
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42753
42996
  Toast,
42754
42997
  {
@@ -43017,7 +43260,7 @@ var init_WizardContainer = __esm({
43017
43260
  const isCompleted = index < currentStep;
43018
43261
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
43019
43262
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
43020
- return /* @__PURE__ */ jsxs(React136__default.Fragment, { children: [
43263
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
43021
43264
  /* @__PURE__ */ jsx(
43022
43265
  Button,
43023
43266
  {
@@ -43399,12 +43642,12 @@ var init_WorldMapTemplate = __esm({
43399
43642
  }
43400
43643
  });
43401
43644
  function lazyThree(name, loader) {
43402
- const Lazy = React136__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43645
+ const Lazy = React81__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43403
43646
  function ThreeWrapper(props) {
43404
- return React136__default.createElement(
43405
- React136__default.Suspense,
43647
+ return React81__default.createElement(
43648
+ React81__default.Suspense,
43406
43649
  { fallback: null },
43407
- React136__default.createElement(Lazy, props)
43650
+ React81__default.createElement(Lazy, props)
43408
43651
  );
43409
43652
  }
43410
43653
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -44008,7 +44251,7 @@ function SuspenseConfigProvider({
44008
44251
  config,
44009
44252
  children
44010
44253
  }) {
44011
- return React136__default.createElement(
44254
+ return React81__default.createElement(
44012
44255
  SuspenseConfigContext.Provider,
44013
44256
  { value: config },
44014
44257
  children
@@ -44491,7 +44734,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44491
44734
  const key = `${parentId}-${index}-trait:${traitName}`;
44492
44735
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44493
44736
  }
44494
- return /* @__PURE__ */ jsx(React136__default.Fragment, { children: child }, `${parentId}-${index}`);
44737
+ return /* @__PURE__ */ jsx(React81__default.Fragment, { children: child }, `${parentId}-${index}`);
44495
44738
  }
44496
44739
  if (!child || typeof child !== "object") return null;
44497
44740
  const childId = `${parentId}-${index}`;
@@ -44528,14 +44771,14 @@ function isPatternConfig(value) {
44528
44771
  if (value === null || value === void 0) return false;
44529
44772
  if (typeof value !== "object") return false;
44530
44773
  if (Array.isArray(value)) return false;
44531
- if (React136__default.isValidElement(value)) return false;
44774
+ if (React81__default.isValidElement(value)) return false;
44532
44775
  if (value instanceof Date) return false;
44533
44776
  if (typeof value === "function") return false;
44534
44777
  const record = value;
44535
44778
  return "type" in record && typeof record.type === "string";
44536
44779
  }
44537
44780
  function isPlainConfigObject(value) {
44538
- if (React136__default.isValidElement(value)) return false;
44781
+ if (React81__default.isValidElement(value)) return false;
44539
44782
  if (value instanceof Date) return false;
44540
44783
  const proto = Object.getPrototypeOf(value);
44541
44784
  return proto === Object.prototype || proto === null;