@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 React135 from 'react';
2
- import React135__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React80 from 'react';
2
+ import React80__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, VerificationProvider } from '@almadar/ui/providers';
4
4
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -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 { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, 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
  import { StateMachineManager, createContextFromBindings, interpolateValue, collectDeclaredConfigDefaults, createServerEffectHandlers, EffectExecutor, InMemoryPersistence } from '@almadar/runtime';
@@ -968,7 +971,7 @@ var init_Box = __esm({
968
971
  fixed: "fixed",
969
972
  sticky: "sticky"
970
973
  };
971
- Box = React135__default.forwardRef(
974
+ Box = React80__default.forwardRef(
972
975
  ({
973
976
  padding,
974
977
  paddingX,
@@ -1667,7 +1670,7 @@ function resolveIconProp(value, sizeClass) {
1667
1670
  const IconComp = value;
1668
1671
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1669
1672
  }
1670
- if (React135__default.isValidElement(value)) {
1673
+ if (React80__default.isValidElement(value)) {
1671
1674
  return value;
1672
1675
  }
1673
1676
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1743,7 +1746,7 @@ var init_Button = __esm({
1743
1746
  md: "h-4 w-4",
1744
1747
  lg: "h-5 w-5"
1745
1748
  };
1746
- Button = React135__default.forwardRef(
1749
+ Button = React80__default.forwardRef(
1747
1750
  ({
1748
1751
  className,
1749
1752
  variant = "primary",
@@ -1846,7 +1849,7 @@ var init_Badge = __esm({
1846
1849
  md: "px-2.5 py-1 text-sm",
1847
1850
  lg: "px-3 py-1.5 text-base"
1848
1851
  };
1849
- Badge = React135__default.forwardRef(
1852
+ Badge = React80__default.forwardRef(
1850
1853
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1851
1854
  const iconSizes3 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1852
1855
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2140,7 +2143,7 @@ var init_SvgFlow = __esm({
2140
2143
  opacity = 1,
2141
2144
  className
2142
2145
  }) => {
2143
- const markerId = React135__default.useMemo(() => {
2146
+ const markerId = React80__default.useMemo(() => {
2144
2147
  flowIdCounter += 1;
2145
2148
  return `almadar-flow-arrow-${flowIdCounter}`;
2146
2149
  }, []);
@@ -2683,7 +2686,7 @@ var init_SvgRing = __esm({
2683
2686
  className,
2684
2687
  label
2685
2688
  }) => {
2686
- const gradientId = React135__default.useMemo(() => {
2689
+ const gradientId = React80__default.useMemo(() => {
2687
2690
  ringIdCounter += 1;
2688
2691
  return `almadar-ring-glow-${ringIdCounter}`;
2689
2692
  }, []);
@@ -2844,7 +2847,7 @@ var Input;
2844
2847
  var init_Input = __esm({
2845
2848
  "components/atoms/Input.tsx"() {
2846
2849
  init_cn();
2847
- Input = React135__default.forwardRef(
2850
+ Input = React80__default.forwardRef(
2848
2851
  ({
2849
2852
  className,
2850
2853
  inputType,
@@ -2962,7 +2965,7 @@ var Label;
2962
2965
  var init_Label = __esm({
2963
2966
  "components/atoms/Label.tsx"() {
2964
2967
  init_cn();
2965
- Label = React135__default.forwardRef(
2968
+ Label = React80__default.forwardRef(
2966
2969
  ({ className, required, children, ...props }, ref) => {
2967
2970
  return /* @__PURE__ */ jsxs(
2968
2971
  "label",
@@ -2988,7 +2991,7 @@ var Textarea;
2988
2991
  var init_Textarea = __esm({
2989
2992
  "components/atoms/Textarea.tsx"() {
2990
2993
  init_cn();
2991
- Textarea = React135__default.forwardRef(
2994
+ Textarea = React80__default.forwardRef(
2992
2995
  ({ className, error, ...props }, ref) => {
2993
2996
  return /* @__PURE__ */ jsx(
2994
2997
  "textarea",
@@ -3017,7 +3020,7 @@ var Select;
3017
3020
  var init_Select = __esm({
3018
3021
  "components/atoms/Select.tsx"() {
3019
3022
  init_cn();
3020
- Select = React135__default.forwardRef(
3023
+ Select = React80__default.forwardRef(
3021
3024
  ({ className, options, placeholder, error, ...props }, ref) => {
3022
3025
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3023
3026
  /* @__PURE__ */ jsxs(
@@ -3059,7 +3062,7 @@ var Checkbox;
3059
3062
  var init_Checkbox = __esm({
3060
3063
  "components/atoms/Checkbox.tsx"() {
3061
3064
  init_cn();
3062
- Checkbox = React135__default.forwardRef(
3065
+ Checkbox = React80__default.forwardRef(
3063
3066
  ({ className, label, id, ...props }, ref) => {
3064
3067
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3065
3068
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -3141,7 +3144,7 @@ var init_Card = __esm({
3141
3144
  md: "shadow",
3142
3145
  lg: "shadow-lg"
3143
3146
  };
3144
- Card = React135__default.forwardRef(
3147
+ Card = React80__default.forwardRef(
3145
3148
  ({
3146
3149
  className,
3147
3150
  variant = "bordered",
@@ -3177,9 +3180,9 @@ var init_Card = __esm({
3177
3180
  }
3178
3181
  );
3179
3182
  Card.displayName = "Card";
3180
- CardHeader = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3183
+ CardHeader = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3181
3184
  CardHeader.displayName = "CardHeader";
3182
- CardTitle = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3185
+ CardTitle = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3183
3186
  "h3",
3184
3187
  {
3185
3188
  ref,
@@ -3192,11 +3195,11 @@ var init_Card = __esm({
3192
3195
  }
3193
3196
  ));
3194
3197
  CardTitle.displayName = "CardTitle";
3195
- CardContent = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3198
+ CardContent = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3196
3199
  CardContent.displayName = "CardContent";
3197
3200
  CardBody = CardContent;
3198
3201
  CardBody.displayName = "CardBody";
3199
- CardFooter = React135__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3202
+ CardFooter = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3200
3203
  "div",
3201
3204
  {
3202
3205
  ref,
@@ -3251,7 +3254,7 @@ var init_FilterPill = __esm({
3251
3254
  md: "w-3.5 h-3.5",
3252
3255
  lg: "w-4 h-4"
3253
3256
  };
3254
- FilterPill = React135__default.forwardRef(
3257
+ FilterPill = React80__default.forwardRef(
3255
3258
  ({
3256
3259
  className,
3257
3260
  variant = "default",
@@ -3330,7 +3333,7 @@ var init_Spinner = __esm({
3330
3333
  md: "h-6 w-6",
3331
3334
  lg: "h-8 w-8"
3332
3335
  };
3333
- Spinner = React135__default.forwardRef(
3336
+ Spinner = React80__default.forwardRef(
3334
3337
  ({ className, size = "md", ...props }, ref) => {
3335
3338
  return /* @__PURE__ */ jsx(
3336
3339
  "div",
@@ -3778,7 +3781,7 @@ var Radio;
3778
3781
  var init_Radio = __esm({
3779
3782
  "components/atoms/Radio.tsx"() {
3780
3783
  init_cn();
3781
- Radio = React135__default.forwardRef(
3784
+ Radio = React80__default.forwardRef(
3782
3785
  ({
3783
3786
  label,
3784
3787
  helperText,
@@ -3889,7 +3892,7 @@ var init_Switch = __esm({
3889
3892
  "components/atoms/Switch.tsx"() {
3890
3893
  "use client";
3891
3894
  init_cn();
3892
- Switch = React135.forwardRef(
3895
+ Switch = React80.forwardRef(
3893
3896
  ({
3894
3897
  checked,
3895
3898
  defaultChecked = false,
@@ -3900,10 +3903,10 @@ var init_Switch = __esm({
3900
3903
  name,
3901
3904
  className
3902
3905
  }, ref) => {
3903
- const [isChecked, setIsChecked] = React135.useState(
3906
+ const [isChecked, setIsChecked] = React80.useState(
3904
3907
  checked !== void 0 ? checked : defaultChecked
3905
3908
  );
3906
- React135.useEffect(() => {
3909
+ React80.useEffect(() => {
3907
3910
  if (checked !== void 0) {
3908
3911
  setIsChecked(checked);
3909
3912
  }
@@ -4449,8 +4452,8 @@ var init_LawReferenceTooltip = __esm({
4449
4452
  position = "top",
4450
4453
  className
4451
4454
  }) => {
4452
- const [isVisible, setIsVisible] = React135__default.useState(false);
4453
- const timeoutRef = React135__default.useRef(null);
4455
+ const [isVisible, setIsVisible] = React80__default.useState(false);
4456
+ const timeoutRef = React80__default.useRef(null);
4454
4457
  const handleMouseEnter = () => {
4455
4458
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4456
4459
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4459,7 +4462,7 @@ var init_LawReferenceTooltip = __esm({
4459
4462
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4460
4463
  setIsVisible(false);
4461
4464
  };
4462
- React135__default.useEffect(() => {
4465
+ React80__default.useEffect(() => {
4463
4466
  return () => {
4464
4467
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4465
4468
  };
@@ -4669,7 +4672,7 @@ var init_StatusDot = __esm({
4669
4672
  md: "w-2.5 h-2.5",
4670
4673
  lg: "w-3 h-3"
4671
4674
  };
4672
- StatusDot = React135__default.forwardRef(
4675
+ StatusDot = React80__default.forwardRef(
4673
4676
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4674
4677
  return /* @__PURE__ */ jsx(
4675
4678
  "span",
@@ -4722,7 +4725,7 @@ var init_TrendIndicator = __esm({
4722
4725
  down: TrendingDown,
4723
4726
  flat: ArrowRight
4724
4727
  };
4725
- TrendIndicator = React135__default.forwardRef(
4728
+ TrendIndicator = React80__default.forwardRef(
4726
4729
  ({
4727
4730
  className,
4728
4731
  value,
@@ -4789,7 +4792,7 @@ var init_RangeSlider = __esm({
4789
4792
  md: "w-4 h-4",
4790
4793
  lg: "w-5 h-5"
4791
4794
  };
4792
- RangeSlider = React135__default.forwardRef(
4795
+ RangeSlider = React80__default.forwardRef(
4793
4796
  ({
4794
4797
  className,
4795
4798
  min = 0,
@@ -5322,7 +5325,7 @@ var init_ContentSection = __esm({
5322
5325
  md: "py-16",
5323
5326
  lg: "py-24"
5324
5327
  };
5325
- ContentSection = React135__default.forwardRef(
5328
+ ContentSection = React80__default.forwardRef(
5326
5329
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5327
5330
  return /* @__PURE__ */ jsx(
5328
5331
  Box,
@@ -5856,7 +5859,7 @@ var init_AnimatedReveal = __esm({
5856
5859
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5857
5860
  "none": {}
5858
5861
  };
5859
- AnimatedReveal = React135__default.forwardRef(
5862
+ AnimatedReveal = React80__default.forwardRef(
5860
5863
  ({
5861
5864
  trigger = "scroll",
5862
5865
  animation = "fade-up",
@@ -6016,7 +6019,7 @@ var init_AnimatedGraphic = __esm({
6016
6019
  "components/atoms/AnimatedGraphic.tsx"() {
6017
6020
  "use client";
6018
6021
  init_cn();
6019
- AnimatedGraphic = React135__default.forwardRef(
6022
+ AnimatedGraphic = React80__default.forwardRef(
6020
6023
  ({
6021
6024
  src,
6022
6025
  svgContent,
@@ -6039,7 +6042,7 @@ var init_AnimatedGraphic = __esm({
6039
6042
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6040
6043
  const resolvedSvg = svgContent ?? fetchedSvg;
6041
6044
  const prevAnimateRef = useRef(animate);
6042
- const setRef = React135__default.useCallback(
6045
+ const setRef = React80__default.useCallback(
6043
6046
  (node) => {
6044
6047
  containerRef.current = node;
6045
6048
  if (typeof ref === "function") ref(node);
@@ -6264,9 +6267,9 @@ function ScoreDisplay({
6264
6267
  ...rest
6265
6268
  }) {
6266
6269
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
6267
- const [displayValue, setDisplayValue] = React135.useState(resolvedValue);
6268
- const [isAnimating, setIsAnimating] = React135.useState(false);
6269
- React135.useEffect(() => {
6270
+ const [displayValue, setDisplayValue] = React80.useState(resolvedValue);
6271
+ const [isAnimating, setIsAnimating] = React80.useState(false);
6272
+ React80.useEffect(() => {
6270
6273
  if (!animated || displayValue === resolvedValue) {
6271
6274
  setDisplayValue(resolvedValue);
6272
6275
  return;
@@ -6336,9 +6339,9 @@ function ControlButton({
6336
6339
  className
6337
6340
  }) {
6338
6341
  const eventBus = useEventBus();
6339
- const [isPressed, setIsPressed] = React135.useState(false);
6342
+ const [isPressed, setIsPressed] = React80.useState(false);
6340
6343
  const actualPressed = pressed ?? isPressed;
6341
- const handlePointerDown = React135.useCallback(
6344
+ const handlePointerDown = React80.useCallback(
6342
6345
  (e) => {
6343
6346
  e.preventDefault();
6344
6347
  if (disabled) return;
@@ -6348,7 +6351,7 @@ function ControlButton({
6348
6351
  },
6349
6352
  [disabled, pressEvent, eventBus, onPress]
6350
6353
  );
6351
- const handlePointerUp = React135.useCallback(
6354
+ const handlePointerUp = React80.useCallback(
6352
6355
  (e) => {
6353
6356
  e.preventDefault();
6354
6357
  if (disabled) return;
@@ -6358,7 +6361,7 @@ function ControlButton({
6358
6361
  },
6359
6362
  [disabled, releaseEvent, eventBus, onRelease]
6360
6363
  );
6361
- const handlePointerLeave = React135.useCallback(
6364
+ const handlePointerLeave = React80.useCallback(
6362
6365
  (e) => {
6363
6366
  if (isPressed) {
6364
6367
  setIsPressed(false);
@@ -7264,9 +7267,9 @@ function MiniMap({
7264
7267
  viewportRect,
7265
7268
  className
7266
7269
  }) {
7267
- const canvasRef = React135.useRef(null);
7268
- const frameRef = React135.useRef(0);
7269
- React135.useEffect(() => {
7270
+ const canvasRef = React80.useRef(null);
7271
+ const frameRef = React80.useRef(0);
7272
+ React80.useEffect(() => {
7270
7273
  const canvas = canvasRef.current;
7271
7274
  if (!canvas) return;
7272
7275
  const ctx = canvas.getContext("2d");
@@ -7429,7 +7432,7 @@ var init_ErrorBoundary = __esm({
7429
7432
  "use client";
7430
7433
  init_cn();
7431
7434
  init_ErrorState();
7432
- ErrorBoundary = class extends React135__default.Component {
7435
+ ErrorBoundary = class extends React80__default.Component {
7433
7436
  constructor(props) {
7434
7437
  super(props);
7435
7438
  __publicField(this, "reset", () => {
@@ -8504,8 +8507,8 @@ var init_Tooltip = __esm({
8504
8507
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
8505
8508
  };
8506
8509
  }, []);
8507
- const triggerElement = React135__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8508
- const trigger = React135__default.cloneElement(triggerElement, {
8510
+ const triggerElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8511
+ const trigger = React80__default.cloneElement(triggerElement, {
8509
8512
  ref: triggerRef,
8510
8513
  onMouseEnter: handleMouseEnter,
8511
8514
  onMouseLeave: handleMouseLeave,
@@ -8626,8 +8629,8 @@ var init_Popover = __esm({
8626
8629
  onMouseEnter: handleOpen,
8627
8630
  onMouseLeave: handleClose
8628
8631
  };
8629
- const childElement = React135__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8630
- const triggerElement = React135__default.cloneElement(
8632
+ const childElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8633
+ const triggerElement = React80__default.cloneElement(
8631
8634
  childElement,
8632
8635
  {
8633
8636
  ref: triggerRef,
@@ -8744,8 +8747,8 @@ var init_Menu = __esm({
8744
8747
  "bottom-start": "top-full left-0 mt-2",
8745
8748
  "bottom-end": "top-full right-0 mt-2"
8746
8749
  };
8747
- const triggerChild = React135__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8748
- const triggerElement = React135__default.cloneElement(
8750
+ const triggerChild = React80__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
8751
+ const triggerElement = React80__default.cloneElement(
8749
8752
  triggerChild,
8750
8753
  {
8751
8754
  ref: triggerRef,
@@ -9161,7 +9164,7 @@ var init_MapView = __esm({
9161
9164
  shadowSize: [41, 41]
9162
9165
  });
9163
9166
  L.Marker.prototype.options.icon = defaultIcon;
9164
- const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React135__default;
9167
+ const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React80__default;
9165
9168
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9166
9169
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9167
9170
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -9407,7 +9410,7 @@ function InputPattern({
9407
9410
  fieldName
9408
9411
  }) {
9409
9412
  const { emit } = useEventBus();
9410
- const [localValue, setLocalValue] = React135__default.useState(value);
9413
+ const [localValue, setLocalValue] = React80__default.useState(value);
9411
9414
  const handleChange = (e) => {
9412
9415
  setLocalValue(e.target.value);
9413
9416
  if (onChange) {
@@ -9445,7 +9448,7 @@ function TextareaPattern({
9445
9448
  fieldName
9446
9449
  }) {
9447
9450
  const { emit } = useEventBus();
9448
- const [localValue, setLocalValue] = React135__default.useState(value);
9451
+ const [localValue, setLocalValue] = React80__default.useState(value);
9449
9452
  const handleChange = (e) => {
9450
9453
  setLocalValue(e.target.value);
9451
9454
  if (onChange) {
@@ -9477,7 +9480,7 @@ function SelectPattern({
9477
9480
  fieldName
9478
9481
  }) {
9479
9482
  const { emit } = useEventBus();
9480
- const [localValue, setLocalValue] = React135__default.useState(value);
9483
+ const [localValue, setLocalValue] = React80__default.useState(value);
9481
9484
  const handleChange = (e) => {
9482
9485
  setLocalValue(e.target.value);
9483
9486
  if (onChange) {
@@ -9506,7 +9509,7 @@ function CheckboxPattern({
9506
9509
  className
9507
9510
  }) {
9508
9511
  const { emit } = useEventBus();
9509
- const [localChecked, setLocalChecked] = React135__default.useState(checked);
9512
+ const [localChecked, setLocalChecked] = React80__default.useState(checked);
9510
9513
  const handleChange = (e) => {
9511
9514
  setLocalChecked(e.target.checked);
9512
9515
  if (onChange) {
@@ -9737,8 +9740,8 @@ function ActionButtons({
9737
9740
  disabled
9738
9741
  }) {
9739
9742
  const eventBus = useEventBus();
9740
- const [activeButtons, setActiveButtons] = React135.useState(/* @__PURE__ */ new Set());
9741
- const handlePress = React135.useCallback(
9743
+ const [activeButtons, setActiveButtons] = React80.useState(/* @__PURE__ */ new Set());
9744
+ const handlePress = React80.useCallback(
9742
9745
  (id) => {
9743
9746
  setActiveButtons((prev) => new Set(prev).add(id));
9744
9747
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9746,7 +9749,7 @@ function ActionButtons({
9746
9749
  },
9747
9750
  [actionEvent, eventBus, onAction]
9748
9751
  );
9749
- const handleRelease = React135.useCallback(
9752
+ const handleRelease = React80.useCallback(
9750
9753
  (id) => {
9751
9754
  setActiveButtons((prev) => {
9752
9755
  const next = new Set(prev);
@@ -12609,7 +12612,7 @@ var init_MarkdownContent = __esm({
12609
12612
  init_Box();
12610
12613
  init_useTranslate();
12611
12614
  init_cn();
12612
- MarkdownContent = React135__default.memo(
12615
+ MarkdownContent = React80__default.memo(
12613
12616
  ({ content, direction, className }) => {
12614
12617
  const { t: _t } = useTranslate();
12615
12618
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12827,7 +12830,7 @@ var init_CodeBlock = __esm({
12827
12830
  log7 = createLogger("almadar:ui:markdown-code");
12828
12831
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12829
12832
  HIDDEN_LINE_NUMBERS = { display: "none" };
12830
- CodeBlock = React135__default.memo(
12833
+ CodeBlock = React80__default.memo(
12831
12834
  ({
12832
12835
  code: rawCode,
12833
12836
  language = "text",
@@ -14086,7 +14089,7 @@ var init_StateMachineView = __esm({
14086
14089
  style: { top: title ? 30 : 0 },
14087
14090
  children: [
14088
14091
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
14089
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React135__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14092
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React80__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14090
14093
  StateNode,
14091
14094
  {
14092
14095
  state,
@@ -20463,7 +20466,7 @@ function CraftingRecipe({
20463
20466
  className
20464
20467
  }) {
20465
20468
  const eventBus = useEventBus();
20466
- const handleCraft = React135.useCallback(() => {
20469
+ const handleCraft = React80.useCallback(() => {
20467
20470
  onCraft?.();
20468
20471
  if (craftEvent) {
20469
20472
  eventBus.emit(craftEvent, { output: output.label });
@@ -20480,7 +20483,7 @@ function CraftingRecipe({
20480
20483
  children: [
20481
20484
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
20482
20485
  const hasSufficient = ingredient.available >= ingredient.required;
20483
- return /* @__PURE__ */ jsxs(React135.Fragment, { children: [
20486
+ return /* @__PURE__ */ jsxs(React80.Fragment, { children: [
20484
20487
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
20485
20488
  ItemSlot,
20486
20489
  {
@@ -20543,8 +20546,8 @@ function DPad({
20543
20546
  }) {
20544
20547
  const eventBus = useEventBus();
20545
20548
  const sizes = sizeMap15[size];
20546
- const [activeDirections, setActiveDirections] = React135.useState(/* @__PURE__ */ new Set());
20547
- const handlePress = React135.useCallback(
20549
+ const [activeDirections, setActiveDirections] = React80.useState(/* @__PURE__ */ new Set());
20550
+ const handlePress = React80.useCallback(
20548
20551
  (direction) => {
20549
20552
  setActiveDirections((prev) => new Set(prev).add(direction));
20550
20553
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -20552,7 +20555,7 @@ function DPad({
20552
20555
  },
20553
20556
  [directionEvent, eventBus, onDirection]
20554
20557
  );
20555
- const handleRelease = React135.useCallback(
20558
+ const handleRelease = React80.useCallback(
20556
20559
  (direction) => {
20557
20560
  setActiveDirections((prev) => {
20558
20561
  const next = new Set(prev);
@@ -21038,6 +21041,192 @@ var init_DashboardLayout = __esm({
21038
21041
  NavLink.displayName = "NavLink";
21039
21042
  }
21040
21043
  });
21044
+ function useDataDnd(args) {
21045
+ const {
21046
+ dragGroup,
21047
+ accepts,
21048
+ sortable,
21049
+ dropEvent,
21050
+ reorderEvent,
21051
+ dndItemIdField = "id",
21052
+ items,
21053
+ layout
21054
+ } = args;
21055
+ const enabled = Boolean(dragGroup || accepts || sortable);
21056
+ const eventBus = useEventBus();
21057
+ const parentRoot = React80__default.useContext(RootCtx);
21058
+ const isRoot = enabled && parentRoot === null;
21059
+ const [localOrder, setLocalOrder] = React80__default.useState(null);
21060
+ const orderedItems = localOrder ?? items;
21061
+ React80__default.useEffect(() => {
21062
+ setLocalOrder(null);
21063
+ }, [items]);
21064
+ const itemIds = React80__default.useMemo(
21065
+ () => orderedItems.map((it, idx) => {
21066
+ const raw = it[dndItemIdField];
21067
+ return raw ?? `__idx_${idx}`;
21068
+ }),
21069
+ [orderedItems, dndItemIdField]
21070
+ );
21071
+ const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
21072
+ const registerZone = React80__default.useCallback((zoneId2, meta2) => {
21073
+ zonesRef.current.set(zoneId2, meta2);
21074
+ }, []);
21075
+ const unregisterZone = React80__default.useCallback((zoneId2) => {
21076
+ zonesRef.current.delete(zoneId2);
21077
+ }, []);
21078
+ const zoneId = React80__default.useId();
21079
+ const ownGroup = dragGroup ?? accepts ?? zoneId;
21080
+ const meta = React80__default.useMemo(
21081
+ () => ({ group: ownGroup, dropEvent, reorderEvent, itemIds }),
21082
+ [ownGroup, dropEvent, reorderEvent, itemIds]
21083
+ );
21084
+ React80__default.useEffect(() => {
21085
+ const target = isRoot ? null : parentRoot;
21086
+ if (!target) {
21087
+ zonesRef.current.set(zoneId, meta);
21088
+ return () => zonesRef.current.delete(zoneId);
21089
+ }
21090
+ target.registerZone(zoneId, meta);
21091
+ return () => target.unregisterZone(zoneId);
21092
+ }, [parentRoot, isRoot, zoneId, meta]);
21093
+ const sensors = useSensors(
21094
+ useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
21095
+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
21096
+ );
21097
+ const findZoneByItem = React80__default.useCallback(
21098
+ (id) => {
21099
+ for (const z of zonesRef.current.values()) {
21100
+ if (z.itemIds.includes(id)) return z;
21101
+ }
21102
+ return void 0;
21103
+ },
21104
+ []
21105
+ );
21106
+ const findZoneByGroup = React80__default.useCallback(
21107
+ (group) => {
21108
+ for (const z of zonesRef.current.values()) {
21109
+ if (z.group === group) return z;
21110
+ }
21111
+ return void 0;
21112
+ },
21113
+ []
21114
+ );
21115
+ const handleDragEnd = React80__default.useCallback(
21116
+ (event) => {
21117
+ const { active, over } = event;
21118
+ if (!over) return;
21119
+ const sourceZone = findZoneByItem(active.id);
21120
+ const overData = over.data?.current;
21121
+ const targetGroup = overData?.dndGroup;
21122
+ if (!sourceZone || !targetGroup) return;
21123
+ const targetZone = findZoneByGroup(targetGroup);
21124
+ if (!targetZone) return;
21125
+ if (sourceZone.group !== targetZone.group) {
21126
+ if (targetZone.dropEvent) {
21127
+ const newIndex2 = targetZone.itemIds.indexOf(over.id);
21128
+ eventBus.emit(targetZone.dropEvent, {
21129
+ id: String(active.id),
21130
+ sourceGroup: sourceZone.group,
21131
+ targetGroup: targetZone.group,
21132
+ newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
21133
+ });
21134
+ }
21135
+ return;
21136
+ }
21137
+ const oldIndex = sourceZone.itemIds.indexOf(active.id);
21138
+ const newIndex = sourceZone.itemIds.indexOf(over.id);
21139
+ if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) return;
21140
+ if (sourceZone.group === ownGroup) {
21141
+ const reordered = arrayMove(orderedItems, oldIndex, newIndex);
21142
+ setLocalOrder(reordered);
21143
+ }
21144
+ if (sourceZone.reorderEvent) {
21145
+ eventBus.emit(sourceZone.reorderEvent, {
21146
+ id: String(active.id),
21147
+ oldIndex,
21148
+ newIndex
21149
+ });
21150
+ }
21151
+ },
21152
+ [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21153
+ );
21154
+ const SortableItem = React80__default.useCallback(
21155
+ ({ id, children }) => {
21156
+ const {
21157
+ attributes,
21158
+ listeners: listeners6,
21159
+ setNodeRef,
21160
+ transform,
21161
+ transition,
21162
+ isDragging
21163
+ } = useSortable({ id, data: { dndGroup: ownGroup } });
21164
+ const style = {
21165
+ transform: CSS.Transform.toString(transform),
21166
+ transition,
21167
+ opacity: isDragging ? 0.4 : 1,
21168
+ cursor: enabled ? "grab" : void 0
21169
+ };
21170
+ return /* @__PURE__ */ jsx(
21171
+ Box,
21172
+ {
21173
+ className: "touch-none",
21174
+ ref: setNodeRef,
21175
+ style,
21176
+ ...attributes,
21177
+ ...listeners6,
21178
+ children
21179
+ }
21180
+ );
21181
+ },
21182
+ [ownGroup, enabled]
21183
+ );
21184
+ const DropZoneShell = ({ children }) => {
21185
+ const { setNodeRef, isOver } = useDroppable({
21186
+ id: `dnd-zone-${zoneId}`,
21187
+ data: { dndGroup: ownGroup }
21188
+ });
21189
+ return /* @__PURE__ */ jsx(
21190
+ Box,
21191
+ {
21192
+ ref: setNodeRef,
21193
+ className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg" : void 0,
21194
+ children
21195
+ }
21196
+ );
21197
+ };
21198
+ const rootContextValue = React80__default.useMemo(
21199
+ () => ({ registerZone, unregisterZone }),
21200
+ [registerZone, unregisterZone]
21201
+ );
21202
+ const wrapContainer = React80__default.useCallback(
21203
+ (children) => {
21204
+ if (!enabled) return children;
21205
+ const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21206
+ const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21207
+ if (isRoot) {
21208
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: inner }) });
21209
+ }
21210
+ return inner;
21211
+ },
21212
+ [enabled, layout, sensors, handleDragEnd, itemIds, isRoot, rootContextValue]
21213
+ );
21214
+ return {
21215
+ enabled,
21216
+ wrapContainer,
21217
+ SortableItem,
21218
+ orderedItems
21219
+ };
21220
+ }
21221
+ var RootCtx;
21222
+ var init_useDataDnd = __esm({
21223
+ "components/molecules/useDataDnd.tsx"() {
21224
+ "use client";
21225
+ init_useEventBus();
21226
+ init_Box();
21227
+ RootCtx = React80__default.createContext(null);
21228
+ }
21229
+ });
21041
21230
  function fieldLabel2(key) {
21042
21231
  return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21043
21232
  }
@@ -21101,14 +21290,31 @@ function DataGrid({
21101
21290
  hasMore,
21102
21291
  children,
21103
21292
  pageSize = 0,
21104
- renderItem: schemaRenderItem
21293
+ renderItem: schemaRenderItem,
21294
+ dragGroup,
21295
+ accepts,
21296
+ sortable,
21297
+ dropEvent,
21298
+ reorderEvent,
21299
+ dndItemIdField
21105
21300
  }) {
21106
21301
  const eventBus = useEventBus();
21107
21302
  const { t } = useTranslate();
21108
21303
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
21109
21304
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
21110
21305
  const fieldDefs = fields ?? columns ?? [];
21111
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21306
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21307
+ const dnd = useDataDnd({
21308
+ items: allDataRaw,
21309
+ layout: "grid",
21310
+ dragGroup,
21311
+ accepts,
21312
+ sortable,
21313
+ dropEvent,
21314
+ reorderEvent,
21315
+ dndItemIdField
21316
+ });
21317
+ const allData = dnd.orderedItems;
21112
21318
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21113
21319
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21114
21320
  const toggleSelection = useCallback((id) => {
@@ -21180,196 +21386,205 @@ function DataGrid({
21180
21386
  const allIds = data.map((item, i) => item.id || String(i));
21181
21387
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
21182
21388
  const someSelected = selectedIds.size > 0;
21183
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21184
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21389
+ const idFieldName = dndItemIdField ?? "id";
21390
+ return dnd.wrapContainer(
21391
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21392
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
21393
+ /* @__PURE__ */ jsx(
21394
+ "input",
21395
+ {
21396
+ type: "checkbox",
21397
+ checked: allSelected,
21398
+ onChange: toggleAll,
21399
+ className: "w-4 h-4 accent-primary",
21400
+ "aria-label": "Select all"
21401
+ }
21402
+ ),
21403
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21404
+ selectedIds.size,
21405
+ " ",
21406
+ t("common.selected") || "selected"
21407
+ ] })
21408
+ ] }),
21185
21409
  /* @__PURE__ */ jsx(
21186
- "input",
21410
+ Box,
21187
21411
  {
21188
- type: "checkbox",
21189
- checked: allSelected,
21190
- onChange: toggleAll,
21191
- className: "w-4 h-4 accent-primary",
21192
- "aria-label": "Select all"
21193
- }
21194
- ),
21195
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
21196
- selectedIds.size,
21197
- " ",
21198
- t("common.selected") || "selected"
21199
- ] })
21200
- ] }),
21201
- /* @__PURE__ */ jsx(
21202
- Box,
21203
- {
21204
- className: cn("grid", gapStyles6[gap], colsClass, className),
21205
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21206
- children: data.map((item, index) => {
21207
- const itemData = item;
21208
- const id = itemData.id || String(index);
21209
- const isSelected = selectedIds.has(id);
21210
- if (hasRenderProp) {
21211
- return /* @__PURE__ */ jsx(
21212
- Box,
21213
- {
21214
- "data-entity-row": true,
21215
- "data-entity-id": id,
21216
- className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21217
- children: children(itemData, index)
21218
- },
21219
- id
21220
- );
21221
- }
21222
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21223
- return /* @__PURE__ */ jsxs(
21224
- Box,
21225
- {
21226
- "data-entity-row": true,
21227
- "data-entity-id": id,
21228
- className: cn(
21229
- "bg-card rounded-lg",
21230
- "border border-border",
21231
- "shadow-sm hover:shadow-lg",
21232
- "hover:border-primary transition-all",
21233
- "flex flex-col",
21234
- isSelected && "ring-2 ring-primary border-primary"
21235
- ),
21236
- children: [
21237
- imageField && (() => {
21238
- const imgUrl = getNestedValue(itemData, imageField);
21239
- if (!imgUrl || typeof imgUrl !== "string") return null;
21240
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21241
- "img",
21242
- {
21243
- src: imgUrl,
21244
- alt: titleValue !== void 0 ? String(titleValue) : "",
21245
- className: "w-full h-full object-cover",
21246
- loading: "lazy"
21247
- }
21248
- ) });
21249
- })(),
21250
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21251
- selectable && /* @__PURE__ */ jsx(
21252
- "input",
21253
- {
21254
- type: "checkbox",
21255
- checked: isSelected,
21256
- onChange: () => toggleSelection(id),
21257
- onClick: (e) => e.stopPropagation(),
21258
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21259
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21260
- }
21412
+ className: cn("grid", gapStyles6[gap], colsClass, className),
21413
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
21414
+ children: data.map((item, index) => {
21415
+ const itemData = item;
21416
+ const id = itemData.id || String(index);
21417
+ const isSelected = selectedIds.has(id);
21418
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21419
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21420
+ if (hasRenderProp) {
21421
+ return wrapDnd(
21422
+ /* @__PURE__ */ jsx(
21423
+ Box,
21424
+ {
21425
+ "data-entity-row": true,
21426
+ "data-entity-id": id,
21427
+ className: cn(isSelected && "ring-2 ring-primary rounded-lg"),
21428
+ children: children(itemData, index)
21429
+ },
21430
+ id
21431
+ )
21432
+ );
21433
+ }
21434
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21435
+ return wrapDnd(
21436
+ /* @__PURE__ */ jsxs(
21437
+ Box,
21438
+ {
21439
+ "data-entity-row": true,
21440
+ "data-entity-id": id,
21441
+ className: cn(
21442
+ "bg-card rounded-lg",
21443
+ "border border-border",
21444
+ "shadow-sm hover:shadow-lg",
21445
+ "hover:border-primary transition-all",
21446
+ "flex flex-col",
21447
+ isSelected && "ring-2 ring-primary border-primary"
21261
21448
  ),
21262
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21263
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21264
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21265
- /* @__PURE__ */ jsx(
21266
- Typography,
21449
+ children: [
21450
+ imageField && (() => {
21451
+ const imgUrl = getNestedValue(itemData, imageField);
21452
+ if (!imgUrl || typeof imgUrl !== "string") return null;
21453
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
21454
+ "img",
21267
21455
  {
21268
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21269
- className: "font-semibold truncate",
21270
- children: String(titleValue)
21456
+ src: imgUrl,
21457
+ alt: titleValue !== void 0 ? String(titleValue) : "",
21458
+ className: "w-full h-full object-cover",
21459
+ loading: "lazy"
21271
21460
  }
21272
- )
21273
- ] }),
21274
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21275
- const val = getNestedValue(itemData, field.name);
21276
- if (val === void 0 || val === null) return null;
21277
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21278
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21279
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21280
- ] }, field.name);
21281
- }) })
21282
- ] }),
21283
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21284
- Button,
21285
- {
21286
- variant: "ghost",
21287
- size: "sm",
21288
- onClick: handleActionClick(action, itemData),
21289
- "data-testid": `action-${action.event}`,
21290
- "data-row-id": String(itemData.id),
21291
- className: "text-error hover:text-error hover:bg-error/10 px-2",
21292
- children: [
21293
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21294
- action.label
21295
- ]
21296
- },
21297
- idx
21298
- )) })
21299
- ] }) }),
21300
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21301
- const value = getNestedValue(itemData, field.name);
21302
- if (value === void 0 || value === null || value === "") return null;
21303
- if (field.format === "boolean") {
21304
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21305
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21306
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21307
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21461
+ ) });
21462
+ })(),
21463
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
21464
+ selectable && /* @__PURE__ */ jsx(
21465
+ "input",
21466
+ {
21467
+ type: "checkbox",
21468
+ checked: isSelected,
21469
+ onChange: () => toggleSelection(id),
21470
+ onClick: (e) => e.stopPropagation(),
21471
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
21472
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
21473
+ }
21474
+ ),
21475
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
21476
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21477
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
21478
+ /* @__PURE__ */ jsx(
21479
+ Typography,
21480
+ {
21481
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21482
+ className: "font-semibold truncate",
21483
+ children: String(titleValue)
21484
+ }
21485
+ )
21486
+ ] }),
21487
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
21488
+ const val = getNestedValue(itemData, field.name);
21489
+ if (val === void 0 || val === null) return null;
21490
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21491
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21492
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
21493
+ ] }, field.name);
21494
+ }) })
21308
21495
  ] }),
21309
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21310
- ] }, field.name);
21311
- }
21312
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21313
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21314
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21315
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21316
- ] }),
21317
- /* @__PURE__ */ jsx(
21318
- Typography,
21319
- {
21320
- variant: field.variant === "caption" ? "caption" : "small",
21321
- className: "text-right truncate max-w-[60%]",
21322
- children: formatValue(value, field.format)
21496
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
21497
+ Button,
21498
+ {
21499
+ variant: "ghost",
21500
+ size: "sm",
21501
+ onClick: handleActionClick(action, itemData),
21502
+ "data-testid": `action-${action.event}`,
21503
+ "data-row-id": String(itemData.id),
21504
+ className: "text-error hover:text-error hover:bg-error/10 px-2",
21505
+ children: [
21506
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
21507
+ action.label
21508
+ ]
21509
+ },
21510
+ idx
21511
+ )) })
21512
+ ] }) }),
21513
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
21514
+ const value = getNestedValue(itemData, field.name);
21515
+ if (value === void 0 || value === null || value === "") return null;
21516
+ if (field.format === "boolean") {
21517
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21518
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21519
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21520
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21521
+ ] }),
21522
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
21523
+ ] }, field.name);
21323
21524
  }
21324
- )
21325
- ] }, field.name);
21326
- }) }) }),
21327
- 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(
21328
- Button,
21329
- {
21330
- variant: action.variant === "primary" ? "primary" : "ghost",
21331
- size: "sm",
21332
- onClick: handleActionClick(action, itemData),
21333
- "data-testid": `action-${action.event}`,
21334
- "data-row-id": String(itemData.id),
21335
- children: [
21336
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21337
- action.label
21338
- ]
21339
- },
21340
- idx
21341
- )) }) })
21342
- ]
21343
- },
21344
- id
21345
- );
21346
- })
21347
- }
21348
- ),
21349
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21350
- Button,
21351
- {
21352
- variant: "ghost",
21353
- size: "sm",
21354
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21355
- children: [
21356
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21357
- t("common.showMore"),
21358
- " (",
21359
- allData.length - visibleCount,
21360
- " remaining)"
21361
- ]
21362
- }
21363
- ) }),
21364
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21365
- InfiniteScrollSentinel,
21366
- {
21367
- loadMoreEvent,
21368
- isLoading,
21369
- hasMore
21370
- }
21371
- )
21372
- ] });
21525
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
21526
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21527
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21528
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
21529
+ ] }),
21530
+ /* @__PURE__ */ jsx(
21531
+ Typography,
21532
+ {
21533
+ variant: field.variant === "caption" ? "caption" : "small",
21534
+ className: "text-right truncate max-w-[60%]",
21535
+ children: formatValue(value, field.format)
21536
+ }
21537
+ )
21538
+ ] }, field.name);
21539
+ }) }) }),
21540
+ 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(
21541
+ Button,
21542
+ {
21543
+ variant: action.variant === "primary" ? "primary" : "ghost",
21544
+ size: "sm",
21545
+ onClick: handleActionClick(action, itemData),
21546
+ "data-testid": `action-${action.event}`,
21547
+ "data-row-id": String(itemData.id),
21548
+ children: [
21549
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21550
+ action.label
21551
+ ]
21552
+ },
21553
+ idx
21554
+ )) }) })
21555
+ ]
21556
+ },
21557
+ id
21558
+ )
21559
+ );
21560
+ })
21561
+ }
21562
+ ),
21563
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21564
+ Button,
21565
+ {
21566
+ variant: "ghost",
21567
+ size: "sm",
21568
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21569
+ children: [
21570
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21571
+ t("common.showMore"),
21572
+ " (",
21573
+ allData.length - visibleCount,
21574
+ " remaining)"
21575
+ ]
21576
+ }
21577
+ ) }),
21578
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21579
+ InfiniteScrollSentinel,
21580
+ {
21581
+ loadMoreEvent,
21582
+ isLoading,
21583
+ hasMore
21584
+ }
21585
+ )
21586
+ ] })
21587
+ );
21373
21588
  }
21374
21589
  var dataGridLog, BADGE_VARIANTS, gapStyles6;
21375
21590
  var init_DataGrid = __esm({
@@ -21386,6 +21601,7 @@ var init_DataGrid = __esm({
21386
21601
  init_Button();
21387
21602
  init_Icon();
21388
21603
  init_InfiniteScrollSentinel();
21604
+ init_useDataDnd();
21389
21605
  dataGridLog = createLogger("almadar:ui:data-grid");
21390
21606
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
21391
21607
  "default",
@@ -21480,17 +21696,34 @@ function DataList({
21480
21696
  hasMore,
21481
21697
  children,
21482
21698
  pageSize = 5,
21483
- renderItem: schemaRenderItem
21699
+ renderItem: schemaRenderItem,
21700
+ dragGroup,
21701
+ accepts,
21702
+ sortable: sortableProp,
21703
+ dropEvent,
21704
+ reorderEvent: dndReorderEvent,
21705
+ dndItemIdField
21484
21706
  }) {
21485
21707
  const eventBus = useEventBus();
21486
21708
  const { t } = useTranslate();
21487
- const [visibleCount, setVisibleCount] = React135__default.useState(pageSize || Infinity);
21709
+ const [visibleCount, setVisibleCount] = React80__default.useState(pageSize || Infinity);
21488
21710
  const fieldDefs = fields ?? columns ?? [];
21489
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
21711
+ const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21712
+ const dnd = useDataDnd({
21713
+ items: allDataRaw,
21714
+ layout: "list",
21715
+ dragGroup,
21716
+ accepts,
21717
+ sortable: sortableProp,
21718
+ dropEvent,
21719
+ reorderEvent: dndReorderEvent,
21720
+ dndItemIdField
21721
+ });
21722
+ const allData = dnd.orderedItems;
21490
21723
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21491
21724
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21492
21725
  const hasRenderProp = typeof children === "function";
21493
- React135__default.useEffect(() => {
21726
+ React80__default.useEffect(() => {
21494
21727
  const renderItemTypeOf = typeof schemaRenderItem;
21495
21728
  const childrenTypeOf = typeof children;
21496
21729
  if (data.length > 0 && !hasRenderProp) {
@@ -21546,7 +21779,7 @@ function DataList({
21546
21779
  const items2 = data.map((item) => item);
21547
21780
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21548
21781
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21549
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21782
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21550
21783
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21551
21784
  group.items.map((itemData, index) => {
21552
21785
  const id = itemData.id || `${gi}-${index}`;
@@ -21594,18 +21827,112 @@ function DataList({
21594
21827
  }
21595
21828
  const items = data.map((item) => item);
21596
21829
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
21830
+ const idFieldName = dndItemIdField ?? "id";
21597
21831
  const renderItem = (itemData, index, isLast) => {
21832
+ const dndId = itemData[idFieldName] ?? `__idx_${index}`;
21833
+ const wrapDnd = (node) => dnd.enabled ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
21598
21834
  if (hasRenderProp) {
21599
21835
  const id2 = itemData.id || String(index);
21600
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21601
- /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21602
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21603
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21604
- HStack,
21605
- {
21606
- gap: "xs",
21607
- className: "flex-shrink-0",
21608
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21836
+ return wrapDnd(
21837
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
21838
+ /* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
21839
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
21840
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
21841
+ HStack,
21842
+ {
21843
+ gap: "xs",
21844
+ className: "flex-shrink-0",
21845
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21846
+ Button,
21847
+ {
21848
+ variant: action.variant ?? "ghost",
21849
+ size: "sm",
21850
+ onClick: handleActionClick(action, itemData),
21851
+ "data-testid": `action-${action.event}`,
21852
+ "data-row-id": String(itemData.id),
21853
+ className: cn(
21854
+ action.variant === "danger" && "text-error hover:bg-error/10"
21855
+ ),
21856
+ children: [
21857
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21858
+ action.label
21859
+ ]
21860
+ },
21861
+ idx
21862
+ ))
21863
+ }
21864
+ )
21865
+ ] }),
21866
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21867
+ ] }, id2)
21868
+ );
21869
+ }
21870
+ const id = itemData.id || String(index);
21871
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21872
+ return wrapDnd(
21873
+ /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21874
+ /* @__PURE__ */ jsxs(
21875
+ Box,
21876
+ {
21877
+ className: cn(
21878
+ "group flex items-center gap-4 transition-all duration-200",
21879
+ isCompact ? "px-4 py-2" : "px-6 py-4",
21880
+ "hover:bg-muted/80",
21881
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21882
+ ),
21883
+ children: [
21884
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21885
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21886
+ titleField?.icon && /* @__PURE__ */ jsx(
21887
+ Icon,
21888
+ {
21889
+ name: titleField.icon,
21890
+ size: isCompact ? "xs" : "sm",
21891
+ className: "text-primary flex-shrink-0"
21892
+ }
21893
+ ),
21894
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21895
+ Typography,
21896
+ {
21897
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
21898
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21899
+ children: String(titleValue)
21900
+ }
21901
+ ),
21902
+ badgeFields.map((field) => {
21903
+ const val = getNestedValue(itemData, field.name);
21904
+ if (val === void 0 || val === null) return null;
21905
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21906
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21907
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21908
+ ] }, field.name);
21909
+ })
21910
+ ] }),
21911
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21912
+ const value = getNestedValue(itemData, field.name);
21913
+ if (value === void 0 || value === null || value === "") return null;
21914
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21915
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21916
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21917
+ field.label ?? fieldLabel3(field.name),
21918
+ ":"
21919
+ ] }),
21920
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21921
+ ] }, field.name);
21922
+ }) }),
21923
+ progressFields.map((field) => {
21924
+ const value = getNestedValue(itemData, field.name);
21925
+ if (typeof value !== "number") return null;
21926
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21927
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21928
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21929
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21930
+ ] }),
21931
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21932
+ ] }, field.name);
21933
+ })
21934
+ ] }),
21935
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21609
21936
  Button,
21610
21937
  {
21611
21938
  variant: action.variant ?? "ghost",
@@ -21622,141 +21949,56 @@ function DataList({
21622
21949
  ]
21623
21950
  },
21624
21951
  idx
21625
- ))
21626
- }
21627
- )
21628
- ] }),
21952
+ )) })
21953
+ ]
21954
+ }
21955
+ ),
21629
21956
  isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21630
- ] }, id2);
21631
- }
21632
- const id = itemData.id || String(index);
21633
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
21634
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
21635
- /* @__PURE__ */ jsxs(
21636
- Box,
21637
- {
21638
- className: cn(
21639
- "group flex items-center gap-4 transition-all duration-200",
21640
- isCompact ? "px-4 py-2" : "px-6 py-4",
21641
- "hover:bg-muted/80",
21642
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
21643
- ),
21644
- children: [
21645
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
21646
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
21647
- titleField?.icon && /* @__PURE__ */ jsx(
21648
- Icon,
21649
- {
21650
- name: titleField.icon,
21651
- size: isCompact ? "xs" : "sm",
21652
- className: "text-primary flex-shrink-0"
21653
- }
21654
- ),
21655
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
21656
- Typography,
21657
- {
21658
- variant: titleField?.variant === "h3" ? "h3" : "h4",
21659
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
21660
- children: String(titleValue)
21661
- }
21662
- ),
21663
- badgeFields.map((field) => {
21664
- const val = getNestedValue(itemData, field.name);
21665
- if (val === void 0 || val === null) return null;
21666
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
21667
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
21668
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
21669
- ] }, field.name);
21670
- })
21671
- ] }),
21672
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
21673
- const value = getNestedValue(itemData, field.name);
21674
- if (value === void 0 || value === null || value === "") return null;
21675
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
21676
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21677
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
21678
- field.label ?? fieldLabel3(field.name),
21679
- ":"
21680
- ] }),
21681
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
21682
- ] }, field.name);
21683
- }) }),
21684
- progressFields.map((field) => {
21685
- const value = getNestedValue(itemData, field.name);
21686
- if (typeof value !== "number") return null;
21687
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
21688
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
21689
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
21690
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
21691
- ] }),
21692
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
21693
- ] }, field.name);
21694
- })
21695
- ] }),
21696
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
21697
- Button,
21698
- {
21699
- variant: action.variant ?? "ghost",
21700
- size: "sm",
21701
- onClick: handleActionClick(action, itemData),
21702
- "data-testid": `action-${action.event}`,
21703
- "data-row-id": String(itemData.id),
21704
- className: cn(
21705
- action.variant === "danger" && "text-error hover:bg-error/10"
21706
- ),
21707
- children: [
21708
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
21709
- action.label
21710
- ]
21711
- },
21712
- idx
21713
- )) })
21714
- ]
21715
- }
21716
- ),
21717
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
21718
- ] }, id);
21957
+ ] }, id)
21958
+ );
21719
21959
  };
21720
- return /* @__PURE__ */ jsxs(
21721
- Box,
21722
- {
21723
- className: cn(
21724
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21725
- !isCard && gapClass,
21726
- className
21727
- ),
21728
- children: [
21729
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
21730
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21731
- group.items.map(
21732
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21960
+ return dnd.wrapContainer(
21961
+ /* @__PURE__ */ jsxs(
21962
+ Box,
21963
+ {
21964
+ className: cn(
21965
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
21966
+ !isCard && gapClass,
21967
+ className
21968
+ ),
21969
+ children: [
21970
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
21971
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21972
+ group.items.map(
21973
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
21974
+ )
21975
+ ] }, gi)),
21976
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21977
+ Button,
21978
+ {
21979
+ variant: "ghost",
21980
+ size: "sm",
21981
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21982
+ children: [
21983
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21984
+ t("common.showMore"),
21985
+ " (",
21986
+ allData.length - visibleCount,
21987
+ " remaining)"
21988
+ ]
21989
+ }
21990
+ ) }),
21991
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21992
+ InfiniteScrollSentinel,
21993
+ {
21994
+ loadMoreEvent,
21995
+ isLoading,
21996
+ hasMore
21997
+ }
21733
21998
  )
21734
- ] }, gi)),
21735
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
21736
- Button,
21737
- {
21738
- variant: "ghost",
21739
- size: "sm",
21740
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
21741
- children: [
21742
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
21743
- t("common.showMore"),
21744
- " (",
21745
- allData.length - visibleCount,
21746
- " remaining)"
21747
- ]
21748
- }
21749
- ) }),
21750
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
21751
- InfiniteScrollSentinel,
21752
- {
21753
- loadMoreEvent,
21754
- isLoading,
21755
- hasMore
21756
- }
21757
- )
21758
- ]
21759
- }
21999
+ ]
22000
+ }
22001
+ )
21760
22002
  );
21761
22003
  }
21762
22004
  var dataListLog;
@@ -21776,6 +22018,7 @@ var init_DataList = __esm({
21776
22018
  init_ProgressBar();
21777
22019
  init_Divider();
21778
22020
  init_InfiniteScrollSentinel();
22021
+ init_useDataDnd();
21779
22022
  dataListLog = createLogger("almadar:ui:data-list");
21780
22023
  DataList.displayName = "DataList";
21781
22024
  }
@@ -22962,7 +23205,7 @@ var init_WizardProgress = __esm({
22962
23205
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
22963
23206
  const isActive = index === currentStep;
22964
23207
  const isCompleted = index < currentStep;
22965
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
23208
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
22966
23209
  /* @__PURE__ */ jsx(
22967
23210
  "button",
22968
23211
  {
@@ -23873,7 +24116,7 @@ function InventoryGrid({
23873
24116
  const eventBus = useEventBus();
23874
24117
  const slotCount = totalSlots ?? items.length;
23875
24118
  const emptySlotCount = Math.max(0, slotCount - items.length);
23876
- const handleSelect = React135.useCallback(
24119
+ const handleSelect = React80.useCallback(
23877
24120
  (id) => {
23878
24121
  onSelect?.(id);
23879
24122
  if (selectEvent) {
@@ -24086,15 +24329,15 @@ function GameCanvas2D({
24086
24329
  fps = 60,
24087
24330
  className
24088
24331
  }) {
24089
- const canvasRef = React135.useRef(null);
24090
- const rafRef = React135.useRef(0);
24091
- const frameRef = React135.useRef(0);
24092
- const lastTimeRef = React135.useRef(0);
24093
- const onDrawRef = React135.useRef(onDraw);
24332
+ const canvasRef = React80.useRef(null);
24333
+ const rafRef = React80.useRef(0);
24334
+ const frameRef = React80.useRef(0);
24335
+ const lastTimeRef = React80.useRef(0);
24336
+ const onDrawRef = React80.useRef(onDraw);
24094
24337
  onDrawRef.current = onDraw;
24095
- const onTickRef = React135.useRef(onTick);
24338
+ const onTickRef = React80.useRef(onTick);
24096
24339
  onTickRef.current = onTick;
24097
- React135.useEffect(() => {
24340
+ React80.useEffect(() => {
24098
24341
  const canvas = canvasRef.current;
24099
24342
  if (!canvas) return;
24100
24343
  const ctx = canvas.getContext("2d");
@@ -24383,7 +24626,7 @@ function TurnPanel({
24383
24626
  className
24384
24627
  }) {
24385
24628
  const eventBus = useEventBus();
24386
- const handleAction = React135.useCallback(
24629
+ const handleAction = React80.useCallback(
24387
24630
  (event) => {
24388
24631
  if (event) {
24389
24632
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -24529,7 +24772,7 @@ function UnitCommandBar({
24529
24772
  className
24530
24773
  }) {
24531
24774
  const eventBus = useEventBus();
24532
- const handleCommand = React135.useCallback(
24775
+ const handleCommand = React80.useCallback(
24533
24776
  (event) => {
24534
24777
  if (event) {
24535
24778
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25014,7 +25257,7 @@ function GameMenu({
25014
25257
  } catch {
25015
25258
  }
25016
25259
  const eventBus = eventBusProp || eventBusFromHook;
25017
- const handleOptionClick = React135.useCallback(
25260
+ const handleOptionClick = React80.useCallback(
25018
25261
  (option) => {
25019
25262
  if (option.event && eventBus) {
25020
25263
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25128,7 +25371,7 @@ function GameOverScreen({
25128
25371
  } catch {
25129
25372
  }
25130
25373
  const eventBus = eventBusProp || eventBusFromHook;
25131
- const handleActionClick = React135.useCallback(
25374
+ const handleActionClick = React80.useCallback(
25132
25375
  (action) => {
25133
25376
  if (action.event && eventBus) {
25134
25377
  eventBus.emit(`UI:${action.event}`, { action });
@@ -27617,7 +27860,7 @@ var init_StepFlow = __esm({
27617
27860
  className
27618
27861
  }) => {
27619
27862
  if (orientation === "vertical") {
27620
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React135__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27863
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React80__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
27621
27864
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
27622
27865
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27623
27866
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -27628,7 +27871,7 @@ var init_StepFlow = __esm({
27628
27871
  ] })
27629
27872
  ] }) }, index)) });
27630
27873
  }
27631
- 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(React135__default.Fragment, { children: [
27874
+ 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(React80__default.Fragment, { children: [
27632
27875
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
27633
27876
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
27634
27877
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -28510,7 +28753,7 @@ var init_LikertScale = __esm({
28510
28753
  md: "text-base",
28511
28754
  lg: "text-lg"
28512
28755
  };
28513
- LikertScale = React135__default.forwardRef(
28756
+ LikertScale = React80__default.forwardRef(
28514
28757
  ({
28515
28758
  question,
28516
28759
  options = DEFAULT_LIKERT_OPTIONS,
@@ -28522,7 +28765,7 @@ var init_LikertScale = __esm({
28522
28765
  variant = "radios",
28523
28766
  className
28524
28767
  }, ref) => {
28525
- const groupId = React135__default.useId();
28768
+ const groupId = React80__default.useId();
28526
28769
  const eventBus = useEventBus();
28527
28770
  const handleSelect = useCallback(
28528
28771
  (next) => {
@@ -30748,7 +30991,7 @@ var init_DocBreadcrumb = __esm({
30748
30991
  "aria-label": "Breadcrumb",
30749
30992
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
30750
30993
  const isLast = idx === items.length - 1;
30751
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
30994
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
30752
30995
  idx > 0 && /* @__PURE__ */ jsx(
30753
30996
  Icon,
30754
30997
  {
@@ -31638,7 +31881,7 @@ var init_MiniStateMachine = __esm({
31638
31881
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
31639
31882
  const tc = transitionCounts[s.name] ?? 0;
31640
31883
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
31641
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
31884
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
31642
31885
  /* @__PURE__ */ jsx(
31643
31886
  AvlState,
31644
31887
  {
@@ -33015,7 +33258,7 @@ var init_DocumentViewer = __esm({
33015
33258
  }
33016
33259
  });
33017
33260
  function extractTitle(children) {
33018
- if (!React135__default.isValidElement(children)) return void 0;
33261
+ if (!React80__default.isValidElement(children)) return void 0;
33019
33262
  const props = children.props;
33020
33263
  if (typeof props.title === "string") {
33021
33264
  return props.title;
@@ -33070,7 +33313,7 @@ function LinearView({
33070
33313
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
33071
33314
  const isDone = i < currentIdx;
33072
33315
  const isCurrent = i === currentIdx;
33073
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
33316
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
33074
33317
  i > 0 && /* @__PURE__ */ jsx(
33075
33318
  Typography,
33076
33319
  {
@@ -33970,12 +34213,12 @@ var init_Form = __esm({
33970
34213
  const isSchemaEntity = isOrbitalEntitySchema(entity);
33971
34214
  const resolvedEntity = isSchemaEntity ? entity : void 0;
33972
34215
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
33973
- const normalizedInitialData = React135__default.useMemo(() => {
34216
+ const normalizedInitialData = React80__default.useMemo(() => {
33974
34217
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
33975
34218
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
33976
34219
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
33977
34220
  }, [entity, initialData]);
33978
- const entityDerivedFields = React135__default.useMemo(() => {
34221
+ const entityDerivedFields = React80__default.useMemo(() => {
33979
34222
  if (fields && fields.length > 0) return void 0;
33980
34223
  if (!resolvedEntity) return void 0;
33981
34224
  return resolvedEntity.fields.map(
@@ -33994,16 +34237,16 @@ var init_Form = __esm({
33994
34237
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
33995
34238
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
33996
34239
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
33997
- const [formData, setFormData] = React135__default.useState(
34240
+ const [formData, setFormData] = React80__default.useState(
33998
34241
  normalizedInitialData
33999
34242
  );
34000
- const [collapsedSections, setCollapsedSections] = React135__default.useState(
34243
+ const [collapsedSections, setCollapsedSections] = React80__default.useState(
34001
34244
  /* @__PURE__ */ new Set()
34002
34245
  );
34003
- const [submitError, setSubmitError] = React135__default.useState(null);
34004
- const formRef = React135__default.useRef(null);
34246
+ const [submitError, setSubmitError] = React80__default.useState(null);
34247
+ const formRef = React80__default.useRef(null);
34005
34248
  const formMode = props.mode;
34006
- const mountedRef = React135__default.useRef(false);
34249
+ const mountedRef = React80__default.useRef(false);
34007
34250
  if (!mountedRef.current) {
34008
34251
  mountedRef.current = true;
34009
34252
  debug("forms", "mount", {
@@ -34016,7 +34259,7 @@ var init_Form = __esm({
34016
34259
  });
34017
34260
  }
34018
34261
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
34019
- const evalContext = React135__default.useMemo(
34262
+ const evalContext = React80__default.useMemo(
34020
34263
  () => ({
34021
34264
  formValues: formData,
34022
34265
  globalVariables: externalContext?.globalVariables ?? {},
@@ -34025,7 +34268,7 @@ var init_Form = __esm({
34025
34268
  }),
34026
34269
  [formData, externalContext]
34027
34270
  );
34028
- React135__default.useEffect(() => {
34271
+ React80__default.useEffect(() => {
34029
34272
  debug("forms", "initialData-sync", {
34030
34273
  mode: formMode,
34031
34274
  normalizedInitialData,
@@ -34036,7 +34279,7 @@ var init_Form = __esm({
34036
34279
  setFormData(normalizedInitialData);
34037
34280
  }
34038
34281
  }, [normalizedInitialData]);
34039
- const processCalculations = React135__default.useCallback(
34282
+ const processCalculations = React80__default.useCallback(
34040
34283
  (changedFieldId, newFormData) => {
34041
34284
  if (!hiddenCalculations.length) return;
34042
34285
  const context = {
@@ -34061,7 +34304,7 @@ var init_Form = __esm({
34061
34304
  },
34062
34305
  [hiddenCalculations, externalContext, eventBus]
34063
34306
  );
34064
- const checkViolations = React135__default.useCallback(
34307
+ const checkViolations = React80__default.useCallback(
34065
34308
  (changedFieldId, newFormData) => {
34066
34309
  if (!violationTriggers.length) return;
34067
34310
  const context = {
@@ -34099,7 +34342,7 @@ var init_Form = __esm({
34099
34342
  processCalculations(name, newFormData);
34100
34343
  checkViolations(name, newFormData);
34101
34344
  };
34102
- const isFieldVisible = React135__default.useCallback(
34345
+ const isFieldVisible = React80__default.useCallback(
34103
34346
  (fieldName) => {
34104
34347
  const condition = conditionalFields[fieldName];
34105
34348
  if (!condition) return true;
@@ -34107,7 +34350,7 @@ var init_Form = __esm({
34107
34350
  },
34108
34351
  [conditionalFields, evalContext]
34109
34352
  );
34110
- const isSectionVisible = React135__default.useCallback(
34353
+ const isSectionVisible = React80__default.useCallback(
34111
34354
  (section) => {
34112
34355
  if (!section.condition) return true;
34113
34356
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -34183,7 +34426,7 @@ var init_Form = __esm({
34183
34426
  eventBus.emit(`UI:${onCancel}`);
34184
34427
  }
34185
34428
  };
34186
- const renderField = React135__default.useCallback(
34429
+ const renderField = React80__default.useCallback(
34187
34430
  (field) => {
34188
34431
  const fieldName = field.name || field.field;
34189
34432
  if (!fieldName) return null;
@@ -34204,7 +34447,7 @@ var init_Form = __esm({
34204
34447
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
34205
34448
  );
34206
34449
  const effectiveFields = entityDerivedFields ?? fields;
34207
- const normalizedFields = React135__default.useMemo(() => {
34450
+ const normalizedFields = React80__default.useMemo(() => {
34208
34451
  if (!effectiveFields || effectiveFields.length === 0) return [];
34209
34452
  return effectiveFields.map((field) => {
34210
34453
  if (typeof field === "string") {
@@ -34226,7 +34469,7 @@ var init_Form = __esm({
34226
34469
  return field;
34227
34470
  });
34228
34471
  }, [effectiveFields, resolvedEntity]);
34229
- const schemaFields = React135__default.useMemo(() => {
34472
+ const schemaFields = React80__default.useMemo(() => {
34230
34473
  if (normalizedFields.length === 0) return null;
34231
34474
  if (isDebugEnabled()) {
34232
34475
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -34236,7 +34479,7 @@ var init_Form = __esm({
34236
34479
  }
34237
34480
  return normalizedFields.map(renderField).filter(Boolean);
34238
34481
  }, [normalizedFields, renderField, entityName, conditionalFields]);
34239
- const sectionElements = React135__default.useMemo(() => {
34482
+ const sectionElements = React80__default.useMemo(() => {
34240
34483
  if (!sections || sections.length === 0) return null;
34241
34484
  return sections.map((section) => {
34242
34485
  if (!isSectionVisible(section)) {
@@ -35962,7 +36205,7 @@ var init_List = __esm({
35962
36205
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
35963
36206
  return [];
35964
36207
  }, [entity]);
35965
- const getItemActions = React135__default.useCallback(
36208
+ const getItemActions = React80__default.useCallback(
35966
36209
  (item) => {
35967
36210
  if (!itemActions) return [];
35968
36211
  if (typeof itemActions === "function") {
@@ -36435,7 +36678,7 @@ var init_MediaGallery = __esm({
36435
36678
  [selectable, selectedItems, selectionEvent, eventBus]
36436
36679
  );
36437
36680
  const entityData = Array.isArray(entity) ? entity : [];
36438
- const items = React135__default.useMemo(() => {
36681
+ const items = React80__default.useMemo(() => {
36439
36682
  if (propItems) return propItems;
36440
36683
  if (entityData.length === 0) return [];
36441
36684
  return entityData.map((record, idx) => ({
@@ -36599,7 +36842,7 @@ var init_MediaGallery = __esm({
36599
36842
  }
36600
36843
  });
36601
36844
  function extractTitle2(children) {
36602
- if (!React135__default.isValidElement(children)) return void 0;
36845
+ if (!React80__default.isValidElement(children)) return void 0;
36603
36846
  const props = children.props;
36604
36847
  if (typeof props.title === "string") {
36605
36848
  return props.title;
@@ -37312,7 +37555,7 @@ var init_PageHeader = __esm({
37312
37555
  info: "bg-info/10 text-info"
37313
37556
  };
37314
37557
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37315
- 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(React135__default.Fragment, { children: [
37558
+ 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(React80__default.Fragment, { children: [
37316
37559
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37317
37560
  crumb.href ? /* @__PURE__ */ jsx(
37318
37561
  "a",
@@ -37627,7 +37870,7 @@ var init_debugRegistry = __esm({
37627
37870
  }
37628
37871
  });
37629
37872
  function useDebugData() {
37630
- const [data, setData] = React135.useState(() => ({
37873
+ const [data, setData] = React80.useState(() => ({
37631
37874
  traits: [],
37632
37875
  ticks: [],
37633
37876
  guards: [],
@@ -37641,7 +37884,7 @@ function useDebugData() {
37641
37884
  },
37642
37885
  lastUpdate: Date.now()
37643
37886
  }));
37644
- React135.useEffect(() => {
37887
+ React80.useEffect(() => {
37645
37888
  const updateData = () => {
37646
37889
  setData({
37647
37890
  traits: getAllTraits(),
@@ -37750,12 +37993,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
37750
37993
  return positions;
37751
37994
  }
37752
37995
  function WalkMinimap() {
37753
- const [walkStep, setWalkStep] = React135.useState(null);
37754
- const [traits2, setTraits] = React135.useState([]);
37755
- const [coveredEdges, setCoveredEdges] = React135.useState([]);
37756
- const [completedTraits, setCompletedTraits] = React135.useState(/* @__PURE__ */ new Set());
37757
- const prevTraitRef = React135.useRef(null);
37758
- React135.useEffect(() => {
37996
+ const [walkStep, setWalkStep] = React80.useState(null);
37997
+ const [traits2, setTraits] = React80.useState([]);
37998
+ const [coveredEdges, setCoveredEdges] = React80.useState([]);
37999
+ const [completedTraits, setCompletedTraits] = React80.useState(/* @__PURE__ */ new Set());
38000
+ const prevTraitRef = React80.useRef(null);
38001
+ React80.useEffect(() => {
37759
38002
  const interval = setInterval(() => {
37760
38003
  const w = window;
37761
38004
  const step = w.__orbitalWalkStep;
@@ -38202,15 +38445,15 @@ var init_EntitiesTab = __esm({
38202
38445
  }
38203
38446
  });
38204
38447
  function EventFlowTab({ events: events2 }) {
38205
- const [filter, setFilter] = React135.useState("all");
38206
- const containerRef = React135.useRef(null);
38207
- const [autoScroll, setAutoScroll] = React135.useState(true);
38208
- React135.useEffect(() => {
38448
+ const [filter, setFilter] = React80.useState("all");
38449
+ const containerRef = React80.useRef(null);
38450
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38451
+ React80.useEffect(() => {
38209
38452
  if (autoScroll && containerRef.current) {
38210
38453
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38211
38454
  }
38212
38455
  }, [events2.length, autoScroll]);
38213
- const filteredEvents = React135.useMemo(() => {
38456
+ const filteredEvents = React80.useMemo(() => {
38214
38457
  if (filter === "all") return events2;
38215
38458
  return events2.filter((e) => e.type === filter);
38216
38459
  }, [events2, filter]);
@@ -38329,7 +38572,7 @@ var init_EventFlowTab = __esm({
38329
38572
  }
38330
38573
  });
38331
38574
  function GuardsPanel({ guards }) {
38332
- const [filter, setFilter] = React135.useState("all");
38575
+ const [filter, setFilter] = React80.useState("all");
38333
38576
  if (guards.length === 0) {
38334
38577
  return /* @__PURE__ */ jsx(
38335
38578
  EmptyState,
@@ -38342,7 +38585,7 @@ function GuardsPanel({ guards }) {
38342
38585
  }
38343
38586
  const passedCount = guards.filter((g) => g.result).length;
38344
38587
  const failedCount = guards.length - passedCount;
38345
- const filteredGuards = React135.useMemo(() => {
38588
+ const filteredGuards = React80.useMemo(() => {
38346
38589
  if (filter === "all") return guards;
38347
38590
  if (filter === "passed") return guards.filter((g) => g.result);
38348
38591
  return guards.filter((g) => !g.result);
@@ -38503,10 +38746,10 @@ function EffectBadge({ effect }) {
38503
38746
  ] });
38504
38747
  }
38505
38748
  function TransitionTimeline({ transitions }) {
38506
- const containerRef = React135.useRef(null);
38507
- const [autoScroll, setAutoScroll] = React135.useState(true);
38508
- const [expandedId, setExpandedId] = React135.useState(null);
38509
- React135.useEffect(() => {
38749
+ const containerRef = React80.useRef(null);
38750
+ const [autoScroll, setAutoScroll] = React80.useState(true);
38751
+ const [expandedId, setExpandedId] = React80.useState(null);
38752
+ React80.useEffect(() => {
38510
38753
  if (autoScroll && containerRef.current) {
38511
38754
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
38512
38755
  }
@@ -38792,9 +39035,9 @@ function getAllEvents(traits2) {
38792
39035
  }
38793
39036
  function EventDispatcherTab({ traits: traits2, schema }) {
38794
39037
  const eventBus = useEventBus();
38795
- const [log12, setLog] = React135.useState([]);
38796
- const prevStatesRef = React135.useRef(/* @__PURE__ */ new Map());
38797
- React135.useEffect(() => {
39038
+ const [log12, setLog] = React80.useState([]);
39039
+ const prevStatesRef = React80.useRef(/* @__PURE__ */ new Map());
39040
+ React80.useEffect(() => {
38798
39041
  for (const trait of traits2) {
38799
39042
  const prev = prevStatesRef.current.get(trait.id);
38800
39043
  if (prev && prev !== trait.currentState) {
@@ -38964,10 +39207,10 @@ function VerifyModePanel({
38964
39207
  serverCount,
38965
39208
  localCount
38966
39209
  }) {
38967
- const [expanded, setExpanded] = React135.useState(true);
38968
- const scrollRef = React135.useRef(null);
38969
- const prevCountRef = React135.useRef(0);
38970
- React135.useEffect(() => {
39210
+ const [expanded, setExpanded] = React80.useState(true);
39211
+ const scrollRef = React80.useRef(null);
39212
+ const prevCountRef = React80.useRef(0);
39213
+ React80.useEffect(() => {
38971
39214
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
38972
39215
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
38973
39216
  }
@@ -39033,10 +39276,10 @@ function RuntimeDebugger({
39033
39276
  defaultTab,
39034
39277
  schema
39035
39278
  }) {
39036
- const [isCollapsed, setIsCollapsed] = React135.useState(mode === "verify" ? true : defaultCollapsed);
39037
- const [isVisible, setIsVisible] = React135.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39279
+ const [isCollapsed, setIsCollapsed] = React80.useState(mode === "verify" ? true : defaultCollapsed);
39280
+ const [isVisible, setIsVisible] = React80.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
39038
39281
  const debugData = useDebugData();
39039
- React135.useEffect(() => {
39282
+ React80.useEffect(() => {
39040
39283
  if (mode === "inline") return;
39041
39284
  return onDebugToggle((enabled) => {
39042
39285
  setIsVisible(enabled);
@@ -39045,7 +39288,7 @@ function RuntimeDebugger({
39045
39288
  }
39046
39289
  });
39047
39290
  }, [mode]);
39048
- React135.useEffect(() => {
39291
+ React80.useEffect(() => {
39049
39292
  if (mode === "inline") return;
39050
39293
  const handleKeyDown = (e) => {
39051
39294
  if (e.key === "`" && isVisible) {
@@ -39594,7 +39837,7 @@ function SequenceBar({
39594
39837
  onSlotRemove(index);
39595
39838
  }, [onSlotRemove, playing]);
39596
39839
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
39597
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
39840
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
39598
39841
  i > 0 && /* @__PURE__ */ jsx(
39599
39842
  Typography,
39600
39843
  {
@@ -40995,7 +41238,7 @@ var init_StatCard = __esm({
40995
41238
  const labelToUse = propLabel ?? propTitle;
40996
41239
  const eventBus = useEventBus();
40997
41240
  const { t } = useTranslate();
40998
- const handleActionClick = React135__default.useCallback(() => {
41241
+ const handleActionClick = React80__default.useCallback(() => {
40999
41242
  if (action?.event) {
41000
41243
  eventBus.emit(`UI:${action.event}`, {});
41001
41244
  }
@@ -41006,7 +41249,7 @@ var init_StatCard = __esm({
41006
41249
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41007
41250
  const isLoading = externalLoading ?? false;
41008
41251
  const error = externalError;
41009
- const computeMetricValue = React135__default.useCallback(
41252
+ const computeMetricValue = React80__default.useCallback(
41010
41253
  (metric, items) => {
41011
41254
  if (metric.value !== void 0) {
41012
41255
  return metric.value;
@@ -41045,7 +41288,7 @@ var init_StatCard = __esm({
41045
41288
  },
41046
41289
  []
41047
41290
  );
41048
- const schemaStats = React135__default.useMemo(() => {
41291
+ const schemaStats = React80__default.useMemo(() => {
41049
41292
  if (!metrics || metrics.length === 0) return null;
41050
41293
  return metrics.map((metric) => ({
41051
41294
  label: metric.label,
@@ -41053,7 +41296,7 @@ var init_StatCard = __esm({
41053
41296
  format: metric.format
41054
41297
  }));
41055
41298
  }, [metrics, data, computeMetricValue]);
41056
- const calculatedTrend = React135__default.useMemo(() => {
41299
+ const calculatedTrend = React80__default.useMemo(() => {
41057
41300
  if (manualTrend !== void 0) return manualTrend;
41058
41301
  if (previousValue === void 0 || currentValue === void 0)
41059
41302
  return void 0;
@@ -42189,7 +42432,7 @@ var init_Timeline = __esm({
42189
42432
  }) => {
42190
42433
  const { t } = useTranslate();
42191
42434
  const entityData = Array.isArray(entity) ? entity : [];
42192
- const items = React135__default.useMemo(() => {
42435
+ const items = React80__default.useMemo(() => {
42193
42436
  if (propItems) return propItems;
42194
42437
  if (entityData.length === 0) return [];
42195
42438
  return entityData.map((record, idx) => {
@@ -42296,7 +42539,7 @@ var init_Timeline = __esm({
42296
42539
  }
42297
42540
  });
42298
42541
  function extractToastProps(children) {
42299
- if (!React135__default.isValidElement(children)) {
42542
+ if (!React80__default.isValidElement(children)) {
42300
42543
  if (typeof children === "string") {
42301
42544
  return { message: children };
42302
42545
  }
@@ -42334,7 +42577,7 @@ var init_ToastSlot = __esm({
42334
42577
  eventBus.emit("UI:CLOSE");
42335
42578
  };
42336
42579
  if (!isVisible) return null;
42337
- const isCustomContent = React135__default.isValidElement(children) && !message;
42580
+ const isCustomContent = React80__default.isValidElement(children) && !message;
42338
42581
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42339
42582
  Toast,
42340
42583
  {
@@ -42603,7 +42846,7 @@ var init_WizardContainer = __esm({
42603
42846
  const isCompleted = index < currentStep;
42604
42847
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
42605
42848
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
42606
- return /* @__PURE__ */ jsxs(React135__default.Fragment, { children: [
42849
+ return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
42607
42850
  /* @__PURE__ */ jsx(
42608
42851
  Button,
42609
42852
  {
@@ -42985,12 +43228,12 @@ var init_WorldMapTemplate = __esm({
42985
43228
  }
42986
43229
  });
42987
43230
  function lazyThree(name, loader) {
42988
- const Lazy = React135__default.lazy(() => loader().then((m) => ({ default: m[name] })));
43231
+ const Lazy = React80__default.lazy(() => loader().then((m) => ({ default: m[name] })));
42989
43232
  function ThreeWrapper(props) {
42990
- return React135__default.createElement(
42991
- React135__default.Suspense,
43233
+ return React80__default.createElement(
43234
+ React80__default.Suspense,
42992
43235
  { fallback: null },
42993
- React135__default.createElement(Lazy, props)
43236
+ React80__default.createElement(Lazy, props)
42994
43237
  );
42995
43238
  }
42996
43239
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -43594,7 +43837,7 @@ function SuspenseConfigProvider({
43594
43837
  config,
43595
43838
  children
43596
43839
  }) {
43597
- return React135__default.createElement(
43840
+ return React80__default.createElement(
43598
43841
  SuspenseConfigContext.Provider,
43599
43842
  { value: config },
43600
43843
  children
@@ -44077,7 +44320,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44077
44320
  const key = `${parentId}-${index}-trait:${traitName}`;
44078
44321
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44079
44322
  }
44080
- return /* @__PURE__ */ jsx(React135__default.Fragment, { children: child }, `${parentId}-${index}`);
44323
+ return /* @__PURE__ */ jsx(React80__default.Fragment, { children: child }, `${parentId}-${index}`);
44081
44324
  }
44082
44325
  if (!child || typeof child !== "object") return null;
44083
44326
  const childId = `${parentId}-${index}`;
@@ -44114,14 +44357,14 @@ function isPatternConfig(value) {
44114
44357
  if (value === null || value === void 0) return false;
44115
44358
  if (typeof value !== "object") return false;
44116
44359
  if (Array.isArray(value)) return false;
44117
- if (React135__default.isValidElement(value)) return false;
44360
+ if (React80__default.isValidElement(value)) return false;
44118
44361
  if (value instanceof Date) return false;
44119
44362
  if (typeof value === "function") return false;
44120
44363
  const record = value;
44121
44364
  return "type" in record && typeof record.type === "string";
44122
44365
  }
44123
44366
  function isPlainConfigObject(value) {
44124
- if (React135__default.isValidElement(value)) return false;
44367
+ if (React80__default.isValidElement(value)) return false;
44125
44368
  if (value instanceof Date) return false;
44126
44369
  const proto = Object.getPrototypeOf(value);
44127
44370
  return proto === Object.prototype || proto === null;
@@ -44482,7 +44725,7 @@ function resolveLambdaBindings(body, argName, arg) {
44482
44725
  if (Array.isArray(body)) {
44483
44726
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
44484
44727
  }
44485
- if (body !== null && typeof body === "object" && !React135__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44728
+ if (body !== null && typeof body === "object" && !React80__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44486
44729
  const out = {};
44487
44730
  for (const [k, v] of Object.entries(body)) {
44488
44731
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -44501,7 +44744,7 @@ function getSlotContentRenderer2() {
44501
44744
  function makeLambdaFn(argName, lambdaBody, callerKey) {
44502
44745
  return (item, index) => {
44503
44746
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
44504
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React135__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44747
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React80__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44505
44748
  return null;
44506
44749
  }
44507
44750
  const record = resolvedBody;
@@ -44519,7 +44762,7 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
44519
44762
  props: childProps,
44520
44763
  priority: 0
44521
44764
  };
44522
- return React135__default.createElement(SlotContentRenderer2, { content: childContent });
44765
+ return React80__default.createElement(SlotContentRenderer2, { content: childContent });
44523
44766
  };
44524
44767
  }
44525
44768
  function convertNode(node, callerKey) {
@@ -44538,7 +44781,7 @@ function convertNode(node, callerKey) {
44538
44781
  });
44539
44782
  return anyChanged ? mapped : node;
44540
44783
  }
44541
- if (typeof node === "object" && !React135__default.isValidElement(node) && !(node instanceof Date)) {
44784
+ if (typeof node === "object" && !React80__default.isValidElement(node) && !(node instanceof Date)) {
44542
44785
  return convertObjectProps(node);
44543
44786
  }
44544
44787
  return node;