@almadar/ui 5.23.0 → 5.24.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,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import * as React80 from 'react';
3
- import React80__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
2
+ import * as React81 from 'react';
3
+ import React81__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -211,7 +211,7 @@ var init_SvgFlow = __esm({
211
211
  opacity = 1,
212
212
  className
213
213
  }) => {
214
- const markerId = React80__default.useMemo(() => {
214
+ const markerId = React81__default.useMemo(() => {
215
215
  flowIdCounter += 1;
216
216
  return `almadar-flow-arrow-${flowIdCounter}`;
217
217
  }, []);
@@ -754,7 +754,7 @@ var init_SvgRing = __esm({
754
754
  className,
755
755
  label
756
756
  }) => {
757
- const gradientId = React80__default.useMemo(() => {
757
+ const gradientId = React81__default.useMemo(() => {
758
758
  ringIdCounter += 1;
759
759
  return `almadar-ring-glow-${ringIdCounter}`;
760
760
  }, []);
@@ -1836,7 +1836,7 @@ var init_Icon = __esm({
1836
1836
  const directIcon = typeof icon === "string" ? void 0 : icon;
1837
1837
  const effectiveName = typeof icon === "string" ? icon : name;
1838
1838
  const family = useIconFamily();
1839
- const RenderedComponent = React80__default.useMemo(() => {
1839
+ const RenderedComponent = React81__default.useMemo(() => {
1840
1840
  if (directIcon) return null;
1841
1841
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1842
1842
  }, [directIcon, effectiveName, family]);
@@ -1894,7 +1894,7 @@ function resolveIconProp(value, sizeClass) {
1894
1894
  const IconComp = value;
1895
1895
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1896
1896
  }
1897
- if (React80__default.isValidElement(value)) {
1897
+ if (React81__default.isValidElement(value)) {
1898
1898
  return value;
1899
1899
  }
1900
1900
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1970,7 +1970,7 @@ var init_Button = __esm({
1970
1970
  md: "h-icon-default w-icon-default",
1971
1971
  lg: "h-icon-default w-icon-default"
1972
1972
  };
1973
- Button = React80__default.forwardRef(
1973
+ Button = React81__default.forwardRef(
1974
1974
  ({
1975
1975
  className,
1976
1976
  variant = "primary",
@@ -2036,7 +2036,7 @@ var init_Input = __esm({
2036
2036
  "components/core/atoms/Input.tsx"() {
2037
2037
  init_cn();
2038
2038
  init_Icon();
2039
- Input = React80__default.forwardRef(
2039
+ Input = React81__default.forwardRef(
2040
2040
  ({
2041
2041
  className,
2042
2042
  inputType,
@@ -2157,7 +2157,7 @@ var Label;
2157
2157
  var init_Label = __esm({
2158
2158
  "components/core/atoms/Label.tsx"() {
2159
2159
  init_cn();
2160
- Label = React80__default.forwardRef(
2160
+ Label = React81__default.forwardRef(
2161
2161
  ({ className, required, children, ...props }, ref) => {
2162
2162
  return /* @__PURE__ */ jsxs(
2163
2163
  "label",
@@ -2183,7 +2183,7 @@ var Textarea;
2183
2183
  var init_Textarea = __esm({
2184
2184
  "components/core/atoms/Textarea.tsx"() {
2185
2185
  init_cn();
2186
- Textarea = React80__default.forwardRef(
2186
+ Textarea = React81__default.forwardRef(
2187
2187
  ({ className, error, ...props }, ref) => {
2188
2188
  return /* @__PURE__ */ jsx(
2189
2189
  "textarea",
@@ -2213,7 +2213,7 @@ var init_Select = __esm({
2213
2213
  "components/core/atoms/Select.tsx"() {
2214
2214
  init_cn();
2215
2215
  init_Icon();
2216
- Select = React80__default.forwardRef(
2216
+ Select = React81__default.forwardRef(
2217
2217
  ({ className, options, placeholder, error, ...props }, ref) => {
2218
2218
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2219
2219
  /* @__PURE__ */ jsxs(
@@ -2255,7 +2255,7 @@ var Checkbox;
2255
2255
  var init_Checkbox = __esm({
2256
2256
  "components/core/atoms/Checkbox.tsx"() {
2257
2257
  init_cn();
2258
- Checkbox = React80__default.forwardRef(
2258
+ Checkbox = React81__default.forwardRef(
2259
2259
  ({ className, label, id, ...props }, ref) => {
2260
2260
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2261
2261
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2346,7 +2346,7 @@ var init_Card = __esm({
2346
2346
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
2347
2347
  "tile-image-first": "p-0 overflow-hidden"
2348
2348
  };
2349
- Card = React80__default.forwardRef(
2349
+ Card = React81__default.forwardRef(
2350
2350
  ({
2351
2351
  className,
2352
2352
  variant = "bordered",
@@ -2384,9 +2384,9 @@ var init_Card = __esm({
2384
2384
  }
2385
2385
  );
2386
2386
  Card.displayName = "Card";
2387
- CardHeader = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2387
+ CardHeader = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2388
2388
  CardHeader.displayName = "CardHeader";
2389
- CardTitle = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2389
+ CardTitle = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2390
2390
  "h3",
2391
2391
  {
2392
2392
  ref,
@@ -2399,11 +2399,11 @@ var init_Card = __esm({
2399
2399
  }
2400
2400
  ));
2401
2401
  CardTitle.displayName = "CardTitle";
2402
- CardContent = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2402
+ CardContent = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2403
2403
  CardContent.displayName = "CardContent";
2404
2404
  CardBody = CardContent;
2405
2405
  CardBody.displayName = "CardBody";
2406
- CardFooter = React80__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2406
+ CardFooter = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2407
2407
  "div",
2408
2408
  {
2409
2409
  ref,
@@ -2456,7 +2456,7 @@ var init_Badge = __esm({
2456
2456
  md: "px-2.5 py-1 text-sm",
2457
2457
  lg: "px-3 py-1.5 text-base"
2458
2458
  };
2459
- Badge = React80__default.forwardRef(
2459
+ Badge = React81__default.forwardRef(
2460
2460
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2461
2461
  const iconSizes3 = {
2462
2462
  sm: "h-icon-default w-icon-default",
@@ -2549,7 +2549,7 @@ var init_FilterPill = __esm({
2549
2549
  md: "w-3.5 h-3.5",
2550
2550
  lg: "w-4 h-4"
2551
2551
  };
2552
- FilterPill = React80__default.forwardRef(
2552
+ FilterPill = React81__default.forwardRef(
2553
2553
  ({
2554
2554
  className,
2555
2555
  variant = "default",
@@ -2626,7 +2626,7 @@ var init_Spinner = __esm({
2626
2626
  md: "h-6 w-6",
2627
2627
  lg: "h-8 w-8"
2628
2628
  };
2629
- Spinner = React80__default.forwardRef(
2629
+ Spinner = React81__default.forwardRef(
2630
2630
  ({ className, size = "md", ...props }, ref) => {
2631
2631
  return /* @__PURE__ */ jsx(
2632
2632
  "div",
@@ -2705,11 +2705,15 @@ var init_Avatar = __esm({
2705
2705
  actionPayload
2706
2706
  }) => {
2707
2707
  const eventBus = useEventBus();
2708
+ const [imgFailed, setImgFailed] = React81__default.useState(false);
2709
+ React81__default.useEffect(() => {
2710
+ setImgFailed(false);
2711
+ }, [src]);
2708
2712
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
2709
2713
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
2710
- const hasImage = !!src;
2711
- const hasInitials = !!initials;
2714
+ const hasImage = !!src && !imgFailed;
2712
2715
  const hasIcon = !!IconComponent;
2716
+ const hasInitials = !!initials && !(hasIcon && !providedInitials);
2713
2717
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
2714
2718
  const isClickable = action || onClick;
2715
2719
  const handleClick = () => {
@@ -2739,9 +2743,8 @@ var init_Avatar = __esm({
2739
2743
  src,
2740
2744
  alt: alt || "Avatar",
2741
2745
  className: "w-full h-full object-cover",
2742
- onError: (e) => {
2743
- const target = e.target;
2744
- target.style.display = "none";
2746
+ onError: () => {
2747
+ setImgFailed(true);
2745
2748
  }
2746
2749
  }
2747
2750
  ) : hasInitials ? /* @__PURE__ */ jsx(
@@ -2910,7 +2913,7 @@ var init_Box = __esm({
2910
2913
  fixed: "fixed",
2911
2914
  sticky: "sticky"
2912
2915
  };
2913
- Box = React80__default.forwardRef(
2916
+ Box = React81__default.forwardRef(
2914
2917
  ({
2915
2918
  padding,
2916
2919
  paddingX,
@@ -2960,7 +2963,7 @@ var init_Box = __esm({
2960
2963
  onMouseLeave?.(e);
2961
2964
  }, [hoverEvent, eventBus, onMouseLeave]);
2962
2965
  const isClickable = action || onClick;
2963
- return React80__default.createElement(
2966
+ return React81__default.createElement(
2964
2967
  Component,
2965
2968
  {
2966
2969
  ref,
@@ -3282,7 +3285,7 @@ var init_Radio = __esm({
3282
3285
  md: "w-2.5 h-2.5",
3283
3286
  lg: "w-3 h-3"
3284
3287
  };
3285
- Radio = React80__default.forwardRef(
3288
+ Radio = React81__default.forwardRef(
3286
3289
  ({
3287
3290
  label,
3288
3291
  helperText,
@@ -3299,12 +3302,12 @@ var init_Radio = __esm({
3299
3302
  onChange,
3300
3303
  ...props
3301
3304
  }, ref) => {
3302
- const reactId = React80__default.useId();
3305
+ const reactId = React81__default.useId();
3303
3306
  const baseId = id || `radio-${reactId}`;
3304
3307
  const hasError = !!error;
3305
3308
  const eventBus = useEventBus();
3306
- const [selected, setSelected] = React80__default.useState(value);
3307
- React80__default.useEffect(() => {
3309
+ const [selected, setSelected] = React81__default.useState(value);
3310
+ React81__default.useEffect(() => {
3308
3311
  if (value !== void 0) setSelected(value);
3309
3312
  }, [value]);
3310
3313
  const pick = (next, e) => {
@@ -3486,7 +3489,7 @@ var init_Switch = __esm({
3486
3489
  "components/core/atoms/Switch.tsx"() {
3487
3490
  "use client";
3488
3491
  init_cn();
3489
- Switch = React80.forwardRef(
3492
+ Switch = React81.forwardRef(
3490
3493
  ({
3491
3494
  checked,
3492
3495
  defaultChecked = false,
@@ -3497,10 +3500,10 @@ var init_Switch = __esm({
3497
3500
  name,
3498
3501
  className
3499
3502
  }, ref) => {
3500
- const [isChecked, setIsChecked] = React80.useState(
3503
+ const [isChecked, setIsChecked] = React81.useState(
3501
3504
  checked !== void 0 ? checked : defaultChecked
3502
3505
  );
3503
- React80.useEffect(() => {
3506
+ React81.useEffect(() => {
3504
3507
  if (checked !== void 0) {
3505
3508
  setIsChecked(checked);
3506
3509
  }
@@ -4371,7 +4374,7 @@ var Dialog;
4371
4374
  var init_Dialog = __esm({
4372
4375
  "components/core/atoms/Dialog.tsx"() {
4373
4376
  init_cn();
4374
- Dialog = React80__default.forwardRef(
4377
+ Dialog = React81__default.forwardRef(
4375
4378
  ({
4376
4379
  role = "dialog",
4377
4380
  "aria-modal": ariaModal = true,
@@ -4397,7 +4400,7 @@ var Aside;
4397
4400
  var init_Aside = __esm({
4398
4401
  "components/core/atoms/Aside.tsx"() {
4399
4402
  init_cn();
4400
- Aside = React80__default.forwardRef(
4403
+ Aside = React81__default.forwardRef(
4401
4404
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4402
4405
  );
4403
4406
  Aside.displayName = "Aside";
@@ -4475,8 +4478,8 @@ var init_LawReferenceTooltip = __esm({
4475
4478
  className
4476
4479
  }) => {
4477
4480
  const { t } = useTranslate();
4478
- const [isVisible, setIsVisible] = React80__default.useState(false);
4479
- const timeoutRef = React80__default.useRef(null);
4481
+ const [isVisible, setIsVisible] = React81__default.useState(false);
4482
+ const timeoutRef = React81__default.useRef(null);
4480
4483
  const handleMouseEnter = () => {
4481
4484
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4482
4485
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4485,7 +4488,7 @@ var init_LawReferenceTooltip = __esm({
4485
4488
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4486
4489
  setIsVisible(false);
4487
4490
  };
4488
- React80__default.useEffect(() => {
4491
+ React81__default.useEffect(() => {
4489
4492
  return () => {
4490
4493
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4491
4494
  };
@@ -4695,7 +4698,7 @@ var init_StatusDot = __esm({
4695
4698
  md: "w-2.5 h-2.5",
4696
4699
  lg: "w-3 h-3"
4697
4700
  };
4698
- StatusDot = React80__default.forwardRef(
4701
+ StatusDot = React81__default.forwardRef(
4699
4702
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4700
4703
  return /* @__PURE__ */ jsx(
4701
4704
  "span",
@@ -4749,7 +4752,7 @@ var init_TrendIndicator = __esm({
4749
4752
  down: "trending-down",
4750
4753
  flat: "arrow-right"
4751
4754
  };
4752
- TrendIndicator = React80__default.forwardRef(
4755
+ TrendIndicator = React81__default.forwardRef(
4753
4756
  ({
4754
4757
  className,
4755
4758
  value,
@@ -4816,7 +4819,7 @@ var init_RangeSlider = __esm({
4816
4819
  md: "w-4 h-4",
4817
4820
  lg: "w-5 h-5"
4818
4821
  };
4819
- RangeSlider = React80__default.forwardRef(
4822
+ RangeSlider = React81__default.forwardRef(
4820
4823
  ({
4821
4824
  className,
4822
4825
  min = 0,
@@ -5412,7 +5415,7 @@ var init_ContentSection = __esm({
5412
5415
  md: "py-16",
5413
5416
  lg: "py-24"
5414
5417
  };
5415
- ContentSection = React80__default.forwardRef(
5418
+ ContentSection = React81__default.forwardRef(
5416
5419
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5417
5420
  return /* @__PURE__ */ jsx(
5418
5421
  Box,
@@ -5946,7 +5949,7 @@ var init_AnimatedReveal = __esm({
5946
5949
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5947
5950
  "none": {}
5948
5951
  };
5949
- AnimatedReveal = React80__default.forwardRef(
5952
+ AnimatedReveal = React81__default.forwardRef(
5950
5953
  ({
5951
5954
  trigger = "scroll",
5952
5955
  animation = "fade-up",
@@ -6106,7 +6109,7 @@ var init_AnimatedGraphic = __esm({
6106
6109
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6107
6110
  "use client";
6108
6111
  init_cn();
6109
- AnimatedGraphic = React80__default.forwardRef(
6112
+ AnimatedGraphic = React81__default.forwardRef(
6110
6113
  ({
6111
6114
  src,
6112
6115
  svgContent,
@@ -6129,7 +6132,7 @@ var init_AnimatedGraphic = __esm({
6129
6132
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6130
6133
  const resolvedSvg = svgContent ?? fetchedSvg;
6131
6134
  const prevAnimateRef = useRef(animate);
6132
- const setRef = React80__default.useCallback(
6135
+ const setRef = React81__default.useCallback(
6133
6136
  (node) => {
6134
6137
  containerRef.current = node;
6135
6138
  if (typeof ref === "function") ref(node);
@@ -6532,7 +6535,7 @@ var init_Drawer = __esm({
6532
6535
  };
6533
6536
  const widthClass = width in sizeWidths ? sizeWidths[width] : "";
6534
6537
  const widthStyle = width in sizeWidths ? void 0 : { width };
6535
- const positionClasses3 = position === "right" ? "right-0 border-l" : "left-0 border-r";
6538
+ const positionClasses = position === "right" ? "right-0 border-l" : "left-0 border-r";
6536
6539
  const animationClasses2 = position === "right" ? "animate-slide-in-right" : "animate-slide-in-left";
6537
6540
  return /* @__PURE__ */ jsxs(Fragment, { children: [
6538
6541
  /* @__PURE__ */ jsx(
@@ -6553,7 +6556,7 @@ var init_Drawer = __esm({
6553
6556
  className: cn(
6554
6557
  "fixed top-0 bottom-0 z-50",
6555
6558
  "flex flex-col max-h-screen",
6556
- positionClasses3,
6559
+ positionClasses,
6557
6560
  widthClass,
6558
6561
  animationClasses2,
6559
6562
  className
@@ -6819,7 +6822,7 @@ var init_ErrorBoundary = __esm({
6819
6822
  }
6820
6823
  );
6821
6824
  };
6822
- ErrorBoundary = class extends React80__default.Component {
6825
+ ErrorBoundary = class extends React81__default.Component {
6823
6826
  constructor(props) {
6824
6827
  super(props);
6825
6828
  __publicField(this, "reset", () => {
@@ -7792,18 +7795,42 @@ var init_Alert = __esm({
7792
7795
  Alert.displayName = "Alert";
7793
7796
  }
7794
7797
  });
7795
- var positionClasses, arrowClasses, Tooltip;
7798
+ function computeTooltipStyle(position, triggerRect) {
7799
+ switch (position) {
7800
+ case "bottom":
7801
+ return {
7802
+ left: triggerRect.left + triggerRect.width / 2,
7803
+ top: triggerRect.bottom + TRIGGER_GAP,
7804
+ transform: "translateX(-50%)"
7805
+ };
7806
+ case "left":
7807
+ return {
7808
+ left: triggerRect.left - TRIGGER_GAP,
7809
+ top: triggerRect.top + triggerRect.height / 2,
7810
+ transform: "translate(-100%, -50%)"
7811
+ };
7812
+ case "right":
7813
+ return {
7814
+ left: triggerRect.right + TRIGGER_GAP,
7815
+ top: triggerRect.top + triggerRect.height / 2,
7816
+ transform: "translateY(-50%)"
7817
+ };
7818
+ case "top":
7819
+ default:
7820
+ return {
7821
+ left: triggerRect.left + triggerRect.width / 2,
7822
+ top: triggerRect.top - TRIGGER_GAP,
7823
+ transform: "translate(-50%, -100%)"
7824
+ };
7825
+ }
7826
+ }
7827
+ var TRIGGER_GAP, arrowClasses, Tooltip;
7796
7828
  var init_Tooltip = __esm({
7797
7829
  "components/core/molecules/Tooltip.tsx"() {
7798
7830
  "use client";
7799
7831
  init_Typography();
7800
7832
  init_cn();
7801
- positionClasses = {
7802
- top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
7803
- bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
7804
- left: "right-full top-1/2 -translate-y-1/2 mr-2",
7805
- right: "left-full top-1/2 -translate-y-1/2 ml-2"
7806
- };
7833
+ TRIGGER_GAP = 8;
7807
7834
  arrowClasses = {
7808
7835
  top: "top-full left-1/2 -translate-x-1/2 border-t-primary border-l-transparent border-r-transparent border-b-transparent",
7809
7836
  bottom: "bottom-full left-1/2 -translate-x-1/2 border-b-primary border-l-transparent border-r-transparent border-t-transparent",
@@ -7858,8 +7885,8 @@ var init_Tooltip = __esm({
7858
7885
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7859
7886
  };
7860
7887
  }, []);
7861
- const triggerElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7862
- const trigger = React80__default.cloneElement(triggerElement, {
7888
+ const triggerElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7889
+ const trigger = React81__default.cloneElement(triggerElement, {
7863
7890
  ref: triggerRef,
7864
7891
  onMouseEnter: handleMouseEnter,
7865
7892
  onMouseLeave: handleMouseLeave,
@@ -7877,14 +7904,9 @@ var init_Tooltip = __esm({
7877
7904
  "text-sm pointer-events-none",
7878
7905
  "break-words whitespace-normal",
7879
7906
  "h-auto min-h-fit",
7880
- positionClasses[position],
7881
7907
  className
7882
7908
  ),
7883
- style: {
7884
- left: position === "left" || position === "right" ? triggerRect.left + (position === "left" ? 0 : triggerRect.width) : triggerRect.left + triggerRect.width / 2,
7885
- top: position === "top" || position === "bottom" ? triggerRect.top + (position === "top" ? 0 : triggerRect.height) : triggerRect.top + triggerRect.height / 2,
7886
- transform: position === "top" || position === "bottom" ? "translateX(-50%)" : position === "left" || position === "right" ? "translateY(-50%)" : "none"
7887
- },
7909
+ style: computeTooltipStyle(position, triggerRect),
7888
7910
  role: "tooltip",
7889
7911
  children: [
7890
7912
  /* @__PURE__ */ jsx("div", { className: "w-full break-words whitespace-normal h-auto", children: typeof content === "string" ? /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-primary-foreground break-words whitespace-normal", children: content }) : /* @__PURE__ */ jsx("div", { className: "break-words whitespace-normal", children: content }) }),
@@ -7911,8 +7933,9 @@ var init_Tooltip = __esm({
7911
7933
  function computePopoverStyle(position, triggerRect, popoverWidth) {
7912
7934
  if (position === "left" || position === "right") {
7913
7935
  return {
7914
- left: triggerRect.left + (position === "left" ? 0 : triggerRect.width),
7915
- top: triggerRect.top + triggerRect.height / 2
7936
+ left: position === "left" ? triggerRect.left - popoverWidth - TRIGGER_GAP2 : triggerRect.right + TRIGGER_GAP2,
7937
+ top: triggerRect.top + triggerRect.height / 2,
7938
+ transform: "translateY(-50%)"
7916
7939
  };
7917
7940
  }
7918
7941
  const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 1024;
@@ -7924,21 +7947,16 @@ function computePopoverStyle(position, triggerRect, popoverWidth) {
7924
7947
  );
7925
7948
  return {
7926
7949
  left: clamped,
7927
- top: triggerRect.top + (position === "top" ? 0 : triggerRect.height)
7950
+ top: position === "top" ? triggerRect.top - TRIGGER_GAP2 : triggerRect.bottom + TRIGGER_GAP2,
7951
+ transform: position === "top" ? "translateY(-100%)" : void 0
7928
7952
  };
7929
7953
  }
7930
- var positionClasses2, arrowClasses2, VIEWPORT_EDGE_PADDING, Popover;
7954
+ var arrowClasses2, VIEWPORT_EDGE_PADDING, TRIGGER_GAP2, Popover;
7931
7955
  var init_Popover = __esm({
7932
7956
  "components/core/molecules/Popover.tsx"() {
7933
7957
  "use client";
7934
7958
  init_Typography();
7935
7959
  init_cn();
7936
- positionClasses2 = {
7937
- top: "mb-2",
7938
- bottom: "mt-2",
7939
- left: "mr-2 -translate-y-1/2",
7940
- right: "ml-2 -translate-y-1/2"
7941
- };
7942
7960
  arrowClasses2 = {
7943
7961
  top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
7944
7962
  bottom: "bottom-full left-1/2 -translate-x-1/2 border-b-white border-l-transparent border-r-transparent border-t-transparent",
@@ -7946,6 +7964,7 @@ var init_Popover = __esm({
7946
7964
  right: "right-full top-1/2 -translate-y-1/2 border-r-white border-t-transparent border-b-transparent border-l-transparent"
7947
7965
  };
7948
7966
  VIEWPORT_EDGE_PADDING = 8;
7967
+ TRIGGER_GAP2 = 8;
7949
7968
  Popover = ({
7950
7969
  content,
7951
7970
  children,
@@ -8014,8 +8033,8 @@ var init_Popover = __esm({
8014
8033
  onMouseEnter: handleOpen,
8015
8034
  onMouseLeave: handleClose
8016
8035
  };
8017
- const childElement = React80__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8018
- const triggerElement = React80__default.cloneElement(
8036
+ const childElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8037
+ const triggerElement = React81__default.cloneElement(
8019
8038
  childElement,
8020
8039
  {
8021
8040
  ref: triggerRef,
@@ -8029,7 +8048,6 @@ var init_Popover = __esm({
8029
8048
  className: cn(
8030
8049
  "fixed z-50 p-4",
8031
8050
  "bg-card border-2 border-border shadow-elevation-popover",
8032
- positionClasses2[position],
8033
8051
  className
8034
8052
  ),
8035
8053
  style: computePopoverStyle(position, triggerRect, popoverWidth),
@@ -8119,7 +8137,7 @@ var init_Menu = __esm({
8119
8137
  document.addEventListener("mousedown", handleClickOutside);
8120
8138
  return () => document.removeEventListener("mousedown", handleClickOutside);
8121
8139
  }, [isOpen]);
8122
- const positionClasses3 = {
8140
+ const positionClasses = {
8123
8141
  "top-left": "bottom-full left-0 mb-2",
8124
8142
  "top-right": "bottom-full right-0 mb-2",
8125
8143
  "bottom-left": "top-full left-0 mt-2",
@@ -8142,8 +8160,8 @@ var init_Menu = __esm({
8142
8160
  };
8143
8161
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
8144
8162
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
8145
- const triggerChild = React80__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8146
- const triggerElement = React80__default.cloneElement(
8163
+ const triggerChild = React81__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8164
+ const triggerElement = React81__default.cloneElement(
8147
8165
  triggerChild,
8148
8166
  {
8149
8167
  ref: triggerRef,
@@ -8227,7 +8245,7 @@ var init_Menu = __esm({
8227
8245
  className: cn(
8228
8246
  "absolute z-50",
8229
8247
  menuContainerStyles,
8230
- positionClasses3[effectivePosition],
8248
+ positionClasses[effectivePosition],
8231
8249
  className
8232
8250
  ),
8233
8251
  style: {
@@ -8403,7 +8421,7 @@ var init_FloatingActionButton = __esm({
8403
8421
  document.addEventListener("mousedown", handleClickOutside);
8404
8422
  return () => document.removeEventListener("mousedown", handleClickOutside);
8405
8423
  }, [isExpanded, actions]);
8406
- const positionClasses3 = {
8424
+ const positionClasses = {
8407
8425
  "bottom-right": "bottom-6 right-6",
8408
8426
  "bottom-left": "bottom-6 left-6",
8409
8427
  "bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
@@ -8412,7 +8430,7 @@ var init_FloatingActionButton = __esm({
8412
8430
  "top-center": "top-6 left-1/2 -translate-x-1/2"
8413
8431
  };
8414
8432
  if (resolvedAction && (!actions || actions.length === 0)) {
8415
- return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses3[position], className), children: /* @__PURE__ */ jsx(
8433
+ return /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", positionClasses[position], className), children: /* @__PURE__ */ jsx(
8416
8434
  Button,
8417
8435
  {
8418
8436
  variant: resolvedAction.variant || "primary",
@@ -8440,7 +8458,7 @@ var init_FloatingActionButton = __esm({
8440
8458
  ref: fabRef,
8441
8459
  className: cn(
8442
8460
  "fixed z-50 flex flex-col items-end gap-3",
8443
- positionClasses3[position],
8461
+ positionClasses[position],
8444
8462
  position.includes("left") && "items-start",
8445
8463
  className
8446
8464
  ),
@@ -8550,13 +8568,13 @@ var init_MapView = __esm({
8550
8568
  shadowSize: [41, 41]
8551
8569
  });
8552
8570
  L.Marker.prototype.options.icon = defaultIcon;
8553
- const { useEffect: useEffect70, useRef: useRef67, useCallback: useCallback114, useState: useState100 } = React80__default;
8571
+ const { useEffect: useEffect71, useRef: useRef68, useCallback: useCallback116, useState: useState102 } = React81__default;
8554
8572
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8555
8573
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8556
8574
  function MapUpdater({ centerLat, centerLng, zoom }) {
8557
8575
  const map = useMap();
8558
- const prevRef = useRef67({ centerLat, centerLng, zoom });
8559
- useEffect70(() => {
8576
+ const prevRef = useRef68({ centerLat, centerLng, zoom });
8577
+ useEffect71(() => {
8560
8578
  const prev = prevRef.current;
8561
8579
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
8562
8580
  map.setView([centerLat, centerLng], zoom);
@@ -8567,7 +8585,7 @@ var init_MapView = __esm({
8567
8585
  }
8568
8586
  function MapClickHandler({ onMapClick }) {
8569
8587
  const map = useMap();
8570
- useEffect70(() => {
8588
+ useEffect71(() => {
8571
8589
  if (!onMapClick) return;
8572
8590
  const handler = (e) => {
8573
8591
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -8595,8 +8613,8 @@ var init_MapView = __esm({
8595
8613
  showAttribution = true
8596
8614
  }) {
8597
8615
  const eventBus = useEventBus2();
8598
- const [clickedPosition, setClickedPosition] = useState100(null);
8599
- const handleMapClick = useCallback114((lat, lng) => {
8616
+ const [clickedPosition, setClickedPosition] = useState102(null);
8617
+ const handleMapClick = useCallback116((lat, lng) => {
8600
8618
  if (showClickedPin) {
8601
8619
  setClickedPosition({ lat, lng });
8602
8620
  }
@@ -8605,7 +8623,7 @@ var init_MapView = __esm({
8605
8623
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
8606
8624
  }
8607
8625
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
8608
- const handleMarkerClick = useCallback114((marker) => {
8626
+ const handleMarkerClick = useCallback116((marker) => {
8609
8627
  onMarkerClick?.(marker);
8610
8628
  if (markerClickEvent) {
8611
8629
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -8614,7 +8632,7 @@ var init_MapView = __esm({
8614
8632
  return /* @__PURE__ */ jsx(
8615
8633
  Box,
8616
8634
  {
8617
- className: cn("relative w-full overflow-hidden rounded-lg", className),
8635
+ className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
8618
8636
  style: { height },
8619
8637
  "data-testid": "map-view",
8620
8638
  children: /* @__PURE__ */ jsxs(
@@ -8796,7 +8814,7 @@ function InputPattern({
8796
8814
  fieldName
8797
8815
  }) {
8798
8816
  const { emit } = useEventBus();
8799
- const [localValue, setLocalValue] = React80__default.useState(value);
8817
+ const [localValue, setLocalValue] = React81__default.useState(value);
8800
8818
  const handleChange = (e) => {
8801
8819
  setLocalValue(e.target.value);
8802
8820
  if (onChange) {
@@ -8834,7 +8852,7 @@ function TextareaPattern({
8834
8852
  fieldName
8835
8853
  }) {
8836
8854
  const { emit } = useEventBus();
8837
- const [localValue, setLocalValue] = React80__default.useState(value);
8855
+ const [localValue, setLocalValue] = React81__default.useState(value);
8838
8856
  const handleChange = (e) => {
8839
8857
  setLocalValue(e.target.value);
8840
8858
  if (onChange) {
@@ -8866,7 +8884,7 @@ function SelectPattern({
8866
8884
  fieldName
8867
8885
  }) {
8868
8886
  const { emit } = useEventBus();
8869
- const [localValue, setLocalValue] = React80__default.useState(value);
8887
+ const [localValue, setLocalValue] = React81__default.useState(value);
8870
8888
  const handleChange = (e) => {
8871
8889
  setLocalValue(e.target.value);
8872
8890
  if (onChange) {
@@ -8895,7 +8913,7 @@ function CheckboxPattern({
8895
8913
  className
8896
8914
  }) {
8897
8915
  const { emit } = useEventBus();
8898
- const [localChecked, setLocalChecked] = React80__default.useState(checked);
8916
+ const [localChecked, setLocalChecked] = React81__default.useState(checked);
8899
8917
  const handleChange = (e) => {
8900
8918
  setLocalChecked(e.target.checked);
8901
8919
  if (onChange) {
@@ -9208,9 +9226,9 @@ function ControlButton({
9208
9226
  className
9209
9227
  }) {
9210
9228
  const eventBus = useEventBus();
9211
- const [isPressed, setIsPressed] = React80.useState(false);
9229
+ const [isPressed, setIsPressed] = React81.useState(false);
9212
9230
  const actualPressed = pressed ?? isPressed;
9213
- const handlePointerDown = React80.useCallback(
9231
+ const handlePointerDown = React81.useCallback(
9214
9232
  (e) => {
9215
9233
  e.preventDefault();
9216
9234
  if (disabled) return;
@@ -9220,7 +9238,7 @@ function ControlButton({
9220
9238
  },
9221
9239
  [disabled, pressEvent, eventBus, onPress]
9222
9240
  );
9223
- const handlePointerUp = React80.useCallback(
9241
+ const handlePointerUp = React81.useCallback(
9224
9242
  (e) => {
9225
9243
  e.preventDefault();
9226
9244
  if (disabled) return;
@@ -9230,7 +9248,7 @@ function ControlButton({
9230
9248
  },
9231
9249
  [disabled, releaseEvent, eventBus, onRelease]
9232
9250
  );
9233
- const handlePointerLeave = React80.useCallback(
9251
+ const handlePointerLeave = React81.useCallback(
9234
9252
  (e) => {
9235
9253
  if (isPressed) {
9236
9254
  setIsPressed(false);
@@ -9307,8 +9325,8 @@ function ActionButtons({
9307
9325
  disabled
9308
9326
  }) {
9309
9327
  const eventBus = useEventBus();
9310
- const [activeButtons, setActiveButtons] = React80.useState(/* @__PURE__ */ new Set());
9311
- const handlePress = React80.useCallback(
9328
+ const [activeButtons, setActiveButtons] = React81.useState(/* @__PURE__ */ new Set());
9329
+ const handlePress = React81.useCallback(
9312
9330
  (id) => {
9313
9331
  setActiveButtons((prev) => new Set(prev).add(id));
9314
9332
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9316,7 +9334,7 @@ function ActionButtons({
9316
9334
  },
9317
9335
  [actionEvent, eventBus, onAction]
9318
9336
  );
9319
- const handleRelease = React80.useCallback(
9337
+ const handleRelease = React81.useCallback(
9320
9338
  (id) => {
9321
9339
  setActiveButtons((prev) => {
9322
9340
  const next = new Set(prev);
@@ -12242,7 +12260,10 @@ function computeFoldRegions(code) {
12242
12260
  }
12243
12261
  return regions.sort((a, b) => a.start - b.start);
12244
12262
  }
12245
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12263
+ function toCodeLanguage(value) {
12264
+ return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
12265
+ }
12266
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12246
12267
  var init_CodeBlock = __esm({
12247
12268
  "components/core/molecules/markdown/CodeBlock.tsx"() {
12248
12269
  init_Box();
@@ -12320,9 +12341,40 @@ var init_CodeBlock = __esm({
12320
12341
  };
12321
12342
  loloStyle = { ...dark, ...loloStyleOverrides };
12322
12343
  log5 = createLogger("almadar:ui:markdown-code");
12344
+ CODE_LANGUAGES = [
12345
+ "text",
12346
+ "json",
12347
+ "javascript",
12348
+ "js",
12349
+ "typescript",
12350
+ "ts",
12351
+ "jsx",
12352
+ "tsx",
12353
+ "css",
12354
+ "markdown",
12355
+ "md",
12356
+ "bash",
12357
+ "shell",
12358
+ "sh",
12359
+ "yaml",
12360
+ "yml",
12361
+ "rust",
12362
+ "python",
12363
+ "py",
12364
+ "sql",
12365
+ "diff",
12366
+ "toml",
12367
+ "go",
12368
+ "graphql",
12369
+ "html",
12370
+ "xml",
12371
+ "orb",
12372
+ "lolo"
12373
+ ];
12374
+ CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
12323
12375
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12324
12376
  HIDDEN_LINE_NUMBERS = { display: "none" };
12325
- CodeBlock = React80__default.memo(
12377
+ CodeBlock = React81__default.memo(
12326
12378
  ({
12327
12379
  code: rawCode,
12328
12380
  language = "text",
@@ -12759,7 +12811,7 @@ var init_MarkdownContent = __esm({
12759
12811
  init_Box();
12760
12812
  init_CodeBlock();
12761
12813
  init_cn();
12762
- MarkdownContent = React80__default.memo(
12814
+ MarkdownContent = React81__default.memo(
12763
12815
  ({ content, direction, className }) => {
12764
12816
  const { t: _t } = useTranslate();
12765
12817
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12809,7 +12861,7 @@ var init_MarkdownContent = __esm({
12809
12861
  CodeBlock,
12810
12862
  {
12811
12863
  code,
12812
- language: match[1],
12864
+ language: toCodeLanguage(match[1]),
12813
12865
  maxHeight: "60vh"
12814
12866
  }
12815
12867
  );
@@ -13855,7 +13907,7 @@ var init_StateMachineView = __esm({
13855
13907
  style: { top: title ? 30 : 0 },
13856
13908
  children: [
13857
13909
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
13858
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React80__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
13910
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React81__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
13859
13911
  StateNode,
13860
13912
  {
13861
13913
  state,
@@ -14668,7 +14720,7 @@ var init_ContentRenderer = __esm({
14668
14720
  CodeBlock,
14669
14721
  {
14670
14722
  code: segment.content,
14671
- language: segment.language
14723
+ language: toCodeLanguage(segment.language)
14672
14724
  },
14673
14725
  key
14674
14726
  );
@@ -14693,7 +14745,7 @@ var init_ContentRenderer = __esm({
14693
14745
  CodeBlock,
14694
14746
  {
14695
14747
  code: segment.content,
14696
- language: segment.language
14748
+ language: toCodeLanguage(segment.language)
14697
14749
  }
14698
14750
  ),
14699
14751
  /* @__PURE__ */ jsx(ScaledDiagram, { children: /* @__PURE__ */ jsx(
@@ -15460,7 +15512,7 @@ var init_Grid = __esm({
15460
15512
  as: Component = "div"
15461
15513
  }) => {
15462
15514
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
15463
- return React80__default.createElement(
15515
+ return React81__default.createElement(
15464
15516
  Component,
15465
15517
  {
15466
15518
  className: cn(
@@ -20998,7 +21050,7 @@ function CraftingRecipe({
20998
21050
  className
20999
21051
  }) {
21000
21052
  const eventBus = useEventBus();
21001
- const handleCraft = React80.useCallback(() => {
21053
+ const handleCraft = React81.useCallback(() => {
21002
21054
  onCraft?.();
21003
21055
  if (craftEvent) {
21004
21056
  eventBus.emit(craftEvent, { output: output.label });
@@ -21015,7 +21067,7 @@ function CraftingRecipe({
21015
21067
  children: [
21016
21068
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
21017
21069
  const hasSufficient = ingredient.available >= ingredient.required;
21018
- return /* @__PURE__ */ jsxs(React80.Fragment, { children: [
21070
+ return /* @__PURE__ */ jsxs(React81.Fragment, { children: [
21019
21071
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
21020
21072
  ItemSlot,
21021
21073
  {
@@ -21078,8 +21130,8 @@ function DPad({
21078
21130
  }) {
21079
21131
  const eventBus = useEventBus();
21080
21132
  const sizes = sizeMap6[size];
21081
- const [activeDirections, setActiveDirections] = React80.useState(/* @__PURE__ */ new Set());
21082
- const handlePress = React80.useCallback(
21133
+ const [activeDirections, setActiveDirections] = React81.useState(/* @__PURE__ */ new Set());
21134
+ const handlePress = React81.useCallback(
21083
21135
  (direction) => {
21084
21136
  setActiveDirections((prev) => new Set(prev).add(direction));
21085
21137
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -21087,7 +21139,7 @@ function DPad({
21087
21139
  },
21088
21140
  [directionEvent, eventBus, onDirection]
21089
21141
  );
21090
- const handleRelease = React80.useCallback(
21142
+ const handleRelease = React81.useCallback(
21091
21143
  (direction) => {
21092
21144
  setActiveDirections((prev) => {
21093
21145
  const next = new Set(prev);
@@ -21822,14 +21874,14 @@ function useDataDnd(args) {
21822
21874
  const isZone = Boolean(dragGroup || accepts || sortable);
21823
21875
  const enabled = isZone || Boolean(dndRoot);
21824
21876
  const eventBus = useEventBus();
21825
- const parentRoot = React80__default.useContext(RootCtx);
21877
+ const parentRoot = React81__default.useContext(RootCtx);
21826
21878
  const isRoot = enabled && parentRoot === null;
21827
- const zoneId = React80__default.useId();
21879
+ const zoneId = React81__default.useId();
21828
21880
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21829
- const [optimisticOrders, setOptimisticOrders] = React80__default.useState(() => /* @__PURE__ */ new Map());
21830
- const optimisticOrdersRef = React80__default.useRef(optimisticOrders);
21881
+ const [optimisticOrders, setOptimisticOrders] = React81__default.useState(() => /* @__PURE__ */ new Map());
21882
+ const optimisticOrdersRef = React81__default.useRef(optimisticOrders);
21831
21883
  optimisticOrdersRef.current = optimisticOrders;
21832
- const clearOptimisticOrder = React80__default.useCallback((group) => {
21884
+ const clearOptimisticOrder = React81__default.useCallback((group) => {
21833
21885
  setOptimisticOrders((prev) => {
21834
21886
  if (!prev.has(group)) return prev;
21835
21887
  const next = new Map(prev);
@@ -21854,7 +21906,7 @@ function useDataDnd(args) {
21854
21906
  const raw = it[dndItemIdField];
21855
21907
  return String(raw ?? `__idx_${idx}`);
21856
21908
  }).join("|");
21857
- const itemIds = React80__default.useMemo(
21909
+ const itemIds = React81__default.useMemo(
21858
21910
  () => orderedItems.map((it, idx) => {
21859
21911
  const raw = it[dndItemIdField];
21860
21912
  return raw ?? `__idx_${idx}`;
@@ -21862,7 +21914,7 @@ function useDataDnd(args) {
21862
21914
  [itemIdsSignature]
21863
21915
  );
21864
21916
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
21865
- React80__default.useEffect(() => {
21917
+ React81__default.useEffect(() => {
21866
21918
  const root = isRoot ? null : parentRoot;
21867
21919
  if (root) {
21868
21920
  root.clearOptimisticOrder(ownGroup);
@@ -21870,20 +21922,20 @@ function useDataDnd(args) {
21870
21922
  clearOptimisticOrder(ownGroup);
21871
21923
  }
21872
21924
  }, [itemsContentSig, ownGroup]);
21873
- const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
21874
- const registerZone = React80__default.useCallback((zoneId2, meta2) => {
21925
+ const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
21926
+ const registerZone = React81__default.useCallback((zoneId2, meta2) => {
21875
21927
  zonesRef.current.set(zoneId2, meta2);
21876
21928
  }, []);
21877
- const unregisterZone = React80__default.useCallback((zoneId2) => {
21929
+ const unregisterZone = React81__default.useCallback((zoneId2) => {
21878
21930
  zonesRef.current.delete(zoneId2);
21879
21931
  }, []);
21880
- const [activeDrag, setActiveDrag] = React80__default.useState(null);
21881
- const [overZoneGroup, setOverZoneGroup] = React80__default.useState(null);
21882
- const meta = React80__default.useMemo(
21932
+ const [activeDrag, setActiveDrag] = React81__default.useState(null);
21933
+ const [overZoneGroup, setOverZoneGroup] = React81__default.useState(null);
21934
+ const meta = React81__default.useMemo(
21883
21935
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
21884
21936
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
21885
21937
  );
21886
- React80__default.useEffect(() => {
21938
+ React81__default.useEffect(() => {
21887
21939
  const target = isRoot ? null : parentRoot;
21888
21940
  if (!target) {
21889
21941
  zonesRef.current.set(zoneId, meta);
@@ -21902,7 +21954,7 @@ function useDataDnd(args) {
21902
21954
  }, [parentRoot, isRoot, zoneId, meta]);
21903
21955
  const sensors = useAlmadarDndSensors(true);
21904
21956
  const collisionDetection = almadarDndCollisionDetection;
21905
- const findZoneByItem = React80__default.useCallback(
21957
+ const findZoneByItem = React81__default.useCallback(
21906
21958
  (id) => {
21907
21959
  for (const z of zonesRef.current.values()) {
21908
21960
  if (z.itemIds.includes(id)) return z;
@@ -21911,7 +21963,7 @@ function useDataDnd(args) {
21911
21963
  },
21912
21964
  []
21913
21965
  );
21914
- React80__default.useCallback(
21966
+ React81__default.useCallback(
21915
21967
  (group) => {
21916
21968
  for (const z of zonesRef.current.values()) {
21917
21969
  if (z.group === group) return z;
@@ -21920,7 +21972,7 @@ function useDataDnd(args) {
21920
21972
  },
21921
21973
  []
21922
21974
  );
21923
- const handleDragEnd = React80__default.useCallback(
21975
+ const handleDragEnd = React81__default.useCallback(
21924
21976
  (event) => {
21925
21977
  const { active, over } = event;
21926
21978
  const activeIdStr = String(active.id);
@@ -22011,8 +22063,8 @@ function useDataDnd(args) {
22011
22063
  },
22012
22064
  [eventBus]
22013
22065
  );
22014
- const sortableData = React80__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22015
- const SortableItem = React80__default.useCallback(
22066
+ const sortableData = React81__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22067
+ const SortableItem = React81__default.useCallback(
22016
22068
  ({ id, children }) => {
22017
22069
  const {
22018
22070
  attributes,
@@ -22052,7 +22104,7 @@ function useDataDnd(args) {
22052
22104
  id: droppableId,
22053
22105
  data: sortableData
22054
22106
  });
22055
- const ctx = React80__default.useContext(RootCtx);
22107
+ const ctx = React81__default.useContext(RootCtx);
22056
22108
  const activeDrag2 = ctx?.activeDrag ?? null;
22057
22109
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22058
22110
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22067,7 +22119,7 @@ function useDataDnd(args) {
22067
22119
  showForeignPlaceholder,
22068
22120
  ctxAvailable: ctx != null
22069
22121
  });
22070
- React80__default.useEffect(() => {
22122
+ React81__default.useEffect(() => {
22071
22123
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22072
22124
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22073
22125
  return /* @__PURE__ */ jsx(
@@ -22081,11 +22133,11 @@ function useDataDnd(args) {
22081
22133
  }
22082
22134
  );
22083
22135
  };
22084
- const rootContextValue = React80__default.useMemo(
22136
+ const rootContextValue = React81__default.useMemo(
22085
22137
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22086
22138
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22087
22139
  );
22088
- const handleDragStart = React80__default.useCallback((event) => {
22140
+ const handleDragStart = React81__default.useCallback((event) => {
22089
22141
  const sourceZone = findZoneByItem(event.active.id);
22090
22142
  const rect = event.active.rect.current.initial;
22091
22143
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22104,7 +22156,7 @@ function useDataDnd(args) {
22104
22156
  isRoot
22105
22157
  });
22106
22158
  }, [findZoneByItem, isRoot, zoneId]);
22107
- const handleDragOver = React80__default.useCallback((event) => {
22159
+ const handleDragOver = React81__default.useCallback((event) => {
22108
22160
  const { active, over } = event;
22109
22161
  const overData = over?.data?.current;
22110
22162
  const overGroup = overData?.dndGroup ?? null;
@@ -22174,7 +22226,7 @@ function useDataDnd(args) {
22174
22226
  return next;
22175
22227
  });
22176
22228
  }, []);
22177
- const handleDragCancel = React80__default.useCallback((event) => {
22229
+ const handleDragCancel = React81__default.useCallback((event) => {
22178
22230
  setActiveDrag(null);
22179
22231
  setOverZoneGroup(null);
22180
22232
  dndLog.warn("dragCancel", {
@@ -22182,12 +22234,12 @@ function useDataDnd(args) {
22182
22234
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22183
22235
  });
22184
22236
  }, []);
22185
- const handleDragEndWithCleanup = React80__default.useCallback((event) => {
22237
+ const handleDragEndWithCleanup = React81__default.useCallback((event) => {
22186
22238
  handleDragEnd(event);
22187
22239
  setActiveDrag(null);
22188
22240
  setOverZoneGroup(null);
22189
22241
  }, [handleDragEnd]);
22190
- const wrapContainer = React80__default.useCallback(
22242
+ const wrapContainer = React81__default.useCallback(
22191
22243
  (children) => {
22192
22244
  if (!enabled) return children;
22193
22245
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -22241,7 +22293,7 @@ var init_useDataDnd = __esm({
22241
22293
  init_useAlmadarDndCollision();
22242
22294
  init_Box();
22243
22295
  dndLog = createLogger("almadar:ui:dnd");
22244
- RootCtx = React80__default.createContext(null);
22296
+ RootCtx = React81__default.createContext(null);
22245
22297
  }
22246
22298
  });
22247
22299
  function fieldLabel2(key) {
@@ -22761,7 +22813,7 @@ function DataList({
22761
22813
  }) {
22762
22814
  const eventBus = useEventBus();
22763
22815
  const { t } = useTranslate();
22764
- const [visibleCount, setVisibleCount] = React80__default.useState(pageSize || Infinity);
22816
+ const [visibleCount, setVisibleCount] = React81__default.useState(pageSize || Infinity);
22765
22817
  const fieldDefs = fields ?? columns ?? [];
22766
22818
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
22767
22819
  const dnd = useDataDnd({
@@ -22780,7 +22832,7 @@ function DataList({
22780
22832
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
22781
22833
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
22782
22834
  const hasRenderProp = typeof children === "function";
22783
- React80__default.useEffect(() => {
22835
+ React81__default.useEffect(() => {
22784
22836
  const renderItemTypeOf = typeof schemaRenderItem;
22785
22837
  const childrenTypeOf = typeof children;
22786
22838
  if (data.length > 0 && !hasRenderProp) {
@@ -22885,7 +22937,7 @@ function DataList({
22885
22937
  const items2 = data.map((item) => item);
22886
22938
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
22887
22939
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
22888
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
22940
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22889
22941
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
22890
22942
  group.items.map((itemData, index) => {
22891
22943
  const id = itemData.id || `${gi}-${index}`;
@@ -23033,7 +23085,7 @@ function DataList({
23033
23085
  className
23034
23086
  ),
23035
23087
  children: [
23036
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
23088
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
23037
23089
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23038
23090
  group.items.map(
23039
23091
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -24657,7 +24709,7 @@ var init_WizardProgress = __esm({
24657
24709
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
24658
24710
  const isActive = index === currentStep;
24659
24711
  const isCompleted = index < currentStep;
24660
- return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
24712
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
24661
24713
  /* @__PURE__ */ jsx(
24662
24714
  "button",
24663
24715
  {
@@ -25174,7 +25226,7 @@ var init_FormSectionHeader = __esm({
25174
25226
  Box,
25175
25227
  {
25176
25228
  className: cn(
25177
- "px-4 py-3 bg-muted rounded-t-lg",
25229
+ "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
25178
25230
  isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
25179
25231
  className
25180
25232
  ),
@@ -25186,7 +25238,7 @@ var init_FormSectionHeader = __esm({
25186
25238
  {
25187
25239
  name: icon,
25188
25240
  size: "md",
25189
- className: "text-muted-foreground"
25241
+ className: "text-primary"
25190
25242
  }
25191
25243
  ),
25192
25244
  statusIcon && /* @__PURE__ */ jsx(
@@ -25197,8 +25249,8 @@ var init_FormSectionHeader = __esm({
25197
25249
  className: hasErrors ? "text-error" : "text-success"
25198
25250
  }
25199
25251
  ),
25200
- /* @__PURE__ */ jsxs(Box, { children: [
25201
- /* @__PURE__ */ jsx(Typography, { variant: "label", weight: "semibold", children: title }),
25252
+ /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
25253
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
25202
25254
  subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
25203
25255
  ] })
25204
25256
  ] }),
@@ -25268,6 +25320,303 @@ var init_FlipCard = __esm({
25268
25320
  FlipCard.displayName = "FlipCard";
25269
25321
  }
25270
25322
  });
25323
+ var ALL_CATEGORY, GridPicker;
25324
+ var init_GridPicker = __esm({
25325
+ "components/core/molecules/GridPicker.tsx"() {
25326
+ "use client";
25327
+ init_cn();
25328
+ init_Input();
25329
+ init_Badge();
25330
+ init_Stack();
25331
+ ALL_CATEGORY = "__all__";
25332
+ GridPicker = ({
25333
+ items,
25334
+ value,
25335
+ onChange,
25336
+ categories,
25337
+ searchPlaceholder,
25338
+ renderThumbnail,
25339
+ cellSize = 32,
25340
+ className
25341
+ }) => {
25342
+ const [search, setSearch] = useState("");
25343
+ const [activeCategory, setActiveCategory] = useState(ALL_CATEGORY);
25344
+ const gridRef = useRef(null);
25345
+ const categoryChips = useMemo(() => {
25346
+ if (categories !== void 0) return categories;
25347
+ const seen = [];
25348
+ for (const item of items) {
25349
+ if (!seen.includes(item.category)) seen.push(item.category);
25350
+ }
25351
+ return seen;
25352
+ }, [categories, items]);
25353
+ const filtered = useMemo(() => {
25354
+ const needle = search.trim().toLowerCase();
25355
+ return items.filter((item) => {
25356
+ const matchesCategory = activeCategory === ALL_CATEGORY || item.category === activeCategory;
25357
+ const matchesSearch = needle === "" || item.label.toLowerCase().includes(needle);
25358
+ return matchesCategory && matchesSearch;
25359
+ });
25360
+ }, [items, search, activeCategory]);
25361
+ const select = useCallback(
25362
+ (item) => {
25363
+ onChange(item.id);
25364
+ },
25365
+ [onChange]
25366
+ );
25367
+ const handleKeyDown = useCallback(
25368
+ (e, index) => {
25369
+ const cells = gridRef.current?.querySelectorAll(
25370
+ "[data-gridpicker-cell]"
25371
+ );
25372
+ if (cells === void 0 || cells.length === 0) return;
25373
+ const columns = (() => {
25374
+ const grid = gridRef.current;
25375
+ if (grid === null) return 1;
25376
+ const style = window.getComputedStyle(grid);
25377
+ const cols = style.gridTemplateColumns.split(" ").filter(Boolean).length;
25378
+ return cols > 0 ? cols : 1;
25379
+ })();
25380
+ let next = -1;
25381
+ if (e.key === "ArrowRight") next = index + 1;
25382
+ else if (e.key === "ArrowLeft") next = index - 1;
25383
+ else if (e.key === "ArrowDown") next = index + columns;
25384
+ else if (e.key === "ArrowUp") next = index - columns;
25385
+ else if (e.key === "Enter" || e.key === " ") {
25386
+ e.preventDefault();
25387
+ select(filtered[index]);
25388
+ return;
25389
+ } else {
25390
+ return;
25391
+ }
25392
+ e.preventDefault();
25393
+ if (next >= 0 && next < cells.length) {
25394
+ cells[next].focus();
25395
+ }
25396
+ },
25397
+ [filtered, select]
25398
+ );
25399
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("w-full", className), children: [
25400
+ /* @__PURE__ */ jsx(
25401
+ Input,
25402
+ {
25403
+ type: "search",
25404
+ icon: "search",
25405
+ value: search,
25406
+ placeholder: searchPlaceholder,
25407
+ clearable: true,
25408
+ onClear: () => setSearch(""),
25409
+ onChange: (e) => setSearch(e.target.value)
25410
+ }
25411
+ ),
25412
+ categoryChips.length > 0 && /* @__PURE__ */ jsxs(HStack, { gap: "xs", wrap: true, children: [
25413
+ /* @__PURE__ */ jsx(
25414
+ Badge,
25415
+ {
25416
+ variant: activeCategory === ALL_CATEGORY ? "primary" : "neutral",
25417
+ size: "sm",
25418
+ role: "button",
25419
+ tabIndex: 0,
25420
+ "aria-pressed": activeCategory === ALL_CATEGORY,
25421
+ className: "cursor-pointer",
25422
+ onClick: () => setActiveCategory(ALL_CATEGORY),
25423
+ onKeyDown: (e) => {
25424
+ if (e.key === "Enter" || e.key === " ") {
25425
+ e.preventDefault();
25426
+ setActiveCategory(ALL_CATEGORY);
25427
+ }
25428
+ },
25429
+ children: "All"
25430
+ }
25431
+ ),
25432
+ categoryChips.map((category) => /* @__PURE__ */ jsx(
25433
+ Badge,
25434
+ {
25435
+ variant: activeCategory === category ? "primary" : "neutral",
25436
+ size: "sm",
25437
+ role: "button",
25438
+ tabIndex: 0,
25439
+ "aria-pressed": activeCategory === category,
25440
+ className: "cursor-pointer",
25441
+ onClick: () => setActiveCategory(category),
25442
+ onKeyDown: (e) => {
25443
+ if (e.key === "Enter" || e.key === " ") {
25444
+ e.preventDefault();
25445
+ setActiveCategory(category);
25446
+ }
25447
+ },
25448
+ children: category
25449
+ },
25450
+ category
25451
+ ))
25452
+ ] }),
25453
+ /* @__PURE__ */ jsx(
25454
+ "div",
25455
+ {
25456
+ ref: gridRef,
25457
+ role: "listbox",
25458
+ className: "grid gap-1 overflow-y-auto max-h-64 p-1",
25459
+ style: {
25460
+ gridTemplateColumns: `repeat(auto-fill, minmax(${cellSize}px, 1fr))`
25461
+ },
25462
+ children: filtered.map((item, index) => {
25463
+ const selected = item.id === value;
25464
+ return /* @__PURE__ */ jsx(
25465
+ "button",
25466
+ {
25467
+ type: "button",
25468
+ role: "option",
25469
+ "aria-selected": selected,
25470
+ "aria-label": item.label,
25471
+ title: item.label,
25472
+ "data-gridpicker-cell": true,
25473
+ tabIndex: selected || value === void 0 && index === 0 ? 0 : -1,
25474
+ onClick: () => select(item),
25475
+ onKeyDown: (e) => handleKeyDown(e, index),
25476
+ className: cn(
25477
+ "flex items-center justify-center rounded-sm",
25478
+ "transition-colors hover:bg-muted",
25479
+ "focus:outline-none focus:ring-1 focus:ring-ring",
25480
+ selected && "bg-primary/10 ring-1 ring-primary"
25481
+ ),
25482
+ style: { width: cellSize, height: cellSize },
25483
+ children: renderThumbnail(item)
25484
+ },
25485
+ item.id
25486
+ );
25487
+ })
25488
+ }
25489
+ )
25490
+ ] });
25491
+ };
25492
+ GridPicker.displayName = "GridPicker";
25493
+ }
25494
+ });
25495
+ function iconForKind(kind) {
25496
+ if (kind === "audio") return "music";
25497
+ if (kind === "model") return "box";
25498
+ return "file";
25499
+ }
25500
+ var THUMB_PX, IMAGE_KINDS, AssetPicker;
25501
+ var init_AssetPicker = __esm({
25502
+ "components/core/molecules/AssetPicker.tsx"() {
25503
+ "use client";
25504
+ init_GridPicker();
25505
+ init_Icon();
25506
+ THUMB_PX = 32;
25507
+ IMAGE_KINDS = /* @__PURE__ */ new Set([
25508
+ "image",
25509
+ "spritesheet",
25510
+ "scene",
25511
+ "portrait"
25512
+ ]);
25513
+ AssetPicker = ({
25514
+ assets,
25515
+ value,
25516
+ onChange,
25517
+ className
25518
+ }) => {
25519
+ const byUrl = useMemo(() => {
25520
+ const map = /* @__PURE__ */ new Map();
25521
+ for (const entry of assets) map.set(entry.url, entry);
25522
+ return map;
25523
+ }, [assets]);
25524
+ const items = useMemo(
25525
+ () => assets.map((entry) => ({
25526
+ id: entry.url,
25527
+ label: entry.name,
25528
+ category: entry.category
25529
+ })),
25530
+ [assets]
25531
+ );
25532
+ const categories = useMemo(() => {
25533
+ const seen = [];
25534
+ for (const entry of assets) {
25535
+ if (!seen.includes(entry.category)) seen.push(entry.category);
25536
+ }
25537
+ return seen;
25538
+ }, [assets]);
25539
+ const renderThumbnail = useCallback(
25540
+ (item) => {
25541
+ const entry = byUrl.get(item.id);
25542
+ if (entry === void 0) return null;
25543
+ if (IMAGE_KINDS.has(entry.kind)) {
25544
+ return /* @__PURE__ */ jsx(
25545
+ "img",
25546
+ {
25547
+ src: entry.thumbnailUrl ?? entry.url,
25548
+ alt: entry.name,
25549
+ loading: "lazy",
25550
+ width: THUMB_PX,
25551
+ height: THUMB_PX,
25552
+ style: { width: THUMB_PX, height: THUMB_PX, objectFit: "cover" }
25553
+ }
25554
+ );
25555
+ }
25556
+ return /* @__PURE__ */ jsx(Icon, { name: iconForKind(entry.kind), size: "sm" });
25557
+ },
25558
+ [byUrl]
25559
+ );
25560
+ return /* @__PURE__ */ jsx(
25561
+ GridPicker,
25562
+ {
25563
+ items,
25564
+ value,
25565
+ onChange,
25566
+ categories,
25567
+ renderThumbnail,
25568
+ cellSize: THUMB_PX,
25569
+ className
25570
+ }
25571
+ );
25572
+ };
25573
+ AssetPicker.displayName = "AssetPicker";
25574
+ }
25575
+ });
25576
+ function pascalToKebab(name) {
25577
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
25578
+ }
25579
+ function kebabToPascal3(name) {
25580
+ return name.split("-").map((part) => /^\d+$/.test(part) ? part : part.charAt(0).toUpperCase() + part.slice(1)).join("");
25581
+ }
25582
+ var ICON_ITEMS, IconPicker;
25583
+ var init_IconPicker = __esm({
25584
+ "components/core/molecules/IconPicker.tsx"() {
25585
+ "use client";
25586
+ init_Icon();
25587
+ init_GridPicker();
25588
+ ICON_ITEMS = (() => {
25589
+ const items = [];
25590
+ for (const [exportName, candidate] of Object.entries(LucideIcons2)) {
25591
+ if (!/^[A-Z]/.test(exportName)) continue;
25592
+ if (exportName.endsWith("Icon")) continue;
25593
+ if (exportName.startsWith("Lucide")) continue;
25594
+ const isComponent = candidate !== null && (typeof candidate === "object" || typeof candidate === "function") && "$$typeof" in candidate;
25595
+ if (!isComponent) continue;
25596
+ const kebab = pascalToKebab(exportName);
25597
+ if (kebabToPascal3(kebab) !== exportName) continue;
25598
+ items.push({ id: kebab, label: kebab, category: "icons" });
25599
+ }
25600
+ return items;
25601
+ })();
25602
+ IconPicker = ({ value, onChange, className }) => {
25603
+ const items = useMemo(() => ICON_ITEMS, []);
25604
+ return /* @__PURE__ */ jsx(
25605
+ GridPicker,
25606
+ {
25607
+ items,
25608
+ value,
25609
+ onChange,
25610
+ searchPlaceholder: "Search icons\u2026",
25611
+ renderThumbnail: (it) => /* @__PURE__ */ jsx(Icon, { name: it.id }),
25612
+ cellSize: 32,
25613
+ className
25614
+ }
25615
+ );
25616
+ };
25617
+ IconPicker.displayName = "IconPicker";
25618
+ }
25619
+ });
25271
25620
  function toISODate(d) {
25272
25621
  return d.toISOString().slice(0, 10);
25273
25622
  }
@@ -25704,9 +26053,9 @@ function ScoreDisplay({
25704
26053
  ...rest
25705
26054
  }) {
25706
26055
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
25707
- const [displayValue, setDisplayValue] = React80.useState(resolvedValue);
25708
- const [isAnimating, setIsAnimating] = React80.useState(false);
25709
- React80.useEffect(() => {
26056
+ const [displayValue, setDisplayValue] = React81.useState(resolvedValue);
26057
+ const [isAnimating, setIsAnimating] = React81.useState(false);
26058
+ React81.useEffect(() => {
25710
26059
  if (!animated || displayValue === resolvedValue) {
25711
26060
  setDisplayValue(resolvedValue);
25712
26061
  return;
@@ -25853,7 +26202,7 @@ function InventoryGrid({
25853
26202
  const eventBus = useEventBus();
25854
26203
  const slotCount = totalSlots ?? items.length;
25855
26204
  const emptySlotCount = Math.max(0, slotCount - items.length);
25856
- const handleSelect = React80.useCallback(
26205
+ const handleSelect = React81.useCallback(
25857
26206
  (id) => {
25858
26207
  onSelect?.(id);
25859
26208
  if (selectEvent) {
@@ -26139,31 +26488,31 @@ function GameCanvas2D({
26139
26488
  assetBaseUrl = "",
26140
26489
  className
26141
26490
  }) {
26142
- const canvasRef = React80.useRef(null);
26143
- const rafRef = React80.useRef(0);
26144
- const frameRef = React80.useRef(0);
26145
- const lastTimeRef = React80.useRef(0);
26146
- const imageCache = React80.useRef(/* @__PURE__ */ new Map());
26491
+ const canvasRef = React81.useRef(null);
26492
+ const rafRef = React81.useRef(0);
26493
+ const frameRef = React81.useRef(0);
26494
+ const lastTimeRef = React81.useRef(0);
26495
+ const imageCache = React81.useRef(/* @__PURE__ */ new Map());
26147
26496
  const emit = useEmitEvent();
26148
- const onDrawRef = React80.useRef(onDraw);
26497
+ const onDrawRef = React81.useRef(onDraw);
26149
26498
  onDrawRef.current = onDraw;
26150
- const onTickRef = React80.useRef(onTick);
26499
+ const onTickRef = React81.useRef(onTick);
26151
26500
  onTickRef.current = onTick;
26152
- const tickEventRef = React80.useRef(tickEvent);
26501
+ const tickEventRef = React81.useRef(tickEvent);
26153
26502
  tickEventRef.current = tickEvent;
26154
- const drawEventRef = React80.useRef(drawEvent);
26503
+ const drawEventRef = React81.useRef(drawEvent);
26155
26504
  drawEventRef.current = drawEvent;
26156
- const emitRef = React80.useRef(emit);
26505
+ const emitRef = React81.useRef(emit);
26157
26506
  emitRef.current = emit;
26158
- const assetBaseUrlRef = React80.useRef(assetBaseUrl);
26507
+ const assetBaseUrlRef = React81.useRef(assetBaseUrl);
26159
26508
  assetBaseUrlRef.current = assetBaseUrl;
26160
- const backgroundImageRef = React80.useRef(backgroundImage);
26509
+ const backgroundImageRef = React81.useRef(backgroundImage);
26161
26510
  backgroundImageRef.current = backgroundImage;
26162
- const widthRef = React80.useRef(width);
26511
+ const widthRef = React81.useRef(width);
26163
26512
  widthRef.current = width;
26164
- const heightRef = React80.useRef(height);
26513
+ const heightRef = React81.useRef(height);
26165
26514
  heightRef.current = height;
26166
- const loadImage = React80.useCallback((url) => {
26515
+ const loadImage = React81.useCallback((url) => {
26167
26516
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
26168
26517
  const cached = imageCache.current.get(fullUrl);
26169
26518
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -26175,7 +26524,7 @@ function GameCanvas2D({
26175
26524
  }
26176
26525
  return null;
26177
26526
  }, []);
26178
- React80.useEffect(() => {
26527
+ React81.useEffect(() => {
26179
26528
  const canvas = canvasRef.current;
26180
26529
  if (!canvas) return;
26181
26530
  const ctx = canvas.getContext("2d");
@@ -26530,7 +26879,7 @@ function TurnPanel({
26530
26879
  className
26531
26880
  }) {
26532
26881
  const eventBus = useEventBus();
26533
- const handleAction = React80.useCallback(
26882
+ const handleAction = React81.useCallback(
26534
26883
  (event) => {
26535
26884
  if (event) {
26536
26885
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -26676,7 +27025,7 @@ function UnitCommandBar({
26676
27025
  className
26677
27026
  }) {
26678
27027
  const eventBus = useEventBus();
26679
- const handleCommand = React80.useCallback(
27028
+ const handleCommand = React81.useCallback(
26680
27029
  (event) => {
26681
27030
  if (event) {
26682
27031
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -27161,7 +27510,7 @@ function GameMenu({
27161
27510
  } catch {
27162
27511
  }
27163
27512
  const eventBus = eventBusProp || eventBusFromHook;
27164
- const handleOptionClick = React80.useCallback(
27513
+ const handleOptionClick = React81.useCallback(
27165
27514
  (option) => {
27166
27515
  if (option.event && eventBus) {
27167
27516
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27275,7 +27624,7 @@ function GameOverScreen({
27275
27624
  } catch {
27276
27625
  }
27277
27626
  const eventBus = eventBusProp || eventBusFromHook;
27278
- const handleActionClick = React80.useCallback(
27627
+ const handleActionClick = React81.useCallback(
27279
27628
  (action) => {
27280
27629
  if (action.event && eventBus) {
27281
27630
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28291,7 +28640,7 @@ var init_StarRating = __esm({
28291
28640
  name: "star",
28292
28641
  className: cn(
28293
28642
  styles.star,
28294
- "text-muted",
28643
+ "text-muted-foreground",
28295
28644
  "transition-colors duration-100"
28296
28645
  ),
28297
28646
  strokeWidth: 1.5
@@ -28774,8 +29123,8 @@ function TableView({
28774
29123
  }) {
28775
29124
  const eventBus = useEventBus();
28776
29125
  const { t } = useTranslate();
28777
- const [visibleCount, setVisibleCount] = React80__default.useState(pageSize > 0 ? pageSize : Infinity);
28778
- const [localSelected, setLocalSelected] = React80__default.useState(/* @__PURE__ */ new Set());
29126
+ const [visibleCount, setVisibleCount] = React81__default.useState(pageSize > 0 ? pageSize : Infinity);
29127
+ const [localSelected, setLocalSelected] = React81__default.useState(/* @__PURE__ */ new Set());
28779
29128
  const colDefs = columns ?? fields ?? [];
28780
29129
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
28781
29130
  const dnd = useDataDnd({
@@ -28970,12 +29319,12 @@ function TableView({
28970
29319
  ]
28971
29320
  }
28972
29321
  );
28973
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React80__default.Fragment, { children: rowInner }, id);
29322
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React81__default.Fragment, { children: rowInner }, id);
28974
29323
  };
28975
29324
  const items = data.map((row) => row);
28976
29325
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
28977
29326
  let runningIndex = 0;
28978
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
29327
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
28979
29328
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
28980
29329
  group.items.map((row) => renderRow(row, runningIndex++))
28981
29330
  ] }, gi)) });
@@ -30327,7 +30676,7 @@ var init_StepFlow = __esm({
30327
30676
  className
30328
30677
  }) => {
30329
30678
  if (orientation === "vertical") {
30330
- 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: [
30679
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React81__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30331
30680
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
30332
30681
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30333
30682
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -30338,7 +30687,7 @@ var init_StepFlow = __esm({
30338
30687
  ] })
30339
30688
  ] }) }, index)) });
30340
30689
  }
30341
- 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: [
30690
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
30342
30691
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
30343
30692
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30344
30693
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31314,7 +31663,7 @@ var init_LikertScale = __esm({
31314
31663
  md: "text-base",
31315
31664
  lg: "text-lg"
31316
31665
  };
31317
- LikertScale = React80__default.forwardRef(
31666
+ LikertScale = React81__default.forwardRef(
31318
31667
  ({
31319
31668
  question,
31320
31669
  options = DEFAULT_LIKERT_OPTIONS,
@@ -31326,7 +31675,7 @@ var init_LikertScale = __esm({
31326
31675
  variant = "radios",
31327
31676
  className
31328
31677
  }, ref) => {
31329
- const groupId = React80__default.useId();
31678
+ const groupId = React81__default.useId();
31330
31679
  const eventBus = useEventBus();
31331
31680
  const handleSelect = useCallback(
31332
31681
  (next) => {
@@ -32471,6 +32820,7 @@ function Editable({
32471
32820
  function BlockRow({
32472
32821
  block,
32473
32822
  readOnly,
32823
+ showAffordances,
32474
32824
  placeholder,
32475
32825
  onUpdate,
32476
32826
  onDelete,
@@ -32689,7 +33039,7 @@ function BlockRow({
32689
33039
  onValueChange: (next) => setChildContent(child.id, next)
32690
33040
  }
32691
33041
  ),
32692
- !readOnly && /* @__PURE__ */ jsx(
33042
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(
32693
33043
  Button,
32694
33044
  {
32695
33045
  type: "button",
@@ -32704,7 +33054,7 @@ function BlockRow({
32704
33054
  }
32705
33055
  )
32706
33056
  ] }, child.id)),
32707
- !readOnly && /* @__PURE__ */ jsx(Box, { as: "li", className: "list-none pl-0", children: /* @__PURE__ */ jsxs(
33057
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { as: "li", className: "list-none pl-0", children: /* @__PURE__ */ jsxs(
32708
33058
  Button,
32709
33059
  {
32710
33060
  type: "button",
@@ -32751,7 +33101,7 @@ function BlockRow({
32751
33101
  "data-block-id": block.id,
32752
33102
  "data-block-type": block.type,
32753
33103
  children: [
32754
- !readOnly && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
33104
+ !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
32755
33105
  /* @__PURE__ */ jsx(
32756
33106
  Button,
32757
33107
  {
@@ -32850,6 +33200,7 @@ var init_RichBlockEditor = __esm({
32850
33200
  changeEvent,
32851
33201
  readOnly = false,
32852
33202
  placeholder,
33203
+ enableBlocks = false,
32853
33204
  showToolbar = true,
32854
33205
  className
32855
33206
  }) => {
@@ -32921,7 +33272,7 @@ var init_RichBlockEditor = __esm({
32921
33272
  padding: "none",
32922
33273
  className: cn("flex flex-col", className),
32923
33274
  children: [
32924
- showToolbar && !readOnly && /* @__PURE__ */ jsx(
33275
+ enableBlocks && showToolbar && !readOnly && /* @__PURE__ */ jsx(
32925
33276
  Box,
32926
33277
  {
32927
33278
  role: "toolbar",
@@ -32957,6 +33308,7 @@ var init_RichBlockEditor = __esm({
32957
33308
  {
32958
33309
  block,
32959
33310
  readOnly,
33311
+ showAffordances: enableBlocks,
32960
33312
  placeholder,
32961
33313
  onUpdate: (updater) => handleUpdate(block.id, updater),
32962
33314
  onDelete: () => handleDelete(block.id),
@@ -33631,7 +33983,7 @@ var init_DocBreadcrumb = __esm({
33631
33983
  "aria-label": t("aria.breadcrumb"),
33632
33984
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
33633
33985
  const isLast = idx === items.length - 1;
33634
- return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
33986
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
33635
33987
  idx > 0 && /* @__PURE__ */ jsx(
33636
33988
  Icon,
33637
33989
  {
@@ -34595,7 +34947,7 @@ var init_MiniStateMachine = __esm({
34595
34947
  const x = 2 + i * (NODE_W + GAP2 + ARROW_W + GAP2);
34596
34948
  const tc = transitionCounts[s.name] ?? 0;
34597
34949
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
34598
- return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
34950
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
34599
34951
  /* @__PURE__ */ jsx(
34600
34952
  AvlState,
34601
34953
  {
@@ -34799,7 +35151,7 @@ var init_PageHeader = __esm({
34799
35151
  info: "bg-info/10 text-info"
34800
35152
  };
34801
35153
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
34802
- 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: [
35154
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
34803
35155
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
34804
35156
  crumb.href ? /* @__PURE__ */ jsx(
34805
35157
  "a",
@@ -34908,7 +35260,7 @@ var init_FormSection = __esm({
34908
35260
  columns = 1,
34909
35261
  className
34910
35262
  }) => {
34911
- const [collapsed, setCollapsed] = React80__default.useState(defaultCollapsed);
35263
+ const [collapsed, setCollapsed] = React81__default.useState(defaultCollapsed);
34912
35264
  const { t } = useTranslate();
34913
35265
  const eventBus = useEventBus();
34914
35266
  const gridClass = {
@@ -34916,7 +35268,7 @@ var init_FormSection = __esm({
34916
35268
  2: "grid-cols-1 md:grid-cols-2",
34917
35269
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
34918
35270
  }[columns];
34919
- React80__default.useCallback(() => {
35271
+ React81__default.useCallback(() => {
34920
35272
  if (collapsible) {
34921
35273
  setCollapsed((prev) => !prev);
34922
35274
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -35023,8 +35375,8 @@ function TextLikeControl({
35023
35375
  onCommit
35024
35376
  }) {
35025
35377
  const initial = value === void 0 || value === null ? "" : String(value);
35026
- const [draft, setDraft] = React80__default.useState(initial);
35027
- React80__default.useEffect(() => setDraft(initial), [initial]);
35378
+ const [draft, setDraft] = React81__default.useState(initial);
35379
+ React81__default.useEffect(() => setDraft(initial), [initial]);
35028
35380
  const commit = () => {
35029
35381
  if (numeric) {
35030
35382
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -35050,10 +35402,27 @@ function FieldControl({
35050
35402
  name,
35051
35403
  decl,
35052
35404
  value,
35053
- onChange
35405
+ onChange,
35406
+ assets
35054
35407
  }) {
35055
35408
  let control;
35056
- if (decl.type === "boolean") {
35409
+ const stringValue = typeof value === "string" ? value : void 0;
35410
+ if (decl.control === "icon") {
35411
+ control = /* @__PURE__ */ jsx(IconPicker, { value: stringValue, onChange: (icon) => onChange(name, icon) });
35412
+ } else if (decl.control === "asset" && assets !== void 0) {
35413
+ control = /* @__PURE__ */ jsx(AssetPicker, { assets, value: stringValue, onChange: (url) => onChange(name, url) });
35414
+ } else if (decl.control === "color" && decl.values !== void 0 && decl.values.length > 0) {
35415
+ control = /* @__PURE__ */ jsx(
35416
+ Select,
35417
+ {
35418
+ options: decl.values.map((v) => ({ value: v, label: v })),
35419
+ value: stringValue ?? "",
35420
+ onChange: (e) => onChange(name, e.target.value)
35421
+ }
35422
+ );
35423
+ } else if (decl.control === "asset" || decl.control === "color") {
35424
+ control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, value, onCommit: onChange });
35425
+ } else if (decl.type === "boolean") {
35057
35426
  control = /* @__PURE__ */ jsx(Switch, { checked: value === true, onChange: (c) => onChange(name, c) });
35058
35427
  } else if (decl.type === "string" && decl.values !== void 0 && decl.values.length > 0) {
35059
35428
  control = /* @__PURE__ */ jsx(
@@ -35092,6 +35461,8 @@ var init_PropertyInspector = __esm({
35092
35461
  init_Select();
35093
35462
  init_Input();
35094
35463
  init_FormSection();
35464
+ init_IconPicker();
35465
+ init_AssetPicker();
35095
35466
  TIER_ORDER = ["presentation", "domain", "policy", "infra", "internal"];
35096
35467
  PropertyInspector = ({
35097
35468
  config,
@@ -35099,7 +35470,8 @@ var init_PropertyInspector = __esm({
35099
35470
  onChange,
35100
35471
  onReset,
35101
35472
  title,
35102
- className
35473
+ className,
35474
+ assets
35103
35475
  }) => {
35104
35476
  const fields = Object.entries(config);
35105
35477
  const byTier = /* @__PURE__ */ new Map();
@@ -35126,7 +35498,8 @@ var init_PropertyInspector = __esm({
35126
35498
  name,
35127
35499
  decl,
35128
35500
  value: currentValue(decl, values?.[name]),
35129
- onChange
35501
+ onChange,
35502
+ assets
35130
35503
  },
35131
35504
  name
35132
35505
  )) }) }, tier))
@@ -35784,7 +36157,7 @@ var init_WizardContainer = __esm({
35784
36157
  const isCompleted = index < currentStep;
35785
36158
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
35786
36159
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
35787
- return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
36160
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
35788
36161
  /* @__PURE__ */ jsx(
35789
36162
  Button,
35790
36163
  {
@@ -37034,6 +37407,9 @@ var init_molecules2 = __esm({
37034
37407
  init_ViolationAlert();
37035
37408
  init_FormSectionHeader();
37036
37409
  init_FlipCard();
37410
+ init_GridPicker();
37411
+ init_AssetPicker();
37412
+ init_IconPicker();
37037
37413
  init_DateRangePicker();
37038
37414
  init_DateRangeSelector();
37039
37415
  init_ChartLegend();
@@ -38228,7 +38604,7 @@ var init_DialogueBubble = __esm({
38228
38604
  }
38229
38605
  });
38230
38606
  function extractTitle(children) {
38231
- if (!React80__default.isValidElement(children)) return void 0;
38607
+ if (!React81__default.isValidElement(children)) return void 0;
38232
38608
  const props = children.props;
38233
38609
  if (typeof props.title === "string") {
38234
38610
  return props.title;
@@ -38340,7 +38716,7 @@ function LinearView({
38340
38716
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
38341
38717
  const isDone = i < currentIdx;
38342
38718
  const isCurrent = i === currentIdx;
38343
- return /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
38719
+ return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
38344
38720
  i > 0 && /* @__PURE__ */ jsx(
38345
38721
  Typography,
38346
38722
  {
@@ -39298,12 +39674,12 @@ var init_Form = __esm({
39298
39674
  const isSchemaEntity = isOrbitalEntitySchema(entity);
39299
39675
  const resolvedEntity = isSchemaEntity ? entity : void 0;
39300
39676
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
39301
- const normalizedInitialData = React80__default.useMemo(() => {
39677
+ const normalizedInitialData = React81__default.useMemo(() => {
39302
39678
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
39303
39679
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
39304
39680
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
39305
39681
  }, [entity, initialData]);
39306
- const entityDerivedFields = React80__default.useMemo(() => {
39682
+ const entityDerivedFields = React81__default.useMemo(() => {
39307
39683
  if (fields && fields.length > 0) return void 0;
39308
39684
  if (!resolvedEntity) return void 0;
39309
39685
  return resolvedEntity.fields.map(
@@ -39323,16 +39699,16 @@ var init_Form = __esm({
39323
39699
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
39324
39700
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
39325
39701
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
39326
- const [formData, setFormData] = React80__default.useState(
39702
+ const [formData, setFormData] = React81__default.useState(
39327
39703
  normalizedInitialData
39328
39704
  );
39329
- const [collapsedSections, setCollapsedSections] = React80__default.useState(
39705
+ const [collapsedSections, setCollapsedSections] = React81__default.useState(
39330
39706
  /* @__PURE__ */ new Set()
39331
39707
  );
39332
- const [submitError, setSubmitError] = React80__default.useState(null);
39333
- const formRef = React80__default.useRef(null);
39708
+ const [submitError, setSubmitError] = React81__default.useState(null);
39709
+ const formRef = React81__default.useRef(null);
39334
39710
  const formMode = props.mode;
39335
- const mountedRef = React80__default.useRef(false);
39711
+ const mountedRef = React81__default.useRef(false);
39336
39712
  if (!mountedRef.current) {
39337
39713
  mountedRef.current = true;
39338
39714
  debug("forms", "mount", {
@@ -39345,7 +39721,7 @@ var init_Form = __esm({
39345
39721
  });
39346
39722
  }
39347
39723
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
39348
- const evalContext = React80__default.useMemo(
39724
+ const evalContext = React81__default.useMemo(
39349
39725
  () => ({
39350
39726
  formValues: formData,
39351
39727
  globalVariables: externalContext?.globalVariables ?? {},
@@ -39354,7 +39730,7 @@ var init_Form = __esm({
39354
39730
  }),
39355
39731
  [formData, externalContext]
39356
39732
  );
39357
- React80__default.useEffect(() => {
39733
+ React81__default.useEffect(() => {
39358
39734
  debug("forms", "initialData-sync", {
39359
39735
  mode: formMode,
39360
39736
  normalizedInitialData,
@@ -39365,7 +39741,7 @@ var init_Form = __esm({
39365
39741
  setFormData(normalizedInitialData);
39366
39742
  }
39367
39743
  }, [normalizedInitialData]);
39368
- const processCalculations = React80__default.useCallback(
39744
+ const processCalculations = React81__default.useCallback(
39369
39745
  (changedFieldId, newFormData) => {
39370
39746
  if (!hiddenCalculations.length) return;
39371
39747
  const context = {
@@ -39390,7 +39766,7 @@ var init_Form = __esm({
39390
39766
  },
39391
39767
  [hiddenCalculations, externalContext, eventBus]
39392
39768
  );
39393
- const checkViolations = React80__default.useCallback(
39769
+ const checkViolations = React81__default.useCallback(
39394
39770
  (changedFieldId, newFormData) => {
39395
39771
  if (!violationTriggers.length) return;
39396
39772
  const context = {
@@ -39428,7 +39804,7 @@ var init_Form = __esm({
39428
39804
  processCalculations(name, newFormData);
39429
39805
  checkViolations(name, newFormData);
39430
39806
  };
39431
- const isFieldVisible = React80__default.useCallback(
39807
+ const isFieldVisible = React81__default.useCallback(
39432
39808
  (fieldName) => {
39433
39809
  const condition = conditionalFields[fieldName];
39434
39810
  if (!condition) return true;
@@ -39436,7 +39812,7 @@ var init_Form = __esm({
39436
39812
  },
39437
39813
  [conditionalFields, evalContext]
39438
39814
  );
39439
- const isSectionVisible = React80__default.useCallback(
39815
+ const isSectionVisible = React81__default.useCallback(
39440
39816
  (section) => {
39441
39817
  if (!section.condition) return true;
39442
39818
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -39512,7 +39888,7 @@ var init_Form = __esm({
39512
39888
  eventBus.emit(`UI:${onCancel}`);
39513
39889
  }
39514
39890
  };
39515
- const renderField = React80__default.useCallback(
39891
+ const renderField = React81__default.useCallback(
39516
39892
  (field) => {
39517
39893
  const fieldName = field.name || field.field;
39518
39894
  if (!fieldName) return null;
@@ -39533,7 +39909,7 @@ var init_Form = __esm({
39533
39909
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
39534
39910
  );
39535
39911
  const effectiveFields = entityDerivedFields ?? fields;
39536
- const normalizedFields = React80__default.useMemo(() => {
39912
+ const normalizedFields = React81__default.useMemo(() => {
39537
39913
  if (!effectiveFields || effectiveFields.length === 0) return [];
39538
39914
  return effectiveFields.map((field) => {
39539
39915
  if (typeof field === "string") {
@@ -39556,7 +39932,7 @@ var init_Form = __esm({
39556
39932
  return field;
39557
39933
  });
39558
39934
  }, [effectiveFields, resolvedEntity]);
39559
- const schemaFields = React80__default.useMemo(() => {
39935
+ const schemaFields = React81__default.useMemo(() => {
39560
39936
  if (normalizedFields.length === 0) return null;
39561
39937
  if (isDebugEnabled()) {
39562
39938
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -39566,7 +39942,7 @@ var init_Form = __esm({
39566
39942
  }
39567
39943
  return normalizedFields.map(renderField).filter(Boolean);
39568
39944
  }, [normalizedFields, renderField, entityName, conditionalFields]);
39569
- const sectionElements = React80__default.useMemo(() => {
39945
+ const sectionElements = React81__default.useMemo(() => {
39570
39946
  if (!sections || sections.length === 0) return null;
39571
39947
  return sections.map((section) => {
39572
39948
  if (!isSectionVisible(section)) {
@@ -40848,7 +41224,7 @@ var init_List = __esm({
40848
41224
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
40849
41225
  return [];
40850
41226
  }, [entity]);
40851
- const getItemActions = React80__default.useCallback(
41227
+ const getItemActions = React81__default.useCallback(
40852
41228
  (item) => {
40853
41229
  if (!itemActions) return [];
40854
41230
  if (typeof itemActions === "function") {
@@ -41324,7 +41700,7 @@ var init_MediaGallery = __esm({
41324
41700
  [selectable, selectedItems, selectionEvent, eventBus]
41325
41701
  );
41326
41702
  const entityData = Array.isArray(entity) ? entity : [];
41327
- const items = React80__default.useMemo(() => {
41703
+ const items = React81__default.useMemo(() => {
41328
41704
  if (propItems) return propItems;
41329
41705
  if (entityData.length === 0) return [];
41330
41706
  return entityData.map((record, idx) => ({
@@ -41494,9 +41870,9 @@ function MiniMap({
41494
41870
  viewportRect,
41495
41871
  className
41496
41872
  }) {
41497
- const canvasRef = React80.useRef(null);
41498
- const frameRef = React80.useRef(0);
41499
- React80.useEffect(() => {
41873
+ const canvasRef = React81.useRef(null);
41874
+ const frameRef = React81.useRef(0);
41875
+ React81.useEffect(() => {
41500
41876
  const canvas = canvasRef.current;
41501
41877
  if (!canvas) return;
41502
41878
  const ctx = canvas.getContext("2d");
@@ -41578,7 +41954,7 @@ var init_MiniMap = __esm({
41578
41954
  }
41579
41955
  });
41580
41956
  function extractTitle2(children) {
41581
- if (!React80__default.isValidElement(children)) return void 0;
41957
+ if (!React81__default.isValidElement(children)) return void 0;
41582
41958
  const props = children.props;
41583
41959
  if (typeof props.title === "string") {
41584
41960
  return props.title;
@@ -42035,7 +42411,7 @@ var init_debugRegistry = __esm({
42035
42411
  }
42036
42412
  });
42037
42413
  function useDebugData() {
42038
- const [data, setData] = React80.useState(() => ({
42414
+ const [data, setData] = React81.useState(() => ({
42039
42415
  traits: [],
42040
42416
  ticks: [],
42041
42417
  guards: [],
@@ -42049,7 +42425,7 @@ function useDebugData() {
42049
42425
  },
42050
42426
  lastUpdate: Date.now()
42051
42427
  }));
42052
- React80.useEffect(() => {
42428
+ React81.useEffect(() => {
42053
42429
  const updateData = () => {
42054
42430
  setData({
42055
42431
  traits: getAllTraits(),
@@ -42158,12 +42534,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42158
42534
  return positions;
42159
42535
  }
42160
42536
  function WalkMinimap() {
42161
- const [walkStep, setWalkStep] = React80.useState(null);
42162
- const [traits2, setTraits] = React80.useState([]);
42163
- const [coveredEdges, setCoveredEdges] = React80.useState([]);
42164
- const [completedTraits, setCompletedTraits] = React80.useState(/* @__PURE__ */ new Set());
42165
- const prevTraitRef = React80.useRef(null);
42166
- React80.useEffect(() => {
42537
+ const [walkStep, setWalkStep] = React81.useState(null);
42538
+ const [traits2, setTraits] = React81.useState([]);
42539
+ const [coveredEdges, setCoveredEdges] = React81.useState([]);
42540
+ const [completedTraits, setCompletedTraits] = React81.useState(/* @__PURE__ */ new Set());
42541
+ const prevTraitRef = React81.useRef(null);
42542
+ React81.useEffect(() => {
42167
42543
  const interval = setInterval(() => {
42168
42544
  const w = window;
42169
42545
  const step = w.__orbitalWalkStep;
@@ -42599,15 +42975,15 @@ var init_EntitiesTab = __esm({
42599
42975
  });
42600
42976
  function EventFlowTab({ events: events2 }) {
42601
42977
  const { t } = useTranslate();
42602
- const [filter, setFilter] = React80.useState("all");
42603
- const containerRef = React80.useRef(null);
42604
- const [autoScroll, setAutoScroll] = React80.useState(true);
42605
- React80.useEffect(() => {
42978
+ const [filter, setFilter] = React81.useState("all");
42979
+ const containerRef = React81.useRef(null);
42980
+ const [autoScroll, setAutoScroll] = React81.useState(true);
42981
+ React81.useEffect(() => {
42606
42982
  if (autoScroll && containerRef.current) {
42607
42983
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42608
42984
  }
42609
42985
  }, [events2.length, autoScroll]);
42610
- const filteredEvents = React80.useMemo(() => {
42986
+ const filteredEvents = React81.useMemo(() => {
42611
42987
  if (filter === "all") return events2;
42612
42988
  return events2.filter((e) => e.type === filter);
42613
42989
  }, [events2, filter]);
@@ -42723,7 +43099,7 @@ var init_EventFlowTab = __esm({
42723
43099
  });
42724
43100
  function GuardsPanel({ guards }) {
42725
43101
  const { t } = useTranslate();
42726
- const [filter, setFilter] = React80.useState("all");
43102
+ const [filter, setFilter] = React81.useState("all");
42727
43103
  if (guards.length === 0) {
42728
43104
  return /* @__PURE__ */ jsx(
42729
43105
  EmptyState,
@@ -42736,7 +43112,7 @@ function GuardsPanel({ guards }) {
42736
43112
  }
42737
43113
  const passedCount = guards.filter((g) => g.result).length;
42738
43114
  const failedCount = guards.length - passedCount;
42739
- const filteredGuards = React80.useMemo(() => {
43115
+ const filteredGuards = React81.useMemo(() => {
42740
43116
  if (filter === "all") return guards;
42741
43117
  if (filter === "passed") return guards.filter((g) => g.result);
42742
43118
  return guards.filter((g) => !g.result);
@@ -42899,10 +43275,10 @@ function EffectBadge({ effect }) {
42899
43275
  }
42900
43276
  function TransitionTimeline({ transitions }) {
42901
43277
  const { t } = useTranslate();
42902
- const containerRef = React80.useRef(null);
42903
- const [autoScroll, setAutoScroll] = React80.useState(true);
42904
- const [expandedId, setExpandedId] = React80.useState(null);
42905
- React80.useEffect(() => {
43278
+ const containerRef = React81.useRef(null);
43279
+ const [autoScroll, setAutoScroll] = React81.useState(true);
43280
+ const [expandedId, setExpandedId] = React81.useState(null);
43281
+ React81.useEffect(() => {
42906
43282
  if (autoScroll && containerRef.current) {
42907
43283
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42908
43284
  }
@@ -43182,9 +43558,9 @@ function getAllEvents(traits2) {
43182
43558
  function EventDispatcherTab({ traits: traits2, schema }) {
43183
43559
  const eventBus = useEventBus();
43184
43560
  const { t } = useTranslate();
43185
- const [log8, setLog] = React80.useState([]);
43186
- const prevStatesRef = React80.useRef(/* @__PURE__ */ new Map());
43187
- React80.useEffect(() => {
43561
+ const [log8, setLog] = React81.useState([]);
43562
+ const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
43563
+ React81.useEffect(() => {
43188
43564
  for (const trait of traits2) {
43189
43565
  const prev = prevStatesRef.current.get(trait.id);
43190
43566
  if (prev && prev !== trait.currentState) {
@@ -43353,10 +43729,10 @@ function VerifyModePanel({
43353
43729
  localCount
43354
43730
  }) {
43355
43731
  const { t } = useTranslate();
43356
- const [expanded, setExpanded] = React80.useState(true);
43357
- const scrollRef = React80.useRef(null);
43358
- const prevCountRef = React80.useRef(0);
43359
- React80.useEffect(() => {
43732
+ const [expanded, setExpanded] = React81.useState(true);
43733
+ const scrollRef = React81.useRef(null);
43734
+ const prevCountRef = React81.useRef(0);
43735
+ React81.useEffect(() => {
43360
43736
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43361
43737
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43362
43738
  }
@@ -43413,10 +43789,10 @@ function RuntimeDebugger({
43413
43789
  schema
43414
43790
  }) {
43415
43791
  const { t } = useTranslate();
43416
- const [isCollapsed, setIsCollapsed] = React80.useState(mode === "verify" ? true : defaultCollapsed);
43417
- const [isVisible, setIsVisible] = React80.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43792
+ const [isCollapsed, setIsCollapsed] = React81.useState(mode === "verify" ? true : defaultCollapsed);
43793
+ const [isVisible, setIsVisible] = React81.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43418
43794
  const debugData = useDebugData();
43419
- React80.useEffect(() => {
43795
+ React81.useEffect(() => {
43420
43796
  if (mode === "inline") return;
43421
43797
  return onDebugToggle((enabled) => {
43422
43798
  setIsVisible(enabled);
@@ -43425,7 +43801,7 @@ function RuntimeDebugger({
43425
43801
  }
43426
43802
  });
43427
43803
  }, [mode]);
43428
- React80.useEffect(() => {
43804
+ React81.useEffect(() => {
43429
43805
  if (mode === "inline") return;
43430
43806
  const handleKeyDown = (e) => {
43431
43807
  if (e.key === "`" && isVisible) {
@@ -43440,7 +43816,7 @@ function RuntimeDebugger({
43440
43816
  if (!isVisible) {
43441
43817
  return null;
43442
43818
  }
43443
- const positionClasses3 = {
43819
+ const positionClasses = {
43444
43820
  "bottom-right": "bottom-4 right-4",
43445
43821
  "bottom-left": "bottom-4 left-4",
43446
43822
  "top-right": "top-4 right-4",
@@ -43569,7 +43945,7 @@ function RuntimeDebugger({
43569
43945
  className: cn(
43570
43946
  "runtime-debugger",
43571
43947
  "fixed",
43572
- positionClasses3[position],
43948
+ positionClasses[position],
43573
43949
  isCollapsed ? "runtime-debugger--collapsed" : "runtime-debugger--expanded",
43574
43950
  className
43575
43951
  ),
@@ -43874,7 +44250,7 @@ function SequenceBar({
43874
44250
  onSlotRemove(index);
43875
44251
  }, [onSlotRemove, playing]);
43876
44252
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
43877
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React80__default.Fragment, { children: [
44253
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
43878
44254
  i > 0 && /* @__PURE__ */ jsx(
43879
44255
  Typography,
43880
44256
  {
@@ -44964,7 +45340,7 @@ var init_StatCard = __esm({
44964
45340
  const labelToUse = propLabel ?? propTitle;
44965
45341
  const eventBus = useEventBus();
44966
45342
  const { t } = useTranslate();
44967
- const handleActionClick = React80__default.useCallback(() => {
45343
+ const handleActionClick = React81__default.useCallback(() => {
44968
45344
  if (action?.event) {
44969
45345
  eventBus.emit(`UI:${action.event}`, {});
44970
45346
  }
@@ -44975,7 +45351,7 @@ var init_StatCard = __esm({
44975
45351
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
44976
45352
  const isLoading = externalLoading ?? false;
44977
45353
  const error = externalError;
44978
- const computeMetricValue = React80__default.useCallback(
45354
+ const computeMetricValue = React81__default.useCallback(
44979
45355
  (metric, items) => {
44980
45356
  if (metric.value !== void 0) {
44981
45357
  return metric.value;
@@ -45014,7 +45390,7 @@ var init_StatCard = __esm({
45014
45390
  },
45015
45391
  []
45016
45392
  );
45017
- const schemaStats = React80__default.useMemo(() => {
45393
+ const schemaStats = React81__default.useMemo(() => {
45018
45394
  if (!metrics || metrics.length === 0) return null;
45019
45395
  return metrics.map((metric) => ({
45020
45396
  label: metric.label,
@@ -45022,7 +45398,7 @@ var init_StatCard = __esm({
45022
45398
  format: metric.format
45023
45399
  }));
45024
45400
  }, [metrics, data, computeMetricValue]);
45025
- const calculatedTrend = React80__default.useMemo(() => {
45401
+ const calculatedTrend = React81__default.useMemo(() => {
45026
45402
  if (manualTrend !== void 0) return manualTrend;
45027
45403
  if (previousValue === void 0 || currentValue2 === void 0)
45028
45404
  return void 0;
@@ -46027,7 +46403,7 @@ var init_Timeline = __esm({
46027
46403
  }) => {
46028
46404
  const { t } = useTranslate();
46029
46405
  const entityData = Array.isArray(entity) ? entity : [];
46030
- const items = React80__default.useMemo(() => {
46406
+ const items = React81__default.useMemo(() => {
46031
46407
  if (propItems) return propItems;
46032
46408
  if (entityData.length === 0) return [];
46033
46409
  return entityData.map((record, idx) => {
@@ -46184,7 +46560,7 @@ var init_TimerDisplay = __esm({
46184
46560
  }
46185
46561
  });
46186
46562
  function extractToastProps(children) {
46187
- if (!React80__default.isValidElement(children)) {
46563
+ if (!React81__default.isValidElement(children)) {
46188
46564
  if (typeof children === "string") {
46189
46565
  return { message: children };
46190
46566
  }
@@ -46222,7 +46598,7 @@ var init_ToastSlot = __esm({
46222
46598
  eventBus.emit("UI:CLOSE");
46223
46599
  };
46224
46600
  if (!isVisible) return null;
46225
- const isCustomContent = React80__default.isValidElement(children) && !message;
46601
+ const isCustomContent = React81__default.isValidElement(children) && !message;
46226
46602
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
46227
46603
  Toast,
46228
46604
  {
@@ -46742,13 +47118,22 @@ function XPBar({
46742
47118
  }) {
46743
47119
  const sizes = sizeMap18[size];
46744
47120
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
47121
+ const [fillWidth, setFillWidth] = React81.useState(animated ? 0 : percentage);
47122
+ React81.useEffect(() => {
47123
+ if (!animated) {
47124
+ setFillWidth(percentage);
47125
+ return;
47126
+ }
47127
+ const frame = requestAnimationFrame(() => setFillWidth(percentage));
47128
+ return () => cancelAnimationFrame(frame);
47129
+ }, [animated, percentage]);
46745
47130
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
46746
47131
  level != null && /* @__PURE__ */ jsxs(
46747
47132
  "span",
46748
47133
  {
46749
47134
  className: cn(
46750
47135
  "flex-shrink-0 rounded-interactive font-bold",
46751
- "bg-accent text-foreground border border-accent",
47136
+ "bg-accent text-accent-foreground border border-accent",
46752
47137
  sizes.badge
46753
47138
  ),
46754
47139
  children: [
@@ -46773,7 +47158,7 @@ function XPBar({
46773
47158
  "bg-gradient-to-r from-accent to-info",
46774
47159
  animated && "transition-all duration-500 ease-out"
46775
47160
  ),
46776
- style: { width: `${percentage}%` }
47161
+ style: { width: `${fillWidth}%` }
46777
47162
  }
46778
47163
  )
46779
47164
  }
@@ -46790,6 +47175,7 @@ function XPBar({
46790
47175
  var sizeMap18;
46791
47176
  var init_XPBar = __esm({
46792
47177
  "components/game/atoms/XPBar.tsx"() {
47178
+ "use client";
46793
47179
  init_cn();
46794
47180
  sizeMap18 = {
46795
47181
  sm: { bar: "h-2", text: "text-xs", badge: "text-xs px-1.5 py-0.5" },
@@ -46800,12 +47186,12 @@ var init_XPBar = __esm({
46800
47186
  }
46801
47187
  });
46802
47188
  function lazyThree(name, loader) {
46803
- const Lazy = React80__default.lazy(() => loader().then((m) => ({ default: m[name] })));
47189
+ const Lazy = React81__default.lazy(() => loader().then((m) => ({ default: m[name] })));
46804
47190
  function ThreeWrapper(props) {
46805
- return React80__default.createElement(
46806
- React80__default.Suspense,
47191
+ return React81__default.createElement(
47192
+ React81__default.Suspense,
46807
47193
  { fallback: null },
46808
- React80__default.createElement(Lazy, props)
47194
+ React81__default.createElement(Lazy, props)
46809
47195
  );
46810
47196
  }
46811
47197
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -47421,7 +47807,7 @@ function SuspenseConfigProvider({
47421
47807
  config,
47422
47808
  children
47423
47809
  }) {
47424
- return React80__default.createElement(
47810
+ return React81__default.createElement(
47425
47811
  SuspenseConfigContext.Provider,
47426
47812
  { value: config },
47427
47813
  children
@@ -47496,6 +47882,9 @@ function renderContainedPortal(t, slot, content, onDismiss) {
47496
47882
  const slotId = `slot-${slot}`;
47497
47883
  switch (slot) {
47498
47884
  case "modal":
47885
+ if (SELF_OVERLAY_PATTERNS.has(content.pattern)) {
47886
+ return /* @__PURE__ */ jsx(Box, { id: slotId, className: "contents", children: slotContent });
47887
+ }
47499
47888
  return /* @__PURE__ */ jsx(
47500
47889
  Box,
47501
47890
  {
@@ -47757,8 +48146,8 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
47757
48146
  const slotId = `slot-${slot}`;
47758
48147
  let wrapper;
47759
48148
  switch (slot) {
47760
- case "modal":
47761
- wrapper = /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsx(
48149
+ case "modal": {
48150
+ const innerContent = /* @__PURE__ */ jsx(
47762
48151
  Box,
47763
48152
  {
47764
48153
  id: slotId,
@@ -47767,8 +48156,10 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
47767
48156
  "data-source-trait": sourceTrait,
47768
48157
  children
47769
48158
  }
47770
- ) });
48159
+ );
48160
+ wrapper = pattern !== void 0 && SELF_OVERLAY_PATTERNS.has(pattern) ? innerContent : /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: innerContent });
47771
48161
  break;
48162
+ }
47772
48163
  case "drawer":
47773
48164
  wrapper = /* @__PURE__ */ jsx(Drawer, { isOpen: true, onClose: handleDismiss, position: "right", children: /* @__PURE__ */ jsx(
47774
48165
  Box,
@@ -47826,7 +48217,7 @@ function SlotPortal({
47826
48217
  let wrapper;
47827
48218
  switch (slot) {
47828
48219
  case "modal":
47829
- wrapper = /* @__PURE__ */ jsx(
48220
+ wrapper = SELF_OVERLAY_PATTERNS.has(content.pattern) ? /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent }) : /* @__PURE__ */ jsx(
47830
48221
  Modal,
47831
48222
  {
47832
48223
  isOpen: true,
@@ -47906,7 +48297,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47906
48297
  const key = `${parentId}-${index}-trait:${traitName}`;
47907
48298
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
47908
48299
  }
47909
- return /* @__PURE__ */ jsx(React80__default.Fragment, { children: child }, `${parentId}-${index}`);
48300
+ return /* @__PURE__ */ jsx(React81__default.Fragment, { children: child }, `${parentId}-${index}`);
47910
48301
  }
47911
48302
  if (!child || typeof child !== "object") return null;
47912
48303
  const childId = `${parentId}-${index}`;
@@ -47946,14 +48337,14 @@ function isPatternConfig(value) {
47946
48337
  if (value === null || value === void 0) return false;
47947
48338
  if (typeof value !== "object") return false;
47948
48339
  if (Array.isArray(value)) return false;
47949
- if (React80__default.isValidElement(value)) return false;
48340
+ if (React81__default.isValidElement(value)) return false;
47950
48341
  if (value instanceof Date) return false;
47951
48342
  if (typeof value === "function") return false;
47952
48343
  const record = value;
47953
48344
  return "type" in record && typeof record.type === "string";
47954
48345
  }
47955
48346
  function isPlainConfigObject(value) {
47956
- if (React80__default.isValidElement(value)) return false;
48347
+ if (React81__default.isValidElement(value)) return false;
47957
48348
  if (value instanceof Date) return false;
47958
48349
  const proto = Object.getPrototypeOf(value);
47959
48350
  return proto === Object.prototype || proto === null;
@@ -48206,7 +48597,7 @@ function UISlotRenderer({
48206
48597
  }
48207
48598
  return wrapped;
48208
48599
  }
48209
- var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, FORM_PATTERNS, PATTERNS_WITH_CHILDREN;
48600
+ var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, FORM_PATTERNS, SELF_OVERLAY_PATTERNS, PATTERNS_WITH_CHILDREN;
48210
48601
  var init_UISlotRenderer = __esm({
48211
48602
  "components/core/organisms/UISlotRenderer.tsx"() {
48212
48603
  "use client";
@@ -48242,6 +48633,7 @@ var init_UISlotRenderer = __esm({
48242
48633
  "inline-edit-form",
48243
48634
  "wizard-step"
48244
48635
  ]);
48636
+ SELF_OVERLAY_PATTERNS = /* @__PURE__ */ new Set(["modal", "confirm-dialog"]);
48245
48637
  PATTERNS_WITH_CHILDREN = /* @__PURE__ */ new Set([
48246
48638
  "stack",
48247
48639
  "vstack",
@@ -49563,4 +49955,4 @@ init_AboutPageTemplate();
49563
49955
  // components/index.ts
49564
49956
  init_cn();
49565
49957
 
49566
- export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CodeView, CodeViewer, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocCodeBlock, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, HStack, Header, Heading, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };
49958
+ export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CodeView, CodeViewer, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocCodeBlock, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, Heading, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };