@almadar/ui 6.4.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{EntityBindingContext-0Evn_LcT.d.cts → EntityBindingContext-Bn3ePJQC.d.cts} +1 -1
  2. package/dist/{EntityBindingContext-0Evn_LcT.d.ts → EntityBindingContext-Bn3ePJQC.d.ts} +1 -1
  3. package/dist/{GameAudioProvider-B48iXwz3.d.ts → GameAudioProvider-Ctceau1s.d.ts} +6 -18
  4. package/dist/{GameAudioProvider-CQAdPreB.d.cts → GameAudioProvider-Dk_Y3LN3.d.cts} +6 -18
  5. package/dist/avl/index.cjs +2755 -1532
  6. package/dist/avl/index.js +1710 -487
  7. package/dist/{avl-schema-parser-dvJKXn-o.d.ts → avl-schema-parser-DncJLEn9.d.ts} +18 -0
  8. package/dist/{avl-schema-parser-Bt4NzAam.d.cts → avl-schema-parser-FQ1474v8.d.cts} +18 -0
  9. package/dist/{cn-DJSBBm5W.d.cts → cn-CCjFspAo.d.cts} +25 -1
  10. package/dist/{cn-BbhJq_nr.d.ts → cn-sgpqpN0U.d.ts} +25 -1
  11. package/dist/components/index.cjs +2518 -1692
  12. package/dist/components/index.d.cts +178 -25
  13. package/dist/components/index.d.ts +178 -25
  14. package/dist/components/index.js +1500 -677
  15. package/dist/context/index.cjs +10 -13
  16. package/dist/context/index.js +10 -13
  17. package/dist/hooks/index.cjs +63 -13
  18. package/dist/hooks/index.d.cts +2 -2
  19. package/dist/hooks/index.d.ts +2 -2
  20. package/dist/hooks/index.js +64 -15
  21. package/dist/lib/drawable/three/index.cjs +126 -13
  22. package/dist/lib/drawable/three/index.d.cts +2 -2
  23. package/dist/lib/drawable/three/index.d.ts +2 -2
  24. package/dist/lib/drawable/three/index.js +127 -14
  25. package/dist/lib/index.cjs +180 -0
  26. package/dist/lib/index.d.cts +1 -1
  27. package/dist/lib/index.d.ts +1 -1
  28. package/dist/lib/index.js +178 -1
  29. package/dist/locales/index.cjs +6 -3
  30. package/dist/locales/index.js +6 -3
  31. package/dist/providers/index.cjs +2346 -1399
  32. package/dist/providers/index.d.cts +2 -2
  33. package/dist/providers/index.d.ts +2 -2
  34. package/dist/providers/index.js +1389 -442
  35. package/dist/runtime/index.cjs +2892 -1356
  36. package/dist/runtime/index.d.cts +78 -6
  37. package/dist/runtime/index.d.ts +78 -6
  38. package/dist/runtime/index.js +1974 -441
  39. package/dist/{useEventBus-CQWyAWpK.d.ts → useKeyboardRouter-D84cNWmA.d.ts} +31 -1
  40. package/dist/{useEventBus-Ckr4wqW3.d.cts → useKeyboardRouter-DQEE_9mq.d.cts} +31 -1
  41. package/locales/ar.json +2 -1
  42. package/locales/en.json +2 -1
  43. package/locales/sl.json +2 -1
  44. package/package.json +4 -4
  45. package/themes/comic.css +437 -0
  46. package/themes/index.css +1 -0
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React78 from 'react';
3
- import React78__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, useState, useLayoutEffect, useId, Suspense, lazy, useSyncExternalStore } from 'react';
2
+ import * as React79 from 'react';
3
+ import React79__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, useState, useLayoutEffect, useId, Suspense, lazy, useSyncExternalStore } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScopeChain, useCurrentPagePath, useGameAudioContextOptional, useRenderSlot, useNavStack, useEntitySchemaOptional, RenderSlotProvider, useEntityBindingSnapshot, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -12,7 +12,7 @@ import { useTranslate } from '@almadar/ui/hooks';
12
12
  import { useUISlots, useTheme } from '@almadar/ui/context';
13
13
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
14
14
  import { createContextFromBindings, interpolateValue } from '@almadar/runtime';
15
- import { mergeEntityFrame, isFileValue, isInlineTrait, isSecretConfigType, isRenderBindingMarker } from '@almadar/core';
15
+ import { UI_SLOTS, mergeEntityFrame, isFileValue, isInlineTrait, isSecretConfigType, isRenderBindingMarker } from '@almadar/core';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { wrapCallbackForEvent, perfStart, perfEnd } from '@almadar/runtime/ui';
18
18
  import { Link, Outlet, useLocation } from 'react-router-dom';
@@ -262,7 +262,7 @@ var init_SvgFlow = __esm({
262
262
  width = 100,
263
263
  height = 100
264
264
  }) => {
265
- const markerId = React78__default.useMemo(() => {
265
+ const markerId = React79__default.useMemo(() => {
266
266
  flowIdCounter += 1;
267
267
  return `almadar-flow-arrow-${flowIdCounter}`;
268
268
  }, []);
@@ -855,7 +855,7 @@ var init_SvgRing = __esm({
855
855
  width = 100,
856
856
  height = 100
857
857
  }) => {
858
- const gradientId = React78__default.useMemo(() => {
858
+ const gradientId = React79__default.useMemo(() => {
859
859
  ringIdCounter += 1;
860
860
  return `almadar-ring-glow-${ringIdCounter}`;
861
861
  }, []);
@@ -1397,7 +1397,7 @@ var init_Icon = __esm({
1397
1397
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
1398
1398
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
1399
1399
  const family = useIconFamily();
1400
- const RenderedComponent = React78__default.useMemo(() => {
1400
+ const RenderedComponent = React79__default.useMemo(() => {
1401
1401
  if (directIcon) return null;
1402
1402
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
1403
1403
  }, [directIcon, effectiveName, family]);
@@ -1526,7 +1526,7 @@ var init_atlasSlice = __esm({
1526
1526
  }
1527
1527
  });
1528
1528
  function useAtlasSliceDataUrl(asset) {
1529
- const [, bump] = React78.useReducer((x) => x + 1, 0);
1529
+ const [, bump] = React79.useReducer((x) => x + 1, 0);
1530
1530
  if (!isAtlasAsset(asset)) return void 0;
1531
1531
  const key = `${asset.atlas}#${asset.sprite}`;
1532
1532
  const cached = sliceDataUrlCache.get(key);
@@ -1589,13 +1589,13 @@ function AtlasImage({
1589
1589
  style,
1590
1590
  "aria-hidden": ariaHidden
1591
1591
  }) {
1592
- const [, bump] = React78.useReducer((x) => x + 1, 0);
1593
- const canvasRef = React78.useRef(null);
1592
+ const [, bump] = React79.useReducer((x) => x + 1, 0);
1593
+ const canvasRef = React79.useRef(null);
1594
1594
  const sliced = isAtlasAsset(asset);
1595
1595
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
1596
1596
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
1597
1597
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
1598
- React78.useEffect(() => {
1598
+ React79.useEffect(() => {
1599
1599
  const canvas = canvasRef.current;
1600
1600
  if (!canvas || !img || !rect) return;
1601
1601
  canvas.width = rect.sw;
@@ -1671,7 +1671,7 @@ function resolveIconProp(value, sizeClass) {
1671
1671
  const IconComp = value;
1672
1672
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1673
1673
  }
1674
- if (React78__default.isValidElement(value)) {
1674
+ if (React79__default.isValidElement(value)) {
1675
1675
  return value;
1676
1676
  }
1677
1677
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -1748,7 +1748,7 @@ var init_Button = __esm({
1748
1748
  md: "h-icon-default w-icon-default",
1749
1749
  lg: "h-icon-default w-icon-default"
1750
1750
  };
1751
- Button = React78__default.forwardRef(
1751
+ Button = React79__default.forwardRef(
1752
1752
  ({
1753
1753
  className,
1754
1754
  variant = "primary",
@@ -1820,7 +1820,7 @@ var init_Input = __esm({
1820
1820
  init_cn();
1821
1821
  init_Icon();
1822
1822
  init_useEventBus();
1823
- Input = React78__default.forwardRef(
1823
+ Input = React79__default.forwardRef(
1824
1824
  ({
1825
1825
  className,
1826
1826
  inputType,
@@ -1844,9 +1844,9 @@ var init_Input = __esm({
1844
1844
  const eventBus = useEventBus();
1845
1845
  const type = inputType || htmlType || "text";
1846
1846
  const isDeclarative = typeof onChange === "string";
1847
- const [localValue, setLocalValue] = React78__default.useState(value);
1848
- const pendingEchoRef = React78__default.useRef(/* @__PURE__ */ new Set());
1849
- React78__default.useEffect(() => {
1847
+ const [localValue, setLocalValue] = React79__default.useState(value);
1848
+ const pendingEchoRef = React79__default.useRef(/* @__PURE__ */ new Set());
1849
+ React79__default.useEffect(() => {
1850
1850
  if (!isDeclarative) return;
1851
1851
  const incoming = value == null ? "" : String(value);
1852
1852
  if (pendingEchoRef.current.has(incoming)) {
@@ -2013,7 +2013,7 @@ var Label;
2013
2013
  var init_Label = __esm({
2014
2014
  "components/core/atoms/Label.tsx"() {
2015
2015
  init_cn();
2016
- Label = React78__default.forwardRef(
2016
+ Label = React79__default.forwardRef(
2017
2017
  ({ className, required, children, ...props }, ref) => {
2018
2018
  return /* @__PURE__ */ jsxs(
2019
2019
  "label",
@@ -2040,7 +2040,7 @@ var init_Textarea = __esm({
2040
2040
  "components/core/atoms/Textarea.tsx"() {
2041
2041
  init_cn();
2042
2042
  init_useEventBus();
2043
- Textarea = React78__default.forwardRef(
2043
+ Textarea = React79__default.forwardRef(
2044
2044
  ({ className, error, onChange, ...props }, ref) => {
2045
2045
  const eventBus = useEventBus();
2046
2046
  const handleChange = (e) => {
@@ -2290,7 +2290,7 @@ var init_Select = __esm({
2290
2290
  init_cn();
2291
2291
  init_Icon();
2292
2292
  init_useEventBus();
2293
- Select = React78__default.forwardRef(
2293
+ Select = React79__default.forwardRef(
2294
2294
  (props, _ref) => {
2295
2295
  const { multiple, searchable, clearable } = props;
2296
2296
  if (multiple || searchable || clearable) {
@@ -2307,7 +2307,7 @@ var init_Checkbox = __esm({
2307
2307
  "components/core/atoms/Checkbox.tsx"() {
2308
2308
  init_cn();
2309
2309
  init_useEventBus();
2310
- Checkbox = React78__default.forwardRef(
2310
+ Checkbox = React79__default.forwardRef(
2311
2311
  ({ className, label, id, onChange, ...props }, ref) => {
2312
2312
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2313
2313
  const eventBus = useEventBus();
@@ -2361,7 +2361,7 @@ var init_Spinner = __esm({
2361
2361
  md: "h-6 w-6",
2362
2362
  lg: "h-8 w-8"
2363
2363
  };
2364
- Spinner = React78__default.forwardRef(
2364
+ Spinner = React79__default.forwardRef(
2365
2365
  ({ className, size = "md", overlay, ...props }, ref) => {
2366
2366
  if (overlay) {
2367
2367
  return /* @__PURE__ */ jsx(
@@ -2451,7 +2451,7 @@ var init_Card = __esm({
2451
2451
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
2452
2452
  "tile-image-first": "p-0 overflow-hidden"
2453
2453
  };
2454
- Card = React78__default.forwardRef(
2454
+ Card = React79__default.forwardRef(
2455
2455
  ({
2456
2456
  className,
2457
2457
  variant = "bordered",
@@ -2500,9 +2500,9 @@ var init_Card = __esm({
2500
2500
  }
2501
2501
  );
2502
2502
  Card.displayName = "Card";
2503
- CardHeader = React78__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2503
+ CardHeader = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2504
2504
  CardHeader.displayName = "CardHeader";
2505
- CardTitle = React78__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2505
+ CardTitle = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2506
2506
  "h3",
2507
2507
  {
2508
2508
  ref,
@@ -2515,11 +2515,11 @@ var init_Card = __esm({
2515
2515
  }
2516
2516
  ));
2517
2517
  CardTitle.displayName = "CardTitle";
2518
- CardContent = React78__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2518
+ CardContent = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2519
2519
  CardContent.displayName = "CardContent";
2520
2520
  CardBody = CardContent;
2521
2521
  CardBody.displayName = "CardBody";
2522
- CardFooter = React78__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2522
+ CardFooter = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2523
2523
  "div",
2524
2524
  {
2525
2525
  ref,
@@ -2573,7 +2573,7 @@ var init_Badge = __esm({
2573
2573
  md: "px-2.5 py-1 text-sm",
2574
2574
  lg: "px-3 py-1.5 text-base"
2575
2575
  };
2576
- Badge = React78__default.forwardRef(
2576
+ Badge = React79__default.forwardRef(
2577
2577
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
2578
2578
  const iconSizes3 = {
2579
2579
  sm: "h-icon-default w-icon-default",
@@ -2701,7 +2701,7 @@ var init_FilterPill = __esm({
2701
2701
  md: "w-3.5 h-3.5",
2702
2702
  lg: "w-4 h-4"
2703
2703
  };
2704
- FilterPill = React78__default.forwardRef(
2704
+ FilterPill = React79__default.forwardRef(
2705
2705
  ({
2706
2706
  className,
2707
2707
  variant = "default",
@@ -2830,8 +2830,8 @@ var init_Avatar = __esm({
2830
2830
  actionPayload
2831
2831
  }) => {
2832
2832
  const eventBus = useEventBus();
2833
- const [imgFailed, setImgFailed] = React78__default.useState(false);
2834
- React78__default.useEffect(() => {
2833
+ const [imgFailed, setImgFailed] = React79__default.useState(false);
2834
+ React79__default.useEffect(() => {
2835
2835
  setImgFailed(false);
2836
2836
  }, [src]);
2837
2837
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -3083,7 +3083,7 @@ var init_Box = __esm({
3083
3083
  fixed: "fixed",
3084
3084
  sticky: "sticky"
3085
3085
  };
3086
- Box = React78__default.forwardRef(
3086
+ Box = React79__default.forwardRef(
3087
3087
  ({
3088
3088
  padding,
3089
3089
  paddingX,
@@ -3148,7 +3148,7 @@ var init_Box = __esm({
3148
3148
  onPointerDown?.(e);
3149
3149
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3150
3150
  const isClickable = action || onClick;
3151
- return React78__default.createElement(
3151
+ return React79__default.createElement(
3152
3152
  Component,
3153
3153
  {
3154
3154
  ref,
@@ -3202,7 +3202,7 @@ var init_Center = __esm({
3202
3202
  as: Component = "div"
3203
3203
  }) => {
3204
3204
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
3205
- return React78__default.createElement(Component, {
3205
+ return React79__default.createElement(Component, {
3206
3206
  className: cn(
3207
3207
  inline ? "inline-flex" : "flex",
3208
3208
  horizontal && "justify-center",
@@ -3470,7 +3470,7 @@ var init_Radio = __esm({
3470
3470
  md: "w-2.5 h-2.5",
3471
3471
  lg: "w-3 h-3"
3472
3472
  };
3473
- Radio = React78__default.forwardRef(
3473
+ Radio = React79__default.forwardRef(
3474
3474
  ({
3475
3475
  label,
3476
3476
  helperText,
@@ -3487,12 +3487,12 @@ var init_Radio = __esm({
3487
3487
  onChange,
3488
3488
  ...props
3489
3489
  }, ref) => {
3490
- const reactId = React78__default.useId();
3490
+ const reactId = React79__default.useId();
3491
3491
  const baseId = id || `radio-${reactId}`;
3492
3492
  const hasError = !!error;
3493
3493
  const eventBus = useEventBus();
3494
- const [selected, setSelected] = React78__default.useState(value);
3495
- React78__default.useEffect(() => {
3494
+ const [selected, setSelected] = React79__default.useState(value);
3495
+ React79__default.useEffect(() => {
3496
3496
  if (value !== void 0) setSelected(value);
3497
3497
  }, [value]);
3498
3498
  const pick = (next, e) => {
@@ -3674,7 +3674,7 @@ var init_Switch = __esm({
3674
3674
  "components/core/atoms/Switch.tsx"() {
3675
3675
  "use client";
3676
3676
  init_cn();
3677
- Switch = React78.forwardRef(
3677
+ Switch = React79.forwardRef(
3678
3678
  ({
3679
3679
  checked,
3680
3680
  defaultChecked = false,
@@ -3685,10 +3685,10 @@ var init_Switch = __esm({
3685
3685
  name,
3686
3686
  className
3687
3687
  }, ref) => {
3688
- const [isChecked, setIsChecked] = React78.useState(
3688
+ const [isChecked, setIsChecked] = React79.useState(
3689
3689
  checked !== void 0 ? checked : defaultChecked
3690
3690
  );
3691
- React78.useEffect(() => {
3691
+ React79.useEffect(() => {
3692
3692
  if (checked !== void 0) {
3693
3693
  setIsChecked(checked);
3694
3694
  }
@@ -3851,7 +3851,7 @@ var init_Stack = __esm({
3851
3851
  };
3852
3852
  const isHorizontal = direction === "horizontal";
3853
3853
  const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
3854
- return React78__default.createElement(
3854
+ return React79__default.createElement(
3855
3855
  Component,
3856
3856
  {
3857
3857
  className: cn(
@@ -4140,7 +4140,7 @@ var init_Typography = __esm({
4140
4140
  if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
4141
4141
  body = formatValue(body, format);
4142
4142
  }
4143
- return React78__default.createElement(
4143
+ return React79__default.createElement(
4144
4144
  Component,
4145
4145
  {
4146
4146
  id,
@@ -4374,7 +4374,7 @@ var Dialog;
4374
4374
  var init_Dialog = __esm({
4375
4375
  "components/core/atoms/Dialog.tsx"() {
4376
4376
  init_cn();
4377
- Dialog = React78__default.forwardRef(
4377
+ Dialog = React79__default.forwardRef(
4378
4378
  ({
4379
4379
  role = "dialog",
4380
4380
  "aria-modal": ariaModal = true,
@@ -4400,7 +4400,7 @@ var Aside;
4400
4400
  var init_Aside = __esm({
4401
4401
  "components/core/atoms/Aside.tsx"() {
4402
4402
  init_cn();
4403
- Aside = React78__default.forwardRef(
4403
+ Aside = React79__default.forwardRef(
4404
4404
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4405
4405
  );
4406
4406
  Aside.displayName = "Aside";
@@ -4479,9 +4479,9 @@ var init_LawReferenceTooltip = __esm({
4479
4479
  className
4480
4480
  }) => {
4481
4481
  const { t } = useTranslate();
4482
- const [isVisible, setIsVisible] = React78__default.useState(false);
4483
- const timeoutRef = React78__default.useRef(null);
4484
- const triggerRef = React78__default.useRef(null);
4482
+ const [isVisible, setIsVisible] = React79__default.useState(false);
4483
+ const timeoutRef = React79__default.useRef(null);
4484
+ const triggerRef = React79__default.useRef(null);
4485
4485
  const handleMouseEnter = () => {
4486
4486
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4487
4487
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4492,7 +4492,7 @@ var init_LawReferenceTooltip = __esm({
4492
4492
  };
4493
4493
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
4494
4494
  const open = isVisible || revealed;
4495
- React78__default.useEffect(() => {
4495
+ React79__default.useEffect(() => {
4496
4496
  return () => {
4497
4497
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4498
4498
  };
@@ -4702,7 +4702,7 @@ var init_StatusDot = __esm({
4702
4702
  md: "w-2.5 h-2.5",
4703
4703
  lg: "w-3 h-3"
4704
4704
  };
4705
- StatusDot = React78__default.forwardRef(
4705
+ StatusDot = React79__default.forwardRef(
4706
4706
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4707
4707
  return /* @__PURE__ */ jsx(
4708
4708
  "span",
@@ -4756,7 +4756,7 @@ var init_TrendIndicator = __esm({
4756
4756
  down: "trending-down",
4757
4757
  flat: "arrow-right"
4758
4758
  };
4759
- TrendIndicator = React78__default.forwardRef(
4759
+ TrendIndicator = React79__default.forwardRef(
4760
4760
  ({
4761
4761
  className,
4762
4762
  value,
@@ -4825,7 +4825,7 @@ var init_RangeSlider = __esm({
4825
4825
  md: "w-4 h-4",
4826
4826
  lg: "w-5 h-5"
4827
4827
  };
4828
- RangeSlider = React78__default.forwardRef(
4828
+ RangeSlider = React79__default.forwardRef(
4829
4829
  ({
4830
4830
  className,
4831
4831
  min = 0,
@@ -5482,7 +5482,7 @@ var init_ContentSection = __esm({
5482
5482
  md: "py-16",
5483
5483
  lg: "py-24"
5484
5484
  };
5485
- ContentSection = React78__default.forwardRef(
5485
+ ContentSection = React79__default.forwardRef(
5486
5486
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5487
5487
  return /* @__PURE__ */ jsx(
5488
5488
  Box,
@@ -6016,7 +6016,7 @@ var init_AnimatedReveal = __esm({
6016
6016
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6017
6017
  "none": {}
6018
6018
  };
6019
- AnimatedReveal = React78__default.forwardRef(
6019
+ AnimatedReveal = React79__default.forwardRef(
6020
6020
  ({
6021
6021
  trigger = "scroll",
6022
6022
  animation = "fade-up",
@@ -6176,7 +6176,7 @@ var init_AnimatedGraphic = __esm({
6176
6176
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6177
6177
  "use client";
6178
6178
  init_cn();
6179
- AnimatedGraphic = React78__default.forwardRef(
6179
+ AnimatedGraphic = React79__default.forwardRef(
6180
6180
  ({
6181
6181
  src,
6182
6182
  svgContent,
@@ -6199,7 +6199,7 @@ var init_AnimatedGraphic = __esm({
6199
6199
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6200
6200
  const resolvedSvg = svgContent ?? fetchedSvg;
6201
6201
  const prevAnimateRef = useRef(animate);
6202
- const setRef = React78__default.useCallback(
6202
+ const setRef = React79__default.useCallback(
6203
6203
  (node) => {
6204
6204
  containerRef.current = node;
6205
6205
  if (typeof ref === "function") ref(node);
@@ -6300,7 +6300,7 @@ function resolveMarkerExpression(expression, entity, config, state) {
6300
6300
  function isPlainObject(value) {
6301
6301
  if (value === null || value === void 0 || typeof value !== "object") return false;
6302
6302
  if (Array.isArray(value)) return false;
6303
- if (React78__default.isValidElement(value)) return false;
6303
+ if (React79__default.isValidElement(value)) return false;
6304
6304
  if (value instanceof Date) return false;
6305
6305
  if (typeof value === "function") return false;
6306
6306
  return true;
@@ -6309,7 +6309,7 @@ function isEvaluatorResolvedData(value) {
6309
6309
  return evaluatorResolvedData.has(value);
6310
6310
  }
6311
6311
  function brandResolved(value) {
6312
- if (value !== null && typeof value === "object" && !React78__default.isValidElement(value) && !(value instanceof Date)) {
6312
+ if (value !== null && typeof value === "object" && !React79__default.isValidElement(value) && !(value instanceof Date)) {
6313
6313
  resolvedMarkerFree.add(value);
6314
6314
  }
6315
6315
  }
@@ -6342,7 +6342,7 @@ function walkValue(value, scopeTrait, entity, config, state) {
6342
6342
  }
6343
6343
  const resolved = resolveMarkerExpression(value.expression, entity, config, state);
6344
6344
  markerResolutionCache.set(value, { entity, config, state, resolved });
6345
- if (resolved !== null && typeof resolved === "object" && !React78__default.isValidElement(resolved) && !(resolved instanceof Date)) {
6345
+ if (resolved !== null && typeof resolved === "object" && !React79__default.isValidElement(resolved) && !(resolved instanceof Date)) {
6346
6346
  resolvedMarkerFree.add(resolved);
6347
6347
  evaluatorResolvedData.add(resolved);
6348
6348
  }
@@ -6999,7 +6999,7 @@ var init_ErrorBoundary = __esm({
6999
6999
  }
7000
7000
  );
7001
7001
  };
7002
- ErrorBoundary = class extends React78__default.Component {
7002
+ ErrorBoundary = class extends React79__default.Component {
7003
7003
  constructor(props) {
7004
7004
  super(props);
7005
7005
  __publicField(this, "reset", () => {
@@ -7282,7 +7282,7 @@ var init_Container = __esm({
7282
7282
  as: Component = "div"
7283
7283
  }) => {
7284
7284
  const resolvedSize = maxWidth ?? size ?? "lg";
7285
- return React78__default.createElement(
7285
+ return React79__default.createElement(
7286
7286
  Component,
7287
7287
  {
7288
7288
  className: cn(
@@ -9847,14 +9847,15 @@ function drawArrowHead(ctx, x1, y1, x2, y2, size) {
9847
9847
  ctx.closePath();
9848
9848
  ctx.fill();
9849
9849
  }
9850
- function drawShape(ctx, shape, width, height, allShapes) {
9850
+ function drawShape(ctx, shape, width, height, allShapes, fontFamily) {
9851
9851
  ctx.save();
9852
9852
  const opacity = shape.opacity ?? 1;
9853
9853
  ctx.globalAlpha = opacity;
9854
9854
  const stroke = resolveColor2(shape.color, ctx, "#333333");
9855
9855
  const fill = shape.fill ? resolveColor2(shape.fill, ctx, "#cccccc") : void 0;
9856
9856
  ctx.lineWidth = shape.lineWidth ?? 2;
9857
- if (shape.dash) ctx.setLineDash([...DASH_PATTERNS[shape.dash]]);
9857
+ const dashPattern = shape.dash ? DASH_PATTERNS[shape.dash] : void 0;
9858
+ if (dashPattern) ctx.setLineDash([...dashPattern]);
9858
9859
  switch (shape.type) {
9859
9860
  case "grid": {
9860
9861
  const step = shape.step ?? 40;
@@ -9976,7 +9977,7 @@ function drawShape(ctx, shape, width, height, allShapes) {
9976
9977
  case "text": {
9977
9978
  if (shape.x == null || shape.y == null || !shape.text) break;
9978
9979
  ctx.fillStyle = stroke;
9979
- ctx.font = `${shape.fontSize ?? 14}px ${themeBodyFont(ctx.canvas)}`;
9980
+ ctx.font = `${shape.fontSize ?? 14}px ${shape.fontFamily ?? fontFamily ?? themeBodyFont(ctx.canvas)}`;
9980
9981
  ctx.textAlign = shape.align ?? "left";
9981
9982
  ctx.textBaseline = "middle";
9982
9983
  ctx.fillText(shape.text, shape.x, shape.y);
@@ -10018,7 +10019,7 @@ function drawShape(ctx, shape, width, height, allShapes) {
10018
10019
  }
10019
10020
  ctx.restore();
10020
10021
  }
10021
- function readoutShapes(readouts, width) {
10022
+ function readoutShapes(readouts, width, fontFamily) {
10022
10023
  const out = [];
10023
10024
  const chipH = 18;
10024
10025
  const gap = 6;
@@ -10042,13 +10043,14 @@ function readoutShapes(readouts, width) {
10042
10043
  text,
10043
10044
  color: "#ffffff",
10044
10045
  fontSize: 10,
10045
- align: "center"
10046
+ align: "center",
10047
+ fontFamily
10046
10048
  });
10047
10049
  rightEdge = chipX - gap;
10048
10050
  }
10049
10051
  return out;
10050
10052
  }
10051
- function traceShapes(panel, k, width, height) {
10053
+ function traceShapes(panel, k, width, height, fontFamily) {
10052
10054
  const w = panel.width ?? Math.round(width * 0.32);
10053
10055
  const h = panel.height ?? Math.round(height * 0.28);
10054
10056
  const x = panel.x ?? width - w - 8;
@@ -10102,14 +10104,14 @@ function traceShapes(panel, k, width, height) {
10102
10104
  out.push({ type: "circle", x: last.x, y: last.y, radius: 2, color, fill: color });
10103
10105
  }
10104
10106
  if (series.label) {
10105
- out.push({ type: "text", x: x + 6, y: y + 10 + 11 * j, text: series.label, color, fontSize: 9 });
10107
+ out.push({ type: "text", x: x + 6, y: y + 10 + 11 * j, text: series.label, color, fontSize: 9, fontFamily });
10106
10108
  }
10107
10109
  });
10108
10110
  if (panel.yLabel) {
10109
- out.push({ type: "text", x: x + w - 6, y: y + 10, text: panel.yLabel, color: "#6b7280", fontSize: 9, align: "right" });
10111
+ out.push({ type: "text", x: x + w - 6, y: y + 10, text: panel.yLabel, color: "#6b7280", fontSize: 9, align: "right", fontFamily });
10110
10112
  }
10111
10113
  if (panel.xLabel) {
10112
- out.push({ type: "text", x: x + w - 6, y: y + h - 6, text: panel.xLabel, color: "#6b7280", fontSize: 9, align: "right" });
10114
+ out.push({ type: "text", x: x + w - 6, y: y + h - 6, text: panel.xLabel, color: "#6b7280", fontSize: 9, align: "right", fontFamily });
10113
10115
  }
10114
10116
  return out;
10115
10117
  }
@@ -10132,13 +10134,14 @@ var init_LearningCanvas = __esm({
10132
10134
  init_useEventBus();
10133
10135
  init_webPainter2d();
10134
10136
  init_paintDispatch();
10135
- DASH_PATTERNS = { dashed: [6, 4], dotted: [2, 3] };
10137
+ DASH_PATTERNS = { solid: [], dashed: [6, 4], dotted: [2, 3] };
10136
10138
  TRACE_SERIES_COLORS = ["#2563eb", "#dc2626", "#16a34a", "#f59e0b"];
10137
10139
  LearningCanvas = ({
10138
10140
  className,
10139
10141
  width = 600,
10140
10142
  height = 400,
10141
10143
  backgroundColor,
10144
+ fontFamily,
10142
10145
  shapes = [],
10143
10146
  drawables,
10144
10147
  projector,
@@ -10174,10 +10177,10 @@ var init_LearningCanvas = __esm({
10174
10177
  }, [shapes]);
10175
10178
  const derivedShapes = useMemo(() => {
10176
10179
  if (!traces?.length && !readouts?.length) return shapes;
10177
- const traceOut = (traces ?? []).flatMap((panel, k) => traceShapes(panel, k, width, height));
10178
- const readoutOut = readouts?.length ? readoutShapes(readouts, width) : [];
10180
+ const traceOut = (traces ?? []).flatMap((panel, k) => traceShapes(panel, k, width, height, fontFamily));
10181
+ const readoutOut = readouts?.length ? readoutShapes(readouts, width, fontFamily) : [];
10179
10182
  return [...shapes, ...traceOut, ...readoutOut];
10180
- }, [shapes, traces, readouts, width, height]);
10183
+ }, [shapes, traces, readouts, width, height, fontFamily]);
10181
10184
  const draw = useCallback(() => {
10182
10185
  const _perfT = perfStart("learningcanvas:paint");
10183
10186
  const canvas = canvasRef.current;
@@ -10196,15 +10199,15 @@ var init_LearningCanvas = __esm({
10196
10199
  ctx.fillRect(0, 0, width, height);
10197
10200
  }
10198
10201
  for (const shape of derivedShapes) {
10199
- if (shape.type !== "text") drawShape(ctx, shape, width, height, derivedShapes);
10202
+ if (shape.type !== "text") drawShape(ctx, shape, width, height, derivedShapes, fontFamily);
10200
10203
  }
10201
10204
  for (const shape of derivedShapes) {
10202
- if (shape.type === "text") drawShape(ctx, shape, width, height, derivedShapes);
10205
+ if (shape.type === "text") drawShape(ctx, shape, width, height, derivedShapes, fontFamily);
10203
10206
  }
10204
10207
  if (drawables?.length && projector) {
10205
10208
  const painter = createWebPainter(ctx, invalidateRef.current);
10206
10209
  const timeMs = needsAnim && typeof performance !== "undefined" ? performance.now() : 0;
10207
- const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: themeBodyFont(canvas) };
10210
+ const dctx = { projector, time: timeMs, invalidate: invalidateRef.current, fontFamily: fontFamily || themeBodyFont(canvas) };
10208
10211
  for (const node of drawables) {
10209
10212
  paintDrawable(painter, node, dctx);
10210
10213
  }
@@ -13321,6 +13324,250 @@ var init_EmptyState = __esm({
13321
13324
  EmptyState.displayName = "EmptyState";
13322
13325
  }
13323
13326
  });
13327
+
13328
+ // lib/editorMotions.ts
13329
+ function clamp(value, min, max) {
13330
+ return Math.max(min, Math.min(max, value));
13331
+ }
13332
+ function computeLines(text) {
13333
+ const lines = [];
13334
+ let start = 0;
13335
+ for (let i = 0; i <= text.length; i++) {
13336
+ if (i === text.length || text[i] === "\n") {
13337
+ lines.push({ start, end: i });
13338
+ start = i + 1;
13339
+ }
13340
+ }
13341
+ return lines;
13342
+ }
13343
+ function lineIndexAt(lines, pos) {
13344
+ for (let i = 0; i < lines.length; i++) {
13345
+ if (pos <= lines[i].end) return i;
13346
+ }
13347
+ return lines.length - 1;
13348
+ }
13349
+ function findWords(text) {
13350
+ const words = [];
13351
+ const re = /\w+|\S+/g;
13352
+ let m;
13353
+ while ((m = re.exec(text)) !== null) {
13354
+ words.push({ start: m.index, end: m.index + m[0].length });
13355
+ }
13356
+ return words;
13357
+ }
13358
+ function nextWordStart(text, pos) {
13359
+ for (const w of findWords(text)) {
13360
+ if (w.start > pos) return w.start;
13361
+ }
13362
+ return text.length;
13363
+ }
13364
+ function prevWordStart(text, pos) {
13365
+ let result = 0;
13366
+ for (const w of findWords(text)) {
13367
+ if (w.start < pos) result = w.start;
13368
+ else break;
13369
+ }
13370
+ return result;
13371
+ }
13372
+ function nextWordEnd(text, pos) {
13373
+ for (const w of findWords(text)) {
13374
+ const lastChar = w.end - 1;
13375
+ if (lastChar > pos) return lastChar;
13376
+ }
13377
+ return text.length > 0 ? text.length - 1 : 0;
13378
+ }
13379
+ function firstNonBlank(text, line) {
13380
+ let i = line.start;
13381
+ while (i < line.end && (text[i] === " " || text[i] === " ")) i++;
13382
+ return i;
13383
+ }
13384
+ function nextParagraphBoundary(lines, fromLineIdx, textLength) {
13385
+ for (let i = fromLineIdx + 1; i < lines.length; i++) {
13386
+ if (lines[i].start === lines[i].end) return lines[i].start;
13387
+ }
13388
+ return textLength;
13389
+ }
13390
+ function prevParagraphBoundary(lines, fromLineIdx) {
13391
+ for (let i = fromLineIdx - 1; i >= 0; i--) {
13392
+ if (lines[i].start === lines[i].end) return lines[i].start;
13393
+ }
13394
+ return 0;
13395
+ }
13396
+ function applyMotion(text, caret, motion, count) {
13397
+ const n = Math.max(1, count);
13398
+ const lines = computeLines(text);
13399
+ const lineIdx = lineIndexAt(lines, caret);
13400
+ const line = lines[lineIdx];
13401
+ switch (motion) {
13402
+ case "left":
13403
+ return clamp(caret - n, line.start, line.end);
13404
+ case "right":
13405
+ return clamp(caret + n, line.start, line.end);
13406
+ case "up": {
13407
+ const col = caret - line.start;
13408
+ const targetIdx = clamp(lineIdx - n, 0, lines.length - 1);
13409
+ const target = lines[targetIdx];
13410
+ return clamp(target.start + col, target.start, target.end);
13411
+ }
13412
+ case "down": {
13413
+ const col = caret - line.start;
13414
+ const targetIdx = clamp(lineIdx + n, 0, lines.length - 1);
13415
+ const target = lines[targetIdx];
13416
+ return clamp(target.start + col, target.start, target.end);
13417
+ }
13418
+ case "word-forward": {
13419
+ let pos = caret;
13420
+ for (let i = 0; i < n; i++) pos = nextWordStart(text, pos);
13421
+ return pos;
13422
+ }
13423
+ case "word-back": {
13424
+ let pos = caret;
13425
+ for (let i = 0; i < n; i++) pos = prevWordStart(text, pos);
13426
+ return pos;
13427
+ }
13428
+ case "word-end": {
13429
+ let pos = caret;
13430
+ for (let i = 0; i < n; i++) pos = nextWordEnd(text, pos);
13431
+ return pos;
13432
+ }
13433
+ case "line-start":
13434
+ return line.start;
13435
+ case "line-end":
13436
+ return line.end > line.start ? line.end - 1 : line.start;
13437
+ case "first-nonblank":
13438
+ return firstNonBlank(text, line);
13439
+ case "doc-start":
13440
+ return 0;
13441
+ case "doc-end":
13442
+ return text.length;
13443
+ case "paragraph-forward": {
13444
+ let pos = caret;
13445
+ for (let i = 0; i < n; i++) {
13446
+ pos = nextParagraphBoundary(lines, lineIndexAt(lines, pos), text.length);
13447
+ }
13448
+ return pos;
13449
+ }
13450
+ case "paragraph-back": {
13451
+ let pos = caret;
13452
+ for (let i = 0; i < n; i++) {
13453
+ pos = prevParagraphBoundary(lines, lineIndexAt(lines, pos));
13454
+ }
13455
+ return pos;
13456
+ }
13457
+ case "line":
13458
+ case "selection":
13459
+ return caret;
13460
+ default: {
13461
+ const _exhaustive = motion;
13462
+ return _exhaustive;
13463
+ }
13464
+ }
13465
+ }
13466
+ function motionRange(text, caret, motion, count, selection) {
13467
+ if (motion === "selection") {
13468
+ if (!selection) return [caret, caret];
13469
+ return [Math.min(selection[0], selection[1]), Math.max(selection[0], selection[1])];
13470
+ }
13471
+ const lines = computeLines(text);
13472
+ if (motion === "line") {
13473
+ const n = Math.max(1, count);
13474
+ const startIdx = lineIndexAt(lines, caret);
13475
+ const endIdx = clamp(startIdx + n - 1, 0, lines.length - 1);
13476
+ const start2 = lines[startIdx].start;
13477
+ const rawEnd = lines[endIdx].end;
13478
+ const end2 = rawEnd < text.length ? rawEnd + 1 : rawEnd;
13479
+ return [start2, end2];
13480
+ }
13481
+ const newCaret = applyMotion(text, caret, motion, count);
13482
+ let start = Math.min(caret, newCaret);
13483
+ let end = Math.max(caret, newCaret);
13484
+ if (motion === "word-end" || motion === "line-end") {
13485
+ end = Math.min(Math.max(start, newCaret) + 1, text.length);
13486
+ } else if (motion === "word-forward" && newCaret > caret) {
13487
+ const startLine = lineIndexAt(lines, caret);
13488
+ const endLine = lineIndexAt(lines, newCaret);
13489
+ if (endLine !== startLine) {
13490
+ end = lines[startLine].end;
13491
+ }
13492
+ }
13493
+ return [start, end];
13494
+ }
13495
+ function applyOperator(text, range, operator, register) {
13496
+ const start = clamp(range[0], 0, text.length);
13497
+ const end = clamp(range[1], start, text.length);
13498
+ const removed = text.slice(start, end);
13499
+ if (operator === "yank") {
13500
+ return { text, caret: start, register: removed };
13501
+ }
13502
+ return { text: text.slice(0, start) + text.slice(end), caret: start, register: removed };
13503
+ }
13504
+ var init_editorMotions = __esm({
13505
+ "lib/editorMotions.ts"() {
13506
+ }
13507
+ });
13508
+ function isMotionPayload(payload) {
13509
+ return !!payload && typeof payload.editorId === "string" && typeof payload.motion === "string" && typeof payload.count === "number";
13510
+ }
13511
+ function isOperatePayload(payload) {
13512
+ return !!payload && typeof payload.editorId === "string" && typeof payload.operator === "string" && typeof payload.motion === "string" && typeof payload.count === "number";
13513
+ }
13514
+ function isInsertTextPayload(payload) {
13515
+ return !!payload && typeof payload.editorId === "string" && typeof payload.text === "string";
13516
+ }
13517
+ function isSetModePayload(payload) {
13518
+ return !!payload && typeof payload.editorId === "string" && typeof payload.mode === "string" && typeof payload.caret === "string";
13519
+ }
13520
+ function useEditorCapabilities(args) {
13521
+ const [caretMode, setCaretMode] = useState("bar");
13522
+ const registerRef = useRef("");
13523
+ useEventListener(`UI:${args.events.onMotion}`, (evt) => {
13524
+ if (!args.editorId || !isMotionPayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
13525
+ const ta = args.textareaRef.current;
13526
+ if (!ta) return;
13527
+ const { motion, count } = evt.payload;
13528
+ const newCaret = applyMotion(ta.value, ta.selectionStart, motion, count);
13529
+ if (ta.selectionStart !== ta.selectionEnd) {
13530
+ ta.setSelectionRange(ta.selectionStart, newCaret);
13531
+ } else {
13532
+ ta.setSelectionRange(newCaret, newCaret);
13533
+ }
13534
+ });
13535
+ useEventListener(`UI:${args.events.onOperate}`, (evt) => {
13536
+ if (!args.editorId || !isOperatePayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
13537
+ const ta = args.textareaRef.current;
13538
+ if (!ta) return;
13539
+ const { operator, motion, count } = evt.payload;
13540
+ const selection = motion === "selection" ? [ta.selectionStart, ta.selectionEnd] : void 0;
13541
+ const range = motionRange(ta.value, ta.selectionStart, motion, count, selection);
13542
+ const result = applyOperator(ta.value, range, operator, registerRef.current);
13543
+ registerRef.current = result.register;
13544
+ if (operator === "yank") {
13545
+ ta.setSelectionRange(range[0], range[0]);
13546
+ } else {
13547
+ ta.setRangeText("", range[0], range[1], "end");
13548
+ }
13549
+ args.applyChange(ta.value);
13550
+ });
13551
+ useEventListener(`UI:${args.events.onInsertText}`, (evt) => {
13552
+ if (!args.editorId || !isInsertTextPayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
13553
+ const ta = args.textareaRef.current;
13554
+ if (!ta) return;
13555
+ ta.setRangeText(evt.payload.text, ta.selectionStart, ta.selectionEnd, "end");
13556
+ args.applyChange(ta.value);
13557
+ });
13558
+ useEventListener(`UI:${args.events.onSetMode}`, (evt) => {
13559
+ if (!args.editorId || !isSetModePayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
13560
+ setCaretMode(evt.payload.caret);
13561
+ });
13562
+ return { caretMode };
13563
+ }
13564
+ var init_useEditorCapabilities = __esm({
13565
+ "components/core/molecules/markdown/useEditorCapabilities.ts"() {
13566
+ "use client";
13567
+ init_useEventBus();
13568
+ init_editorMotions();
13569
+ }
13570
+ });
13324
13571
  function registerCodeLanguageLoader(loader) {
13325
13572
  codeLanguageLoader = loader;
13326
13573
  }
@@ -13409,7 +13656,36 @@ function useLanguageReady(language) {
13409
13656
  }, [language]);
13410
13657
  return ready;
13411
13658
  }
13412
- var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13659
+ function resolveHighlightStyle(lang) {
13660
+ if (lang === "orb") return orbStyle;
13661
+ if (lang === "lolo") return loloStyle;
13662
+ return dark;
13663
+ }
13664
+ function plainCodeColorOf(style) {
13665
+ return style['code[class*="language-"]']?.color ?? "#d4d4d4";
13666
+ }
13667
+ function buildLineProps(errorLines, extraClassName) {
13668
+ return (lineNumber) => {
13669
+ const base = {
13670
+ "data-line": String(lineNumber - 1),
13671
+ ...extraClassName ? { className: extraClassName } : {}
13672
+ };
13673
+ const severity = errorLines?.get(lineNumber);
13674
+ if (!severity) return base;
13675
+ return {
13676
+ ...base,
13677
+ style: {
13678
+ display: "block",
13679
+ backgroundColor: severity === "error" ? "rgba(248, 113, 113, 0.18)" : "rgba(251, 191, 36, 0.18)",
13680
+ // amber-400 @ 18%
13681
+ borderLeft: `3px solid ${severity === "error" ? "#ef4444" : "#f59e0b"}`,
13682
+ paddingLeft: "0.5rem",
13683
+ marginLeft: "-0.5rem"
13684
+ }
13685
+ };
13686
+ };
13687
+ }
13688
+ var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, HIGHLIGHT_CAPACITY_BYTES, MONO_FONT_FAMILY, VIEWER_LINE_NUMBER_STYLE, CodeBlock;
13413
13689
  var init_CodeBlock = __esm({
13414
13690
  "components/core/molecules/markdown/CodeBlock.tsx"() {
13415
13691
  init_cn();
@@ -13425,6 +13701,7 @@ var init_CodeBlock = __esm({
13425
13701
  init_Textarea();
13426
13702
  init_Icon();
13427
13703
  init_useEventBus();
13704
+ init_useEditorCapabilities();
13428
13705
  SyntaxHighlighter.registerLanguage("json", langJson);
13429
13706
  SyntaxHighlighter.registerLanguage("javascript", langJavascript);
13430
13707
  SyntaxHighlighter.registerLanguage("js", langJavascript);
@@ -13642,7 +13919,17 @@ var init_CodeBlock = __esm({
13642
13919
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
13643
13920
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
13644
13921
  HIDDEN_LINE_NUMBERS = { display: "none" };
13645
- CodeBlock = React78__default.memo(
13922
+ HIGHLIGHT_CAPACITY_BYTES = 512 * 1024;
13923
+ MONO_FONT_FAMILY = 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace';
13924
+ VIEWER_LINE_NUMBER_STYLE = {
13925
+ minWidth: "2.5em",
13926
+ paddingRight: "1rem",
13927
+ textAlign: "right",
13928
+ userSelect: "none",
13929
+ opacity: 0.5,
13930
+ fontVariantNumeric: "tabular-nums"
13931
+ };
13932
+ CodeBlock = React79__default.memo(
13646
13933
  ({
13647
13934
  code: rawCode,
13648
13935
  language = "text",
@@ -13666,13 +13953,39 @@ var init_CodeBlock = __esm({
13666
13953
  actions,
13667
13954
  isLoading = false,
13668
13955
  error,
13669
- showCopy
13956
+ showCopy,
13957
+ // editor capability surface — P1 wires these
13958
+ editorId,
13959
+ onEditorFocus = "EDITOR_FOCUS",
13960
+ onEditorBlur = "EDITOR_BLUR",
13961
+ onMotion = "MOTION",
13962
+ onOperate = "OPERATE",
13963
+ onInsertText = "INSERT_TEXT",
13964
+ onSetMode = "SET_MODE",
13965
+ motions = [
13966
+ "left",
13967
+ "right",
13968
+ "up",
13969
+ "down",
13970
+ "word-forward",
13971
+ "word-back",
13972
+ "word-end",
13973
+ "line-start",
13974
+ "line-end",
13975
+ "first-nonblank",
13976
+ "doc-start",
13977
+ "doc-end",
13978
+ "paragraph-forward",
13979
+ "paragraph-back",
13980
+ "line",
13981
+ "selection"
13982
+ ],
13983
+ operators = ["delete", "yank", "change"]
13670
13984
  }) => {
13671
13985
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
13672
- const isOrb = language === "orb";
13673
- const isLolo = language === "lolo";
13674
- const activeStyle = isOrb ? orbStyle : isLolo ? loloStyle : dark;
13675
- const languageReady = useLanguageReady(language);
13986
+ const activeStyle = resolveHighlightStyle(language);
13987
+ const overCapacity = code.length > HIGHLIGHT_CAPACITY_BYTES;
13988
+ const plainCodeColor = plainCodeColorOf(activeStyle);
13676
13989
  const eventBus = useEventBus();
13677
13990
  const { t } = useTranslate();
13678
13991
  const scrollRef = useRef(null);
@@ -13684,6 +13997,9 @@ var init_CodeBlock = __esm({
13684
13997
  const activeFile = files?.[activeFileIndex];
13685
13998
  const activeCode = activeFile?.code ?? code;
13686
13999
  const activeLanguage = activeFile?.language ?? language;
14000
+ const languageReady = useLanguageReady(activeLanguage);
14001
+ const viewerStyle = resolveHighlightStyle(activeLanguage);
14002
+ const viewerPlainCodeColor = plainCodeColorOf(viewerStyle);
13687
14003
  const diffLines = useMemo(() => {
13688
14004
  if (propDiff) return propDiff;
13689
14005
  if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
@@ -13713,33 +14029,33 @@ var init_CodeBlock = __esm({
13713
14029
  ov.scrollLeft = ta.scrollLeft;
13714
14030
  }
13715
14031
  }, []);
13716
- const errorLineProps = useMemo(() => {
13717
- if (!errorLines || errorLines.size === 0) {
13718
- return LINE_PROPS_FN;
13719
- }
13720
- return (lineNumber) => {
13721
- const severity = errorLines.get(lineNumber);
13722
- if (!severity) {
13723
- return { "data-line": String(lineNumber - 1) };
13724
- }
13725
- return {
13726
- "data-line": String(lineNumber - 1),
13727
- style: {
13728
- display: "block",
13729
- backgroundColor: severity === "error" ? "rgba(248, 113, 113, 0.18)" : "rgba(251, 191, 36, 0.18)",
13730
- // amber-400 @ 18%
13731
- borderLeft: `3px solid ${severity === "error" ? "#ef4444" : "#f59e0b"}`,
13732
- paddingLeft: "0.5rem",
13733
- marginLeft: "-0.5rem"
13734
- }
13735
- };
13736
- };
13737
- }, [errorLines]);
14032
+ const handleEditableChange = useCallback((v) => {
14033
+ lastPropCodeRef.current = v;
14034
+ setEditableValue(v);
14035
+ onChange?.(v);
14036
+ }, [onChange]);
14037
+ const { caretMode } = useEditorCapabilities({
14038
+ editorId: editable ? editorId : void 0,
14039
+ textareaRef: editableTextareaRef,
14040
+ events: { onMotion, onOperate, onInsertText, onSetMode },
14041
+ applyChange: handleEditableChange
14042
+ });
14043
+ const [caretIndex, setCaretIndex] = useState(0);
14044
+ const caretRowCol = useMemo(() => {
14045
+ const before = editableValue.slice(0, Math.min(caretIndex, editableValue.length));
14046
+ const lines = before.split("\n");
14047
+ return { row: lines.length - 1, col: lines[lines.length - 1].length };
14048
+ }, [editableValue, caretIndex]);
14049
+ const errorLineProps = useMemo(() => buildLineProps(errorLines), [errorLines]);
14050
+ const viewerLineProps = useMemo(
14051
+ () => buildLineProps(errorLines, "px-4 py-0.5 hover:bg-muted/50"),
14052
+ [errorLines]
14053
+ );
13738
14054
  const isFoldable = foldableProp ?? true;
13739
14055
  const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
13740
14056
  const foldRegions = useMemo(
13741
- () => isFoldable ? computeFoldRegions(code) : [],
13742
- [code, isFoldable]
14057
+ () => isFoldable && !overCapacity ? computeFoldRegions(code) : [],
14058
+ [code, isFoldable, overCapacity]
13743
14059
  );
13744
14060
  const foldStartMap = useMemo(() => {
13745
14061
  const m = /* @__PURE__ */ new Map();
@@ -13773,8 +14089,67 @@ var init_CodeBlock = __esm({
13773
14089
  useEffect(() => {
13774
14090
  setCollapsed(/* @__PURE__ */ new Set());
13775
14091
  }, [code]);
14092
+ const editableOverCapacity = editableValue.length > HIGHLIGHT_CAPACITY_BYTES;
14093
+ const editableHighlightedElement = useMemo(
14094
+ () => editableOverCapacity ? /* @__PURE__ */ jsx(
14095
+ "div",
14096
+ {
14097
+ style: {
14098
+ padding: "1rem",
14099
+ margin: 0,
14100
+ whiteSpace: "pre",
14101
+ minWidth: "100%",
14102
+ color: plainCodeColor,
14103
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14104
+ fontSize: "13px",
14105
+ lineHeight: "1.5"
14106
+ },
14107
+ children: editableValue || " "
14108
+ }
14109
+ ) : /* @__PURE__ */ jsx(
14110
+ SyntaxHighlighter,
14111
+ {
14112
+ PreTag: "div",
14113
+ language,
14114
+ style: activeStyle,
14115
+ wrapLines: errorLines && errorLines.size > 0,
14116
+ lineProps: errorLineProps,
14117
+ customStyle: {
14118
+ backgroundColor: "transparent",
14119
+ borderRadius: 0,
14120
+ padding: "1rem",
14121
+ margin: 0,
14122
+ whiteSpace: "pre",
14123
+ minWidth: "100%",
14124
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14125
+ fontSize: "13px",
14126
+ lineHeight: "1.5"
14127
+ },
14128
+ codeTagProps: {
14129
+ style: {
14130
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14131
+ fontSize: "13px",
14132
+ lineHeight: "1.5"
14133
+ }
14134
+ },
14135
+ children: editableValue || " "
14136
+ }
14137
+ ),
14138
+ [editableValue, editableOverCapacity, plainCodeColor, language, activeStyle, errorLines, errorLineProps, languageReady]
14139
+ );
13776
14140
  const highlightedElement = useMemo(
13777
- () => /* @__PURE__ */ jsx(
14141
+ () => overCapacity ? /* @__PURE__ */ jsx(
14142
+ "div",
14143
+ {
14144
+ style: {
14145
+ margin: 0,
14146
+ whiteSpace: "pre",
14147
+ minWidth: "100%",
14148
+ color: plainCodeColor
14149
+ },
14150
+ children: code
14151
+ }
14152
+ ) : /* @__PURE__ */ jsx(
13778
14153
  SyntaxHighlighter,
13779
14154
  {
13780
14155
  PreTag: "div",
@@ -13796,8 +14171,112 @@ var init_CodeBlock = __esm({
13796
14171
  children: code
13797
14172
  }
13798
14173
  ),
13799
- [code, language, activeStyle, languageReady]
14174
+ [code, overCapacity, plainCodeColor, language, activeStyle, languageReady]
14175
+ );
14176
+ const viewerOverCapacity = activeCode.length > HIGHLIGHT_CAPACITY_BYTES;
14177
+ const viewerHighlightedElement = useMemo(
14178
+ () => viewerOverCapacity ? /* @__PURE__ */ jsx(
14179
+ "div",
14180
+ {
14181
+ className: "px-4 py-0.5",
14182
+ style: {
14183
+ margin: 0,
14184
+ whiteSpace: wrap ? "pre-wrap" : "pre",
14185
+ wordBreak: wrap ? "break-all" : "normal",
14186
+ color: viewerPlainCodeColor,
14187
+ fontFamily: MONO_FONT_FAMILY,
14188
+ fontSize: "12px",
14189
+ lineHeight: "1.6"
14190
+ },
14191
+ children: activeCode
14192
+ }
14193
+ ) : /* @__PURE__ */ jsx(
14194
+ SyntaxHighlighter,
14195
+ {
14196
+ PreTag: "div",
14197
+ language: activeLanguage,
14198
+ style: viewerStyle,
14199
+ wrapLines: true,
14200
+ wrapLongLines: wrap,
14201
+ showLineNumbers,
14202
+ lineNumberStyle: VIEWER_LINE_NUMBER_STYLE,
14203
+ lineProps: viewerLineProps,
14204
+ customStyle: {
14205
+ backgroundColor: "transparent",
14206
+ borderRadius: 0,
14207
+ padding: "0.25rem 0",
14208
+ margin: 0,
14209
+ whiteSpace: wrap ? "pre-wrap" : "pre",
14210
+ wordBreak: wrap ? "break-all" : "normal",
14211
+ fontFamily: MONO_FONT_FAMILY,
14212
+ fontSize: "12px",
14213
+ lineHeight: "1.6"
14214
+ },
14215
+ codeTagProps: { style: { fontFamily: MONO_FONT_FAMILY, fontSize: "12px", lineHeight: "1.6" } },
14216
+ children: activeCode
14217
+ }
14218
+ ),
14219
+ [activeCode, viewerOverCapacity, viewerPlainCodeColor, activeLanguage, viewerStyle, wrap, showLineNumbers, viewerLineProps, languageReady]
13800
14220
  );
14221
+ const diffOverCapacity = useMemo(
14222
+ () => !!diffLines && diffLines.reduce((n, l) => n + l.content.length + 1, 0) > HIGHLIGHT_CAPACITY_BYTES,
14223
+ [diffLines]
14224
+ );
14225
+ const diffRowElements = useMemo(() => {
14226
+ if (!diffLines) return null;
14227
+ return diffLines.map((line, idx) => {
14228
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
14229
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
14230
+ showLineNumbers && /* @__PURE__ */ jsx(
14231
+ Typography,
14232
+ {
14233
+ variant: "caption",
14234
+ color: "secondary",
14235
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
14236
+ children: line.lineNumber ?? ""
14237
+ }
14238
+ ),
14239
+ /* @__PURE__ */ jsxs(
14240
+ Typography,
14241
+ {
14242
+ variant: "caption",
14243
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14244
+ children: [
14245
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
14246
+ diffOverCapacity ? line.content || " " : /* @__PURE__ */ jsx(
14247
+ SyntaxHighlighter,
14248
+ {
14249
+ PreTag: "span",
14250
+ CodeTag: "span",
14251
+ language: activeLanguage,
14252
+ style: viewerStyle,
14253
+ customStyle: {
14254
+ display: "inline",
14255
+ background: "transparent",
14256
+ padding: 0,
14257
+ margin: 0,
14258
+ whiteSpace: wrap ? "pre-wrap" : "pre",
14259
+ wordBreak: wrap ? "break-all" : "normal",
14260
+ fontFamily: "inherit",
14261
+ fontSize: "inherit",
14262
+ lineHeight: "inherit"
14263
+ },
14264
+ codeTagProps: {
14265
+ style: {
14266
+ whiteSpace: wrap ? "pre-wrap" : "pre",
14267
+ fontFamily: "inherit",
14268
+ fontSize: "inherit"
14269
+ }
14270
+ },
14271
+ children: line.content || " "
14272
+ }
14273
+ )
14274
+ ]
14275
+ }
14276
+ )
14277
+ ] }, idx);
14278
+ });
14279
+ }, [diffLines, showLineNumbers, wrap, diffOverCapacity, activeLanguage, viewerStyle, languageReady]);
13801
14280
  useLayoutEffect(() => {
13802
14281
  const container = codeRef.current;
13803
14282
  if (!container) return;
@@ -13941,7 +14420,6 @@ var init_CodeBlock = __esm({
13941
14420
  label: file.label,
13942
14421
  content: null
13943
14422
  }));
13944
- const lines = activeCode.split("\n");
13945
14423
  return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
13946
14424
  tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
13947
14425
  Tabs,
@@ -14004,49 +14482,7 @@ var init_CodeBlock = __esm({
14004
14482
  ]
14005
14483
  }
14006
14484
  ),
14007
- /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
14008
- const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
14009
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
14010
- showLineNumbers && /* @__PURE__ */ jsx(
14011
- Typography,
14012
- {
14013
- variant: "caption",
14014
- color: "secondary",
14015
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
14016
- children: line.lineNumber ?? ""
14017
- }
14018
- ),
14019
- /* @__PURE__ */ jsxs(
14020
- Typography,
14021
- {
14022
- variant: "caption",
14023
- className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14024
- children: [
14025
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
14026
- line.content
14027
- ]
14028
- }
14029
- )
14030
- ] }, idx);
14031
- }) }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
14032
- showLineNumbers && /* @__PURE__ */ jsx(
14033
- Typography,
14034
- {
14035
- variant: "caption",
14036
- color: "secondary",
14037
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
14038
- children: idx + 1
14039
- }
14040
- ),
14041
- /* @__PURE__ */ jsx(
14042
- Typography,
14043
- {
14044
- variant: "caption",
14045
- className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14046
- children: line || " "
14047
- }
14048
- )
14049
- ] }, idx)) }) })
14485
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
14050
14486
  ] }) });
14051
14487
  }
14052
14488
  const hasHeader = showLanguageBadge || effectiveCopy;
@@ -14125,35 +14561,7 @@ var init_CodeBlock = __esm({
14125
14561
  overflow: "hidden",
14126
14562
  pointerEvents: "none"
14127
14563
  },
14128
- children: /* @__PURE__ */ jsx(
14129
- SyntaxHighlighter,
14130
- {
14131
- PreTag: "div",
14132
- language,
14133
- style: activeStyle,
14134
- wrapLines: errorLines && errorLines.size > 0,
14135
- lineProps: errorLineProps,
14136
- customStyle: {
14137
- backgroundColor: "transparent",
14138
- borderRadius: 0,
14139
- padding: "1rem",
14140
- margin: 0,
14141
- whiteSpace: "pre",
14142
- minWidth: "100%",
14143
- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14144
- fontSize: "13px",
14145
- lineHeight: "1.5"
14146
- },
14147
- codeTagProps: {
14148
- style: {
14149
- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14150
- fontSize: "13px",
14151
- lineHeight: "1.5"
14152
- }
14153
- },
14154
- children: editableValue || " "
14155
- }
14156
- )
14564
+ children: editableHighlightedElement
14157
14565
  }
14158
14566
  ),
14159
14567
  /* @__PURE__ */ jsx(
@@ -14161,13 +14569,11 @@ var init_CodeBlock = __esm({
14161
14569
  {
14162
14570
  ref: editableTextareaRef,
14163
14571
  defaultValue: code,
14164
- onChange: (e) => {
14165
- const v = e.target.value;
14166
- lastPropCodeRef.current = v;
14167
- setEditableValue(v);
14168
- onChange?.(v);
14169
- },
14572
+ onChange: (e) => handleEditableChange(e.target.value),
14170
14573
  onScroll: handleEditableScroll,
14574
+ onSelect: (e) => setCaretIndex(e.currentTarget.selectionStart),
14575
+ onFocus: editorId ? () => eventBus.emit(`UI:${onEditorFocus}`, { editorId }) : void 0,
14576
+ onBlur: editorId ? () => eventBus.emit(`UI:${onEditorBlur}`, { editorId }) : void 0,
14171
14577
  spellCheck: false,
14172
14578
  style: {
14173
14579
  position: "absolute",
@@ -14182,7 +14588,7 @@ var init_CodeBlock = __esm({
14182
14588
  resize: "none",
14183
14589
  backgroundColor: "transparent",
14184
14590
  color: "transparent",
14185
- caretColor: "#e6e6e6",
14591
+ caretColor: caretMode === "block" ? "transparent" : "#e6e6e6",
14186
14592
  WebkitTextFillColor: "transparent",
14187
14593
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
14188
14594
  fontSize: "13px",
@@ -14193,6 +14599,22 @@ var init_CodeBlock = __esm({
14193
14599
  }
14194
14600
  },
14195
14601
  editableTextareaKey
14602
+ ),
14603
+ caretMode !== "bar" && /* @__PURE__ */ jsx(
14604
+ "span",
14605
+ {
14606
+ "aria-hidden": true,
14607
+ style: {
14608
+ position: "absolute",
14609
+ top: `calc(1rem + ${caretRowCol.row * 19.5}px)`,
14610
+ left: `calc(1rem + ${caretRowCol.col}ch)`,
14611
+ width: "1ch",
14612
+ height: caretMode === "block" ? "19.5px" : "2px",
14613
+ backgroundColor: caretMode === "block" ? "rgba(230, 230, 230, 0.5)" : void 0,
14614
+ borderBottom: caretMode === "underline" ? "2px solid #e6e6e6" : void 0,
14615
+ pointerEvents: "none"
14616
+ }
14617
+ }
14196
14618
  )
14197
14619
  ]
14198
14620
  }
@@ -14220,55 +14642,175 @@ var init_CodeBlock = __esm({
14220
14642
  )
14221
14643
  ] });
14222
14644
  },
14223
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error
14645
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
14224
14646
  );
14225
14647
  CodeBlock.displayName = "CodeBlock";
14226
14648
  }
14227
14649
  });
14650
+
14651
+ // components/core/molecules/markdown/mermaidSource.ts
14652
+ function isQuoted(label) {
14653
+ const trimmed = label.trim();
14654
+ return trimmed.length === 0 || trimmed.startsWith('"') && trimmed.endsWith('"') && trimmed.length > 1;
14655
+ }
14656
+ function quote(label) {
14657
+ return `"${label.replace(/"/g, "#quot;")}"`;
14658
+ }
14659
+ function isIdentifierChar(ch) {
14660
+ return /[A-Za-z0-9_\-.]/.test(ch);
14661
+ }
14662
+ function declaredType(code) {
14663
+ for (const line of code.split("\n")) {
14664
+ const trimmed = line.trim();
14665
+ if (trimmed.length === 0 || trimmed.startsWith("%%")) continue;
14666
+ return trimmed;
14667
+ }
14668
+ return "";
14669
+ }
14670
+ function isFlowchart(code) {
14671
+ return FLOWCHART_DIRECTIVE.test(declaredType(code));
14672
+ }
14673
+ function quoteNodeLabels(code) {
14674
+ let out = "";
14675
+ let i = 0;
14676
+ while (i < code.length) {
14677
+ const shape = NODE_SHAPES.find(([open2]) => code.startsWith(open2, i));
14678
+ const precededByIdentifier = i > 0 && isIdentifierChar(code[i - 1] ?? "");
14679
+ if (shape === void 0 || !precededByIdentifier) {
14680
+ out += code[i];
14681
+ i += 1;
14682
+ continue;
14683
+ }
14684
+ const [open, close] = shape;
14685
+ const contentStart = i + open.length;
14686
+ const closeAt = code.indexOf(close, contentStart);
14687
+ const newlineAt = code.indexOf("\n", contentStart);
14688
+ if (closeAt === -1 || newlineAt !== -1 && newlineAt < closeAt) {
14689
+ out += code[i];
14690
+ i += 1;
14691
+ continue;
14692
+ }
14693
+ const label = code.slice(contentStart, closeAt);
14694
+ out += open + (isQuoted(label) ? label : quote(label)) + close;
14695
+ i = closeAt + close.length;
14696
+ }
14697
+ return out;
14698
+ }
14699
+ function quoteEdgeLabels(code) {
14700
+ return code.split("\n").map((line) => {
14701
+ let out = "";
14702
+ let rest = line;
14703
+ for (; ; ) {
14704
+ const open = rest.indexOf("|");
14705
+ if (open === -1) break;
14706
+ const close = rest.indexOf("|", open + 1);
14707
+ if (close === -1) break;
14708
+ const label = rest.slice(open + 1, close);
14709
+ out += rest.slice(0, open + 1) + (isQuoted(label) ? label : quote(label)) + "|";
14710
+ rest = rest.slice(close + 1);
14711
+ }
14712
+ return out + rest;
14713
+ }).join("\n");
14714
+ }
14715
+ function quoteSubgraphTitles(code) {
14716
+ return code.split("\n").map((line) => {
14717
+ const match = /^(\s*subgraph\s+)(.+?)(\s*)$/.exec(line);
14718
+ if (match === null) return line;
14719
+ const [, prefix, title, trailing] = match;
14720
+ if (title === void 0 || prefix === void 0) return line;
14721
+ if (isQuoted(title) || title.includes("[")) return line;
14722
+ return prefix + quote(title) + (trailing ?? "");
14723
+ }).join("\n");
14724
+ }
14725
+ function mermaidRepairCandidates(code) {
14726
+ if (!isFlowchart(code)) return [];
14727
+ const nodes = quoteNodeLabels(code);
14728
+ const nodesAndEdges = quoteEdgeLabels(nodes);
14729
+ const all = quoteSubgraphTitles(nodesAndEdges);
14730
+ const ordered2 = [nodes, nodesAndEdges, all];
14731
+ const seen = /* @__PURE__ */ new Set([code]);
14732
+ const candidates = [];
14733
+ for (const candidate of ordered2) {
14734
+ if (seen.has(candidate)) continue;
14735
+ seen.add(candidate);
14736
+ candidates.push(candidate);
14737
+ }
14738
+ return candidates;
14739
+ }
14740
+ var NODE_SHAPES, FLOWCHART_DIRECTIVE;
14741
+ var init_mermaidSource = __esm({
14742
+ "components/core/molecules/markdown/mermaidSource.ts"() {
14743
+ NODE_SHAPES = [
14744
+ ["[[", "]]"],
14745
+ ["[(", ")]"],
14746
+ ["([", "])"],
14747
+ ["((", "))"],
14748
+ ["{{", "}}"],
14749
+ ["[", "]"],
14750
+ ["(", ")"],
14751
+ ["{", "}"]
14752
+ ];
14753
+ FLOWCHART_DIRECTIVE = /^(?:graph|flowchart)\b/;
14754
+ }
14755
+ });
14228
14756
  function loadMermaid() {
14229
14757
  mermaidModule ?? (mermaidModule = import('mermaid').then((m) => m.default));
14230
14758
  return mermaidModule;
14231
14759
  }
14232
- var mermaidModule, MermaidDiagram;
14760
+ var log6, mermaidModule, MermaidDiagram;
14233
14761
  var init_MermaidDiagram = __esm({
14234
14762
  "components/core/molecules/markdown/MermaidDiagram.tsx"() {
14235
14763
  init_Box();
14236
14764
  init_Typography();
14237
14765
  init_CodeBlock();
14766
+ init_mermaidSource();
14238
14767
  init_cn();
14768
+ log6 = createLogger("almadar:ui:mermaid-diagram");
14239
14769
  mermaidModule = null;
14240
- MermaidDiagram = React78__default.memo(
14770
+ MermaidDiagram = React79__default.memo(
14241
14771
  ({ code, className }) => {
14242
14772
  const { resolvedMode } = useTheme();
14773
+ const { t } = useTranslate();
14243
14774
  const containerRef = useRef(null);
14244
- const [error, setError] = useState(null);
14775
+ const [unrenderable, setUnrenderable] = useState(false);
14245
14776
  const reactId = useId();
14246
14777
  useEffect(() => {
14247
14778
  let active = true;
14248
14779
  void (async () => {
14249
- try {
14250
- const mermaid = await loadMermaid();
14251
- mermaid.initialize({
14252
- startOnLoad: false,
14253
- securityLevel: "strict",
14254
- theme: resolvedMode === "dark" ? "dark" : "default"
14255
- });
14256
- const domId = `mermaid-${reactId.replace(/[^a-zA-Z0-9]/g, "")}`;
14257
- const { svg } = await mermaid.render(domId, code);
14258
- if (!active || !containerRef.current) return;
14259
- containerRef.current.innerHTML = svg;
14260
- setError(null);
14261
- } catch (err) {
14262
- if (active) setError(err instanceof Error ? err.message : String(err));
14780
+ const mermaid = await loadMermaid();
14781
+ mermaid.initialize({
14782
+ startOnLoad: false,
14783
+ securityLevel: "strict",
14784
+ theme: resolvedMode === "dark" ? "dark" : "default"
14785
+ });
14786
+ const domId = `mermaid-${reactId.replace(/[^a-zA-Z0-9]/g, "")}`;
14787
+ let firstError = null;
14788
+ for (const [index, source] of [code, ...mermaidRepairCandidates(code)].entries()) {
14789
+ try {
14790
+ const { svg } = await mermaid.render(domId, source);
14791
+ if (!active) return;
14792
+ const container = containerRef.current;
14793
+ if (container === null) return;
14794
+ container.innerHTML = svg;
14795
+ container.dataset.mermaidRepaired = String(index > 0);
14796
+ setUnrenderable(false);
14797
+ if (index > 0) log6.debug("mermaid:repaired", { candidate: index });
14798
+ return;
14799
+ } catch (err) {
14800
+ firstError ?? (firstError = err instanceof Error ? err : new Error(String(err)));
14801
+ }
14263
14802
  }
14803
+ if (!active) return;
14804
+ log6.warn("mermaid:unrenderable", { error: firstError?.message ?? "", code });
14805
+ setUnrenderable(true);
14264
14806
  })();
14265
14807
  return () => {
14266
14808
  active = false;
14267
14809
  };
14268
14810
  }, [code, resolvedMode, reactId]);
14269
14811
  return /* @__PURE__ */ jsxs(Box, { className: cn("not-prose my-4", className), children: [
14270
- error !== null && /* @__PURE__ */ jsxs(Box, { className: "space-y-2 mb-2", children: [
14271
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error whitespace-pre-wrap", children: error }),
14812
+ unrenderable && /* @__PURE__ */ jsxs(Box, { className: "space-y-2 mb-2", "data-testid": "mermaid-unrenderable", children: [
14813
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("mermaid.unrenderable") }),
14272
14814
  /* @__PURE__ */ jsx(CodeBlock, { code, language: "mermaid" })
14273
14815
  ] }),
14274
14816
  /* @__PURE__ */ jsx(
@@ -14277,7 +14819,7 @@ var init_MermaidDiagram = __esm({
14277
14819
  ref: containerRef,
14278
14820
  "data-testid": "mermaid-diagram",
14279
14821
  className: "overflow-x-auto",
14280
- style: error !== null ? { display: "none" } : void 0
14822
+ style: unrenderable ? { display: "none" } : void 0
14281
14823
  }
14282
14824
  )
14283
14825
  ] });
@@ -14295,7 +14837,7 @@ var init_MarkdownContent = __esm({
14295
14837
  init_CodeBlock();
14296
14838
  init_MermaidDiagram();
14297
14839
  init_cn();
14298
- MarkdownContent = React78__default.memo(
14840
+ MarkdownContent = React79__default.memo(
14299
14841
  ({ content, direction = "ltr", className }) => {
14300
14842
  const { t: _t } = useTranslate();
14301
14843
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -15625,7 +16167,7 @@ var init_StateMachineView = __esm({
15625
16167
  style: { top: title ? 30 : 0 },
15626
16168
  children: [
15627
16169
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
15628
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React78__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
16170
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React79__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15629
16171
  StateNode,
15630
16172
  {
15631
16173
  state,
@@ -17682,14 +18224,14 @@ function useSafeEventBus2() {
17682
18224
  } };
17683
18225
  }
17684
18226
  }
17685
- var log6, lookStyles4, ButtonGroup;
18227
+ var log7, lookStyles4, ButtonGroup;
17686
18228
  var init_ButtonGroup = __esm({
17687
18229
  "components/core/molecules/ButtonGroup.tsx"() {
17688
18230
  "use client";
17689
18231
  init_cn();
17690
18232
  init_atoms();
17691
18233
  init_useEventBus();
17692
- log6 = createLogger("almadar:ui:button-group");
18234
+ log7 = createLogger("almadar:ui:button-group");
17693
18235
  lookStyles4 = {
17694
18236
  "right-aligned-buttons": "",
17695
18237
  "floating-bar": "fixed bottom-section left-1/2 -translate-x-1/2 shadow-elevation-toast bg-card p-card-sm rounded-container",
@@ -17770,7 +18312,7 @@ var init_ButtonGroup = __esm({
17770
18312
  {
17771
18313
  variant: "ghost",
17772
18314
  onClick: () => {
17773
- log6.debug("Filter clicked", { field: filter.field });
18315
+ log7.debug("Filter clicked", { field: filter.field });
17774
18316
  },
17775
18317
  children: filter.label
17776
18318
  },
@@ -18266,8 +18808,8 @@ function MiniMap({
18266
18808
  tileAssets,
18267
18809
  unitAssets
18268
18810
  }) {
18269
- const canvasRef = React78.useRef(null);
18270
- const imgCacheRef = React78.useRef(/* @__PURE__ */ new Map());
18811
+ const canvasRef = React79.useRef(null);
18812
+ const imgCacheRef = React79.useRef(/* @__PURE__ */ new Map());
18271
18813
  function loadImg(url) {
18272
18814
  const cached = imgCacheRef.current.get(url);
18273
18815
  if (cached) return cached.complete ? cached : null;
@@ -18283,7 +18825,7 @@ function MiniMap({
18283
18825
  imgCacheRef.current.set(url, img);
18284
18826
  return null;
18285
18827
  }
18286
- React78.useEffect(() => {
18828
+ React79.useEffect(() => {
18287
18829
  const canvas = canvasRef.current;
18288
18830
  if (!canvas) return;
18289
18831
  const ctx = canvas.getContext("2d");
@@ -18788,7 +19330,7 @@ function collectDrawnItems(nodes) {
18788
19330
  for (const n of nodes) {
18789
19331
  switch (n.type) {
18790
19332
  case "draw-sprite":
18791
- if (isValidScenePos(n.position)) out.push({ pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height });
19333
+ if (isValidScenePos(n.position)) out.push({ pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height, rotation: n.rotation });
18792
19334
  break;
18793
19335
  case "draw-shape":
18794
19336
  case "draw-text":
@@ -18798,7 +19340,7 @@ function collectDrawnItems(nodes) {
18798
19340
  break;
18799
19341
  case "draw-sprite-layer":
18800
19342
  for (const it of n.items) {
18801
- if (isValidScenePos(it.position)) out.push({ pos: it.position, id: it.id, anchor: it.anchor, width: it.width, height: it.height });
19343
+ if (isValidScenePos(it.position)) out.push({ pos: it.position, id: it.id, anchor: it.anchor, width: it.width, height: it.height, rotation: it.rotation });
18802
19344
  }
18803
19345
  break;
18804
19346
  case "draw-shape-layer":
@@ -18818,15 +19360,39 @@ function buildHitIndex(items) {
18818
19360
  }
18819
19361
  return m;
18820
19362
  }
19363
+ function withPreviewPosition(nodes, id, pos) {
19364
+ return nodes.map((n) => {
19365
+ if (n.type === "draw-sprite-layer" || n.type === "draw-shape-layer" || n.type === "draw-text-layer") {
19366
+ if (!n.items.some((it) => it.id === id)) return n;
19367
+ return { ...n, items: n.items.map((it) => it.id === id ? { ...it, position: pos } : it) };
19368
+ }
19369
+ if (n.type === "draw-group") {
19370
+ if (!Array.isArray(n.items)) return n;
19371
+ return { ...n, items: withPreviewPosition(n.items, id, pos) };
19372
+ }
19373
+ if (n.id === id && "position" in n) {
19374
+ return { ...n, position: pos };
19375
+ }
19376
+ return n;
19377
+ });
19378
+ }
18821
19379
  function hitTestSprites(items, projector, point) {
18822
19380
  for (let i = items.length - 1; i >= 0; i--) {
18823
19381
  const it = items[i];
18824
19382
  if (it.id === void 0) continue;
18825
19383
  const r = spriteRect(projector, { position: it.pos, anchor: it.anchor, width: it.width, height: it.height });
18826
- if (point.x >= r.x && point.x <= r.x + r.w && point.y >= r.y && point.y <= r.y + r.h) return it.id;
19384
+ const test = it.rotation ? rotatePoint(point, { x: r.x + r.w / 2, y: r.y + r.h / 2 }, -it.rotation) : point;
19385
+ if (test.x >= r.x && test.x <= r.x + r.w && test.y >= r.y && test.y <= r.y + r.h) return it.id;
18827
19386
  }
18828
19387
  return void 0;
18829
19388
  }
19389
+ function rotatePoint(p, center, radians) {
19390
+ const cos = Math.cos(radians);
19391
+ const sin = Math.sin(radians);
19392
+ const dx = p.x - center.x;
19393
+ const dy = p.y - center.y;
19394
+ return { x: center.x + dx * cos - dy * sin, y: center.y + dx * sin + dy * cos };
19395
+ }
18830
19396
  var init_hitTest = __esm({
18831
19397
  "lib/drawable/hitTest.ts"() {
18832
19398
  init_contract();
@@ -18835,6 +19401,41 @@ var init_hitTest = __esm({
18835
19401
  function normalizeBackdrop(bg) {
18836
19402
  return typeof bg === "string" ? { url: bg, role: "decoration", category: "background" } : bg;
18837
19403
  }
19404
+ function selectionOverlayNodes(projector, item) {
19405
+ const r = spriteRect(projector, { position: item.pos, anchor: item.anchor, width: item.width, height: item.height });
19406
+ const tw = projector.tileWidth;
19407
+ const cellTopLeft = projector.anchorPoint(item.pos, "top-left");
19408
+ const offsetX = (r.x - cellTopLeft.x) / tw;
19409
+ const offsetY = (r.y - cellTopLeft.y) / tw;
19410
+ const width = r.w / tw;
19411
+ const height = r.h / tw;
19412
+ const handle = EDIT_HANDLE_SIZE_PX / tw;
19413
+ const ring = {
19414
+ type: "draw-shape",
19415
+ shape: "rect",
19416
+ position: item.pos,
19417
+ anchor: "top-left",
19418
+ offsetX,
19419
+ offsetY,
19420
+ width,
19421
+ height,
19422
+ stroke: EDIT_SELECTION_COLOR,
19423
+ strokeWidth: 2,
19424
+ fill: "none"
19425
+ };
19426
+ const handles = EDIT_SELECTION_CORNERS.map(([cx, cy]) => ({
19427
+ type: "draw-shape",
19428
+ shape: "rect",
19429
+ position: item.pos,
19430
+ anchor: "top-left",
19431
+ offsetX: offsetX + cx * width - handle / 2,
19432
+ offsetY: offsetY + cy * height - handle / 2,
19433
+ width: handle,
19434
+ height: handle,
19435
+ fill: EDIT_SELECTION_COLOR
19436
+ }));
19437
+ return [ring, ...handles];
19438
+ }
18838
19439
  function Canvas2D({
18839
19440
  className,
18840
19441
  isLoading = false,
@@ -18848,6 +19449,12 @@ function Canvas2D({
18848
19449
  tileLeaveEvent,
18849
19450
  keyMap,
18850
19451
  keyUpMap,
19452
+ editable = false,
19453
+ selectedId = null,
19454
+ onSelect,
19455
+ onMove,
19456
+ selectEvent,
19457
+ moveEvent,
18851
19458
  camera = "pan-zoom",
18852
19459
  scale = 0.4,
18853
19460
  tileWidth,
@@ -18864,7 +19471,7 @@ function Canvas2D({
18864
19471
  const registerChildDrawable = useCallback((node) => {
18865
19472
  childDrawablesRef.current.push(node);
18866
19473
  }, []);
18867
- const hasJsxChildren = React78.Children.count(children) > 0;
19474
+ const hasJsxChildren = React79.Children.count(children) > 0;
18868
19475
  function isDrawableLayer(node) {
18869
19476
  return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
18870
19477
  }
@@ -19105,10 +19712,22 @@ function Canvas2D({
19105
19712
  painter.scale(cam.zoom, cam.zoom);
19106
19713
  painter.translate(-viewportSize.width / 2 - cam.x, -viewportSize.height / 2 - cam.y);
19107
19714
  const dctx = { projector, time: timeMs, invalidate: bumpAtlas };
19108
- for (const node of drawables) paintDrawable(painter, node, dctx);
19715
+ let paintNodes = drawables;
19716
+ if (editable) {
19717
+ const drag = editDragRef.current;
19718
+ if (drag && drag.moved) {
19719
+ paintNodes = withPreviewPosition(paintNodes, drag.id, { x: drag.previewX, y: drag.previewY });
19720
+ }
19721
+ const selectedItem = selectedId != null ? drawnItems.find((it) => it.id === selectedId) : void 0;
19722
+ if (selectedItem) {
19723
+ const overlaySource = drag && drag.moved && drag.id === selectedId ? { ...selectedItem, pos: { x: drag.previewX, y: drag.previewY } } : selectedItem;
19724
+ paintNodes = [...paintNodes, ...selectionOverlayNodes(projector, overlaySource)];
19725
+ }
19726
+ }
19727
+ for (const node of paintNodes) paintDrawable(painter, node, dctx);
19109
19728
  painter.restore();
19110
- scheduleAnimation(drawables);
19111
- }, [viewportSize, backgroundImage, bgColor, drawables, projector, cameraRef, bumpAtlas, getImage, cameraPos, defaultGridFocus, camera, dragDistance]);
19729
+ scheduleAnimation(paintNodes);
19730
+ }, [viewportSize, backgroundImage, bgColor, drawables, projector, cameraRef, bumpAtlas, getImage, cameraPos, defaultGridFocus, camera, dragDistance, editable, selectedId, drawnItems]);
19112
19731
  useEffect(() => {
19113
19732
  drawTimeRef.current = draw;
19114
19733
  }, [draw]);
@@ -19153,23 +19772,83 @@ function Canvas2D({
19153
19772
  };
19154
19773
  }, [camera, followTarget, lerpToTarget, draw]);
19155
19774
  const singlePointerActiveRef = useRef(false);
19775
+ const editDragRef = useRef(null);
19776
+ const pointerToScene = useCallback((clientX, clientY) => {
19777
+ const canvas = canvasRef.current;
19778
+ if (!canvas) return { x: 0, y: 0 };
19779
+ const world = screenToWorld(clientX, clientY, canvas, viewportSize);
19780
+ const adjustedX = world.x - scaledTileWidth / 2;
19781
+ const adjustedY = squareGrid ? world.y - scaledTileWidth / 2 : world.y - scaledDiamondTopY - scaledFloorHeight / 2;
19782
+ return unproject(adjustedX, adjustedY);
19783
+ }, [screenToWorld, viewportSize, scaledTileWidth, squareGrid, scaledDiamondTopY, scaledFloorHeight, unproject]);
19156
19784
  const handleCanvasPointerDown = useCallback((e) => {
19157
19785
  singlePointerActiveRef.current = true;
19786
+ if (editable) {
19787
+ if (!canvasRef.current) return;
19788
+ const world = screenToWorld(e.clientX, e.clientY, canvasRef.current, viewportSize);
19789
+ const hitId = hitTestSprites(drawnItems, projector, world);
19790
+ if (hitId === void 0) return;
19791
+ const item = [...drawnItems].reverse().find((it) => it.id === hitId);
19792
+ if (!item) return;
19793
+ editDragRef.current = {
19794
+ id: hitId,
19795
+ pointerId: e.pointerId,
19796
+ startClientX: e.clientX,
19797
+ startClientY: e.clientY,
19798
+ startSceneX: item.pos.x,
19799
+ startSceneY: item.pos.y,
19800
+ moved: false,
19801
+ previewX: item.pos.x,
19802
+ previewY: item.pos.y
19803
+ };
19804
+ return;
19805
+ }
19158
19806
  if (enableCamera) handlePointerDown(e);
19159
- }, [enableCamera, handlePointerDown]);
19807
+ }, [editable, screenToWorld, viewportSize, drawnItems, projector, enableCamera, handlePointerDown]);
19160
19808
  const handleCanvasPointerMove = useCallback((e) => {
19809
+ if (editable) {
19810
+ const drag = editDragRef.current;
19811
+ if (!drag || drag.pointerId !== e.pointerId) return;
19812
+ const dxPx = e.clientX - drag.startClientX;
19813
+ const dyPx = e.clientY - drag.startClientY;
19814
+ if (!drag.moved && Math.abs(dxPx) + Math.abs(dyPx) <= 5) return;
19815
+ drag.moved = true;
19816
+ const nowScene = pointerToScene(e.clientX, e.clientY);
19817
+ const startScene = pointerToScene(drag.startClientX, drag.startClientY);
19818
+ drag.previewX = drag.startSceneX + (nowScene.x - startScene.x);
19819
+ drag.previewY = drag.startSceneY + (nowScene.y - startScene.y);
19820
+ draw();
19821
+ return;
19822
+ }
19161
19823
  if (enableCamera) handlePointerMove(e, () => draw());
19162
- }, [enableCamera, handlePointerMove, draw]);
19824
+ }, [editable, pointerToScene, draw, enableCamera, handlePointerMove]);
19163
19825
  const handleCanvasHover = useCallback((e) => {
19164
19826
  if (singlePointerActiveRef.current) return;
19165
19827
  if (!tileHoverEvent || !canvasRef.current) return;
19166
- const world = screenToWorld(e.clientX, e.clientY, canvasRef.current, viewportSize);
19167
- const adjustedX = world.x - scaledTileWidth / 2;
19168
- const adjustedY = squareGrid ? world.y - scaledTileWidth / 2 : world.y - scaledDiamondTopY - scaledFloorHeight / 2;
19169
- const isoPos = unproject(adjustedX, adjustedY);
19828
+ const isoPos = pointerToScene(e.clientX, e.clientY);
19170
19829
  eventBus.emit(`UI:${tileHoverEvent}`, { x: isoPos.x, y: isoPos.y });
19171
- }, [screenToWorld, viewportSize, scaledTileWidth, squareGrid, scaledDiamondTopY, scaledFloorHeight, unproject, tileHoverEvent, eventBus]);
19830
+ }, [pointerToScene, tileHoverEvent, eventBus]);
19172
19831
  const handleCanvasPointerUp = useCallback((e) => {
19832
+ if (editable) {
19833
+ singlePointerActiveRef.current = false;
19834
+ const drag = editDragRef.current;
19835
+ if (drag && drag.pointerId === e.pointerId) {
19836
+ editDragRef.current = null;
19837
+ if (drag.moved) {
19838
+ onMove?.(drag.id, drag.previewX, drag.previewY);
19839
+ if (moveEvent) eventBus.emit(`UI:${moveEvent}`, { id: drag.id, x: drag.previewX, y: drag.previewY });
19840
+ draw();
19841
+ return;
19842
+ }
19843
+ const next = selectedId === drag.id ? null : drag.id;
19844
+ onSelect?.(next);
19845
+ if (selectEvent) eventBus.emit(`UI:${selectEvent}`, { id: next });
19846
+ return;
19847
+ }
19848
+ onSelect?.(null);
19849
+ if (selectEvent) eventBus.emit(`UI:${selectEvent}`, { id: null });
19850
+ return;
19851
+ }
19173
19852
  singlePointerActiveRef.current = false;
19174
19853
  if (enableCamera) handlePointerUp();
19175
19854
  if (dragDistance() > 5) return;
@@ -19180,16 +19859,14 @@ function Canvas2D({
19180
19859
  eventBus.emit(`UI:${unitClickEvent}`, { unitId: spriteHit });
19181
19860
  return;
19182
19861
  }
19183
- const adjustedX = world.x - scaledTileWidth / 2;
19184
- const adjustedY = squareGrid ? world.y - scaledTileWidth / 2 : world.y - scaledDiamondTopY - scaledFloorHeight / 2;
19185
- const isoPos = unproject(adjustedX, adjustedY);
19862
+ const isoPos = pointerToScene(e.clientX, e.clientY);
19186
19863
  const hitId = hitIndex.get(`${isoPos.x},${isoPos.y}`);
19187
19864
  if (hitId !== void 0 && unitClickEvent) {
19188
19865
  eventBus.emit(`UI:${unitClickEvent}`, { unitId: hitId });
19189
19866
  } else if (tileClickEvent) {
19190
19867
  eventBus.emit(`UI:${tileClickEvent}`, { x: isoPos.x, y: isoPos.y });
19191
19868
  }
19192
- }, [enableCamera, handlePointerUp, dragDistance, screenToWorld, viewportSize, scaledTileWidth, squareGrid, scaledDiamondTopY, scaledFloorHeight, unproject, hitIndex, drawnItems, projector, tileClickEvent, unitClickEvent, eventBus]);
19869
+ }, [editable, selectedId, onMove, moveEvent, onSelect, selectEvent, eventBus, draw, enableCamera, handlePointerUp, dragDistance, screenToWorld, viewportSize, drawnItems, projector, tileClickEvent, unitClickEvent, hitIndex, pointerToScene]);
19193
19870
  const handleCanvasPointerLeave = useCallback(() => {
19194
19871
  handleMouseLeave();
19195
19872
  if (tileLeaveEvent) eventBus.emit(`UI:${tileLeaveEvent}`, {});
@@ -19208,7 +19885,7 @@ function Canvas2D({
19208
19885
  }, [enableCamera, handlePointerUp]);
19209
19886
  const gestureHandlers = useCanvasGestures({
19210
19887
  canvasRef,
19211
- enabled: enableCamera || !!tileHoverEvent || !!tileClickEvent || !!unitClickEvent,
19888
+ enabled: enableCamera || !!tileHoverEvent || !!tileClickEvent || !!unitClickEvent || editable,
19212
19889
  onPointerDown: handleCanvasPointerDown,
19213
19890
  onPointerMove: handleCanvasPointerMove,
19214
19891
  onPointerUp: handleCanvasPointerUp,
@@ -19340,7 +20017,7 @@ function Canvas2D({
19340
20017
  }
19341
20018
  ) });
19342
20019
  }
19343
- var canvas2DLog;
20020
+ var canvas2DLog, EDIT_SELECTION_COLOR, EDIT_HANDLE_SIZE_PX, EDIT_SELECTION_CORNERS;
19344
20021
  var init_Canvas2D = __esm({
19345
20022
  "components/game/molecules/Canvas2D.tsx"() {
19346
20023
  "use client";
@@ -19365,8 +20042,12 @@ var init_Canvas2D = __esm({
19365
20042
  init_DrawGroup();
19366
20043
  init_registry();
19367
20044
  init_hitTest();
20045
+ init_contract();
19368
20046
  init_isometric();
19369
20047
  canvas2DLog = createLogger("almadar:ui:game-canvas");
20048
+ EDIT_SELECTION_COLOR = "#3b82f6";
20049
+ EDIT_HANDLE_SIZE_PX = 8;
20050
+ EDIT_SELECTION_CORNERS = [[0, 0], [1, 0], [0, 1], [1, 1]];
19370
20051
  Canvas2D.displayName = "Canvas2D";
19371
20052
  }
19372
20053
  });
@@ -19408,6 +20089,12 @@ function Canvas({
19408
20089
  featureClickEvent,
19409
20090
  keyMap,
19410
20091
  keyUpMap,
20092
+ editable,
20093
+ selectedId,
20094
+ onSelect,
20095
+ onMove,
20096
+ selectEvent,
20097
+ moveEvent,
19411
20098
  children
19412
20099
  }) {
19413
20100
  canvasLog.debug("Canvas render", { mode, drawablesCount: drawables?.length, projection, camera: camera ? JSON.stringify(camera) : void 0 });
@@ -19422,7 +20109,7 @@ function Canvas({
19422
20109
  if (mode !== "3d") return;
19423
20110
  const next = childDrawablesRef.current;
19424
20111
  canvasLog.debug("children:adopt", { registered: next.length, adopted: childDrawables.length });
19425
- if (next.length === 0 && React78.Children.count(children) > 0) return;
20112
+ if (next.length === 0 && React79.Children.count(children) > 0) return;
19426
20113
  setChildDrawables(
19427
20114
  (prev) => prev.length === next.length && JSON.stringify(prev) === JSON.stringify(next) ? prev : [...next]
19428
20115
  );
@@ -19460,7 +20147,7 @@ function Canvas({
19460
20147
  };
19461
20148
  return /* @__PURE__ */ jsxs(Fragment, { children: [
19462
20149
  /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Canvas3DHost2, { ...props3d }) }),
19463
- React78.Children.count(children) > 0 && /* @__PURE__ */ jsx(DrawableRegistryContext.Provider, { value: registerChildDrawable, children: /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, children }) })
20150
+ React79.Children.count(children) > 0 && /* @__PURE__ */ jsx(DrawableRegistryContext.Provider, { value: registerChildDrawable, children: /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, children }) })
19464
20151
  ] });
19465
20152
  }
19466
20153
  return /* @__PURE__ */ jsx(
@@ -19485,6 +20172,12 @@ function Canvas({
19485
20172
  tileLeaveEvent,
19486
20173
  keyMap,
19487
20174
  keyUpMap,
20175
+ editable,
20176
+ selectedId,
20177
+ onSelect,
20178
+ onMove,
20179
+ selectEvent,
20180
+ moveEvent,
19488
20181
  ...children !== void 0 ? { children } : {}
19489
20182
  }
19490
20183
  );
@@ -21852,6 +22545,187 @@ var init_CodeRunnerPanel = __esm({
21852
22545
  CodeRunnerPanel.displayName = "CodeRunnerPanel";
21853
22546
  }
21854
22547
  });
22548
+ function matchesQuery(query, text) {
22549
+ if (!query) return true;
22550
+ let qi = 0;
22551
+ const q = query.toLowerCase();
22552
+ const t = text.toLowerCase();
22553
+ for (let ti = 0; ti < t.length && qi < q.length; ti++) {
22554
+ if (t[ti] === q[qi]) qi++;
22555
+ }
22556
+ return qi === q.length;
22557
+ }
22558
+ function commandMatches(command, query) {
22559
+ if (!query) return true;
22560
+ if (matchesQuery(query, command.label)) return true;
22561
+ return (command.keywords ?? []).some((keyword) => matchesQuery(query, keyword));
22562
+ }
22563
+ function dispatchCommandPaletteCommand(command, deps) {
22564
+ if (command.disabled) return;
22565
+ if (command.event) deps.emit(`UI:${command.event}`, { commandId: command.id });
22566
+ if (command.action) deps.emit(`UI:${command.action}`, command.actionPayload ?? {});
22567
+ deps.onSelect?.(command);
22568
+ }
22569
+ var UNGROUPED, CommandPalette;
22570
+ var init_CommandPalette = __esm({
22571
+ "components/core/molecules/CommandPalette.tsx"() {
22572
+ "use client";
22573
+ init_Box();
22574
+ init_Stack();
22575
+ init_Typography();
22576
+ init_Icon();
22577
+ init_Input();
22578
+ init_Badge();
22579
+ init_cn();
22580
+ init_useEventBus();
22581
+ init_Modal();
22582
+ UNGROUPED = /* @__PURE__ */ Symbol("command-palette-ungrouped");
22583
+ CommandPalette = ({
22584
+ open,
22585
+ onOpenChange,
22586
+ commands,
22587
+ onSelect,
22588
+ placeholder = "Type a command...",
22589
+ emptyLabel = "No matching commands",
22590
+ className
22591
+ }) => {
22592
+ const eventBus = useEventBus();
22593
+ const [query, setQuery] = useState("");
22594
+ const [highlightIndex, setHighlightIndex] = useState(0);
22595
+ const filtered = useMemo(
22596
+ () => commands.filter((command) => commandMatches(command, query)),
22597
+ [commands, query]
22598
+ );
22599
+ const groups = useMemo(() => {
22600
+ const order = [];
22601
+ const byGroup = /* @__PURE__ */ new Map();
22602
+ for (const command of filtered) {
22603
+ const key = command.group ?? UNGROUPED;
22604
+ if (!byGroup.has(key)) {
22605
+ byGroup.set(key, []);
22606
+ order.push(key);
22607
+ }
22608
+ byGroup.get(key).push(command);
22609
+ }
22610
+ return order.map((key) => ({ group: key === UNGROUPED ? void 0 : key, items: byGroup.get(key) }));
22611
+ }, [filtered]);
22612
+ const resetQuery = useCallback(() => {
22613
+ setQuery("");
22614
+ setHighlightIndex(0);
22615
+ }, []);
22616
+ const handleClose = useCallback(() => {
22617
+ resetQuery();
22618
+ onOpenChange(false);
22619
+ }, [onOpenChange, resetQuery]);
22620
+ const handleSelect = useCallback(
22621
+ (command) => {
22622
+ if (command.disabled) return;
22623
+ dispatchCommandPaletteCommand(command, { emit: eventBus.emit, onSelect });
22624
+ handleClose();
22625
+ },
22626
+ [eventBus, onSelect, handleClose]
22627
+ );
22628
+ const handleQueryChange = useCallback((e) => {
22629
+ setQuery(e.target.value);
22630
+ setHighlightIndex(0);
22631
+ }, []);
22632
+ const handleKeyDown = useCallback(
22633
+ (e) => {
22634
+ if (filtered.length === 0) return;
22635
+ if (e.key === "ArrowDown") {
22636
+ e.preventDefault();
22637
+ setHighlightIndex((prev) => prev < filtered.length - 1 ? prev + 1 : 0);
22638
+ } else if (e.key === "ArrowUp") {
22639
+ e.preventDefault();
22640
+ setHighlightIndex((prev) => prev > 0 ? prev - 1 : filtered.length - 1);
22641
+ } else if (e.key === "Enter") {
22642
+ e.preventDefault();
22643
+ const command = filtered[highlightIndex];
22644
+ if (command) handleSelect(command);
22645
+ }
22646
+ },
22647
+ [filtered, highlightIndex, handleSelect]
22648
+ );
22649
+ return /* @__PURE__ */ jsx(
22650
+ Modal,
22651
+ {
22652
+ isOpen: open,
22653
+ onClose: handleClose,
22654
+ onExited: resetQuery,
22655
+ showCloseButton: false,
22656
+ size: "md",
22657
+ className,
22658
+ children: /* @__PURE__ */ jsx(Box, { "data-testid": "command-palette", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
22659
+ /* @__PURE__ */ jsx(
22660
+ Input,
22661
+ {
22662
+ inputType: "search",
22663
+ placeholder,
22664
+ value: query,
22665
+ onChange: handleQueryChange,
22666
+ onKeyDown: handleKeyDown,
22667
+ leftIcon: "search",
22668
+ clearable: query.length > 0,
22669
+ onClear: resetQuery,
22670
+ autoFocus: true,
22671
+ "data-testid": "command-palette-input"
22672
+ }
22673
+ ),
22674
+ filtered.length === 0 ? /* @__PURE__ */ jsx(Box, { className: "px-2 py-6 text-center", "data-testid": "command-palette-empty", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: emptyLabel }) }) : /* @__PURE__ */ jsx(
22675
+ Box,
22676
+ {
22677
+ className: "max-h-80 overflow-y-auto",
22678
+ role: "listbox",
22679
+ "aria-label": placeholder,
22680
+ children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: groups.map(({ group, items }) => /* @__PURE__ */ jsxs(Box, { children: [
22681
+ group ? /* @__PURE__ */ jsx(
22682
+ Typography,
22683
+ {
22684
+ variant: "caption",
22685
+ color: "muted",
22686
+ className: "px-3 pt-2 pb-1 block",
22687
+ children: group
22688
+ }
22689
+ ) : null,
22690
+ items.map((command) => {
22691
+ const index = filtered.indexOf(command);
22692
+ const isHighlighted = index === highlightIndex;
22693
+ return /* @__PURE__ */ jsxs(
22694
+ Box,
22695
+ {
22696
+ as: "button",
22697
+ role: "option",
22698
+ "aria-selected": isHighlighted,
22699
+ "aria-disabled": command.disabled || void 0,
22700
+ "data-testid": `command-palette-item-${command.id}`,
22701
+ onMouseEnter: () => !command.disabled && setHighlightIndex(index),
22702
+ onClick: () => handleSelect(command),
22703
+ className: cn(
22704
+ "w-full flex items-center gap-3 px-3 py-2 text-start rounded-sm",
22705
+ "text-sm transition-colors",
22706
+ "focus:outline-none",
22707
+ isHighlighted && "bg-muted",
22708
+ command.disabled && "opacity-50 cursor-not-allowed"
22709
+ ),
22710
+ children: [
22711
+ command.icon ? /* @__PURE__ */ jsx(Icon, { icon: command.icon, size: "sm", className: "flex-shrink-0" }) : null,
22712
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1 truncate", children: command.label }),
22713
+ command.shortcut ? /* @__PURE__ */ jsx(Badge, { variant: "neutral", size: "sm", children: command.shortcut }) : null
22714
+ ]
22715
+ },
22716
+ command.id
22717
+ );
22718
+ })
22719
+ ] }, String(group ?? "__ungrouped__"))) })
22720
+ }
22721
+ )
22722
+ ] }) })
22723
+ }
22724
+ );
22725
+ };
22726
+ CommandPalette.displayName = "CommandPalette";
22727
+ }
22728
+ });
21855
22729
  function formatCount(count) {
21856
22730
  if (count >= 1e3) {
21857
22731
  return `${(count / 1e3).toFixed(1)}k`;
@@ -22055,9 +22929,9 @@ function ControlButton({
22055
22929
  className
22056
22930
  }) {
22057
22931
  const eventBus = useEventBus();
22058
- const [isPressed, setIsPressed] = React78.useState(false);
22932
+ const [isPressed, setIsPressed] = React79.useState(false);
22059
22933
  const actualPressed = pressed ?? isPressed;
22060
- const handlePointerDown = React78.useCallback(
22934
+ const handlePointerDown = React79.useCallback(
22061
22935
  (e) => {
22062
22936
  e.preventDefault();
22063
22937
  if (disabled) return;
@@ -22067,7 +22941,7 @@ function ControlButton({
22067
22941
  },
22068
22942
  [disabled, pressEvent, eventBus, onPress]
22069
22943
  );
22070
- const handlePointerUp = React78.useCallback(
22944
+ const handlePointerUp = React79.useCallback(
22071
22945
  (e) => {
22072
22946
  e.preventDefault();
22073
22947
  if (disabled) return;
@@ -22077,7 +22951,7 @@ function ControlButton({
22077
22951
  },
22078
22952
  [disabled, releaseEvent, eventBus, onRelease]
22079
22953
  );
22080
- const handlePointerLeave = React78.useCallback(
22954
+ const handlePointerLeave = React79.useCallback(
22081
22955
  (e) => {
22082
22956
  if (isPressed) {
22083
22957
  setIsPressed(false);
@@ -22166,18 +23040,18 @@ function ControlGrid({
22166
23040
  className
22167
23041
  }) {
22168
23042
  const eventBus = useEventBus();
22169
- const [active, setActive] = React78.useState(/* @__PURE__ */ new Set());
22170
- const [coarse, setCoarse] = React78.useState(
23043
+ const [active, setActive] = React79.useState(/* @__PURE__ */ new Set());
23044
+ const [coarse, setCoarse] = React79.useState(
22171
23045
  () => typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches
22172
23046
  );
22173
- React78.useEffect(() => {
23047
+ React79.useEffect(() => {
22174
23048
  if (visibility !== "auto" || typeof window === "undefined") return;
22175
23049
  const mq = window.matchMedia("(pointer: coarse)");
22176
23050
  const onChange = (e) => setCoarse(e.matches);
22177
23051
  mq.addEventListener("change", onChange);
22178
23052
  return () => mq.removeEventListener("change", onChange);
22179
23053
  }, [visibility]);
22180
- const handlePress = React78.useCallback(
23054
+ const handlePress = React79.useCallback(
22181
23055
  (id) => {
22182
23056
  setActive((prev) => new Set(prev).add(id));
22183
23057
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -22191,7 +23065,7 @@ function ControlGrid({
22191
23065
  },
22192
23066
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
22193
23067
  );
22194
- const handleRelease = React78.useCallback(
23068
+ const handleRelease = React79.useCallback(
22195
23069
  (id) => {
22196
23070
  setActive((prev) => {
22197
23071
  const next = new Set(prev);
@@ -23447,7 +24321,7 @@ var init_Menu = __esm({
23447
24321
  "bottom-end": "bottom-start"
23448
24322
  };
23449
24323
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
23450
- const triggerElement = React78__default.isValidElement(trigger) ? React78__default.cloneElement(trigger, {
24324
+ const triggerElement = React79__default.isValidElement(trigger) ? React79__default.cloneElement(trigger, {
23451
24325
  ref: triggerRef,
23452
24326
  onClick: handleToggle
23453
24327
  }) : /* @__PURE__ */ jsx(
@@ -23550,14 +24424,14 @@ function useDataDnd(args) {
23550
24424
  const isZone = Boolean(dragGroup || accepts || sortable);
23551
24425
  const enabled = isZone || Boolean(dndRoot);
23552
24426
  const eventBus = useEventBus();
23553
- const parentRoot = React78__default.useContext(RootCtx);
24427
+ const parentRoot = React79__default.useContext(RootCtx);
23554
24428
  const isRoot = enabled && parentRoot === null;
23555
- const zoneId = React78__default.useId();
24429
+ const zoneId = React79__default.useId();
23556
24430
  const ownGroup = dragGroup ?? accepts ?? zoneId;
23557
- const [optimisticOrders, setOptimisticOrders] = React78__default.useState(() => /* @__PURE__ */ new Map());
23558
- const optimisticOrdersRef = React78__default.useRef(optimisticOrders);
24431
+ const [optimisticOrders, setOptimisticOrders] = React79__default.useState(() => /* @__PURE__ */ new Map());
24432
+ const optimisticOrdersRef = React79__default.useRef(optimisticOrders);
23559
24433
  optimisticOrdersRef.current = optimisticOrders;
23560
- const clearOptimisticOrder = React78__default.useCallback((group) => {
24434
+ const clearOptimisticOrder = React79__default.useCallback((group) => {
23561
24435
  setOptimisticOrders((prev) => {
23562
24436
  if (!prev.has(group)) return prev;
23563
24437
  const next = new Map(prev);
@@ -23582,7 +24456,7 @@ function useDataDnd(args) {
23582
24456
  const raw = it[dndItemIdField];
23583
24457
  return raw != null ? String(raw) : `__idx_${idx}`;
23584
24458
  }).join("|");
23585
- const itemIds = React78__default.useMemo(
24459
+ const itemIds = React79__default.useMemo(
23586
24460
  () => orderedItems.map((it, idx) => {
23587
24461
  const raw = it[dndItemIdField];
23588
24462
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -23593,7 +24467,7 @@ function useDataDnd(args) {
23593
24467
  const raw = it[dndItemIdField];
23594
24468
  return raw != null ? String(raw) : `__${idx}`;
23595
24469
  }).join("|");
23596
- React78__default.useEffect(() => {
24470
+ React79__default.useEffect(() => {
23597
24471
  const root = isRoot ? null : parentRoot;
23598
24472
  if (root) {
23599
24473
  root.clearOptimisticOrder(ownGroup);
@@ -23601,20 +24475,20 @@ function useDataDnd(args) {
23601
24475
  clearOptimisticOrder(ownGroup);
23602
24476
  }
23603
24477
  }, [itemsContentSig, ownGroup]);
23604
- const zonesRef = React78__default.useRef(/* @__PURE__ */ new Map());
23605
- const registerZone = React78__default.useCallback((zoneId2, meta2) => {
24478
+ const zonesRef = React79__default.useRef(/* @__PURE__ */ new Map());
24479
+ const registerZone = React79__default.useCallback((zoneId2, meta2) => {
23606
24480
  zonesRef.current.set(zoneId2, meta2);
23607
24481
  }, []);
23608
- const unregisterZone = React78__default.useCallback((zoneId2) => {
24482
+ const unregisterZone = React79__default.useCallback((zoneId2) => {
23609
24483
  zonesRef.current.delete(zoneId2);
23610
24484
  }, []);
23611
- const [activeDrag, setActiveDrag] = React78__default.useState(null);
23612
- const [overZoneGroup, setOverZoneGroup] = React78__default.useState(null);
23613
- const meta = React78__default.useMemo(
24485
+ const [activeDrag, setActiveDrag] = React79__default.useState(null);
24486
+ const [overZoneGroup, setOverZoneGroup] = React79__default.useState(null);
24487
+ const meta = React79__default.useMemo(
23614
24488
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
23615
24489
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
23616
24490
  );
23617
- React78__default.useEffect(() => {
24491
+ React79__default.useEffect(() => {
23618
24492
  const target = isRoot ? null : parentRoot;
23619
24493
  if (!target) {
23620
24494
  zonesRef.current.set(zoneId, meta);
@@ -23633,7 +24507,7 @@ function useDataDnd(args) {
23633
24507
  }, [parentRoot, isRoot, zoneId, meta]);
23634
24508
  const sensors = useAlmadarDndSensors(true);
23635
24509
  const collisionDetection = almadarDndCollisionDetection;
23636
- const findZoneByItem = React78__default.useCallback(
24510
+ const findZoneByItem = React79__default.useCallback(
23637
24511
  (id) => {
23638
24512
  for (const z of zonesRef.current.values()) {
23639
24513
  if (z.itemIds.includes(id)) return z;
@@ -23642,7 +24516,7 @@ function useDataDnd(args) {
23642
24516
  },
23643
24517
  []
23644
24518
  );
23645
- React78__default.useCallback(
24519
+ React79__default.useCallback(
23646
24520
  (group) => {
23647
24521
  for (const z of zonesRef.current.values()) {
23648
24522
  if (z.group === group) return z;
@@ -23651,7 +24525,7 @@ function useDataDnd(args) {
23651
24525
  },
23652
24526
  []
23653
24527
  );
23654
- const handleDragEnd = React78__default.useCallback(
24528
+ const handleDragEnd = React79__default.useCallback(
23655
24529
  (event) => {
23656
24530
  const { active, over } = event;
23657
24531
  const activeIdStr = String(active.id);
@@ -23742,8 +24616,8 @@ function useDataDnd(args) {
23742
24616
  },
23743
24617
  [eventBus]
23744
24618
  );
23745
- const sortableData = React78__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
23746
- const SortableItem = React78__default.useCallback(
24619
+ const sortableData = React79__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
24620
+ const SortableItem = React79__default.useCallback(
23747
24621
  ({ id, children }) => {
23748
24622
  const {
23749
24623
  attributes,
@@ -23783,7 +24657,7 @@ function useDataDnd(args) {
23783
24657
  id: droppableId,
23784
24658
  data: sortableData
23785
24659
  });
23786
- const ctx = React78__default.useContext(RootCtx);
24660
+ const ctx = React79__default.useContext(RootCtx);
23787
24661
  const activeDrag2 = ctx?.activeDrag ?? null;
23788
24662
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
23789
24663
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -23798,7 +24672,7 @@ function useDataDnd(args) {
23798
24672
  showForeignPlaceholder,
23799
24673
  ctxAvailable: ctx != null
23800
24674
  });
23801
- React78__default.useEffect(() => {
24675
+ React79__default.useEffect(() => {
23802
24676
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
23803
24677
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
23804
24678
  return /* @__PURE__ */ jsx(
@@ -23812,11 +24686,11 @@ function useDataDnd(args) {
23812
24686
  }
23813
24687
  );
23814
24688
  };
23815
- const rootContextValue = React78__default.useMemo(
24689
+ const rootContextValue = React79__default.useMemo(
23816
24690
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
23817
24691
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
23818
24692
  );
23819
- const handleDragStart = React78__default.useCallback((event) => {
24693
+ const handleDragStart = React79__default.useCallback((event) => {
23820
24694
  const sourceZone = findZoneByItem(event.active.id);
23821
24695
  const rect = event.active.rect.current.initial;
23822
24696
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -23835,7 +24709,7 @@ function useDataDnd(args) {
23835
24709
  isRoot
23836
24710
  });
23837
24711
  }, [findZoneByItem, isRoot, zoneId]);
23838
- const handleDragOver = React78__default.useCallback((event) => {
24712
+ const handleDragOver = React79__default.useCallback((event) => {
23839
24713
  const { active, over } = event;
23840
24714
  const overData = over?.data?.current;
23841
24715
  const overGroup = overData?.dndGroup ?? null;
@@ -23905,7 +24779,7 @@ function useDataDnd(args) {
23905
24779
  return next;
23906
24780
  });
23907
24781
  }, []);
23908
- const handleDragCancel = React78__default.useCallback((event) => {
24782
+ const handleDragCancel = React79__default.useCallback((event) => {
23909
24783
  setActiveDrag(null);
23910
24784
  setOverZoneGroup(null);
23911
24785
  dndLog.warn("dragCancel", {
@@ -23913,12 +24787,12 @@ function useDataDnd(args) {
23913
24787
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
23914
24788
  });
23915
24789
  }, []);
23916
- const handleDragEndWithCleanup = React78__default.useCallback((event) => {
24790
+ const handleDragEndWithCleanup = React79__default.useCallback((event) => {
23917
24791
  handleDragEnd(event);
23918
24792
  setActiveDrag(null);
23919
24793
  setOverZoneGroup(null);
23920
24794
  }, [handleDragEnd]);
23921
- const wrapContainer = React78__default.useCallback(
24795
+ const wrapContainer = React79__default.useCallback(
23922
24796
  (children) => {
23923
24797
  if (!enabled) return children;
23924
24798
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -23972,7 +24846,7 @@ var init_useDataDnd = __esm({
23972
24846
  init_useAlmadarDndCollision();
23973
24847
  init_Box();
23974
24848
  dndLog = createLogger("almadar:ui:dnd");
23975
- RootCtx = React78__default.createContext(null);
24849
+ RootCtx = React79__default.createContext(null);
23976
24850
  }
23977
24851
  });
23978
24852
  function renderIconInput(icon, props) {
@@ -24487,7 +25361,7 @@ function DataList({
24487
25361
  }) {
24488
25362
  const eventBus = useEventBus();
24489
25363
  const { t } = useTranslate();
24490
- const [visibleCount, setVisibleCount] = React78__default.useState(pageSize || Infinity);
25364
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize || Infinity);
24491
25365
  const fieldDefs = fields ?? columns ?? [];
24492
25366
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
24493
25367
  const dnd = useDataDnd({
@@ -24503,14 +25377,14 @@ function DataList({
24503
25377
  dndRoot
24504
25378
  });
24505
25379
  const orderedData = dnd.orderedItems;
24506
- const allData = React78__default.useMemo(
25380
+ const allData = React79__default.useMemo(
24507
25381
  () => sortRows(orderedData, sortBy, sortDirection),
24508
25382
  [orderedData, sortBy, sortDirection]
24509
25383
  );
24510
25384
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
24511
25385
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
24512
25386
  const hasRenderProp = typeof children === "function";
24513
- React78__default.useEffect(() => {
25387
+ React79__default.useEffect(() => {
24514
25388
  const renderItemTypeOf = typeof schemaRenderItem;
24515
25389
  const childrenTypeOf = typeof children;
24516
25390
  if (data.length > 0 && !hasRenderProp) {
@@ -24630,7 +25504,7 @@ function DataList({
24630
25504
  return v === void 0 || v === null || v === "" ? raw : String(v);
24631
25505
  };
24632
25506
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
24633
- groups2.map((group, gi) => /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
25507
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
24634
25508
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
24635
25509
  group.items.map((itemData, index) => {
24636
25510
  const id = itemData.id || `${gi}-${index}`;
@@ -24846,7 +25720,7 @@ function DataList({
24846
25720
  className
24847
25721
  ),
24848
25722
  children: [
24849
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
25723
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
24850
25724
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
24851
25725
  group.items.map(
24852
25726
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -24955,8 +25829,8 @@ function ScalarControl({
24955
25829
  }
24956
25830
  const numeric = typeof value === "number";
24957
25831
  const initial = value === null ? "" : String(value);
24958
- const [draft, setDraft] = React78__default.useState(initial);
24959
- React78__default.useEffect(() => setDraft(initial), [initial]);
25832
+ const [draft, setDraft] = React79__default.useState(initial);
25833
+ React79__default.useEffect(() => setDraft(initial), [initial]);
24960
25834
  const commit = () => {
24961
25835
  if (numeric) {
24962
25836
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -25024,8 +25898,8 @@ function Row({
25024
25898
  onRemove,
25025
25899
  readonly
25026
25900
  }) {
25027
- const [keyDraft, setKeyDraft] = React78__default.useState(rowKey);
25028
- React78__default.useEffect(() => setKeyDraft(rowKey), [rowKey]);
25901
+ const [keyDraft, setKeyDraft] = React79__default.useState(rowKey);
25902
+ React79__default.useEffect(() => setKeyDraft(rowKey), [rowKey]);
25029
25903
  const container = isObj(value) || isArr(value);
25030
25904
  return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "group w-max min-w-full", children: [
25031
25905
  /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className: "py-0.5 w-max", children: [
@@ -25068,7 +25942,7 @@ function ContainerNode({
25068
25942
  depth,
25069
25943
  readonly
25070
25944
  }) {
25071
- const [open, setOpen] = React78__default.useState(depth < 2);
25945
+ const [open, setOpen] = React79__default.useState(depth < 2);
25072
25946
  const array = isArr(value);
25073
25947
  const entries = array ? value.map((v, i) => [String(i), v]) : Object.entries(value);
25074
25948
  const setObjValue = (key, next) => {
@@ -25210,7 +26084,7 @@ var init_FormSection = __esm({
25210
26084
  columns = 1,
25211
26085
  className
25212
26086
  }) => {
25213
- const [collapsed, setCollapsed] = React78__default.useState(defaultCollapsed);
26087
+ const [collapsed, setCollapsed] = React79__default.useState(defaultCollapsed);
25214
26088
  const { t } = useTranslate();
25215
26089
  const eventBus = useEventBus();
25216
26090
  const gridClass = {
@@ -25218,7 +26092,7 @@ var init_FormSection = __esm({
25218
26092
  2: "grid-cols-1 md:grid-cols-2",
25219
26093
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
25220
26094
  }[columns];
25221
- React78__default.useCallback(() => {
26095
+ React79__default.useCallback(() => {
25222
26096
  if (collapsible) {
25223
26097
  setCollapsed((prev) => !prev);
25224
26098
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -25627,8 +26501,8 @@ function TextLikeControl({
25627
26501
  onCommit
25628
26502
  }) {
25629
26503
  const initial = value === void 0 || value === null ? "" : String(value);
25630
- const [draft, setDraft] = React78__default.useState(initial);
25631
- React78__default.useEffect(() => setDraft(initial), [initial]);
26504
+ const [draft, setDraft] = React79__default.useState(initial);
26505
+ React79__default.useEffect(() => setDraft(initial), [initial]);
25632
26506
  const commit = () => {
25633
26507
  if (numeric) {
25634
26508
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -25817,14 +26691,14 @@ var init_NodeSlotEditor = __esm({
25817
26691
  isObj2 = (v) => v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
25818
26692
  NodeSlotEditor = ({ value, onChange, className }) => {
25819
26693
  const { type, props, wasArray } = normalize(value);
25820
- const patterns = React78__default.useMemo(() => {
26694
+ const patterns = React79__default.useMemo(() => {
25821
26695
  try {
25822
26696
  return [...getKnownPatterns()].sort();
25823
26697
  } catch {
25824
26698
  return [];
25825
26699
  }
25826
26700
  }, []);
25827
- const options = React78__default.useMemo(
26701
+ const options = React79__default.useMemo(
25828
26702
  () => [{ value: "", label: "\u2014 none \u2014" }, ...patterns.map((p) => ({ value: p, label: p }))],
25829
26703
  [patterns]
25830
26704
  );
@@ -25836,7 +26710,7 @@ var init_NodeSlotEditor = __esm({
25836
26710
  const pattern = { type: nextType, ...nextProps };
25837
26711
  onChange(wasArray || value === void 0 ? [pattern] : pattern);
25838
26712
  };
25839
- const schemaEntries = React78__default.useMemo(() => {
26713
+ const schemaEntries = React79__default.useMemo(() => {
25840
26714
  if (!type) return [];
25841
26715
  const def = getPatternDefinition(type);
25842
26716
  if (!def?.propsSchema) return [];
@@ -26264,10 +27138,10 @@ var init_FileTree = __esm({
26264
27138
  indent = 16
26265
27139
  }) => {
26266
27140
  const [overrides, setOverrides] = useState(() => /* @__PURE__ */ new Map());
26267
- const byId = React78__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
26268
- const selectedAncestors = React78__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
26269
- const lastSelectedRef = React78__default.useRef(selectedId);
26270
- React78__default.useEffect(() => {
27141
+ const byId = React79__default.useMemo(() => new Map(items.map((node) => [node.id, node])), [items]);
27142
+ const selectedAncestors = React79__default.useMemo(() => ancestorsOf(selectedId, byId), [selectedId, byId]);
27143
+ const lastSelectedRef = React79__default.useRef(selectedId);
27144
+ React79__default.useEffect(() => {
26271
27145
  if (selectedId === lastSelectedRef.current) return;
26272
27146
  lastSelectedRef.current = selectedId;
26273
27147
  setOverrides((prev) => {
@@ -26395,183 +27269,6 @@ var init_FormField = __esm({
26395
27269
  FormField.displayName = "FormField";
26396
27270
  }
26397
27271
  });
26398
- function matchesQuery(query, text) {
26399
- if (!query) return true;
26400
- let qi = 0;
26401
- const q = query.toLowerCase();
26402
- const t = text.toLowerCase();
26403
- for (let ti = 0; ti < t.length && qi < q.length; ti++) {
26404
- if (t[ti] === q[qi]) qi++;
26405
- }
26406
- return qi === q.length;
26407
- }
26408
- function commandMatches(command, query) {
26409
- if (!query) return true;
26410
- if (matchesQuery(query, command.label)) return true;
26411
- return (command.keywords ?? []).some((keyword) => matchesQuery(query, keyword));
26412
- }
26413
- var UNGROUPED, CommandPalette;
26414
- var init_CommandPalette = __esm({
26415
- "components/core/molecules/CommandPalette.tsx"() {
26416
- "use client";
26417
- init_Box();
26418
- init_Stack();
26419
- init_Typography();
26420
- init_Icon();
26421
- init_Input();
26422
- init_Badge();
26423
- init_cn();
26424
- init_useEventBus();
26425
- init_Modal();
26426
- UNGROUPED = /* @__PURE__ */ Symbol("command-palette-ungrouped");
26427
- CommandPalette = ({
26428
- open,
26429
- onOpenChange,
26430
- commands,
26431
- onSelect,
26432
- placeholder = "Type a command...",
26433
- emptyLabel = "No matching commands",
26434
- className
26435
- }) => {
26436
- const eventBus = useEventBus();
26437
- const [query, setQuery] = useState("");
26438
- const [highlightIndex, setHighlightIndex] = useState(0);
26439
- const filtered = useMemo(
26440
- () => commands.filter((command) => commandMatches(command, query)),
26441
- [commands, query]
26442
- );
26443
- const groups = useMemo(() => {
26444
- const order = [];
26445
- const byGroup = /* @__PURE__ */ new Map();
26446
- for (const command of filtered) {
26447
- const key = command.group ?? UNGROUPED;
26448
- if (!byGroup.has(key)) {
26449
- byGroup.set(key, []);
26450
- order.push(key);
26451
- }
26452
- byGroup.get(key).push(command);
26453
- }
26454
- return order.map((key) => ({ group: key === UNGROUPED ? void 0 : key, items: byGroup.get(key) }));
26455
- }, [filtered]);
26456
- const resetQuery = useCallback(() => {
26457
- setQuery("");
26458
- setHighlightIndex(0);
26459
- }, []);
26460
- const handleClose = useCallback(() => {
26461
- resetQuery();
26462
- onOpenChange(false);
26463
- }, [onOpenChange, resetQuery]);
26464
- const handleSelect = useCallback(
26465
- (command) => {
26466
- if (command.disabled) return;
26467
- if (command.event) eventBus.emit(`UI:${command.event}`, { commandId: command.id });
26468
- if (command.action) eventBus.emit(`UI:${command.action}`, command.actionPayload ?? {});
26469
- onSelect?.(command);
26470
- handleClose();
26471
- },
26472
- [eventBus, onSelect, handleClose]
26473
- );
26474
- const handleQueryChange = useCallback((e) => {
26475
- setQuery(e.target.value);
26476
- setHighlightIndex(0);
26477
- }, []);
26478
- const handleKeyDown = useCallback(
26479
- (e) => {
26480
- if (filtered.length === 0) return;
26481
- if (e.key === "ArrowDown") {
26482
- e.preventDefault();
26483
- setHighlightIndex((prev) => prev < filtered.length - 1 ? prev + 1 : 0);
26484
- } else if (e.key === "ArrowUp") {
26485
- e.preventDefault();
26486
- setHighlightIndex((prev) => prev > 0 ? prev - 1 : filtered.length - 1);
26487
- } else if (e.key === "Enter") {
26488
- e.preventDefault();
26489
- const command = filtered[highlightIndex];
26490
- if (command) handleSelect(command);
26491
- }
26492
- },
26493
- [filtered, highlightIndex, handleSelect]
26494
- );
26495
- return /* @__PURE__ */ jsx(
26496
- Modal,
26497
- {
26498
- isOpen: open,
26499
- onClose: handleClose,
26500
- onExited: resetQuery,
26501
- showCloseButton: false,
26502
- size: "md",
26503
- className,
26504
- children: /* @__PURE__ */ jsx(Box, { "data-testid": "command-palette", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
26505
- /* @__PURE__ */ jsx(
26506
- Input,
26507
- {
26508
- inputType: "search",
26509
- placeholder,
26510
- value: query,
26511
- onChange: handleQueryChange,
26512
- onKeyDown: handleKeyDown,
26513
- leftIcon: "search",
26514
- clearable: query.length > 0,
26515
- onClear: resetQuery,
26516
- autoFocus: true,
26517
- "data-testid": "command-palette-input"
26518
- }
26519
- ),
26520
- filtered.length === 0 ? /* @__PURE__ */ jsx(Box, { className: "px-2 py-6 text-center", "data-testid": "command-palette-empty", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: emptyLabel }) }) : /* @__PURE__ */ jsx(
26521
- Box,
26522
- {
26523
- className: "max-h-80 overflow-y-auto",
26524
- role: "listbox",
26525
- "aria-label": placeholder,
26526
- children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: groups.map(({ group, items }) => /* @__PURE__ */ jsxs(Box, { children: [
26527
- group ? /* @__PURE__ */ jsx(
26528
- Typography,
26529
- {
26530
- variant: "caption",
26531
- color: "muted",
26532
- className: "px-3 pt-2 pb-1 block",
26533
- children: group
26534
- }
26535
- ) : null,
26536
- items.map((command) => {
26537
- const index = filtered.indexOf(command);
26538
- const isHighlighted = index === highlightIndex;
26539
- return /* @__PURE__ */ jsxs(
26540
- Box,
26541
- {
26542
- as: "button",
26543
- role: "option",
26544
- "aria-selected": isHighlighted,
26545
- "aria-disabled": command.disabled || void 0,
26546
- "data-testid": `command-palette-item-${command.id}`,
26547
- onMouseEnter: () => !command.disabled && setHighlightIndex(index),
26548
- onClick: () => handleSelect(command),
26549
- className: cn(
26550
- "w-full flex items-center gap-3 px-3 py-2 text-start rounded-sm",
26551
- "text-sm transition-colors",
26552
- "focus:outline-none",
26553
- isHighlighted && "bg-muted",
26554
- command.disabled && "opacity-50 cursor-not-allowed"
26555
- ),
26556
- children: [
26557
- command.icon ? /* @__PURE__ */ jsx(Icon, { icon: command.icon, size: "sm", className: "flex-shrink-0" }) : null,
26558
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "flex-1 truncate", children: command.label }),
26559
- command.shortcut ? /* @__PURE__ */ jsx(Badge, { variant: "neutral", size: "sm", children: command.shortcut }) : null
26560
- ]
26561
- },
26562
- command.id
26563
- );
26564
- })
26565
- ] }, String(group ?? "__ungrouped__"))) })
26566
- }
26567
- )
26568
- ] }) })
26569
- }
26570
- );
26571
- };
26572
- CommandPalette.displayName = "CommandPalette";
26573
- }
26574
- });
26575
27272
  function getOrCreateStore(query) {
26576
27273
  if (!queryStores.has(query)) {
26577
27274
  queryStores.set(query, {
@@ -27286,7 +27983,7 @@ var init_Flex = __esm({
27286
27983
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
27287
27984
  }
27288
27985
  }
27289
- return React78__default.createElement(Component, {
27986
+ return React79__default.createElement(Component, {
27290
27987
  className: cn(
27291
27988
  inline ? "inline-flex" : "flex",
27292
27989
  directionStyles[direction],
@@ -27405,7 +28102,7 @@ var init_Grid = __esm({
27405
28102
  as: Component = "div"
27406
28103
  }) => {
27407
28104
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
27408
- return React78__default.createElement(
28105
+ return React79__default.createElement(
27409
28106
  Component,
27410
28107
  {
27411
28108
  className: cn(
@@ -27827,9 +28524,9 @@ var init_Popover = __esm({
27827
28524
  onMouseLeave: handleClose,
27828
28525
  onPointerDown: tapTriggerProps.onPointerDown
27829
28526
  };
27830
- const childElement = React78__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
28527
+ const childElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
27831
28528
  const childPointerDown = childElement.props.onPointerDown;
27832
- const triggerElement = React78__default.cloneElement(
28529
+ const triggerElement = React79__default.cloneElement(
27833
28530
  childElement,
27834
28531
  {
27835
28532
  ref: triggerRef,
@@ -28143,9 +28840,9 @@ function debug(...args) {
28143
28840
  const [first, ...rest] = args;
28144
28841
  const message = typeof first === "string" ? first : "<debug>";
28145
28842
  if (rest.length === 0 && typeof first === "string") {
28146
- log7.debug(message);
28843
+ log8.debug(message);
28147
28844
  } else {
28148
- log7.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
28845
+ log8.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
28149
28846
  }
28150
28847
  }
28151
28848
  function debugGroup(label) {
@@ -28173,11 +28870,11 @@ function toLogMetaValue(v) {
28173
28870
  }
28174
28871
  return String(v);
28175
28872
  }
28176
- var NAMESPACE, log7;
28873
+ var NAMESPACE, log8;
28177
28874
  var init_debug = __esm({
28178
28875
  "lib/debug.ts"() {
28179
28876
  NAMESPACE = "almadar:ui:debug";
28180
- log7 = createLogger(NAMESPACE);
28877
+ log8 = createLogger(NAMESPACE);
28181
28878
  createLogger("almadar:ui:debug:input");
28182
28879
  createLogger("almadar:ui:debug:collision");
28183
28880
  createLogger("almadar:ui:debug:physics");
@@ -28693,9 +29390,9 @@ var init_Tooltip = __esm({
28693
29390
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
28694
29391
  };
28695
29392
  }, []);
28696
- const triggerElement = React78__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29393
+ const triggerElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
28697
29394
  const childPointerDown = triggerElement.props.onPointerDown;
28698
- const trigger = React78__default.cloneElement(triggerElement, {
29395
+ const trigger = React79__default.cloneElement(triggerElement, {
28699
29396
  ref: triggerRef,
28700
29397
  onMouseEnter: handleMouseEnter,
28701
29398
  onMouseLeave: handleMouseLeave,
@@ -28785,7 +29482,7 @@ var init_WizardProgress = __esm({
28785
29482
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
28786
29483
  const isActive = index === currentStep;
28787
29484
  const isCompleted = index < currentStep;
28788
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
29485
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
28789
29486
  /* @__PURE__ */ jsx(
28790
29487
  "button",
28791
29488
  {
@@ -30469,7 +31166,7 @@ function GameMenu({
30469
31166
  }) {
30470
31167
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
30471
31168
  const eventBus = useEventBus();
30472
- const handleOptionClick = React78.useCallback(
31169
+ const handleOptionClick = React79.useCallback(
30473
31170
  (option) => {
30474
31171
  if (option.event) {
30475
31172
  eventBus.emit(`UI:${option.event}`, { option });
@@ -30705,7 +31402,7 @@ function StateGraph({
30705
31402
  }) {
30706
31403
  const eventBus = useEventBus();
30707
31404
  const nodes = states ?? [];
30708
- const positions = React78.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
31405
+ const positions = React79.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
30709
31406
  return /* @__PURE__ */ jsxs(
30710
31407
  Box,
30711
31408
  {
@@ -30863,15 +31560,19 @@ function GameAudioToggle({
30863
31560
  size = "sm",
30864
31561
  className,
30865
31562
  onAsset,
30866
- offAsset
31563
+ offAsset,
31564
+ toggleEvent
30867
31565
  }) {
30868
31566
  const ctx = useGameAudioContextOptional();
30869
31567
  const [localMuted, setLocalMuted] = useState(false);
30870
31568
  const muted = ctx ? ctx.muted : localMuted;
30871
31569
  const setMuted = ctx ? ctx.setMuted : setLocalMuted;
31570
+ const eventBus = useEventBus();
30872
31571
  const handleToggle = useCallback(() => {
30873
- setMuted(!muted);
30874
- }, [muted, setMuted]);
31572
+ const next = !muted;
31573
+ setMuted(next);
31574
+ if (toggleEvent) eventBus.emit(`UI:${toggleEvent}`, { muted: next });
31575
+ }, [muted, setMuted, toggleEvent, eventBus]);
30875
31576
  const activeAsset = muted ? offAsset : onAsset;
30876
31577
  return /* @__PURE__ */ jsx(
30877
31578
  Button,
@@ -30890,6 +31591,7 @@ var init_GameAudioToggle = __esm({
30890
31591
  "use client";
30891
31592
  init_atoms();
30892
31593
  init_cn();
31594
+ init_useEventBus();
30893
31595
  init_GameIcon();
30894
31596
  GameAudioToggle.displayName = "GameAudioToggle";
30895
31597
  }
@@ -31161,6 +31863,47 @@ var init_useGameAudio = __esm({
31161
31863
  useGameAudio.displayName = "useGameAudio";
31162
31864
  }
31163
31865
  });
31866
+ function GameAudioCue({
31867
+ cue,
31868
+ cueSeq,
31869
+ music,
31870
+ muted,
31871
+ volume,
31872
+ manifest,
31873
+ baseUrl
31874
+ }) {
31875
+ const { play, playMusic, stopMusic, setMuted, setMasterVolume } = useGameAudio({
31876
+ manifest,
31877
+ baseUrl,
31878
+ initialMuted: muted,
31879
+ initialVolume: volume
31880
+ });
31881
+ const prevCueSeqRef = useRef(cueSeq);
31882
+ useEffect(() => {
31883
+ if (cue && cueSeq !== void 0 && cueSeq !== prevCueSeqRef.current) {
31884
+ play(cue);
31885
+ }
31886
+ prevCueSeqRef.current = cueSeq;
31887
+ }, [cue, cueSeq, play]);
31888
+ useEffect(() => {
31889
+ if (music) playMusic(music);
31890
+ else stopMusic();
31891
+ }, [music, playMusic, stopMusic]);
31892
+ useEffect(() => {
31893
+ if (muted !== void 0) setMuted(muted);
31894
+ }, [muted, setMuted]);
31895
+ useEffect(() => {
31896
+ if (volume !== void 0) setMasterVolume(volume);
31897
+ }, [volume, setMasterVolume]);
31898
+ return null;
31899
+ }
31900
+ var init_GameAudioCue = __esm({
31901
+ "components/game/atoms/GameAudioCue.tsx"() {
31902
+ "use client";
31903
+ init_useGameAudio();
31904
+ GameAudioCue.displayName = "GameAudioCue";
31905
+ }
31906
+ });
31164
31907
  function isKnownState(s) {
31165
31908
  return s in DEFAULT_STATE_STYLES;
31166
31909
  }
@@ -31242,7 +31985,7 @@ function LinearView({
31242
31985
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
31243
31986
  const isDone = i < currentIdx;
31244
31987
  const isCurrent = i === currentIdx;
31245
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
31988
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
31246
31989
  i > 0 && /* @__PURE__ */ jsx(
31247
31990
  Typography,
31248
31991
  {
@@ -31875,7 +32618,7 @@ function SequenceBar({
31875
32618
  else onSlotRemove?.(index);
31876
32619
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
31877
32620
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
31878
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
32621
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
31879
32622
  i > 0 && /* @__PURE__ */ jsx(
31880
32623
  Typography,
31881
32624
  {
@@ -32057,15 +32800,18 @@ var init_physicsPresets = __esm({
32057
32800
  ];
32058
32801
  }
32059
32802
  });
32060
- var GAME_FONTS, GameShell;
32061
- var init_GameShell = __esm({
32062
- "components/game/templates/GameShell.tsx"() {
32063
- init_cn();
32064
- init_Box();
32065
- init_Card();
32066
- init_Typography();
32067
- init_AtlasImage();
32068
- GAME_FONTS = {
32803
+
32804
+ // lib/gameFonts.ts
32805
+ function resolveGameFontFamily(input) {
32806
+ if (!input) return void 0;
32807
+ const resolved = GAME_FONT_KEYS[input];
32808
+ if (resolved) return `'${resolved}', ui-sans-serif, system-ui, sans-serif`;
32809
+ return input;
32810
+ }
32811
+ var GAME_FONT_KEYS;
32812
+ var init_gameFonts = __esm({
32813
+ "lib/gameFonts.ts"() {
32814
+ GAME_FONT_KEYS = {
32069
32815
  fredoka: "Fredoka",
32070
32816
  future: "Kenney Future",
32071
32817
  "future-narrow": "Kenney Future Narrow",
@@ -32073,6 +32819,17 @@ var init_GameShell = __esm({
32073
32819
  blocks: "Kenney Blocks",
32074
32820
  mini: "Kenney Mini"
32075
32821
  };
32822
+ }
32823
+ });
32824
+ var GameShell;
32825
+ var init_GameShell = __esm({
32826
+ "components/game/templates/GameShell.tsx"() {
32827
+ init_cn();
32828
+ init_gameFonts();
32829
+ init_Box();
32830
+ init_Card();
32831
+ init_Typography();
32832
+ init_AtlasImage();
32076
32833
  GameShell = ({
32077
32834
  appName = "Game",
32078
32835
  hud,
@@ -32086,7 +32843,7 @@ var init_GameShell = __esm({
32086
32843
  fontFamily,
32087
32844
  "data-theme": dataTheme
32088
32845
  }) => {
32089
- const font = fontFamily ? GAME_FONTS[fontFamily] ?? fontFamily : void 0;
32846
+ const displayFont = resolveGameFontFamily(fontFamily);
32090
32847
  return /* @__PURE__ */ jsxs(
32091
32848
  Box,
32092
32849
  {
@@ -32105,7 +32862,7 @@ var init_GameShell = __esm({
32105
32862
  // passed — an always-on inline stamp would shadow the orbital's
32106
32863
  // inline-theme font-family-display token (inline style beats the
32107
32864
  // theme provider's vars for the whole shell subtree).
32108
- ...font ? { "--font-family-display": `'${font}', ui-sans-serif, system-ui, sans-serif` } : {}
32865
+ ...displayFont ? { "--font-family-display": displayFont } : {}
32109
32866
  },
32110
32867
  children: [
32111
32868
  backgroundAsset && /* @__PURE__ */ jsx(
@@ -32238,6 +32995,7 @@ var init_molecules = __esm({
32238
32995
  init_Canvas();
32239
32996
  init_useUnitSpriteAtlas();
32240
32997
  init_GameAudioToggle();
32998
+ init_GameAudioCue();
32241
32999
  init_useGameAudio();
32242
33000
  init_useCamera();
32243
33001
  init_TraitStateViewer();
@@ -32266,6 +33024,7 @@ var init_MathCanvas = __esm({
32266
33024
  init_perf();
32267
33025
  init_atoms();
32268
33026
  init_Stack();
33027
+ init_gameFonts();
32269
33028
  init_LearningCanvas();
32270
33029
  MathCanvas = ({
32271
33030
  className,
@@ -32285,6 +33044,7 @@ var init_MathCanvas = __esm({
32285
33044
  showTickLabels = false,
32286
33045
  tickLabelFontSize = 10,
32287
33046
  labelFontSize = 12,
33047
+ fontFamily: fontFamilyProp,
32288
33048
  showCurveLabels = false,
32289
33049
  curves = [],
32290
33050
  points = [],
@@ -32307,6 +33067,7 @@ var init_MathCanvas = __esm({
32307
33067
  error
32308
33068
  }) => {
32309
33069
  const eventBus = useEventBus();
33070
+ const fontFamily = resolveGameFontFamily(fontFamilyProp);
32310
33071
  const keyMapKey = keyMap ? JSON.stringify(keyMap) : null;
32311
33072
  const keyUpMapKey = keyUpMap ? JSON.stringify(keyUpMap) : null;
32312
33073
  const stableKeyMap = useMemo(() => keyMap, [keyMapKey]);
@@ -32356,18 +33117,18 @@ var init_MathCanvas = __esm({
32356
33117
  let kx = 0;
32357
33118
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep, kx++) {
32358
33119
  if (kx % labelEveryX === 0 && x !== 0) {
32359
- out.push({ type: "text", x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: tickLabelFontSize, align: "center" });
33120
+ out.push({ type: "text", fontFamily, x: mapX(x), y: xAxisY + 12, text: formatTick(x), color: "#6b7280", fontSize: tickLabelFontSize, align: "center" });
32360
33121
  }
32361
33122
  }
32362
33123
  const labelEveryY = Math.max(1, Math.ceil((yMax - yMin) / gridStep / Math.floor(plotH / 28)));
32363
33124
  let ky = 0;
32364
33125
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep, ky++) {
32365
33126
  if (ky % labelEveryY === 0 && y !== 0) {
32366
- out.push({ type: "text", x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
33127
+ out.push({ type: "text", fontFamily, x: yAxisX - 6, y: mapY(y), text: formatTick(y), color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
32367
33128
  }
32368
33129
  }
32369
33130
  if (xMin <= 0 && xMax >= 0 && yMin <= 0 && yMax >= 0) {
32370
- out.push({ type: "text", x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
33131
+ out.push({ type: "text", fontFamily, x: yAxisX - 6, y: xAxisY + 12, text: "0", color: "#6b7280", fontSize: tickLabelFontSize, align: "right" });
32371
33132
  }
32372
33133
  }
32373
33134
  for (const region of regions) {
@@ -32394,6 +33155,7 @@ var init_MathCanvas = __esm({
32394
33155
  const mid = Math.floor(region.samples.length / 2);
32395
33156
  out.push({
32396
33157
  type: "text",
33158
+ fontFamily,
32397
33159
  x: mapX((first.x + last.x) / 2),
32398
33160
  y: (mapY(region.samples[mid].y) + mapY(baseline)) / 2,
32399
33161
  text: region.label,
@@ -32430,14 +33192,14 @@ var init_MathCanvas = __esm({
32430
33192
  const px = mapX(guide.at);
32431
33193
  out.push({ type: "line", x1: px, y1: margin, x2: px, y2: height - margin, color, dash });
32432
33194
  if (guide.label) {
32433
- out.push({ type: "text", x: px + 4, y: margin + 10, text: guide.label, color, fontSize: 11 });
33195
+ out.push({ type: "text", fontFamily, x: px + 4, y: margin + 10, text: guide.label, color, fontSize: 11 });
32434
33196
  }
32435
33197
  } else {
32436
33198
  if (guide.at < yMin || guide.at > yMax) continue;
32437
33199
  const py = mapY(guide.at);
32438
33200
  out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color, dash });
32439
33201
  if (guide.label) {
32440
- out.push({ type: "text", x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: labelFontSize, align: "right" });
33202
+ out.push({ type: "text", fontFamily, x: width - margin - 4, y: py - 8, text: guide.label, color, fontSize: labelFontSize, align: "right" });
32441
33203
  }
32442
33204
  }
32443
33205
  }
@@ -32476,6 +33238,7 @@ var init_MathCanvas = __esm({
32476
33238
  if (showCurveLabels && curve.label && lastInRange) {
32477
33239
  out.push({
32478
33240
  type: "text",
33241
+ fontFamily,
32479
33242
  x: mapX(lastInRange.x) + 6,
32480
33243
  y: mapY(lastInRange.y) - 6,
32481
33244
  text: curve.label,
@@ -32513,6 +33276,7 @@ var init_MathCanvas = __esm({
32513
33276
  if (hop.label) {
32514
33277
  out.push({
32515
33278
  type: "text",
33279
+ fontFamily,
32516
33280
  x: (x1 + x2) / 2,
32517
33281
  y: xAxisY - peak - 8,
32518
33282
  text: hop.label,
@@ -32540,6 +33304,7 @@ var init_MathCanvas = __esm({
32540
33304
  const rad = mid * Math.PI / 180;
32541
33305
  out.push({
32542
33306
  type: "text",
33307
+ fontFamily,
32543
33308
  x: mapX(angle.x + 1.35 * radius * Math.cos(rad)),
32544
33309
  y: mapY(angle.y + 1.35 * radius * Math.sin(rad)),
32545
33310
  text: angle.label,
@@ -32561,7 +33326,7 @@ var init_MathCanvas = __esm({
32561
33326
  fill: isOpen ? "#ffffff" : p.color ?? "#dc2626"
32562
33327
  });
32563
33328
  if (p.label) {
32564
- out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: labelFontSize });
33329
+ out.push({ type: "text", fontFamily, x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: p.color ?? "#111827", fontSize: labelFontSize });
32565
33330
  }
32566
33331
  }
32567
33332
  for (const v of vectors) {
@@ -32572,7 +33337,7 @@ var init_MathCanvas = __esm({
32572
33337
  const y2 = mapY(v.y + v.vy);
32573
33338
  out.push({ type: "arrow", x1, y1, x2, y2, color: v.color ?? "#7c3aed", lineWidth: 2 });
32574
33339
  if (v.label) {
32575
- out.push({ type: "text", x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: labelFontSize });
33340
+ out.push({ type: "text", fontFamily, x: x2 + 6, y: y2 - 6, text: v.label, color: v.color ?? "#7c3aed", fontSize: labelFontSize });
32576
33341
  }
32577
33342
  }
32578
33343
  out.push(...shapes);
@@ -32593,6 +33358,7 @@ var init_MathCanvas = __esm({
32593
33358
  showTickLabels,
32594
33359
  tickLabelFontSize,
32595
33360
  labelFontSize,
33361
+ fontFamily,
32596
33362
  showCurveLabels,
32597
33363
  curves,
32598
33364
  points,
@@ -32648,6 +33414,7 @@ var init_MathCanvas = __esm({
32648
33414
  width,
32649
33415
  height,
32650
33416
  backgroundColor,
33417
+ fontFamily,
32651
33418
  shapes: derivedShapes,
32652
33419
  drawables,
32653
33420
  projector,
@@ -33880,13 +34647,13 @@ var init_MapView = __esm({
33880
34647
  shadowSize: [41, 41]
33881
34648
  });
33882
34649
  L.Marker.prototype.options.icon = defaultIcon;
33883
- const { useEffect: useEffect70, useRef: useRef67, useCallback: useCallback109, useState: useState109 } = React78__default;
34650
+ const { useEffect: useEffect72, useRef: useRef70, useCallback: useCallback109, useState: useState110 } = React79__default;
33884
34651
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
33885
34652
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
33886
34653
  function MapUpdater({ centerLat, centerLng, zoom }) {
33887
34654
  const map = useMap();
33888
- const prevRef = useRef67({ centerLat, centerLng, zoom });
33889
- useEffect70(() => {
34655
+ const prevRef = useRef70({ centerLat, centerLng, zoom });
34656
+ useEffect72(() => {
33890
34657
  const prev = prevRef.current;
33891
34658
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
33892
34659
  map.setView([centerLat, centerLng], zoom);
@@ -33897,7 +34664,7 @@ var init_MapView = __esm({
33897
34664
  }
33898
34665
  function MapClickHandler({ onMapClick }) {
33899
34666
  const map = useMap();
33900
- useEffect70(() => {
34667
+ useEffect72(() => {
33901
34668
  if (!onMapClick) return;
33902
34669
  const handler = (e) => {
33903
34670
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -33925,7 +34692,7 @@ var init_MapView = __esm({
33925
34692
  showAttribution = true
33926
34693
  }) {
33927
34694
  const eventBus = useEventBus2();
33928
- const [clickedPosition, setClickedPosition] = useState109(null);
34695
+ const [clickedPosition, setClickedPosition] = useState110(null);
33929
34696
  const handleMapClick = useCallback109((lat, lng) => {
33930
34697
  if (showClickedPin) {
33931
34698
  setClickedPosition({ lat, lng });
@@ -34825,8 +35592,8 @@ function TableView({
34825
35592
  }) {
34826
35593
  const eventBus = useEventBus();
34827
35594
  const { t } = useTranslate();
34828
- const [visibleCount, setVisibleCount] = React78__default.useState(pageSize > 0 ? pageSize : Infinity);
34829
- const [localSelected, setLocalSelected] = React78__default.useState(/* @__PURE__ */ new Set());
35595
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize > 0 ? pageSize : Infinity);
35596
+ const [localSelected, setLocalSelected] = React79__default.useState(/* @__PURE__ */ new Set());
34830
35597
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
34831
35598
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
34832
35599
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
@@ -34847,7 +35614,7 @@ function TableView({
34847
35614
  const hasMore = pageSize > 0 && visibleCount < ordered2.length;
34848
35615
  const hasRenderProp = typeof children === "function";
34849
35616
  const idField = dndItemIdField ?? "id";
34850
- React78__default.useEffect(() => {
35617
+ React79__default.useEffect(() => {
34851
35618
  tableViewLog.debug("render", {
34852
35619
  rowCount: data.length,
34853
35620
  colCount: colDefs.length,
@@ -34897,7 +35664,7 @@ function TableView({
34897
35664
  };
34898
35665
  eventBus.emit(`UI:${rowClickEvent}`, payload);
34899
35666
  };
34900
- const colFloors = React78__default.useMemo(
35667
+ const colFloors = React79__default.useMemo(
34901
35668
  () => colDefs.map((col) => {
34902
35669
  const longest = data.reduce((widest, row) => {
34903
35670
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -35040,12 +35807,12 @@ function TableView({
35040
35807
  ]
35041
35808
  }
35042
35809
  );
35043
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React78__default.Fragment, { children: rowInner }, id);
35810
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React79__default.Fragment, { children: rowInner }, id);
35044
35811
  };
35045
35812
  const items = Array.from(data);
35046
35813
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
35047
35814
  let runningIndex = 0;
35048
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
35815
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
35049
35816
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
35050
35817
  group.items.map((row) => renderRow(row, runningIndex++))
35051
35818
  ] }, gi)) });
@@ -36414,7 +37181,7 @@ var init_StepFlow = __esm({
36414
37181
  className
36415
37182
  }) => {
36416
37183
  if (orientation === "vertical") {
36417
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React78__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
37184
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React79__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
36418
37185
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
36419
37186
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
36420
37187
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -36425,7 +37192,7 @@ var init_StepFlow = __esm({
36425
37192
  ] })
36426
37193
  ] }) }, index)) });
36427
37194
  }
36428
- 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(React78__default.Fragment, { children: [
37195
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
36429
37196
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
36430
37197
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
36431
37198
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -37415,7 +38182,7 @@ var init_LikertScale = __esm({
37415
38182
  md: "text-base",
37416
38183
  lg: "text-lg"
37417
38184
  };
37418
- LikertScale = React78__default.forwardRef(
38185
+ LikertScale = React79__default.forwardRef(
37419
38186
  ({
37420
38187
  question,
37421
38188
  options = DEFAULT_LIKERT_OPTIONS,
@@ -37427,7 +38194,7 @@ var init_LikertScale = __esm({
37427
38194
  variant = "radios",
37428
38195
  className
37429
38196
  }, ref) => {
37430
- const groupId = React78__default.useId();
38197
+ const groupId = React79__default.useId();
37431
38198
  const eventBus = useEventBus();
37432
38199
  const handleSelect = useCallback(
37433
38200
  (next) => {
@@ -39850,7 +40617,7 @@ var init_DocBreadcrumb = __esm({
39850
40617
  "aria-label": t("aria.breadcrumb"),
39851
40618
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
39852
40619
  const isLast = idx === items.length - 1;
39853
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
40620
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
39854
40621
  idx > 0 && /* @__PURE__ */ jsx(
39855
40622
  Icon,
39856
40623
  {
@@ -40719,7 +41486,7 @@ var init_MiniStateMachine = __esm({
40719
41486
  const x = 2 + i * (NODE_W + GAP2 + ARROW_W + GAP2);
40720
41487
  const tc = transitionCounts[s.name] ?? 0;
40721
41488
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
40722
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
41489
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
40723
41490
  /* @__PURE__ */ jsx(
40724
41491
  AvlState,
40725
41492
  {
@@ -40924,7 +41691,7 @@ var init_PageHeader = __esm({
40924
41691
  info: "bg-info/10 text-info"
40925
41692
  };
40926
41693
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
40927
- 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(React78__default.Fragment, { children: [
41694
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
40928
41695
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
40929
41696
  crumb.href ? /* @__PURE__ */ jsx(
40930
41697
  "a",
@@ -41282,7 +42049,7 @@ var init_Section = __esm({
41282
42049
  as: Component = "section"
41283
42050
  }) => {
41284
42051
  const hasHeader = title || description || action;
41285
- return React78__default.createElement(
42052
+ return React79__default.createElement(
41286
42053
  Component,
41287
42054
  {
41288
42055
  className: cn(
@@ -41656,7 +42423,7 @@ var init_WizardContainer = __esm({
41656
42423
  const isCompleted = index < currentStep;
41657
42424
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
41658
42425
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
41659
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
42426
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
41660
42427
  /* @__PURE__ */ jsx(
41661
42428
  Button,
41662
42429
  {
@@ -43443,7 +44210,7 @@ var init_ImportPreviewTree = __esm({
43443
44210
  const renderUnit = (unit, childrenByParent, depth) => {
43444
44211
  const summary = fieldSummary(unit);
43445
44212
  const children = childrenByParent.get(unit.ref) ?? [];
43446
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
44213
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
43447
44214
  /* @__PURE__ */ jsxs(
43448
44215
  Box,
43449
44216
  {
@@ -43540,7 +44307,7 @@ var init_ImportProgress = __esm({
43540
44307
  PIPELINE.map((key, index) => {
43541
44308
  const isComplete = index < currentIndex;
43542
44309
  const isActive = index === currentIndex;
43543
- return /* @__PURE__ */ jsxs(React78__default.Fragment, { children: [
44310
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
43544
44311
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
43545
44312
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
43546
44313
  /* @__PURE__ */ jsx(
@@ -44710,7 +45477,7 @@ var init_DetailPanel = __esm({
44710
45477
  }) => {
44711
45478
  const eventBus = useEventBus();
44712
45479
  const { t } = useTranslate();
44713
- const [titleDraft, setTitleDraft] = React78__default.useState(null);
45480
+ const [titleDraft, setTitleDraft] = React79__default.useState(null);
44714
45481
  const isFieldDefArray = (arr) => {
44715
45482
  if (!arr || arr.length === 0) return false;
44716
45483
  const first = arr[0];
@@ -45176,7 +45943,7 @@ var init_SplitPane = __esm({
45176
45943
  /* @__PURE__ */ jsx(
45177
45944
  "div",
45178
45945
  {
45179
- className: cn("overflow-auto", leftClassName),
45946
+ className: cn("flex flex-col overflow-auto", leftClassName),
45180
45947
  style: {
45181
45948
  [isHorizontal ? "width" : "height"]: `${ratio}%`,
45182
45949
  flexShrink: 0
@@ -45194,7 +45961,7 @@ var init_SplitPane = __esm({
45194
45961
  )
45195
45962
  }
45196
45963
  ),
45197
- /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-auto", rightClassName), children: right })
45964
+ /* @__PURE__ */ jsx("div", { className: cn("flex flex-col flex-1 min-h-0 min-w-0 overflow-auto", rightClassName), children: right })
45198
45965
  ]
45199
45966
  }
45200
45967
  );
@@ -45240,7 +46007,7 @@ var init_DockLayout = __esm({
45240
46007
  const showBottomPanel = Boolean(bottomPanel) && !bottomPanelCollapsed;
45241
46008
  const showSecondarySidebar = Boolean(secondarySidebar) && !secondarySidebarCollapsed;
45242
46009
  const centerRow = /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "flex-1 min-h-0 min-w-0", children: [
45243
- /* @__PURE__ */ jsx(Box, { className: cn("flex-1 min-w-0 h-full overflow-auto", mainClassName), children: main }),
46010
+ /* @__PURE__ */ jsx(Box, { className: cn("flex-1 min-w-0 min-h-0 overflow-auto", mainClassName), children: main }),
45244
46011
  showSecondarySidebar && /* @__PURE__ */ jsx(
45245
46012
  Box,
45246
46013
  {
@@ -45271,7 +46038,7 @@ var init_DockLayout = __esm({
45271
46038
  Box,
45272
46039
  {
45273
46040
  className: cn(
45274
- "flex-shrink-0 h-full overflow-auto border-r border-border",
46041
+ "flex-shrink-0 min-h-0 overflow-auto border-r border-border",
45275
46042
  railClassName
45276
46043
  ),
45277
46044
  style: { width: railWidth },
@@ -45320,7 +46087,7 @@ var init_DockLayout = __esm({
45320
46087
  }
45321
46088
  });
45322
46089
  function extractTitle(children) {
45323
- if (!React78__default.isValidElement(children)) return void 0;
46090
+ if (!React79__default.isValidElement(children)) return void 0;
45324
46091
  const props = children.props;
45325
46092
  if (typeof props.title === "string") {
45326
46093
  return props.title;
@@ -45682,7 +46449,7 @@ var init_Form = __esm({
45682
46449
  const isSchemaEntity = isOrbitalEntitySchema(entity);
45683
46450
  const resolvedEntity = isSchemaEntity ? entity : void 0;
45684
46451
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
45685
- const normalizedInitialData = React78__default.useMemo(() => {
46452
+ const normalizedInitialData = React79__default.useMemo(() => {
45686
46453
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
45687
46454
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
45688
46455
  const merged = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
@@ -45701,7 +46468,7 @@ var init_Form = __esm({
45701
46468
  }
45702
46469
  return normalized;
45703
46470
  }, [entity, initialData]);
45704
- const entityDerivedFields = React78__default.useMemo(() => {
46471
+ const entityDerivedFields = React79__default.useMemo(() => {
45705
46472
  if (fields && fields.length > 0) return void 0;
45706
46473
  if (!resolvedEntity) return void 0;
45707
46474
  return resolvedEntity.fields.map(
@@ -45722,16 +46489,16 @@ var init_Form = __esm({
45722
46489
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
45723
46490
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
45724
46491
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
45725
- const [formData, setFormData] = React78__default.useState(
46492
+ const [formData, setFormData] = React79__default.useState(
45726
46493
  normalizedInitialData
45727
46494
  );
45728
- const [collapsedSections, setCollapsedSections] = React78__default.useState(
46495
+ const [collapsedSections, setCollapsedSections] = React79__default.useState(
45729
46496
  /* @__PURE__ */ new Set()
45730
46497
  );
45731
- const [submitError, setSubmitError] = React78__default.useState(null);
45732
- const formRef = React78__default.useRef(null);
46498
+ const [submitError, setSubmitError] = React79__default.useState(null);
46499
+ const formRef = React79__default.useRef(null);
45733
46500
  const formMode = props.mode;
45734
- const mountedRef = React78__default.useRef(false);
46501
+ const mountedRef = React79__default.useRef(false);
45735
46502
  if (!mountedRef.current) {
45736
46503
  mountedRef.current = true;
45737
46504
  debug("forms", "mount", {
@@ -45744,7 +46511,7 @@ var init_Form = __esm({
45744
46511
  });
45745
46512
  }
45746
46513
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
45747
- const evalContext = React78__default.useMemo(
46514
+ const evalContext = React79__default.useMemo(
45748
46515
  () => ({
45749
46516
  formValues: formData,
45750
46517
  globalVariables: externalContext?.globalVariables ?? {},
@@ -45753,7 +46520,7 @@ var init_Form = __esm({
45753
46520
  }),
45754
46521
  [formData, externalContext]
45755
46522
  );
45756
- React78__default.useEffect(() => {
46523
+ React79__default.useEffect(() => {
45757
46524
  debug("forms", "initialData-sync", {
45758
46525
  mode: formMode,
45759
46526
  normalizedInitialData,
@@ -45764,7 +46531,7 @@ var init_Form = __esm({
45764
46531
  setFormData(normalizedInitialData);
45765
46532
  }
45766
46533
  }, [normalizedInitialData]);
45767
- const processCalculations = React78__default.useCallback(
46534
+ const processCalculations = React79__default.useCallback(
45768
46535
  (changedFieldId, newFormData) => {
45769
46536
  if (!hiddenCalculations.length) return;
45770
46537
  const context = {
@@ -45789,7 +46556,7 @@ var init_Form = __esm({
45789
46556
  },
45790
46557
  [hiddenCalculations, externalContext, eventBus]
45791
46558
  );
45792
- const checkViolations = React78__default.useCallback(
46559
+ const checkViolations = React79__default.useCallback(
45793
46560
  (changedFieldId, newFormData) => {
45794
46561
  if (!violationTriggers.length) return;
45795
46562
  const context = {
@@ -45827,7 +46594,7 @@ var init_Form = __esm({
45827
46594
  processCalculations(name, newFormData);
45828
46595
  checkViolations(name, newFormData);
45829
46596
  };
45830
- const isFieldVisible = React78__default.useCallback(
46597
+ const isFieldVisible = React79__default.useCallback(
45831
46598
  (fieldName2) => {
45832
46599
  const condition = conditionalFields[fieldName2];
45833
46600
  if (!condition) return true;
@@ -45835,7 +46602,7 @@ var init_Form = __esm({
45835
46602
  },
45836
46603
  [conditionalFields, evalContext]
45837
46604
  );
45838
- const isSectionVisible = React78__default.useCallback(
46605
+ const isSectionVisible = React79__default.useCallback(
45839
46606
  (section) => {
45840
46607
  if (!section.condition) return true;
45841
46608
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -45911,7 +46678,7 @@ var init_Form = __esm({
45911
46678
  eventBus.emit(`UI:${onCancel}`);
45912
46679
  }
45913
46680
  };
45914
- const renderField = React78__default.useCallback(
46681
+ const renderField = React79__default.useCallback(
45915
46682
  (field) => {
45916
46683
  const fieldName2 = field.name || field.field;
45917
46684
  if (!fieldName2) return null;
@@ -45933,7 +46700,7 @@ var init_Form = __esm({
45933
46700
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
45934
46701
  );
45935
46702
  const effectiveFields = entityDerivedFields ?? fields;
45936
- const normalizedFields = React78__default.useMemo(() => {
46703
+ const normalizedFields = React79__default.useMemo(() => {
45937
46704
  if (!effectiveFields || effectiveFields.length === 0) return [];
45938
46705
  return effectiveFields.map((field) => {
45939
46706
  if (typeof field === "string") {
@@ -45968,7 +46735,7 @@ var init_Form = __esm({
45968
46735
  };
45969
46736
  });
45970
46737
  }, [effectiveFields, resolvedEntity, fieldOverrides]);
45971
- const schemaFields = React78__default.useMemo(() => {
46738
+ const schemaFields = React79__default.useMemo(() => {
45972
46739
  if (normalizedFields.length === 0) return null;
45973
46740
  if (isDebugEnabled()) {
45974
46741
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -45978,7 +46745,7 @@ var init_Form = __esm({
45978
46745
  }
45979
46746
  return normalizedFields.map(renderField).filter(Boolean);
45980
46747
  }, [normalizedFields, renderField, entityName, conditionalFields]);
45981
- const sectionElements = React78__default.useMemo(() => {
46748
+ const sectionElements = React79__default.useMemo(() => {
45982
46749
  if (!sections || sections.length === 0) return null;
45983
46750
  return sections.map((section) => {
45984
46751
  if (!isSectionVisible(section)) {
@@ -46814,7 +47581,7 @@ var init_List = __esm({
46814
47581
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
46815
47582
  return [];
46816
47583
  }, [entity]);
46817
- const getItemActions = React78__default.useCallback(
47584
+ const getItemActions = React79__default.useCallback(
46818
47585
  (item) => {
46819
47586
  if (!itemActions) return [];
46820
47587
  if (typeof itemActions === "function") {
@@ -47296,7 +48063,7 @@ var init_MediaGallery = __esm({
47296
48063
  [selectable, selectedItems, selectionEvent, eventBus]
47297
48064
  );
47298
48065
  const entityData = Array.isArray(entity) ? entity : [];
47299
- const items = React78__default.useMemo(() => {
48066
+ const items = React79__default.useMemo(() => {
47300
48067
  if (propItems && propItems.length > 0) return propItems;
47301
48068
  if (entityData.length === 0) return [];
47302
48069
  return entityData.map((record, idx) => {
@@ -47461,7 +48228,7 @@ var init_MediaGallery = __esm({
47461
48228
  }
47462
48229
  });
47463
48230
  function extractTitle2(children) {
47464
- if (!React78__default.isValidElement(children)) return void 0;
48231
+ if (!React79__default.isValidElement(children)) return void 0;
47465
48232
  const props = children.props;
47466
48233
  if (typeof props.title === "string") {
47467
48234
  return props.title;
@@ -47716,7 +48483,7 @@ var init_debugRegistry = __esm({
47716
48483
  }
47717
48484
  });
47718
48485
  function useDebugData() {
47719
- const [data, setData] = React78.useState(() => ({
48486
+ const [data, setData] = React79.useState(() => ({
47720
48487
  traits: [],
47721
48488
  ticks: [],
47722
48489
  guards: [],
@@ -47730,7 +48497,7 @@ function useDebugData() {
47730
48497
  },
47731
48498
  lastUpdate: Date.now()
47732
48499
  }));
47733
- React78.useEffect(() => {
48500
+ React79.useEffect(() => {
47734
48501
  const updateData = () => {
47735
48502
  setData({
47736
48503
  traits: getAllTraits(),
@@ -47839,12 +48606,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
47839
48606
  return positions;
47840
48607
  }
47841
48608
  function WalkMinimap() {
47842
- const [walkStep, setWalkStep] = React78.useState(null);
47843
- const [traits2, setTraits] = React78.useState([]);
47844
- const [coveredEdges, setCoveredEdges] = React78.useState([]);
47845
- const [completedTraits, setCompletedTraits] = React78.useState(/* @__PURE__ */ new Set());
47846
- const prevTraitRef = React78.useRef(null);
47847
- React78.useEffect(() => {
48609
+ const [walkStep, setWalkStep] = React79.useState(null);
48610
+ const [traits2, setTraits] = React79.useState([]);
48611
+ const [coveredEdges, setCoveredEdges] = React79.useState([]);
48612
+ const [completedTraits, setCompletedTraits] = React79.useState(/* @__PURE__ */ new Set());
48613
+ const prevTraitRef = React79.useRef(null);
48614
+ React79.useEffect(() => {
47848
48615
  const interval = setInterval(() => {
47849
48616
  const w = window;
47850
48617
  const step = w.__orbitalWalkStep;
@@ -48280,15 +49047,15 @@ var init_EntitiesTab = __esm({
48280
49047
  });
48281
49048
  function EventFlowTab({ events: events2 }) {
48282
49049
  const { t } = useTranslate();
48283
- const [filter, setFilter] = React78.useState("all");
48284
- const containerRef = React78.useRef(null);
48285
- const [autoScroll, setAutoScroll] = React78.useState(true);
48286
- React78.useEffect(() => {
49050
+ const [filter, setFilter] = React79.useState("all");
49051
+ const containerRef = React79.useRef(null);
49052
+ const [autoScroll, setAutoScroll] = React79.useState(true);
49053
+ React79.useEffect(() => {
48287
49054
  if (autoScroll && containerRef.current) {
48288
49055
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48289
49056
  }
48290
49057
  }, [events2.length, autoScroll]);
48291
- const filteredEvents = React78.useMemo(() => {
49058
+ const filteredEvents = React79.useMemo(() => {
48292
49059
  if (filter === "all") return events2;
48293
49060
  return events2.filter((e) => e.type === filter);
48294
49061
  }, [events2, filter]);
@@ -48404,7 +49171,7 @@ var init_EventFlowTab = __esm({
48404
49171
  });
48405
49172
  function GuardsPanel({ guards }) {
48406
49173
  const { t } = useTranslate();
48407
- const [filter, setFilter] = React78.useState("all");
49174
+ const [filter, setFilter] = React79.useState("all");
48408
49175
  if (guards.length === 0) {
48409
49176
  return /* @__PURE__ */ jsx(
48410
49177
  EmptyState,
@@ -48417,7 +49184,7 @@ function GuardsPanel({ guards }) {
48417
49184
  }
48418
49185
  const passedCount = guards.filter((g) => g.result).length;
48419
49186
  const failedCount = guards.length - passedCount;
48420
- const filteredGuards = React78.useMemo(() => {
49187
+ const filteredGuards = React79.useMemo(() => {
48421
49188
  if (filter === "all") return guards;
48422
49189
  if (filter === "passed") return guards.filter((g) => g.result);
48423
49190
  return guards.filter((g) => !g.result);
@@ -48580,10 +49347,10 @@ function EffectBadge({ effect }) {
48580
49347
  }
48581
49348
  function TransitionTimeline({ transitions }) {
48582
49349
  const { t } = useTranslate();
48583
- const containerRef = React78.useRef(null);
48584
- const [autoScroll, setAutoScroll] = React78.useState(true);
48585
- const [expandedId, setExpandedId] = React78.useState(null);
48586
- React78.useEffect(() => {
49350
+ const containerRef = React79.useRef(null);
49351
+ const [autoScroll, setAutoScroll] = React79.useState(true);
49352
+ const [expandedId, setExpandedId] = React79.useState(null);
49353
+ React79.useEffect(() => {
48587
49354
  if (autoScroll && containerRef.current) {
48588
49355
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
48589
49356
  }
@@ -48863,9 +49630,9 @@ function getAllEvents(traits2) {
48863
49630
  function EventDispatcherTab({ traits: traits2, schema }) {
48864
49631
  const eventBus = useEventBus();
48865
49632
  const { t } = useTranslate();
48866
- const [log19, setLog] = React78.useState([]);
48867
- const prevStatesRef = React78.useRef(/* @__PURE__ */ new Map());
48868
- React78.useEffect(() => {
49633
+ const [log20, setLog] = React79.useState([]);
49634
+ const prevStatesRef = React79.useRef(/* @__PURE__ */ new Map());
49635
+ React79.useEffect(() => {
48869
49636
  for (const trait of traits2) {
48870
49637
  const prev = prevStatesRef.current.get(trait.id);
48871
49638
  if (prev && prev !== trait.currentState) {
@@ -48927,9 +49694,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
48927
49694
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-muted-foreground mb-1", children: t("debug.otherEvents") }),
48928
49695
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
48929
49696
  ] }),
48930
- log19.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
49697
+ log20.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
48931
49698
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-muted-foreground mb-1", children: t("debug.recentTransitions") }),
48932
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log19.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
49699
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log20.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
48933
49700
  /* @__PURE__ */ jsx("span", { className: "text-primary", children: entry.traitName }),
48934
49701
  " ",
48935
49702
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: entry.from }),
@@ -49034,10 +49801,10 @@ function VerifyModePanel({
49034
49801
  localCount
49035
49802
  }) {
49036
49803
  const { t } = useTranslate();
49037
- const [expanded, setExpanded] = React78.useState(true);
49038
- const scrollRef = React78.useRef(null);
49039
- const prevCountRef = React78.useRef(0);
49040
- React78.useEffect(() => {
49804
+ const [expanded, setExpanded] = React79.useState(true);
49805
+ const scrollRef = React79.useRef(null);
49806
+ const prevCountRef = React79.useRef(0);
49807
+ React79.useEffect(() => {
49041
49808
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
49042
49809
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
49043
49810
  }
@@ -49094,10 +49861,10 @@ function RuntimeDebugger({
49094
49861
  schema
49095
49862
  }) {
49096
49863
  const { t } = useTranslate();
49097
- const [isCollapsed, setIsCollapsed] = React78.useState(mode === "verify" ? true : defaultCollapsed);
49098
- const [isVisible, setIsVisible] = React78.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
49864
+ const [isCollapsed, setIsCollapsed] = React79.useState(mode === "verify" ? true : defaultCollapsed);
49865
+ const [isVisible, setIsVisible] = React79.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
49099
49866
  const debugData = useDebugData();
49100
- React78.useEffect(() => {
49867
+ React79.useEffect(() => {
49101
49868
  if (mode === "inline") return;
49102
49869
  return onDebugToggle((enabled) => {
49103
49870
  setIsVisible(enabled);
@@ -49106,7 +49873,7 @@ function RuntimeDebugger({
49106
49873
  }
49107
49874
  });
49108
49875
  }, [mode]);
49109
- React78.useEffect(() => {
49876
+ React79.useEffect(() => {
49110
49877
  if (mode === "inline") return;
49111
49878
  const handleKeyDown = (e) => {
49112
49879
  if (e.key === "`" && isVisible) {
@@ -49537,7 +50304,7 @@ var init_StatCard = __esm({
49537
50304
  const labelToUse = propLabel ?? propTitle;
49538
50305
  const eventBus = useEventBus();
49539
50306
  const { t } = useTranslate();
49540
- const handleActionClick = React78__default.useCallback(() => {
50307
+ const handleActionClick = React79__default.useCallback(() => {
49541
50308
  if (action?.event) {
49542
50309
  eventBus.emit(`UI:${action.event}`, {});
49543
50310
  }
@@ -49548,7 +50315,7 @@ var init_StatCard = __esm({
49548
50315
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
49549
50316
  const isLoading = externalLoading ?? false;
49550
50317
  const error = externalError;
49551
- const computeMetricValue = React78__default.useCallback(
50318
+ const computeMetricValue = React79__default.useCallback(
49552
50319
  (metric, items) => {
49553
50320
  if (metric.value !== void 0) {
49554
50321
  return metric.value;
@@ -49587,7 +50354,7 @@ var init_StatCard = __esm({
49587
50354
  },
49588
50355
  []
49589
50356
  );
49590
- const schemaStats = React78__default.useMemo(() => {
50357
+ const schemaStats = React79__default.useMemo(() => {
49591
50358
  if (!metrics || metrics.length === 0) return null;
49592
50359
  return metrics.map((metric) => ({
49593
50360
  label: metric.label,
@@ -49595,7 +50362,7 @@ var init_StatCard = __esm({
49595
50362
  format: metric.format
49596
50363
  }));
49597
50364
  }, [metrics, data, computeMetricValue]);
49598
- const calculatedTrend = React78__default.useMemo(() => {
50365
+ const calculatedTrend = React79__default.useMemo(() => {
49599
50366
  if (manualTrend !== void 0) return manualTrend;
49600
50367
  if (previousValue === void 0 || currentValue2 === void 0)
49601
50368
  return void 0;
@@ -50235,8 +51002,8 @@ var init_SubagentTracePanel = __esm({
50235
51002
  ] });
50236
51003
  };
50237
51004
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
50238
- const endRef = React78__default.useRef(null);
50239
- React78__default.useEffect(() => {
51005
+ const endRef = React79__default.useRef(null);
51006
+ React79__default.useEffect(() => {
50240
51007
  if (!autoScroll) return;
50241
51008
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50242
51009
  }, [activities.length, autoScroll]);
@@ -50330,7 +51097,7 @@ var init_SubagentTracePanel = __esm({
50330
51097
  };
50331
51098
  SubagentRichCard = ({ subagent }) => {
50332
51099
  const { t } = useTranslate();
50333
- const activities = React78__default.useMemo(
51100
+ const activities = React79__default.useMemo(
50334
51101
  () => subagentMessagesToActivities(subagent.messages),
50335
51102
  [subagent.messages]
50336
51103
  );
@@ -50407,8 +51174,8 @@ var init_SubagentTracePanel = __esm({
50407
51174
  ] });
50408
51175
  };
50409
51176
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
50410
- const endRef = React78__default.useRef(null);
50411
- React78__default.useEffect(() => {
51177
+ const endRef = React79__default.useRef(null);
51178
+ React79__default.useEffect(() => {
50412
51179
  if (!autoScroll) return;
50413
51180
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
50414
51181
  }, [messages.length, autoScroll]);
@@ -50843,7 +51610,7 @@ var init_Timeline = __esm({
50843
51610
  }) => {
50844
51611
  const { t } = useTranslate();
50845
51612
  const entityData = entity ?? [];
50846
- const items = React78__default.useMemo(() => {
51613
+ const items = React79__default.useMemo(() => {
50847
51614
  if (propItems) return propItems;
50848
51615
  if (entityData.length === 0) return [];
50849
51616
  return entityData.map((record, idx) => {
@@ -50945,7 +51712,7 @@ var init_Timeline = __esm({
50945
51712
  }
50946
51713
  });
50947
51714
  function extractToastProps(children) {
50948
- if (!React78__default.isValidElement(children)) {
51715
+ if (!React79__default.isValidElement(children)) {
50949
51716
  if (typeof children === "string") {
50950
51717
  return { message: children };
50951
51718
  }
@@ -50987,7 +51754,7 @@ var init_ToastSlot = __esm({
50987
51754
  eventBus.emit(`${prefix}CLOSE`);
50988
51755
  };
50989
51756
  if (!isVisible) return null;
50990
- const isCustomContent = React78__default.isValidElement(children) && !message;
51757
+ const isCustomContent = React79__default.isValidElement(children) && !message;
50991
51758
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
50992
51759
  Toast,
50993
51760
  {
@@ -51055,6 +51822,7 @@ var init_component_registry_generated = __esm({
51055
51822
  init_ChoiceButton();
51056
51823
  init_CodeBlock();
51057
51824
  init_CodeRunnerPanel();
51825
+ init_CommandPalette();
51058
51826
  init_CommunityLinks();
51059
51827
  init_ConditionalWrapper();
51060
51828
  init_ConfettiEffect();
@@ -51119,6 +51887,7 @@ var init_component_registry_generated = __esm({
51119
51887
  init_FormSection();
51120
51888
  init_FormSectionHeader();
51121
51889
  init_FxOverlay();
51890
+ init_GameAudioCue();
51122
51891
  init_GameAudioToggle();
51123
51892
  init_GameHud();
51124
51893
  init_GameIcon();
@@ -51329,6 +52098,7 @@ var init_component_registry_generated = __esm({
51329
52098
  "ChoiceButton": ChoiceButton,
51330
52099
  "CodeBlock": CodeBlock,
51331
52100
  "CodeRunnerPanel": CodeRunnerPanel,
52101
+ "CommandPalette": CommandPalette,
51332
52102
  "CommunityLinks": CommunityLinks,
51333
52103
  "ConditionalWrapper": ConditionalWrapper,
51334
52104
  "ConfettiEffect": ConfettiEffect,
@@ -51395,6 +52165,7 @@ var init_component_registry_generated = __esm({
51395
52165
  "FormLayout": FormLayout,
51396
52166
  "FormSectionHeader": FormSectionHeader,
51397
52167
  "FxOverlay": FxOverlay,
52168
+ "GameAudioCue": GameAudioCue,
51398
52169
  "GameAudioToggle": GameAudioToggle,
51399
52170
  "GameHud": GameHud,
51400
52171
  "GameIcon": GameIcon,
@@ -51577,7 +52348,7 @@ function SuspenseConfigProvider({
51577
52348
  config,
51578
52349
  children
51579
52350
  }) {
51580
- return React78__default.createElement(
52351
+ return React79__default.createElement(
51581
52352
  SuspenseConfigContext.Provider,
51582
52353
  { value: config },
51583
52354
  children
@@ -51625,7 +52396,7 @@ function enrichFormFields(fields, entityDef) {
51625
52396
  }
51626
52397
  return { name: field, label: humanizeFieldName(field) };
51627
52398
  }
51628
- if (field && typeof field === "object" && !Array.isArray(field) && !React78__default.isValidElement(field) && !(field instanceof Date)) {
52399
+ if (field && typeof field === "object" && !Array.isArray(field) && !React79__default.isValidElement(field) && !(field instanceof Date)) {
51629
52400
  const obj = field;
51630
52401
  const fieldName2 = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
51631
52402
  if (!fieldName2) return field;
@@ -51678,7 +52449,7 @@ function enrichDetailFields(fields, entityDef) {
51678
52449
  const meta = metaFor(field);
51679
52450
  return meta ? { key: field, ...meta } : field;
51680
52451
  }
51681
- if (field && typeof field === "object" && !Array.isArray(field) && !React78__default.isValidElement(field) && !(field instanceof Date)) {
52452
+ if (field && typeof field === "object" && !Array.isArray(field) && !React79__default.isValidElement(field) && !(field instanceof Date)) {
51682
52453
  const obj = field;
51683
52454
  const fieldName2 = typeof obj.key === "string" ? obj.key : typeof obj.name === "string" ? obj.name : void 0;
51684
52455
  if (!fieldName2 || obj.type) return field;
@@ -52137,7 +52908,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
52137
52908
  const key = `${parentId}-${index}-trait:${traitName}`;
52138
52909
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
52139
52910
  }
52140
- return /* @__PURE__ */ jsx(React78__default.Fragment, { children: child }, `${parentId}-${index}`);
52911
+ return /* @__PURE__ */ jsx(React79__default.Fragment, { children: child }, `${parentId}-${index}`);
52141
52912
  }
52142
52913
  if (!child || typeof child !== "object") return null;
52143
52914
  const childId = `${parentId}-${index}`;
@@ -52194,7 +52965,7 @@ function isPatternConfig(value) {
52194
52965
  if (value === null || value === void 0) return false;
52195
52966
  if (typeof value !== "object") return false;
52196
52967
  if (Array.isArray(value)) return false;
52197
- if (React78__default.isValidElement(value)) return false;
52968
+ if (React79__default.isValidElement(value)) return false;
52198
52969
  if (value instanceof Date) return false;
52199
52970
  if (typeof value === "function") return false;
52200
52971
  const record = value;
@@ -52207,9 +52978,9 @@ function renderPatternValue(value) {
52207
52978
  if (typeof value === "string") return renderPatternChildren(value, () => {
52208
52979
  });
52209
52980
  if (value instanceof Date) return value.toLocaleString();
52210
- if (React78__default.isValidElement(value)) return value;
52981
+ if (React79__default.isValidElement(value)) return value;
52211
52982
  if (Array.isArray(value)) {
52212
- return value.map((item, index) => /* @__PURE__ */ jsx(React78__default.Fragment, { children: renderPatternValue(item) }, index));
52983
+ return value.map((item, index) => /* @__PURE__ */ jsx(React79__default.Fragment, { children: renderPatternValue(item) }, index));
52213
52984
  }
52214
52985
  if (isPatternConfig(value)) {
52215
52986
  const { type, ...props } = value;
@@ -52219,7 +52990,7 @@ function renderPatternValue(value) {
52219
52990
  return null;
52220
52991
  }
52221
52992
  function isPlainConfigObject(value) {
52222
- if (React78__default.isValidElement(value)) return false;
52993
+ if (React79__default.isValidElement(value)) return false;
52223
52994
  if (value instanceof Date) return false;
52224
52995
  const proto = Object.getPrototypeOf(value);
52225
52996
  return proto === Object.prototype || proto === null;
@@ -52393,7 +53164,7 @@ function SlotContentRenderer({
52393
53164
  for (const slotKey of CONTENT_NODE_SLOTS) {
52394
53165
  const slotVal = restProps[slotKey];
52395
53166
  if (slotVal === void 0 || slotVal === null) continue;
52396
- if (React78__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
53167
+ if (React79__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
52397
53168
  const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
52398
53169
  if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
52399
53170
  nodeSlotOverrides[slotKey] = renderPatternChildren(
@@ -52447,7 +53218,7 @@ function SlotContentRenderer({
52447
53218
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
52448
53219
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
52449
53220
  const sample = resolvedItems[0];
52450
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React78__default.isValidElement(sample) && !(sample instanceof Date)) {
53221
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React79__default.isValidElement(sample) && !(sample instanceof Date)) {
52451
53222
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
52452
53223
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
52453
53224
  }
@@ -52881,7 +53652,7 @@ init_AboutPageTemplate();
52881
53652
 
52882
53653
  // components/index.ts
52883
53654
  init_cn();
52884
- var log8 = createLogger("almadar:ui:orbital-history");
53655
+ var log9 = createLogger("almadar:ui:orbital-history");
52885
53656
  function useOrbitalHistory(options) {
52886
53657
  const { appId, authToken, userId, onHistoryChange, onRevertSuccess } = options;
52887
53658
  const getHeaders = useCallback(() => {
@@ -52943,7 +53714,7 @@ function useOrbitalHistory(options) {
52943
53714
  setCurrentVersion(mergedTimeline[0].version);
52944
53715
  }
52945
53716
  } catch (err) {
52946
- log8.error("Failed to load history", { error: err instanceof Error ? err : String(err) });
53717
+ log9.error("Failed to load history", { error: err instanceof Error ? err : String(err) });
52947
53718
  setError(err instanceof Error ? err.message : "Failed to load history");
52948
53719
  } finally {
52949
53720
  setIsLoading(false);
@@ -52976,7 +53747,7 @@ function useOrbitalHistory(options) {
52976
53747
  error: data.error || "Unknown error during revert"
52977
53748
  };
52978
53749
  } catch (err) {
52979
- log8.error("Failed to revert", { error: err instanceof Error ? err : String(err) });
53750
+ log9.error("Failed to revert", { error: err instanceof Error ? err : String(err) });
52980
53751
  return {
52981
53752
  success: false,
52982
53753
  error: err instanceof Error ? err.message : "Failed to revert"
@@ -53000,7 +53771,7 @@ function useOrbitalHistory(options) {
53000
53771
  refresh
53001
53772
  };
53002
53773
  }
53003
- var log9 = createLogger("almadar:ui:filesystem");
53774
+ var log10 = createLogger("almadar:ui:filesystem");
53004
53775
  function useFileSystem() {
53005
53776
  const [status, setStatus] = useState("idle");
53006
53777
  const [error, setError] = useState(null);
@@ -53015,7 +53786,7 @@ function useFileSystem() {
53015
53786
  setError(null);
53016
53787
  setIsLoading(true);
53017
53788
  try {
53018
- log9.debug("Booting WebContainer");
53789
+ log10.debug("Booting WebContainer");
53019
53790
  await new Promise((resolve) => setTimeout(resolve, 100));
53020
53791
  setStatus("ready");
53021
53792
  } catch (err) {
@@ -53076,7 +53847,7 @@ function useFileSystem() {
53076
53847
  setFiles(newTree);
53077
53848
  setStatus("running");
53078
53849
  } catch (err) {
53079
- log9.error("Failed to mount files", { error: err instanceof Error ? err : String(err) });
53850
+ log10.error("Failed to mount files", { error: err instanceof Error ? err : String(err) });
53080
53851
  } finally {
53081
53852
  setIsLoading(false);
53082
53853
  }
@@ -53117,7 +53888,7 @@ function useFileSystem() {
53117
53888
  const path = contentArg !== void 0 ? pathOrContent : selectedPath;
53118
53889
  const content = contentArg !== void 0 ? contentArg : pathOrContent;
53119
53890
  if (!path) {
53120
- log9.warn("updateContent called without path and no file selected");
53891
+ log10.warn("updateContent called without path and no file selected");
53121
53892
  return;
53122
53893
  }
53123
53894
  setFileContents((prev) => {
@@ -53133,14 +53904,14 @@ function useFileSystem() {
53133
53904
  setSelectedFile((prev) => prev ? { ...prev, content, isDirty: true } : null);
53134
53905
  }, []);
53135
53906
  const refreshTree = useCallback(async () => {
53136
- log9.debug("Refreshing tree");
53907
+ log10.debug("Refreshing tree");
53137
53908
  }, []);
53138
53909
  const runCommand = useCallback(async (command) => {
53139
- log9.debug("Running command", { command });
53910
+ log10.debug("Running command", { command });
53140
53911
  return { exitCode: 0, output: "" };
53141
53912
  }, []);
53142
53913
  const startDevServer = useCallback(async () => {
53143
- log9.debug("Starting dev server");
53914
+ log10.debug("Starting dev server");
53144
53915
  setPreviewUrl("http://localhost:5173");
53145
53916
  }, []);
53146
53917
  return {
@@ -53163,7 +53934,7 @@ function useFileSystem() {
53163
53934
  startDevServer
53164
53935
  };
53165
53936
  }
53166
- var log10 = createLogger("almadar:ui:extensions");
53937
+ var log11 = createLogger("almadar:ui:extensions");
53167
53938
  var defaultManifest = {
53168
53939
  languages: {
53169
53940
  typescript: { extensions: [".ts", ".tsx"], icon: "ts", color: "#3178c6" },
@@ -53182,7 +53953,7 @@ function useExtensions(options) {
53182
53953
  const [isLoading, setIsLoading] = useState(false);
53183
53954
  const [error, setError] = useState(null);
53184
53955
  const loadExtension = useCallback(async (extensionId) => {
53185
- log10.debug("Loading extension", { extensionId });
53956
+ log11.debug("Loading extension", { extensionId });
53186
53957
  }, []);
53187
53958
  const loadExtensions = useCallback(async () => {
53188
53959
  setIsLoading(true);
@@ -53254,7 +54025,7 @@ function useExtensions(options) {
53254
54025
  getExtensionForFile
53255
54026
  };
53256
54027
  }
53257
- var log11 = createLogger("almadar:ui:file-editor");
54028
+ var log12 = createLogger("almadar:ui:file-editor");
53258
54029
  function useFileEditor(options) {
53259
54030
  const { extensions, fileSystem, onSchemaUpdate } = options;
53260
54031
  const [openFiles, setOpenFiles] = useState([]);
@@ -53279,7 +54050,7 @@ function useFileEditor(options) {
53279
54050
  setOpenFiles((prev) => [...prev, newFile]);
53280
54051
  setActiveFilePath(path);
53281
54052
  } catch (err) {
53282
- log11.error("Failed to open file", { error: err instanceof Error ? err : String(err) });
54053
+ log12.error("Failed to open file", { error: err instanceof Error ? err : String(err) });
53283
54054
  }
53284
54055
  }, [openFiles, fileSystem, extensions]);
53285
54056
  const closeFile = useCallback((path) => {
@@ -53340,7 +54111,7 @@ function useFileEditor(options) {
53340
54111
  }
53341
54112
  }
53342
54113
  } catch (err) {
53343
- log11.error("Failed to save file", { error: err instanceof Error ? err : String(err) });
54114
+ log12.error("Failed to save file", { error: err instanceof Error ? err : String(err) });
53344
54115
  } finally {
53345
54116
  setIsSaving(false);
53346
54117
  }
@@ -53369,7 +54140,7 @@ function useFileEditor(options) {
53369
54140
  saveAllFiles
53370
54141
  };
53371
54142
  }
53372
- var log12 = createLogger("almadar:ui:compile");
54143
+ var log13 = createLogger("almadar:ui:compile");
53373
54144
  function useCompile() {
53374
54145
  const [isCompiling, setIsCompiling] = useState(false);
53375
54146
  const [stage, setStage] = useState("idle");
@@ -53380,7 +54151,7 @@ function useCompile() {
53380
54151
  setStage("compiling");
53381
54152
  setError(null);
53382
54153
  try {
53383
- log12.debug("Compiling schema", { name: schema.name });
54154
+ log13.debug("Compiling schema", { name: schema.name });
53384
54155
  const result = {
53385
54156
  success: true,
53386
54157
  files: []
@@ -53406,7 +54177,7 @@ function useCompile() {
53406
54177
  compileSchema
53407
54178
  };
53408
54179
  }
53409
- var log13 = createLogger("almadar:ui:preview");
54180
+ var log14 = createLogger("almadar:ui:preview");
53410
54181
  function usePreview(options) {
53411
54182
  const [previewUrl, setPreviewUrl] = useState(null);
53412
54183
  const [isLoading, setIsLoading] = useState(!!options?.appId);
@@ -53440,17 +54211,17 @@ function usePreview(options) {
53440
54211
  setIsLoading(false);
53441
54212
  return;
53442
54213
  }
53443
- log13.debug("Setting up preview for app", { appId });
54214
+ log14.debug("Setting up preview for app", { appId });
53444
54215
  setPreviewUrl(`/api/orbitals/${appId}`);
53445
54216
  setIsLoading(false);
53446
54217
  }, [options?.appId]);
53447
54218
  const startPreview = useCallback(async () => {
53448
- log13.debug("startPreview called");
54219
+ log14.debug("startPreview called");
53449
54220
  }, []);
53450
54221
  const stopPreview = useCallback(async () => {
53451
54222
  setIsLoading(true);
53452
54223
  try {
53453
- log13.debug("Stopping preview server");
54224
+ log14.debug("Stopping preview server");
53454
54225
  setPreviewUrl(null);
53455
54226
  setApp(null);
53456
54227
  } finally {
@@ -53459,15 +54230,15 @@ function usePreview(options) {
53459
54230
  }, []);
53460
54231
  const refresh = useCallback(async () => {
53461
54232
  if (!previewUrl) return;
53462
- log13.debug("Refreshing preview");
54233
+ log14.debug("Refreshing preview");
53463
54234
  setPreviewUrl(`${previewUrl.split("?")[0]}?t=${Date.now()}`);
53464
54235
  }, [previewUrl]);
53465
54236
  const handleRefresh = useCallback(async () => {
53466
- log13.debug("Handle refresh");
54237
+ log14.debug("Handle refresh");
53467
54238
  await refresh();
53468
54239
  }, [refresh]);
53469
54240
  const handleReset = useCallback(async () => {
53470
- log13.debug("Resetting preview");
54241
+ log14.debug("Resetting preview");
53471
54242
  setError(null);
53472
54243
  setLoadError(null);
53473
54244
  setErrorToast(null);
@@ -53501,7 +54272,7 @@ function usePreview(options) {
53501
54272
  dismissErrorToast
53502
54273
  };
53503
54274
  }
53504
- var log14 = createLogger("almadar:ui:agent-chat");
54275
+ var log15 = createLogger("almadar:ui:agent-chat");
53505
54276
  function useAgentChat(options) {
53506
54277
  const [messages, setMessages] = useState([]);
53507
54278
  const [status, setStatus] = useState("idle");
@@ -53524,7 +54295,7 @@ function useAgentChat(options) {
53524
54295
  timestamp: Date.now()
53525
54296
  };
53526
54297
  setMessages((prev) => [...prev, userMessage]);
53527
- log14.debug("Sending message", { content });
54298
+ log15.debug("Sending message", { content });
53528
54299
  const assistantMessage = {
53529
54300
  id: (Date.now() + 1).toString(),
53530
54301
  role: "assistant",
@@ -53547,7 +54318,7 @@ function useAgentChat(options) {
53547
54318
  setError(null);
53548
54319
  const skillName = Array.isArray(skill) ? skill[0] : skill;
53549
54320
  try {
53550
- log14.debug("Starting generation", () => ({ skillName, prompt, genOptions: JSON.stringify(genOptions) }));
54321
+ log15.debug("Starting generation", () => ({ skillName, prompt, genOptions: JSON.stringify(genOptions) }));
53551
54322
  await new Promise((resolve) => setTimeout(resolve, 100));
53552
54323
  setStatus("complete");
53553
54324
  options?.onComplete?.();
@@ -53559,10 +54330,10 @@ function useAgentChat(options) {
53559
54330
  }
53560
54331
  }, [options]);
53561
54332
  const continueConversation = useCallback(async (message) => {
53562
- log14.debug("Continue conversation", { message: Array.isArray(message) ? message : [message] });
54333
+ log15.debug("Continue conversation", { message: Array.isArray(message) ? message : [message] });
53563
54334
  }, []);
53564
54335
  const resumeWithDecision = useCallback(async (decisions) => {
53565
- log14.debug("Resume with decision", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
54336
+ log15.debug("Resume with decision", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
53566
54337
  setInterrupt(null);
53567
54338
  }, []);
53568
54339
  const cancel = useCallback(() => {
@@ -53599,7 +54370,7 @@ function useAgentChat(options) {
53599
54370
  clearHistory
53600
54371
  };
53601
54372
  }
53602
- var log15 = createLogger("almadar:ui:validation");
54373
+ var log16 = createLogger("almadar:ui:validation");
53603
54374
  function useValidation() {
53604
54375
  const [result, setResult] = useState(null);
53605
54376
  const [isValidating, setIsValidating] = useState(false);
@@ -53613,7 +54384,7 @@ function useValidation() {
53613
54384
  setStage("validating");
53614
54385
  setProgressMessage("Validating schema...");
53615
54386
  try {
53616
- log15.debug("Validating app", { appId });
54387
+ log16.debug("Validating app", { appId });
53617
54388
  const validationResult = {
53618
54389
  valid: true,
53619
54390
  errors: [],
@@ -53666,7 +54437,7 @@ function useValidation() {
53666
54437
  reset
53667
54438
  };
53668
54439
  }
53669
- var log16 = createLogger("almadar:ui:deep-agent");
54440
+ var log17 = createLogger("almadar:ui:deep-agent");
53670
54441
  function useDeepAgentGeneration() {
53671
54442
  const [requests, setRequests] = useState([]);
53672
54443
  const [currentRequest, setCurrentRequest] = useState(null);
@@ -53690,7 +54461,7 @@ function useDeepAgentGeneration() {
53690
54461
  setCurrentRequest(request);
53691
54462
  setRequests((prev) => [...prev, request]);
53692
54463
  try {
53693
- log16.debug("Generating from prompt", { prompt });
54464
+ log17.debug("Generating from prompt", { prompt });
53694
54465
  await new Promise((resolve) => setTimeout(resolve, 100));
53695
54466
  request.status = "completed";
53696
54467
  setCurrentRequest(request);
@@ -53710,7 +54481,7 @@ function useDeepAgentGeneration() {
53710
54481
  }
53711
54482
  }, []);
53712
54483
  const startGeneration = useCallback(async (skill, prompt, _options) => {
53713
- log16.debug("Starting generation with skill", { skill });
54484
+ log17.debug("Starting generation with skill", { skill });
53714
54485
  await generate(prompt);
53715
54486
  }, [generate]);
53716
54487
  const cancelGeneration = useCallback(() => {
@@ -53732,7 +54503,7 @@ function useDeepAgentGeneration() {
53732
54503
  setIsComplete(false);
53733
54504
  }, []);
53734
54505
  const submitInterruptDecisions = useCallback((decisions) => {
53735
- log16.debug("Submitting interrupt decisions", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
54506
+ log17.debug("Submitting interrupt decisions", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
53736
54507
  setInterrupt(null);
53737
54508
  }, []);
53738
54509
  return {
@@ -53754,6 +54525,66 @@ function useDeepAgentGeneration() {
53754
54525
 
53755
54526
  // hooks/index.ts
53756
54527
  init_useEventBus();
54528
+
54529
+ // hooks/useKeyboardRouter.ts
54530
+ init_useEventBus();
54531
+ function useKeyboardRouter(options) {
54532
+ const {
54533
+ captureTable,
54534
+ editorFocusEvent = "EDITOR_FOCUS",
54535
+ editorBlurEvent = "EDITOR_BLUR",
54536
+ keyEvent = "KEY",
54537
+ enabled = true
54538
+ } = options;
54539
+ const eventBus = useEventBus();
54540
+ const captureTableRef = useRef(captureTable);
54541
+ captureTableRef.current = captureTable;
54542
+ const focusedEditorIdRef = useRef(null);
54543
+ useEffect(() => {
54544
+ const unsubFocus = eventBus.on(`UI:${editorFocusEvent}`, (event) => {
54545
+ const editorId = event.payload?.editorId;
54546
+ if (typeof editorId === "string") {
54547
+ focusedEditorIdRef.current = editorId;
54548
+ }
54549
+ });
54550
+ const unsubBlur = eventBus.on(`UI:${editorBlurEvent}`, (event) => {
54551
+ const editorId = event.payload?.editorId;
54552
+ if (typeof editorId === "string" && focusedEditorIdRef.current === editorId) {
54553
+ focusedEditorIdRef.current = null;
54554
+ }
54555
+ });
54556
+ return () => {
54557
+ unsubFocus();
54558
+ unsubBlur();
54559
+ };
54560
+ }, [eventBus, editorFocusEvent, editorBlurEvent]);
54561
+ useEffect(() => {
54562
+ if (!enabled) return;
54563
+ const handleKeyDown = (event) => {
54564
+ if (event.isComposing) return;
54565
+ const target = focusedEditorIdRef.current ?? "shell";
54566
+ const entry = captureTableRef.current[target];
54567
+ const captured = entry !== void 0 && (entry.mode === "any" || entry.keys.has(event.key));
54568
+ if (captured) {
54569
+ event.preventDefault();
54570
+ }
54571
+ eventBus.emit(`UI:${keyEvent}`, {
54572
+ editorId: target,
54573
+ key: event.key,
54574
+ code: event.code,
54575
+ ctrl: event.ctrlKey,
54576
+ alt: event.altKey,
54577
+ shift: event.shiftKey,
54578
+ meta: event.metaKey,
54579
+ repeat: event.repeat
54580
+ });
54581
+ };
54582
+ window.addEventListener("keydown", handleKeyDown, { capture: true });
54583
+ return () => {
54584
+ window.removeEventListener("keydown", handleKeyDown, { capture: true });
54585
+ };
54586
+ }, [eventBus, enabled, keyEvent]);
54587
+ }
53757
54588
  function expressionEqual(a, b) {
53758
54589
  if (Object.is(a, b)) return true;
53759
54590
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -53781,7 +54612,7 @@ function expressionEqual(a, b) {
53781
54612
  function isPlainSlotObject(value) {
53782
54613
  if (value === null || value === void 0 || typeof value !== "object") return false;
53783
54614
  if (Array.isArray(value)) return false;
53784
- if (React78__default.isValidElement(value)) return false;
54615
+ if (React79__default.isValidElement(value)) return false;
53785
54616
  if (value instanceof Date) return false;
53786
54617
  if (isRenderBindingMarker(value)) return false;
53787
54618
  return true;
@@ -53800,7 +54631,7 @@ function shareValue(prev, next) {
53800
54631
  return prev instanceof Date && next instanceof Date && prev.getTime() === next.getTime() ? { value: prev, equal: true } : { value: next, equal: false };
53801
54632
  }
53802
54633
  if (typeof prev === "function" || typeof next === "function") return { value: next, equal: false };
53803
- if (React78__default.isValidElement(prev) || React78__default.isValidElement(next)) return { value: next, equal: false };
54634
+ if (React79__default.isValidElement(prev) || React79__default.isValidElement(next)) return { value: next, equal: false };
53804
54635
  if (Array.isArray(prev) && Array.isArray(next)) {
53805
54636
  let equal = prev.length === next.length;
53806
54637
  const out = new Array(next.length);
@@ -53836,21 +54667,12 @@ function reconcileSlotProps(prev, next) {
53836
54667
  }
53837
54668
 
53838
54669
  // hooks/useUISlots.ts
53839
- var log17 = createLogger("almadar:ui:ui-slots");
54670
+ var log18 = createLogger("almadar:ui:ui-slots");
53840
54671
  var DEFAULT_SOURCE_KEY = "__default__";
53841
54672
  var MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
53842
- var ALL_SLOTS2 = [
53843
- "main",
53844
- "sidebar",
53845
- "modal",
53846
- "drawer",
53847
- "overlay",
53848
- "center",
53849
- "toast",
53850
- "hud-top",
53851
- "hud-bottom",
53852
- "floating"
53853
- ];
54673
+ var ALL_SLOTS2 = UI_SLOTS.filter(
54674
+ (slot) => !slot.includes(".") && slot !== "hud" && slot !== "screen"
54675
+ );
53854
54676
  var DEFAULT_SLOTS = ALL_SLOTS2.reduce(
53855
54677
  (acc, slot) => {
53856
54678
  acc[slot] = null;
@@ -53913,7 +54735,7 @@ function useUISlotManager() {
53913
54735
  try {
53914
54736
  callback(slot, content);
53915
54737
  } catch (error) {
53916
- log17.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
54738
+ log18.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
53917
54739
  }
53918
54740
  });
53919
54741
  }, []);
@@ -53925,7 +54747,7 @@ function useUISlotManager() {
53925
54747
  try {
53926
54748
  callback(content);
53927
54749
  } catch (error) {
53928
- log17.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
54750
+ log18.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
53929
54751
  }
53930
54752
  });
53931
54753
  },
@@ -53982,7 +54804,7 @@ function useUISlotManager() {
53982
54804
  const slotSources = prev[config.target] ?? {};
53983
54805
  const existing = slotSources[sourceKey];
53984
54806
  if (existing && existing.priority > content.priority) {
53985
- log17.warn("Slot already has higher priority content", {
54807
+ log18.warn("Slot already has higher priority content", {
53986
54808
  slot: config.target,
53987
54809
  sourceKey,
53988
54810
  existingPriority: existing.priority,
@@ -53993,7 +54815,7 @@ function useUISlotManager() {
53993
54815
  if (existing && existing.priority === content.priority && existing.pattern === content.pattern && existing.animation === content.animation && existing.transitionEvent === content.transitionEvent && existing.fromState === content.fromState && existing.entity === content.entity && existing.nodeId === content.nodeId && existing.autoDismissAt === void 0 && content.autoDismissAt === void 0 && existing.onDismiss === void 0 === (content.onDismiss === void 0)) {
53994
54816
  const reconciled = reconcileSlotProps(existing.props, content.props);
53995
54817
  if (reconciled.equal) {
53996
- log17.debug("slot:flush-bail", { slot: config.target, sourceKey, pattern: content.pattern });
54818
+ log18.debug("slot:flush-bail", { slot: config.target, sourceKey, pattern: content.pattern });
53997
54819
  return prev;
53998
54820
  }
53999
54821
  content.props = reconciled.value;
@@ -54005,7 +54827,7 @@ function useUISlotManager() {
54005
54827
  const nextAll = { ...prev, [config.target]: nextSources };
54006
54828
  const priorWriters = Object.keys(slotSources);
54007
54829
  if (priorWriters.length === 1 && priorWriters[0] !== sourceKey) {
54008
- log17.warn("slot:contention", {
54830
+ log18.warn("slot:contention", {
54009
54831
  slot: config.target,
54010
54832
  writers: [priorWriters[0], sourceKey],
54011
54833
  patternTypes: [slotSources[priorWriters[0]].pattern, content.pattern]
@@ -54015,7 +54837,7 @@ function useUISlotManager() {
54015
54837
  indexTraitRender(content.sourceTrait, content);
54016
54838
  notifyTraitSubscribers(content.sourceTrait, content);
54017
54839
  }
54018
- log17.info("slot:written", {
54840
+ log18.info("slot:written", {
54019
54841
  slot: config.target,
54020
54842
  sourceKey,
54021
54843
  sourceTrait: content.sourceTrait,
@@ -54060,7 +54882,7 @@ function useUISlotManager() {
54060
54882
  setSources((prev) => {
54061
54883
  const slotSources = prev[slot];
54062
54884
  if (!slotSources || !(sourceKey in slotSources)) {
54063
- log17.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
54885
+ log18.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
54064
54886
  return prev;
54065
54887
  }
54066
54888
  const content = slotSources[sourceKey];
@@ -54076,7 +54898,7 @@ function useUISlotManager() {
54076
54898
  }
54077
54899
  const nextSources = { ...slotSources };
54078
54900
  delete nextSources[sourceKey];
54079
- log17.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
54901
+ log18.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
54080
54902
  notifySubscribers(slot, aggregateSlot(nextSources));
54081
54903
  return { ...prev, [slot]: nextSources };
54082
54904
  });
@@ -54252,7 +55074,7 @@ function useTraitListens(dispatch, listens, eventBusInstance) {
54252
55074
  };
54253
55075
  }, [eventBus, dispatch, stableListens]);
54254
55076
  }
54255
- var log18 = createLogger("almadar:ui:shared-entity-store");
55077
+ var log19 = createLogger("almadar:ui:shared-entity-store");
54256
55078
  var EMPTY_ENTITY_STATE = {};
54257
55079
  function createSharedEntityStore() {
54258
55080
  const states = /* @__PURE__ */ new Map();
@@ -54282,7 +55104,7 @@ function createSharedEntityStore() {
54282
55104
  try {
54283
55105
  callback();
54284
55106
  } catch (error) {
54285
- log18.error("Shared entity subscriber error", {
55107
+ log19.error("Shared entity subscriber error", {
54286
55108
  entityId,
54287
55109
  error: error instanceof Error ? error : String(error)
54288
55110
  });
@@ -54888,7 +55710,8 @@ var en_default = {
54888
55710
  "richTextEditor.image": "Insert image",
54889
55711
  "richTextEditor.imagePrompt": "Image URL",
54890
55712
  "richTextEditor.placeholder": "Start writing\u2026",
54891
- "form.imageUrlFallback": "\u2026or paste an image address"
55713
+ "form.imageUrlFallback": "\u2026or paste an image address",
55714
+ "mermaid.unrenderable": "This diagram could not be displayed. Its source is shown below."
54892
55715
  };
54893
55716
 
54894
55717
  // hooks/useTranslate.ts
@@ -54909,7 +55732,7 @@ var I18nContext = createContext({
54909
55732
  });
54910
55733
  I18nContext.displayName = "I18nContext";
54911
55734
  var I18nProvider = I18nContext.Provider;
54912
- function useTranslate116() {
55735
+ function useTranslate117() {
54913
55736
  return useContext(I18nContext);
54914
55737
  }
54915
55738
  function createTranslate(messages) {
@@ -55095,4 +55918,4 @@ function useGitHubBranches(owner, repo, enabled = true) {
55095
55918
  });
55096
55919
  }
55097
55920
 
55098
- export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate116 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };
55921
+ export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioCue, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, dispatchCommandPaletteCommand, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useKeyboardRouter, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate117 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };