@almadar/ui 5.86.0 → 5.87.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.
- package/dist/avl/index.cjs +3349 -1250
- package/dist/avl/index.js +2399 -300
- package/dist/components/game/2d/molecules/index.d.ts +23 -15
- package/dist/components/game/2d/organisms/BuilderBoard.d.ts +60 -0
- package/dist/components/game/2d/organisms/ClassifierBoard.d.ts +66 -0
- package/dist/components/game/2d/organisms/DebuggerBoard.d.ts +61 -0
- package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +42 -0
- package/dist/components/game/2d/organisms/NegotiatorBoard.d.ts +56 -0
- package/dist/components/game/2d/{molecules → organisms}/SequenceBar.d.ts +3 -8
- package/dist/components/game/2d/organisms/SequencerBoard.d.ts +69 -0
- package/dist/components/game/2d/organisms/SimulatorBoard.d.ts +58 -0
- package/dist/components/game/2d/organisms/StateArchitectBoard.d.ts +61 -0
- package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
- package/dist/components/index.cjs +2972 -1243
- package/dist/components/index.js +2004 -283
- package/dist/providers/index.cjs +3209 -1110
- package/dist/providers/index.js +2368 -269
- package/dist/runtime/index.cjs +3205 -1106
- package/dist/runtime/index.js +2374 -275
- package/package.json +1 -1
- /package/dist/components/game/2d/{molecules → organisms}/ActionPalette.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ActionTile.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/EventLog.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ObjectRulePanel.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/RuleEditor.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationCanvas.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationControls.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationGraph.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateJsonView.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateNode.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitSlot.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitStateViewer.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TransitionArrow.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/VariablePanel.d.ts +0 -0
package/dist/avl/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as React104 from 'react';
|
|
3
|
+
import React104__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
|
|
4
4
|
import { getAllPages, OrbitalProvider, EventBusContext, useTraitScope, ServerBridgeProvider, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge, useEntitySchema, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath } from '@almadar/ui/providers';
|
|
5
5
|
import { createLogger, isLogLevelEnabled } from '@almadar/logger';
|
|
6
6
|
import ELK from 'elkjs/lib/elk.bundled.js';
|
|
7
7
|
import { MarkerType, useReactFlow, Handle, Position, getBezierPath, EdgeLabelRenderer, useNodeId, ReactFlowProvider, BaseEdge, useNodesState, useEdgesState, ReactFlow, Controls, Background, BackgroundVariant } from '@xyflow/react';
|
|
8
8
|
import { useTranslate } from '@almadar/ui/hooks';
|
|
9
9
|
import * as LucideIcons2 from 'lucide-react';
|
|
10
|
-
import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, ChevronDown, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, ChevronUp, Tag, User, DollarSign } from 'lucide-react';
|
|
10
|
+
import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, ChevronDown, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, Bug, Send, ChevronUp, Wrench, Tag, User, DollarSign } from 'lucide-react';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
12
|
import { UISlotProvider, useUISlots, useTheme } from '@almadar/ui/context';
|
|
13
13
|
import { evaluateGuard, evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
@@ -3174,7 +3174,7 @@ var init_Typography = __esm({
|
|
|
3174
3174
|
}) => {
|
|
3175
3175
|
const variant = variantProp ?? (level ? `h${level}` : "body1");
|
|
3176
3176
|
const Component = as || defaultElements[variant];
|
|
3177
|
-
return
|
|
3177
|
+
return React104__default.createElement(
|
|
3178
3178
|
Component,
|
|
3179
3179
|
{
|
|
3180
3180
|
id,
|
|
@@ -3511,7 +3511,7 @@ var init_Box = __esm({
|
|
|
3511
3511
|
fixed: "fixed",
|
|
3512
3512
|
sticky: "sticky"
|
|
3513
3513
|
};
|
|
3514
|
-
Box =
|
|
3514
|
+
Box = React104__default.forwardRef(
|
|
3515
3515
|
({
|
|
3516
3516
|
padding,
|
|
3517
3517
|
paddingX,
|
|
@@ -3576,7 +3576,7 @@ var init_Box = __esm({
|
|
|
3576
3576
|
onPointerDown?.(e);
|
|
3577
3577
|
}, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
|
|
3578
3578
|
const isClickable = action || onClick;
|
|
3579
|
-
return
|
|
3579
|
+
return React104__default.createElement(
|
|
3580
3580
|
Component,
|
|
3581
3581
|
{
|
|
3582
3582
|
ref,
|
|
@@ -3672,7 +3672,7 @@ var init_Stack = __esm({
|
|
|
3672
3672
|
};
|
|
3673
3673
|
const isHorizontal = direction === "horizontal";
|
|
3674
3674
|
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";
|
|
3675
|
-
return
|
|
3675
|
+
return React104__default.createElement(
|
|
3676
3676
|
Component,
|
|
3677
3677
|
{
|
|
3678
3678
|
className: cn(
|
|
@@ -4164,7 +4164,7 @@ var init_MiniStateMachine = __esm({
|
|
|
4164
4164
|
const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
|
|
4165
4165
|
const tc = transitionCounts[s.name] ?? 0;
|
|
4166
4166
|
const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
|
|
4167
|
-
return /* @__PURE__ */ jsxs(
|
|
4167
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
4168
4168
|
/* @__PURE__ */ jsx(
|
|
4169
4169
|
AvlState,
|
|
4170
4170
|
{
|
|
@@ -4494,7 +4494,7 @@ function loadLib(key, importer) {
|
|
|
4494
4494
|
return p;
|
|
4495
4495
|
}
|
|
4496
4496
|
function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
4497
|
-
const Lazy =
|
|
4497
|
+
const Lazy = React104__default.lazy(async () => {
|
|
4498
4498
|
const lib = await loadLib(libKey, importer);
|
|
4499
4499
|
const Comp = pick(lib);
|
|
4500
4500
|
if (!Comp) {
|
|
@@ -4504,7 +4504,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
|
4504
4504
|
return { default: Comp };
|
|
4505
4505
|
});
|
|
4506
4506
|
const Wrapped = (props) => /* @__PURE__ */ jsx(
|
|
4507
|
-
|
|
4507
|
+
React104__default.Suspense,
|
|
4508
4508
|
{
|
|
4509
4509
|
fallback: /* @__PURE__ */ jsx(
|
|
4510
4510
|
"span",
|
|
@@ -5235,7 +5235,7 @@ var init_Icon = __esm({
|
|
|
5235
5235
|
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
5236
5236
|
const effectiveName = typeof icon === "string" ? icon : name;
|
|
5237
5237
|
const family = useIconFamily();
|
|
5238
|
-
const RenderedComponent =
|
|
5238
|
+
const RenderedComponent = React104__default.useMemo(() => {
|
|
5239
5239
|
if (directIcon) return null;
|
|
5240
5240
|
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
5241
5241
|
}, [directIcon, effectiveName, family]);
|
|
@@ -5297,7 +5297,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
5297
5297
|
const IconComp = value;
|
|
5298
5298
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
5299
5299
|
}
|
|
5300
|
-
if (
|
|
5300
|
+
if (React104__default.isValidElement(value)) {
|
|
5301
5301
|
return value;
|
|
5302
5302
|
}
|
|
5303
5303
|
if (typeof value === "object" && value !== null && isIconLike(value)) {
|
|
@@ -5373,7 +5373,7 @@ var init_Button = __esm({
|
|
|
5373
5373
|
md: "h-icon-default w-icon-default",
|
|
5374
5374
|
lg: "h-icon-default w-icon-default"
|
|
5375
5375
|
};
|
|
5376
|
-
Button =
|
|
5376
|
+
Button = React104__default.forwardRef(
|
|
5377
5377
|
({
|
|
5378
5378
|
className,
|
|
5379
5379
|
variant = "primary",
|
|
@@ -5441,7 +5441,7 @@ var Dialog;
|
|
|
5441
5441
|
var init_Dialog = __esm({
|
|
5442
5442
|
"components/core/atoms/Dialog.tsx"() {
|
|
5443
5443
|
init_cn();
|
|
5444
|
-
Dialog =
|
|
5444
|
+
Dialog = React104__default.forwardRef(
|
|
5445
5445
|
({
|
|
5446
5446
|
role = "dialog",
|
|
5447
5447
|
"aria-modal": ariaModal = true,
|
|
@@ -5936,7 +5936,7 @@ var init_Badge = __esm({
|
|
|
5936
5936
|
md: "px-2.5 py-1 text-sm",
|
|
5937
5937
|
lg: "px-3 py-1.5 text-base"
|
|
5938
5938
|
};
|
|
5939
|
-
Badge =
|
|
5939
|
+
Badge = React104__default.forwardRef(
|
|
5940
5940
|
({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
|
|
5941
5941
|
const iconSizes3 = {
|
|
5942
5942
|
sm: "h-icon-default w-icon-default",
|
|
@@ -6273,7 +6273,7 @@ var init_SvgFlow = __esm({
|
|
|
6273
6273
|
width = 100,
|
|
6274
6274
|
height = 100
|
|
6275
6275
|
}) => {
|
|
6276
|
-
const markerId =
|
|
6276
|
+
const markerId = React104__default.useMemo(() => {
|
|
6277
6277
|
flowIdCounter += 1;
|
|
6278
6278
|
return `almadar-flow-arrow-${flowIdCounter}`;
|
|
6279
6279
|
}, []);
|
|
@@ -6326,7 +6326,7 @@ var init_SvgGrid = __esm({
|
|
|
6326
6326
|
x = 10,
|
|
6327
6327
|
y = 10,
|
|
6328
6328
|
cols = 4,
|
|
6329
|
-
rows = 3,
|
|
6329
|
+
rows: rows2 = 3,
|
|
6330
6330
|
spacing = 20,
|
|
6331
6331
|
nodeRadius = 3,
|
|
6332
6332
|
color = "var(--color-primary)",
|
|
@@ -6338,7 +6338,7 @@ var init_SvgGrid = __esm({
|
|
|
6338
6338
|
height = 100
|
|
6339
6339
|
}) => {
|
|
6340
6340
|
const highlightSet = new Set(highlights);
|
|
6341
|
-
const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length:
|
|
6341
|
+
const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
|
|
6342
6342
|
(_, row) => Array.from({ length: cols }).map((_2, col) => {
|
|
6343
6343
|
const index = row * cols + col;
|
|
6344
6344
|
const isHighlighted = highlightSet.has(index);
|
|
@@ -6866,7 +6866,7 @@ var init_SvgRing = __esm({
|
|
|
6866
6866
|
width = 100,
|
|
6867
6867
|
height = 100
|
|
6868
6868
|
}) => {
|
|
6869
|
-
const gradientId =
|
|
6869
|
+
const gradientId = React104__default.useMemo(() => {
|
|
6870
6870
|
ringIdCounter += 1;
|
|
6871
6871
|
return `almadar-ring-glow-${ringIdCounter}`;
|
|
6872
6872
|
}, []);
|
|
@@ -7047,7 +7047,7 @@ var init_Input = __esm({
|
|
|
7047
7047
|
init_cn();
|
|
7048
7048
|
init_Icon();
|
|
7049
7049
|
init_useEventBus();
|
|
7050
|
-
Input =
|
|
7050
|
+
Input = React104__default.forwardRef(
|
|
7051
7051
|
({
|
|
7052
7052
|
className,
|
|
7053
7053
|
inputType,
|
|
@@ -7062,7 +7062,7 @@ var init_Input = __esm({
|
|
|
7062
7062
|
onClear,
|
|
7063
7063
|
value,
|
|
7064
7064
|
options,
|
|
7065
|
-
rows = 3,
|
|
7065
|
+
rows: rows2 = 3,
|
|
7066
7066
|
onChange,
|
|
7067
7067
|
...props
|
|
7068
7068
|
}, ref) => {
|
|
@@ -7144,7 +7144,7 @@ var init_Input = __esm({
|
|
|
7144
7144
|
ref,
|
|
7145
7145
|
value,
|
|
7146
7146
|
onChange: handleChange,
|
|
7147
|
-
rows,
|
|
7147
|
+
rows: rows2,
|
|
7148
7148
|
className: baseClassName,
|
|
7149
7149
|
...props
|
|
7150
7150
|
}
|
|
@@ -7207,7 +7207,7 @@ var Label;
|
|
|
7207
7207
|
var init_Label = __esm({
|
|
7208
7208
|
"components/core/atoms/Label.tsx"() {
|
|
7209
7209
|
init_cn();
|
|
7210
|
-
Label =
|
|
7210
|
+
Label = React104__default.forwardRef(
|
|
7211
7211
|
({ className, required, children, ...props }, ref) => {
|
|
7212
7212
|
return /* @__PURE__ */ jsxs(
|
|
7213
7213
|
"label",
|
|
@@ -7234,7 +7234,7 @@ var init_Textarea = __esm({
|
|
|
7234
7234
|
"components/core/atoms/Textarea.tsx"() {
|
|
7235
7235
|
init_cn();
|
|
7236
7236
|
init_useEventBus();
|
|
7237
|
-
Textarea =
|
|
7237
|
+
Textarea = React104__default.forwardRef(
|
|
7238
7238
|
({ className, error, onChange, ...props }, ref) => {
|
|
7239
7239
|
const eventBus = useEventBus();
|
|
7240
7240
|
const handleChange = (e) => {
|
|
@@ -7473,7 +7473,7 @@ var init_Select = __esm({
|
|
|
7473
7473
|
init_cn();
|
|
7474
7474
|
init_Icon();
|
|
7475
7475
|
init_useEventBus();
|
|
7476
|
-
Select =
|
|
7476
|
+
Select = React104__default.forwardRef(
|
|
7477
7477
|
(props, _ref) => {
|
|
7478
7478
|
const { multiple, searchable, clearable } = props;
|
|
7479
7479
|
if (multiple || searchable || clearable) {
|
|
@@ -7490,7 +7490,7 @@ var init_Checkbox = __esm({
|
|
|
7490
7490
|
"components/core/atoms/Checkbox.tsx"() {
|
|
7491
7491
|
init_cn();
|
|
7492
7492
|
init_useEventBus();
|
|
7493
|
-
Checkbox =
|
|
7493
|
+
Checkbox = React104__default.forwardRef(
|
|
7494
7494
|
({ className, label, id, onChange, ...props }, ref) => {
|
|
7495
7495
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
7496
7496
|
const eventBus = useEventBus();
|
|
@@ -7544,7 +7544,7 @@ var init_Spinner = __esm({
|
|
|
7544
7544
|
md: "h-6 w-6",
|
|
7545
7545
|
lg: "h-8 w-8"
|
|
7546
7546
|
};
|
|
7547
|
-
Spinner =
|
|
7547
|
+
Spinner = React104__default.forwardRef(
|
|
7548
7548
|
({ className, size = "md", overlay, ...props }, ref) => {
|
|
7549
7549
|
if (overlay) {
|
|
7550
7550
|
return /* @__PURE__ */ jsx(
|
|
@@ -7634,7 +7634,7 @@ var init_Card = __esm({
|
|
|
7634
7634
|
chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
|
|
7635
7635
|
"tile-image-first": "p-0 overflow-hidden"
|
|
7636
7636
|
};
|
|
7637
|
-
Card =
|
|
7637
|
+
Card = React104__default.forwardRef(
|
|
7638
7638
|
({
|
|
7639
7639
|
className,
|
|
7640
7640
|
variant = "bordered",
|
|
@@ -7682,9 +7682,9 @@ var init_Card = __esm({
|
|
|
7682
7682
|
}
|
|
7683
7683
|
);
|
|
7684
7684
|
Card.displayName = "Card";
|
|
7685
|
-
CardHeader =
|
|
7685
|
+
CardHeader = React104__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
7686
7686
|
CardHeader.displayName = "CardHeader";
|
|
7687
|
-
CardTitle =
|
|
7687
|
+
CardTitle = React104__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7688
7688
|
"h3",
|
|
7689
7689
|
{
|
|
7690
7690
|
ref,
|
|
@@ -7697,11 +7697,11 @@ var init_Card = __esm({
|
|
|
7697
7697
|
}
|
|
7698
7698
|
));
|
|
7699
7699
|
CardTitle.displayName = "CardTitle";
|
|
7700
|
-
CardContent =
|
|
7700
|
+
CardContent = React104__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
7701
7701
|
CardContent.displayName = "CardContent";
|
|
7702
7702
|
CardBody = CardContent;
|
|
7703
7703
|
CardBody.displayName = "CardBody";
|
|
7704
|
-
CardFooter =
|
|
7704
|
+
CardFooter = React104__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7705
7705
|
"div",
|
|
7706
7706
|
{
|
|
7707
7707
|
ref,
|
|
@@ -7756,7 +7756,7 @@ var init_FilterPill = __esm({
|
|
|
7756
7756
|
md: "w-3.5 h-3.5",
|
|
7757
7757
|
lg: "w-4 h-4"
|
|
7758
7758
|
};
|
|
7759
|
-
FilterPill =
|
|
7759
|
+
FilterPill = React104__default.forwardRef(
|
|
7760
7760
|
({
|
|
7761
7761
|
className,
|
|
7762
7762
|
variant = "default",
|
|
@@ -7885,8 +7885,8 @@ var init_Avatar = __esm({
|
|
|
7885
7885
|
actionPayload
|
|
7886
7886
|
}) => {
|
|
7887
7887
|
const eventBus = useEventBus();
|
|
7888
|
-
const [imgFailed, setImgFailed] =
|
|
7889
|
-
|
|
7888
|
+
const [imgFailed, setImgFailed] = React104__default.useState(false);
|
|
7889
|
+
React104__default.useEffect(() => {
|
|
7890
7890
|
setImgFailed(false);
|
|
7891
7891
|
}, [src]);
|
|
7892
7892
|
const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
|
|
@@ -7999,7 +7999,7 @@ var init_Center = __esm({
|
|
|
7999
7999
|
as: Component = "div"
|
|
8000
8000
|
}) => {
|
|
8001
8001
|
const mergedStyle = minHeight ? { minHeight, ...style } : style;
|
|
8002
|
-
return
|
|
8002
|
+
return React104__default.createElement(Component, {
|
|
8003
8003
|
className: cn(
|
|
8004
8004
|
inline ? "inline-flex" : "flex",
|
|
8005
8005
|
horizontal && "justify-center",
|
|
@@ -8267,7 +8267,7 @@ var init_Radio = __esm({
|
|
|
8267
8267
|
md: "w-2.5 h-2.5",
|
|
8268
8268
|
lg: "w-3 h-3"
|
|
8269
8269
|
};
|
|
8270
|
-
Radio =
|
|
8270
|
+
Radio = React104__default.forwardRef(
|
|
8271
8271
|
({
|
|
8272
8272
|
label,
|
|
8273
8273
|
helperText,
|
|
@@ -8284,12 +8284,12 @@ var init_Radio = __esm({
|
|
|
8284
8284
|
onChange,
|
|
8285
8285
|
...props
|
|
8286
8286
|
}, ref) => {
|
|
8287
|
-
const reactId =
|
|
8287
|
+
const reactId = React104__default.useId();
|
|
8288
8288
|
const baseId = id || `radio-${reactId}`;
|
|
8289
8289
|
const hasError = !!error;
|
|
8290
8290
|
const eventBus = useEventBus();
|
|
8291
|
-
const [selected, setSelected] =
|
|
8292
|
-
|
|
8291
|
+
const [selected, setSelected] = React104__default.useState(value);
|
|
8292
|
+
React104__default.useEffect(() => {
|
|
8293
8293
|
if (value !== void 0) setSelected(value);
|
|
8294
8294
|
}, [value]);
|
|
8295
8295
|
const pick = (next, e) => {
|
|
@@ -8471,7 +8471,7 @@ var init_Switch = __esm({
|
|
|
8471
8471
|
"components/core/atoms/Switch.tsx"() {
|
|
8472
8472
|
"use client";
|
|
8473
8473
|
init_cn();
|
|
8474
|
-
Switch =
|
|
8474
|
+
Switch = React104.forwardRef(
|
|
8475
8475
|
({
|
|
8476
8476
|
checked,
|
|
8477
8477
|
defaultChecked = false,
|
|
@@ -8482,10 +8482,10 @@ var init_Switch = __esm({
|
|
|
8482
8482
|
name,
|
|
8483
8483
|
className
|
|
8484
8484
|
}, ref) => {
|
|
8485
|
-
const [isChecked, setIsChecked] =
|
|
8485
|
+
const [isChecked, setIsChecked] = React104.useState(
|
|
8486
8486
|
checked !== void 0 ? checked : defaultChecked
|
|
8487
8487
|
);
|
|
8488
|
-
|
|
8488
|
+
React104.useEffect(() => {
|
|
8489
8489
|
if (checked !== void 0) {
|
|
8490
8490
|
setIsChecked(checked);
|
|
8491
8491
|
}
|
|
@@ -8763,7 +8763,7 @@ var Aside;
|
|
|
8763
8763
|
var init_Aside = __esm({
|
|
8764
8764
|
"components/core/atoms/Aside.tsx"() {
|
|
8765
8765
|
init_cn();
|
|
8766
|
-
Aside =
|
|
8766
|
+
Aside = React104__default.forwardRef(
|
|
8767
8767
|
({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
|
|
8768
8768
|
);
|
|
8769
8769
|
Aside.displayName = "Aside";
|
|
@@ -8842,9 +8842,9 @@ var init_LawReferenceTooltip = __esm({
|
|
|
8842
8842
|
className
|
|
8843
8843
|
}) => {
|
|
8844
8844
|
const { t } = useTranslate();
|
|
8845
|
-
const [isVisible, setIsVisible] =
|
|
8846
|
-
const timeoutRef =
|
|
8847
|
-
const triggerRef =
|
|
8845
|
+
const [isVisible, setIsVisible] = React104__default.useState(false);
|
|
8846
|
+
const timeoutRef = React104__default.useRef(null);
|
|
8847
|
+
const triggerRef = React104__default.useRef(null);
|
|
8848
8848
|
const handleMouseEnter = () => {
|
|
8849
8849
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8850
8850
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -8855,7 +8855,7 @@ var init_LawReferenceTooltip = __esm({
|
|
|
8855
8855
|
};
|
|
8856
8856
|
const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
|
|
8857
8857
|
const open = isVisible || revealed;
|
|
8858
|
-
|
|
8858
|
+
React104__default.useEffect(() => {
|
|
8859
8859
|
return () => {
|
|
8860
8860
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8861
8861
|
};
|
|
@@ -9065,7 +9065,7 @@ var init_StatusDot = __esm({
|
|
|
9065
9065
|
md: "w-2.5 h-2.5",
|
|
9066
9066
|
lg: "w-3 h-3"
|
|
9067
9067
|
};
|
|
9068
|
-
StatusDot =
|
|
9068
|
+
StatusDot = React104__default.forwardRef(
|
|
9069
9069
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
9070
9070
|
return /* @__PURE__ */ jsx(
|
|
9071
9071
|
"span",
|
|
@@ -9119,7 +9119,7 @@ var init_TrendIndicator = __esm({
|
|
|
9119
9119
|
down: "trending-down",
|
|
9120
9120
|
flat: "arrow-right"
|
|
9121
9121
|
};
|
|
9122
|
-
TrendIndicator =
|
|
9122
|
+
TrendIndicator = React104__default.forwardRef(
|
|
9123
9123
|
({
|
|
9124
9124
|
className,
|
|
9125
9125
|
value,
|
|
@@ -9186,7 +9186,7 @@ var init_RangeSlider = __esm({
|
|
|
9186
9186
|
md: "w-4 h-4",
|
|
9187
9187
|
lg: "w-5 h-5"
|
|
9188
9188
|
};
|
|
9189
|
-
RangeSlider =
|
|
9189
|
+
RangeSlider = React104__default.forwardRef(
|
|
9190
9190
|
({
|
|
9191
9191
|
className,
|
|
9192
9192
|
min = 0,
|
|
@@ -9780,7 +9780,7 @@ var init_ContentSection = __esm({
|
|
|
9780
9780
|
md: "py-16",
|
|
9781
9781
|
lg: "py-24"
|
|
9782
9782
|
};
|
|
9783
|
-
ContentSection =
|
|
9783
|
+
ContentSection = React104__default.forwardRef(
|
|
9784
9784
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
9785
9785
|
return /* @__PURE__ */ jsx(
|
|
9786
9786
|
Box,
|
|
@@ -10314,7 +10314,7 @@ var init_AnimatedReveal = __esm({
|
|
|
10314
10314
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
10315
10315
|
"none": {}
|
|
10316
10316
|
};
|
|
10317
|
-
AnimatedReveal =
|
|
10317
|
+
AnimatedReveal = React104__default.forwardRef(
|
|
10318
10318
|
({
|
|
10319
10319
|
trigger = "scroll",
|
|
10320
10320
|
animation = "fade-up",
|
|
@@ -10474,7 +10474,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
10474
10474
|
"components/marketing/atoms/AnimatedGraphic.tsx"() {
|
|
10475
10475
|
"use client";
|
|
10476
10476
|
init_cn();
|
|
10477
|
-
AnimatedGraphic =
|
|
10477
|
+
AnimatedGraphic = React104__default.forwardRef(
|
|
10478
10478
|
({
|
|
10479
10479
|
src,
|
|
10480
10480
|
svgContent,
|
|
@@ -10497,7 +10497,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
10497
10497
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
10498
10498
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
10499
10499
|
const prevAnimateRef = useRef(animate);
|
|
10500
|
-
const setRef =
|
|
10500
|
+
const setRef = React104__default.useCallback(
|
|
10501
10501
|
(node) => {
|
|
10502
10502
|
containerRef.current = node;
|
|
10503
10503
|
if (typeof ref === "function") ref(node);
|
|
@@ -10645,6 +10645,20 @@ var init_effects = __esm({
|
|
|
10645
10645
|
});
|
|
10646
10646
|
|
|
10647
10647
|
// components/game/shared/boardEntity.ts
|
|
10648
|
+
function boardEntity(entity) {
|
|
10649
|
+
if (!entity) return void 0;
|
|
10650
|
+
return Array.isArray(entity) ? entity[0] : entity;
|
|
10651
|
+
}
|
|
10652
|
+
function str(v) {
|
|
10653
|
+
return v == null ? "" : String(v);
|
|
10654
|
+
}
|
|
10655
|
+
function num(v, fallback = 0) {
|
|
10656
|
+
const n = Number(v);
|
|
10657
|
+
return Number.isFinite(n) ? n : fallback;
|
|
10658
|
+
}
|
|
10659
|
+
function rows(v) {
|
|
10660
|
+
return Array.isArray(v) ? v : [];
|
|
10661
|
+
}
|
|
10648
10662
|
var init_boardEntity = __esm({
|
|
10649
10663
|
"components/game/shared/boardEntity.ts"() {
|
|
10650
10664
|
}
|
|
@@ -11090,7 +11104,7 @@ function GameCard({
|
|
|
11090
11104
|
className
|
|
11091
11105
|
}) {
|
|
11092
11106
|
const eventBus = useEventBus();
|
|
11093
|
-
const handleClick =
|
|
11107
|
+
const handleClick = React104.useCallback(() => {
|
|
11094
11108
|
if (disabled) return;
|
|
11095
11109
|
onClick?.(id);
|
|
11096
11110
|
if (clickEvent) eventBus.emit(`UI:${clickEvent}`, { cardId: id });
|
|
@@ -11372,9 +11386,9 @@ function ControlButton({
|
|
|
11372
11386
|
className
|
|
11373
11387
|
}) {
|
|
11374
11388
|
const eventBus = useEventBus();
|
|
11375
|
-
const [isPressed, setIsPressed] =
|
|
11389
|
+
const [isPressed, setIsPressed] = React104.useState(false);
|
|
11376
11390
|
const actualPressed = pressed ?? isPressed;
|
|
11377
|
-
const handlePointerDown =
|
|
11391
|
+
const handlePointerDown = React104.useCallback(
|
|
11378
11392
|
(e) => {
|
|
11379
11393
|
e.preventDefault();
|
|
11380
11394
|
if (disabled) return;
|
|
@@ -11384,7 +11398,7 @@ function ControlButton({
|
|
|
11384
11398
|
},
|
|
11385
11399
|
[disabled, pressEvent, eventBus, onPress]
|
|
11386
11400
|
);
|
|
11387
|
-
const handlePointerUp =
|
|
11401
|
+
const handlePointerUp = React104.useCallback(
|
|
11388
11402
|
(e) => {
|
|
11389
11403
|
e.preventDefault();
|
|
11390
11404
|
if (disabled) return;
|
|
@@ -11394,7 +11408,7 @@ function ControlButton({
|
|
|
11394
11408
|
},
|
|
11395
11409
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
11396
11410
|
);
|
|
11397
|
-
const handlePointerLeave =
|
|
11411
|
+
const handlePointerLeave = React104.useCallback(
|
|
11398
11412
|
(e) => {
|
|
11399
11413
|
if (isPressed) {
|
|
11400
11414
|
setIsPressed(false);
|
|
@@ -12413,8 +12427,8 @@ function MiniMap({
|
|
|
12413
12427
|
tileAssets,
|
|
12414
12428
|
unitAssets
|
|
12415
12429
|
}) {
|
|
12416
|
-
const canvasRef =
|
|
12417
|
-
const imgCacheRef =
|
|
12430
|
+
const canvasRef = React104.useRef(null);
|
|
12431
|
+
const imgCacheRef = React104.useRef(/* @__PURE__ */ new Map());
|
|
12418
12432
|
function loadImg(url) {
|
|
12419
12433
|
const cached = imgCacheRef.current.get(url);
|
|
12420
12434
|
if (cached) return cached.complete ? cached : null;
|
|
@@ -12429,7 +12443,7 @@ function MiniMap({
|
|
|
12429
12443
|
imgCacheRef.current.set(url, img);
|
|
12430
12444
|
return null;
|
|
12431
12445
|
}
|
|
12432
|
-
|
|
12446
|
+
React104.useEffect(() => {
|
|
12433
12447
|
const canvas = canvasRef.current;
|
|
12434
12448
|
if (!canvas) return;
|
|
12435
12449
|
const ctx = canvas.getContext("2d");
|
|
@@ -12564,8 +12578,8 @@ function ControlGrid({
|
|
|
12564
12578
|
className
|
|
12565
12579
|
}) {
|
|
12566
12580
|
const eventBus = useEventBus();
|
|
12567
|
-
const [active, setActive] =
|
|
12568
|
-
const handlePress =
|
|
12581
|
+
const [active, setActive] = React104.useState(/* @__PURE__ */ new Set());
|
|
12582
|
+
const handlePress = React104.useCallback(
|
|
12569
12583
|
(id) => {
|
|
12570
12584
|
setActive((prev) => new Set(prev).add(id));
|
|
12571
12585
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -12579,7 +12593,7 @@ function ControlGrid({
|
|
|
12579
12593
|
},
|
|
12580
12594
|
[kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
|
|
12581
12595
|
);
|
|
12582
|
-
const handleRelease =
|
|
12596
|
+
const handleRelease = React104.useCallback(
|
|
12583
12597
|
(id) => {
|
|
12584
12598
|
setActive((prev) => {
|
|
12585
12599
|
const next = new Set(prev);
|
|
@@ -12837,7 +12851,7 @@ function InventoryGrid({
|
|
|
12837
12851
|
const eventBus = useEventBus();
|
|
12838
12852
|
const slotCount = totalSlots ?? items.length;
|
|
12839
12853
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
12840
|
-
const handleSelect =
|
|
12854
|
+
const handleSelect = React104.useCallback(
|
|
12841
12855
|
(id) => {
|
|
12842
12856
|
onSelect?.(id);
|
|
12843
12857
|
if (selectEvent) {
|
|
@@ -13054,7 +13068,7 @@ function GameMenu({
|
|
|
13054
13068
|
}) {
|
|
13055
13069
|
const resolvedOptions = options ?? menuItems ?? DEFAULT_MENU_OPTIONS;
|
|
13056
13070
|
const eventBus = useEventBus();
|
|
13057
|
-
const handleOptionClick =
|
|
13071
|
+
const handleOptionClick = React104.useCallback(
|
|
13058
13072
|
(option) => {
|
|
13059
13073
|
if (option.event) {
|
|
13060
13074
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -14728,7 +14742,7 @@ function LinearView({
|
|
|
14728
14742
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
14729
14743
|
const isDone = i < currentIdx;
|
|
14730
14744
|
const isCurrent = i === currentIdx;
|
|
14731
|
-
return /* @__PURE__ */ jsxs(
|
|
14745
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
14732
14746
|
i > 0 && /* @__PURE__ */ jsx(
|
|
14733
14747
|
Typography,
|
|
14734
14748
|
{
|
|
@@ -14925,7 +14939,7 @@ function TraitStateViewer({
|
|
|
14925
14939
|
}
|
|
14926
14940
|
var SIZE_CONFIG;
|
|
14927
14941
|
var init_TraitStateViewer = __esm({
|
|
14928
|
-
"components/game/2d/
|
|
14942
|
+
"components/game/2d/organisms/TraitStateViewer.tsx"() {
|
|
14929
14943
|
"use client";
|
|
14930
14944
|
init_cn();
|
|
14931
14945
|
init_Box();
|
|
@@ -15132,7 +15146,7 @@ function TraitSlot({
|
|
|
15132
15146
|
}
|
|
15133
15147
|
var SIZE_CONFIG2, DRAG_MIME;
|
|
15134
15148
|
var init_TraitSlot = __esm({
|
|
15135
|
-
"components/game/2d/
|
|
15149
|
+
"components/game/2d/organisms/TraitSlot.tsx"() {
|
|
15136
15150
|
"use client";
|
|
15137
15151
|
init_cn();
|
|
15138
15152
|
init_useEventBus();
|
|
@@ -15191,7 +15205,7 @@ function ActionTile({
|
|
|
15191
15205
|
}
|
|
15192
15206
|
var DRAG_MIME2, SIZE_CONFIG3;
|
|
15193
15207
|
var init_ActionTile = __esm({
|
|
15194
|
-
"components/game/2d/
|
|
15208
|
+
"components/game/2d/organisms/ActionTile.tsx"() {
|
|
15195
15209
|
init_atoms();
|
|
15196
15210
|
init_cn();
|
|
15197
15211
|
DRAG_MIME2 = "application/x-almadar-slot-item";
|
|
@@ -15228,7 +15242,7 @@ function ActionPalette({
|
|
|
15228
15242
|
] });
|
|
15229
15243
|
}
|
|
15230
15244
|
var init_ActionPalette = __esm({
|
|
15231
|
-
"components/game/2d/
|
|
15245
|
+
"components/game/2d/organisms/ActionPalette.tsx"() {
|
|
15232
15246
|
init_atoms();
|
|
15233
15247
|
init_cn();
|
|
15234
15248
|
init_ActionTile();
|
|
@@ -15240,8 +15254,6 @@ function SequenceBar({
|
|
|
15240
15254
|
maxSlots,
|
|
15241
15255
|
onSlotDrop,
|
|
15242
15256
|
onSlotRemove,
|
|
15243
|
-
slotDropEvent,
|
|
15244
|
-
slotRemoveEvent,
|
|
15245
15257
|
playing = false,
|
|
15246
15258
|
currentStep = -1,
|
|
15247
15259
|
categoryColors,
|
|
@@ -15249,19 +15261,16 @@ function SequenceBar({
|
|
|
15249
15261
|
size = "lg",
|
|
15250
15262
|
className
|
|
15251
15263
|
}) {
|
|
15252
|
-
const { emit } = useEventBus();
|
|
15253
15264
|
const handleDrop = useCallback((index) => (item) => {
|
|
15254
15265
|
if (playing) return;
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
}, [onSlotDrop, slotDropEvent, emit, playing]);
|
|
15266
|
+
onSlotDrop(index, item);
|
|
15267
|
+
}, [onSlotDrop, playing]);
|
|
15258
15268
|
const handleRemove = useCallback((index) => () => {
|
|
15259
15269
|
if (playing) return;
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
}, [onSlotRemove, slotRemoveEvent, emit, playing]);
|
|
15270
|
+
onSlotRemove(index);
|
|
15271
|
+
}, [onSlotRemove, playing]);
|
|
15263
15272
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
15264
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
15273
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
15265
15274
|
i > 0 && /* @__PURE__ */ jsx(
|
|
15266
15275
|
Typography,
|
|
15267
15276
|
{
|
|
@@ -15291,14 +15300,330 @@ function SequenceBar({
|
|
|
15291
15300
|
] }, i)) });
|
|
15292
15301
|
}
|
|
15293
15302
|
var init_SequenceBar = __esm({
|
|
15294
|
-
"components/game/2d/
|
|
15303
|
+
"components/game/2d/organisms/SequenceBar.tsx"() {
|
|
15295
15304
|
init_atoms();
|
|
15296
15305
|
init_cn();
|
|
15297
|
-
init_useEventBus();
|
|
15298
15306
|
init_TraitSlot();
|
|
15299
15307
|
SequenceBar.displayName = "SequenceBar";
|
|
15300
15308
|
}
|
|
15301
15309
|
});
|
|
15310
|
+
function computeSlotFeedback(playerSeq, solutions) {
|
|
15311
|
+
let bestSolution = solutions[0];
|
|
15312
|
+
let bestMatches = -1;
|
|
15313
|
+
for (const sol of solutions) {
|
|
15314
|
+
const matches = sol.filter((id, i) => id === playerSeq[i]).length;
|
|
15315
|
+
if (matches > bestMatches) {
|
|
15316
|
+
bestMatches = matches;
|
|
15317
|
+
bestSolution = sol;
|
|
15318
|
+
}
|
|
15319
|
+
}
|
|
15320
|
+
return playerSeq.map(
|
|
15321
|
+
(id, i) => id !== void 0 && id === bestSolution[i] ? "correct" : "wrong"
|
|
15322
|
+
);
|
|
15323
|
+
}
|
|
15324
|
+
function isFieldRecord(v) {
|
|
15325
|
+
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
15326
|
+
}
|
|
15327
|
+
function assetFromField(v) {
|
|
15328
|
+
if (!isFieldRecord(v)) return void 0;
|
|
15329
|
+
const url = typeof v.url === "string" ? v.url : void 0;
|
|
15330
|
+
const role = typeof v.role === "string" ? v.role : void 0;
|
|
15331
|
+
const category = typeof v.category === "string" ? v.category : "";
|
|
15332
|
+
if (!url || !role) return void 0;
|
|
15333
|
+
return {
|
|
15334
|
+
url,
|
|
15335
|
+
role,
|
|
15336
|
+
category,
|
|
15337
|
+
name: typeof v.name === "string" ? v.name : void 0,
|
|
15338
|
+
thumbnailUrl: typeof v.thumbnailUrl === "string" ? v.thumbnailUrl : void 0,
|
|
15339
|
+
style: typeof v.style === "string" ? v.style : void 0,
|
|
15340
|
+
variant: typeof v.variant === "string" ? v.variant : void 0,
|
|
15341
|
+
dimension: typeof v.dimension === "string" ? v.dimension : void 0,
|
|
15342
|
+
aspect: typeof v.aspect === "string" ? v.aspect : void 0
|
|
15343
|
+
};
|
|
15344
|
+
}
|
|
15345
|
+
function slotItemFromField(fv) {
|
|
15346
|
+
if (!isFieldRecord(fv)) return void 0;
|
|
15347
|
+
const id = typeof fv.id === "string" ? fv.id : void 0;
|
|
15348
|
+
const name = typeof fv.name === "string" ? fv.name : void 0;
|
|
15349
|
+
const category = typeof fv.category === "string" ? fv.category : void 0;
|
|
15350
|
+
if (!id || !name || !category) return void 0;
|
|
15351
|
+
return {
|
|
15352
|
+
id,
|
|
15353
|
+
name,
|
|
15354
|
+
category,
|
|
15355
|
+
description: typeof fv.description === "string" ? fv.description : void 0,
|
|
15356
|
+
iconEmoji: typeof fv.iconEmoji === "string" ? fv.iconEmoji : void 0,
|
|
15357
|
+
iconUrl: assetFromField(fv.iconUrl)
|
|
15358
|
+
};
|
|
15359
|
+
}
|
|
15360
|
+
function SequencerBoard({
|
|
15361
|
+
entity,
|
|
15362
|
+
categoryColors,
|
|
15363
|
+
stepDurationMs = 1e3,
|
|
15364
|
+
playEvent,
|
|
15365
|
+
completeEvent,
|
|
15366
|
+
placeEvent,
|
|
15367
|
+
removeEvent,
|
|
15368
|
+
checkEvent,
|
|
15369
|
+
playAgainEvent,
|
|
15370
|
+
stepEvent,
|
|
15371
|
+
className
|
|
15372
|
+
}) {
|
|
15373
|
+
const { emit } = useEventBus();
|
|
15374
|
+
const { t } = useTranslate();
|
|
15375
|
+
const resolved = boardEntity(entity);
|
|
15376
|
+
const maxSlots = num(resolved?.maxSlots) || 3;
|
|
15377
|
+
const solutions = Array.isArray(resolved?.solutions) ? resolved.solutions : [];
|
|
15378
|
+
const availableActions = (Array.isArray(resolved?.availableActions) ? resolved.availableActions : []).reduce((acc, fv) => {
|
|
15379
|
+
const item = slotItemFromField(fv);
|
|
15380
|
+
if (item) acc.push(item);
|
|
15381
|
+
return acc;
|
|
15382
|
+
}, []);
|
|
15383
|
+
const allowDuplicates = resolved?.allowDuplicates !== false;
|
|
15384
|
+
const entitySlots = Array.isArray(resolved?.slots) ? resolved.slots : [];
|
|
15385
|
+
const entityResult = str(resolved?.result);
|
|
15386
|
+
const entityAttempts = num(resolved?.attempts);
|
|
15387
|
+
const entityCurrentStep = typeof resolved?.currentStep === "number" ? resolved.currentStep : -1;
|
|
15388
|
+
const slots = Array.from({ length: maxSlots }, (_, i) => {
|
|
15389
|
+
const entitySlot = entitySlots.find((s) => s.index === i);
|
|
15390
|
+
if (!entitySlot?.placedActionId) return void 0;
|
|
15391
|
+
return availableActions.find((a) => a.id === entitySlot.placedActionId);
|
|
15392
|
+
});
|
|
15393
|
+
const isSuccess = entityResult === "win";
|
|
15394
|
+
const attempts = entityAttempts;
|
|
15395
|
+
const isPlayingBack = entityCurrentStep >= 0 && !isSuccess;
|
|
15396
|
+
const currentStep = entityCurrentStep;
|
|
15397
|
+
const [headerError, setHeaderError] = useState(false);
|
|
15398
|
+
const [slotFeedback, setSlotFeedback] = useState(
|
|
15399
|
+
() => Array.from({ length: maxSlots }, () => null)
|
|
15400
|
+
);
|
|
15401
|
+
const timerRef = useRef(null);
|
|
15402
|
+
useEffect(() => () => {
|
|
15403
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15404
|
+
}, []);
|
|
15405
|
+
const handleSlotDrop = useCallback((index, item) => {
|
|
15406
|
+
setSlotFeedback((prev) => {
|
|
15407
|
+
const next = [...prev];
|
|
15408
|
+
next[index] = null;
|
|
15409
|
+
return next;
|
|
15410
|
+
});
|
|
15411
|
+
emit("UI:PLAY_SOUND", { key: "drop_slot" });
|
|
15412
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotIndex: index, actionId: item.id });
|
|
15413
|
+
}, [emit, placeEvent]);
|
|
15414
|
+
const handleSlotRemove = useCallback((index) => {
|
|
15415
|
+
setSlotFeedback((prev) => {
|
|
15416
|
+
const next = [...prev];
|
|
15417
|
+
next[index] = null;
|
|
15418
|
+
return next;
|
|
15419
|
+
});
|
|
15420
|
+
emit("UI:PLAY_SOUND", { key: "back" });
|
|
15421
|
+
if (removeEvent) emit(`UI:${removeEvent}`, { slotIndex: index });
|
|
15422
|
+
}, [emit, removeEvent]);
|
|
15423
|
+
const handleReset = useCallback(() => {
|
|
15424
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15425
|
+
setSlotFeedback(Array.from({ length: maxSlots }, () => null));
|
|
15426
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
15427
|
+
}, [maxSlots, playAgainEvent, emit]);
|
|
15428
|
+
const filledSlots = slots.filter((s) => !!s);
|
|
15429
|
+
const canPlay = filledSlots.length > 0 && !isPlayingBack && !isSuccess;
|
|
15430
|
+
const handlePlay = useCallback(() => {
|
|
15431
|
+
if (!canPlay) return;
|
|
15432
|
+
setSlotFeedback(Array.from({ length: maxSlots }, () => null));
|
|
15433
|
+
emit("UI:PLAY_SOUND", { key: "confirm" });
|
|
15434
|
+
const sequence = slots.map((s) => s?.id || "");
|
|
15435
|
+
const playerIds = slots.filter(Boolean).map((s) => s?.id || "");
|
|
15436
|
+
if (playEvent) emit(`UI:${playEvent}`, { sequence });
|
|
15437
|
+
let step = 0;
|
|
15438
|
+
const advance = () => {
|
|
15439
|
+
step++;
|
|
15440
|
+
if (stepEvent) emit(`UI:${stepEvent}`, { step });
|
|
15441
|
+
if (step >= maxSlots) {
|
|
15442
|
+
if (checkEvent) emit(`UI:${checkEvent}`, { sequence: playerIds });
|
|
15443
|
+
const playerSeq = slots.map((s) => s?.id);
|
|
15444
|
+
const success = solutions.some(
|
|
15445
|
+
(sol) => sol.length === playerIds.length && sol.every((id, i) => id === playerIds[i])
|
|
15446
|
+
);
|
|
15447
|
+
if (success) {
|
|
15448
|
+
emit("UI:PLAY_SOUND", { key: "levelComplete" });
|
|
15449
|
+
if (completeEvent) emit(`UI:${completeEvent}`, { success: true, sequence: playerIds });
|
|
15450
|
+
} else {
|
|
15451
|
+
const feedback = computeSlotFeedback(playerSeq, solutions);
|
|
15452
|
+
setSlotFeedback(feedback);
|
|
15453
|
+
emit("UI:PLAY_SOUND", { key: "fail" });
|
|
15454
|
+
const correctCount2 = feedback.filter((f3) => f3 === "correct").length;
|
|
15455
|
+
for (let ci = 0; ci < correctCount2; ci++) {
|
|
15456
|
+
setTimeout(() => {
|
|
15457
|
+
emit("UI:PLAY_SOUND", { key: "correctSlot" });
|
|
15458
|
+
}, 300 + ci * 150);
|
|
15459
|
+
}
|
|
15460
|
+
}
|
|
15461
|
+
} else {
|
|
15462
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
15463
|
+
}
|
|
15464
|
+
};
|
|
15465
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
15466
|
+
}, [canPlay, slots, maxSlots, solutions, stepDurationMs, playEvent, completeEvent, checkEvent, emit]);
|
|
15467
|
+
const machine = {
|
|
15468
|
+
name: str(resolved?.title),
|
|
15469
|
+
description: str(resolved?.description),
|
|
15470
|
+
states: slots.map((s, i) => stepLabel(s, i)),
|
|
15471
|
+
currentState: currentStep >= 0 ? stepLabel(slots[currentStep], currentStep) : "__idle__",
|
|
15472
|
+
transitions: slots.slice(0, -1).map((s, i) => ({
|
|
15473
|
+
from: stepLabel(s, i),
|
|
15474
|
+
to: stepLabel(slots[i + 1], i + 1),
|
|
15475
|
+
event: "NEXT"
|
|
15476
|
+
}))
|
|
15477
|
+
};
|
|
15478
|
+
const usedIds = !allowDuplicates ? slots.filter(Boolean).map((s) => s?.id || "") : [];
|
|
15479
|
+
const hint = str(resolved?.hint);
|
|
15480
|
+
const showHint = attempts >= 3 && !!hint;
|
|
15481
|
+
const hasFeedback = slotFeedback.some((f3) => f3 !== null);
|
|
15482
|
+
const correctCount = slotFeedback.filter((f3) => f3 === "correct").length;
|
|
15483
|
+
const encourageKey = ENCOURAGEMENT_KEYS[Math.min(attempts - 1, ENCOURAGEMENT_KEYS.length - 1)] ?? ENCOURAGEMENT_KEYS[0];
|
|
15484
|
+
if (!resolved) return null;
|
|
15485
|
+
const theme = resolved.theme ?? void 0;
|
|
15486
|
+
const themeBackground = theme?.background;
|
|
15487
|
+
const headerImage = str(resolved.headerImage);
|
|
15488
|
+
return /* @__PURE__ */ jsxs(
|
|
15489
|
+
VStack,
|
|
15490
|
+
{
|
|
15491
|
+
className: cn("p-4 gap-6", className),
|
|
15492
|
+
style: {
|
|
15493
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
15494
|
+
backgroundSize: "cover",
|
|
15495
|
+
backgroundPosition: "center"
|
|
15496
|
+
},
|
|
15497
|
+
children: [
|
|
15498
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
15499
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15500
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
15501
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) })
|
|
15502
|
+
] }),
|
|
15503
|
+
showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
15504
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
15505
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
15506
|
+
] }) }),
|
|
15507
|
+
filledSlots.length > 0 && /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "linear", size: "md" }),
|
|
15508
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15509
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
15510
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("sequencer.yourSequence") + ":" }),
|
|
15511
|
+
hasFeedback && !isPlayingBack && !isSuccess && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
15512
|
+
`${correctCount}/${maxSlots} `,
|
|
15513
|
+
"\u2705"
|
|
15514
|
+
] })
|
|
15515
|
+
] }),
|
|
15516
|
+
/* @__PURE__ */ jsx(
|
|
15517
|
+
SequenceBar,
|
|
15518
|
+
{
|
|
15519
|
+
slots,
|
|
15520
|
+
maxSlots,
|
|
15521
|
+
onSlotDrop: handleSlotDrop,
|
|
15522
|
+
onSlotRemove: handleSlotRemove,
|
|
15523
|
+
playing: isPlayingBack,
|
|
15524
|
+
currentStep,
|
|
15525
|
+
categoryColors,
|
|
15526
|
+
slotFeedback,
|
|
15527
|
+
size: "lg"
|
|
15528
|
+
}
|
|
15529
|
+
)
|
|
15530
|
+
] }),
|
|
15531
|
+
!isPlayingBack && /* @__PURE__ */ jsx(
|
|
15532
|
+
ActionPalette,
|
|
15533
|
+
{
|
|
15534
|
+
actions: availableActions,
|
|
15535
|
+
usedActionIds: usedIds,
|
|
15536
|
+
allowDuplicates,
|
|
15537
|
+
categoryColors,
|
|
15538
|
+
label: t("sequencer.dragActions")
|
|
15539
|
+
}
|
|
15540
|
+
),
|
|
15541
|
+
hasFeedback && !isPlayingBack && !isSuccess && attempts > 0 && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: t(encourageKey) }) }),
|
|
15542
|
+
isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("sequencer.levelComplete") }) }),
|
|
15543
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
15544
|
+
/* @__PURE__ */ jsx(
|
|
15545
|
+
Button,
|
|
15546
|
+
{
|
|
15547
|
+
variant: "primary",
|
|
15548
|
+
onClick: handlePlay,
|
|
15549
|
+
disabled: !canPlay,
|
|
15550
|
+
children: "\u25B6 " + t("game.play")
|
|
15551
|
+
}
|
|
15552
|
+
),
|
|
15553
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
15554
|
+
] })
|
|
15555
|
+
]
|
|
15556
|
+
}
|
|
15557
|
+
);
|
|
15558
|
+
}
|
|
15559
|
+
var ENCOURAGEMENT_KEYS, stepLabel;
|
|
15560
|
+
var init_SequencerBoard = __esm({
|
|
15561
|
+
"components/game/2d/organisms/SequencerBoard.tsx"() {
|
|
15562
|
+
init_atoms();
|
|
15563
|
+
init_cn();
|
|
15564
|
+
init_useEventBus();
|
|
15565
|
+
init_TraitStateViewer();
|
|
15566
|
+
init_boardEntity();
|
|
15567
|
+
init_SequenceBar();
|
|
15568
|
+
init_ActionPalette();
|
|
15569
|
+
ENCOURAGEMENT_KEYS = [
|
|
15570
|
+
"puzzle.tryAgain1",
|
|
15571
|
+
"puzzle.tryAgain2",
|
|
15572
|
+
"puzzle.tryAgain3"
|
|
15573
|
+
];
|
|
15574
|
+
stepLabel = (slot, i) => slot ? `${i + 1}. ${slot.name}` : `Step ${i + 1}`;
|
|
15575
|
+
SequencerBoard.displayName = "SequencerBoard";
|
|
15576
|
+
}
|
|
15577
|
+
});
|
|
15578
|
+
function RuleEditor({
|
|
15579
|
+
rule,
|
|
15580
|
+
availableEvents,
|
|
15581
|
+
availableActions,
|
|
15582
|
+
onChange,
|
|
15583
|
+
onRemove,
|
|
15584
|
+
disabled = false,
|
|
15585
|
+
className
|
|
15586
|
+
}) {
|
|
15587
|
+
const { t } = useTranslate();
|
|
15588
|
+
const handleWhenChange = useCallback((v) => {
|
|
15589
|
+
onChange({ ...rule, whenEvent: v });
|
|
15590
|
+
}, [rule, onChange]);
|
|
15591
|
+
const handleThenChange = useCallback((v) => {
|
|
15592
|
+
onChange({ ...rule, thenAction: v });
|
|
15593
|
+
}, [rule, onChange]);
|
|
15594
|
+
return /* @__PURE__ */ jsxs(HStack, { className: cn("items-center p-2 rounded-lg bg-muted/50 border border-border", className), gap: "sm", children: [
|
|
15595
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold whitespace-nowrap", children: t("eventHandler.when") }),
|
|
15596
|
+
/* @__PURE__ */ jsx(
|
|
15597
|
+
Select,
|
|
15598
|
+
{
|
|
15599
|
+
value: rule.whenEvent,
|
|
15600
|
+
onValueChange: handleWhenChange,
|
|
15601
|
+
options: availableEvents,
|
|
15602
|
+
disabled,
|
|
15603
|
+
className: "flex-1 min-w-0"
|
|
15604
|
+
}
|
|
15605
|
+
),
|
|
15606
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-bold whitespace-nowrap", children: "\u2192 " + t("eventHandler.then") }),
|
|
15607
|
+
/* @__PURE__ */ jsx(
|
|
15608
|
+
Select,
|
|
15609
|
+
{
|
|
15610
|
+
value: rule.thenAction,
|
|
15611
|
+
onValueChange: handleThenChange,
|
|
15612
|
+
options: availableActions,
|
|
15613
|
+
disabled,
|
|
15614
|
+
className: "flex-1 min-w-0"
|
|
15615
|
+
}
|
|
15616
|
+
),
|
|
15617
|
+
onRemove && /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onRemove, disabled, className: "shrink-0", children: "\xD7" })
|
|
15618
|
+
] });
|
|
15619
|
+
}
|
|
15620
|
+
var init_RuleEditor = __esm({
|
|
15621
|
+
"components/game/2d/organisms/RuleEditor.tsx"() {
|
|
15622
|
+
init_atoms();
|
|
15623
|
+
init_cn();
|
|
15624
|
+
RuleEditor.displayName = "RuleEditor";
|
|
15625
|
+
}
|
|
15626
|
+
});
|
|
15302
15627
|
function EventLog({
|
|
15303
15628
|
entries,
|
|
15304
15629
|
maxHeight = 200,
|
|
@@ -15334,7 +15659,7 @@ function EventLog({
|
|
|
15334
15659
|
}
|
|
15335
15660
|
var STATUS_STYLES, STATUS_DOTS;
|
|
15336
15661
|
var init_EventLog = __esm({
|
|
15337
|
-
"components/game/2d/
|
|
15662
|
+
"components/game/2d/organisms/EventLog.tsx"() {
|
|
15338
15663
|
init_atoms();
|
|
15339
15664
|
init_cn();
|
|
15340
15665
|
STATUS_STYLES = {
|
|
@@ -15354,10 +15679,1768 @@ var init_EventLog = __esm({
|
|
|
15354
15679
|
});
|
|
15355
15680
|
|
|
15356
15681
|
// components/game/shared/lib/puzzleObject.ts
|
|
15682
|
+
function objId(o) {
|
|
15683
|
+
return o.id == null ? "" : String(o.id);
|
|
15684
|
+
}
|
|
15685
|
+
function objName(o) {
|
|
15686
|
+
return o.name == null ? "" : String(o.name);
|
|
15687
|
+
}
|
|
15688
|
+
function objIcon(o) {
|
|
15689
|
+
return o.icon == null ? "" : String(o.icon);
|
|
15690
|
+
}
|
|
15691
|
+
function objStates(o) {
|
|
15692
|
+
return Array.isArray(o.states) ? o.states : [];
|
|
15693
|
+
}
|
|
15694
|
+
function objCurrentState(o) {
|
|
15695
|
+
return o.currentState == null ? "" : String(o.currentState);
|
|
15696
|
+
}
|
|
15697
|
+
function objAvailableEvents(o) {
|
|
15698
|
+
return Array.isArray(o.availableEvents) ? o.availableEvents : [];
|
|
15699
|
+
}
|
|
15700
|
+
function objAvailableActions(o) {
|
|
15701
|
+
return Array.isArray(o.availableActions) ? o.availableActions : [];
|
|
15702
|
+
}
|
|
15703
|
+
function objRules(o) {
|
|
15704
|
+
return Array.isArray(o.rules) ? o.rules : [];
|
|
15705
|
+
}
|
|
15706
|
+
function objMaxRules(o) {
|
|
15707
|
+
const n = Number(o.maxRules);
|
|
15708
|
+
return Number.isFinite(n) && n > 0 ? n : 3;
|
|
15709
|
+
}
|
|
15357
15710
|
var init_puzzleObject = __esm({
|
|
15358
15711
|
"components/game/shared/lib/puzzleObject.ts"() {
|
|
15359
15712
|
}
|
|
15360
15713
|
});
|
|
15714
|
+
function ObjectRulePanel({
|
|
15715
|
+
object,
|
|
15716
|
+
onRulesChange,
|
|
15717
|
+
disabled = false,
|
|
15718
|
+
className
|
|
15719
|
+
}) {
|
|
15720
|
+
const { t } = useTranslate();
|
|
15721
|
+
const id = objId(object);
|
|
15722
|
+
const name = objName(object);
|
|
15723
|
+
const icon = objIcon(object);
|
|
15724
|
+
const states = objStates(object);
|
|
15725
|
+
const currentState = objCurrentState(object);
|
|
15726
|
+
const availableEvents = objAvailableEvents(object);
|
|
15727
|
+
const availableActions = objAvailableActions(object);
|
|
15728
|
+
const rules = objRules(object);
|
|
15729
|
+
const maxRules = objMaxRules(object);
|
|
15730
|
+
const canAdd = rules.length < maxRules;
|
|
15731
|
+
const handleRuleChange = useCallback((index, updatedRule) => {
|
|
15732
|
+
const newRules = [...rules];
|
|
15733
|
+
newRules[index] = updatedRule;
|
|
15734
|
+
onRulesChange(id, newRules);
|
|
15735
|
+
}, [id, rules, onRulesChange]);
|
|
15736
|
+
const handleRuleRemove = useCallback((index) => {
|
|
15737
|
+
const newRules = rules.filter((_, i) => i !== index);
|
|
15738
|
+
onRulesChange(id, newRules);
|
|
15739
|
+
}, [id, rules, onRulesChange]);
|
|
15740
|
+
const handleAddRule = useCallback(() => {
|
|
15741
|
+
if (!canAdd || disabled) return;
|
|
15742
|
+
const firstEvent = availableEvents[0]?.value || "";
|
|
15743
|
+
const firstAction = availableActions[0]?.value || "";
|
|
15744
|
+
const newRule = {
|
|
15745
|
+
id: `rule-${nextRuleId++}`,
|
|
15746
|
+
whenEvent: firstEvent,
|
|
15747
|
+
thenAction: firstAction
|
|
15748
|
+
};
|
|
15749
|
+
onRulesChange(id, [...rules, newRule]);
|
|
15750
|
+
}, [canAdd, disabled, id, rules, availableEvents, availableActions, onRulesChange]);
|
|
15751
|
+
const machine = {
|
|
15752
|
+
name,
|
|
15753
|
+
states,
|
|
15754
|
+
currentState,
|
|
15755
|
+
transitions: rules.map((r2) => ({
|
|
15756
|
+
from: currentState,
|
|
15757
|
+
to: states.find((s) => s !== currentState) || currentState,
|
|
15758
|
+
event: r2.whenEvent
|
|
15759
|
+
}))
|
|
15760
|
+
};
|
|
15761
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("p-4 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
15762
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center", gap: "sm", children: [
|
|
15763
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: icon }),
|
|
15764
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
15765
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-bold", children: name }),
|
|
15766
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("eventHandler.state") + ": " + currentState })
|
|
15767
|
+
] })
|
|
15768
|
+
] }),
|
|
15769
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "compact", size: "sm" }),
|
|
15770
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15771
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("eventHandler.rules", { count: rules.length, max: maxRules }) + ":" }),
|
|
15772
|
+
rules.map((rule, i) => /* @__PURE__ */ jsx(
|
|
15773
|
+
RuleEditor,
|
|
15774
|
+
{
|
|
15775
|
+
rule,
|
|
15776
|
+
availableEvents,
|
|
15777
|
+
availableActions,
|
|
15778
|
+
onChange: (r2) => handleRuleChange(i, r2),
|
|
15779
|
+
onRemove: () => handleRuleRemove(i),
|
|
15780
|
+
disabled
|
|
15781
|
+
},
|
|
15782
|
+
rule.id
|
|
15783
|
+
)),
|
|
15784
|
+
canAdd && !disabled && /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleAddRule, className: "self-start", children: t("eventHandler.addRule") })
|
|
15785
|
+
] })
|
|
15786
|
+
] });
|
|
15787
|
+
}
|
|
15788
|
+
var nextRuleId;
|
|
15789
|
+
var init_ObjectRulePanel = __esm({
|
|
15790
|
+
"components/game/2d/organisms/ObjectRulePanel.tsx"() {
|
|
15791
|
+
init_atoms();
|
|
15792
|
+
init_cn();
|
|
15793
|
+
init_TraitStateViewer();
|
|
15794
|
+
init_RuleEditor();
|
|
15795
|
+
init_puzzleObject();
|
|
15796
|
+
nextRuleId = 1;
|
|
15797
|
+
ObjectRulePanel.displayName = "ObjectRulePanel";
|
|
15798
|
+
}
|
|
15799
|
+
});
|
|
15800
|
+
function EventHandlerBoard({
|
|
15801
|
+
entity,
|
|
15802
|
+
stepDurationMs = 800,
|
|
15803
|
+
playEvent,
|
|
15804
|
+
completeEvent,
|
|
15805
|
+
editRuleEvent,
|
|
15806
|
+
playAgainEvent,
|
|
15807
|
+
className
|
|
15808
|
+
}) {
|
|
15809
|
+
const { emit } = useEventBus();
|
|
15810
|
+
const { t } = useTranslate();
|
|
15811
|
+
const resolved = boardEntity(entity);
|
|
15812
|
+
const objects = rows(resolved?.objects);
|
|
15813
|
+
const entityResult = str(resolved?.result) || "none";
|
|
15814
|
+
const isSuccess = entityResult === "win";
|
|
15815
|
+
const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
|
|
15816
|
+
const [selectedObjectId, setSelectedObjectId] = useState(
|
|
15817
|
+
objects[0] ? objId(objects[0]) : null
|
|
15818
|
+
);
|
|
15819
|
+
const [headerError, setHeaderError] = useState(false);
|
|
15820
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
15821
|
+
const [eventLog, setEventLog] = useState([]);
|
|
15822
|
+
const timerRef = useRef(null);
|
|
15823
|
+
const logIdCounter = useRef(0);
|
|
15824
|
+
useEffect(() => () => {
|
|
15825
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15826
|
+
}, []);
|
|
15827
|
+
const selectedObject = objects.find((o) => objId(o) === selectedObjectId) ?? null;
|
|
15828
|
+
const handleRulesChange = useCallback((objectId, rules) => {
|
|
15829
|
+
if (editRuleEvent) emit(`UI:${editRuleEvent}`, { objectId, rules });
|
|
15830
|
+
}, [editRuleEvent, emit]);
|
|
15831
|
+
const addLogEntry = useCallback((icon, message, status = "done") => {
|
|
15832
|
+
const id = `log-${logIdCounter.current++}`;
|
|
15833
|
+
setEventLog((prev) => [...prev, { id, timestamp: Date.now(), icon, message, status }]);
|
|
15834
|
+
}, []);
|
|
15835
|
+
const handlePlay = useCallback(() => {
|
|
15836
|
+
if (isPlaying || isSuccess) return;
|
|
15837
|
+
if (playEvent) emit(`UI:${playEvent}`, {});
|
|
15838
|
+
setIsPlaying(true);
|
|
15839
|
+
setEventLog([]);
|
|
15840
|
+
const allRules = [];
|
|
15841
|
+
objects.forEach((obj) => {
|
|
15842
|
+
objRules(obj).forEach((rule) => {
|
|
15843
|
+
allRules.push({ object: obj, rule });
|
|
15844
|
+
});
|
|
15845
|
+
});
|
|
15846
|
+
const triggers = Array.isArray(resolved?.triggerEvents) ? resolved.triggerEvents : [];
|
|
15847
|
+
const goalEvent = str(resolved?.goalEvent);
|
|
15848
|
+
const eventQueue = [...triggers];
|
|
15849
|
+
const firedEvents = /* @__PURE__ */ new Set();
|
|
15850
|
+
let stepIdx = 0;
|
|
15851
|
+
let goalReached = false;
|
|
15852
|
+
const processNext = () => {
|
|
15853
|
+
if (eventQueue.length === 0 || stepIdx > 20) {
|
|
15854
|
+
setIsPlaying(false);
|
|
15855
|
+
if (goalReached && completeEvent) emit(`UI:${completeEvent}`, { success: true });
|
|
15856
|
+
return;
|
|
15857
|
+
}
|
|
15858
|
+
const currentEvent = eventQueue.shift();
|
|
15859
|
+
if (firedEvents.has(currentEvent)) {
|
|
15860
|
+
timerRef.current = setTimeout(processNext, 100);
|
|
15861
|
+
return;
|
|
15862
|
+
}
|
|
15863
|
+
firedEvents.add(currentEvent);
|
|
15864
|
+
const matching = allRules.filter((r2) => r2.rule.whenEvent === currentEvent);
|
|
15865
|
+
if (matching.length === 0) {
|
|
15866
|
+
addLogEntry("\u26A1", t("eventHandler.noListeners", { event: currentEvent }), "done");
|
|
15867
|
+
} else {
|
|
15868
|
+
matching.forEach(({ object, rule }) => {
|
|
15869
|
+
addLogEntry(objIcon(object), t("eventHandler.heardEvent", { object: objName(object), event: currentEvent, action: rule.thenAction }), "done");
|
|
15870
|
+
eventQueue.push(rule.thenAction);
|
|
15871
|
+
if (rule.thenAction === goalEvent) {
|
|
15872
|
+
goalReached = true;
|
|
15873
|
+
}
|
|
15874
|
+
});
|
|
15875
|
+
}
|
|
15876
|
+
if (currentEvent === goalEvent) {
|
|
15877
|
+
goalReached = true;
|
|
15878
|
+
}
|
|
15879
|
+
stepIdx++;
|
|
15880
|
+
timerRef.current = setTimeout(processNext, stepDurationMs);
|
|
15881
|
+
};
|
|
15882
|
+
if (triggers.length > 0) {
|
|
15883
|
+
addLogEntry("\u{1F3AC}", t("eventHandler.simulationStarted", { events: triggers.join(", ") }), "active");
|
|
15884
|
+
}
|
|
15885
|
+
timerRef.current = setTimeout(processNext, stepDurationMs);
|
|
15886
|
+
}, [isPlaying, isSuccess, objects, resolved, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
|
|
15887
|
+
const handleTryAgain = useCallback(() => {
|
|
15888
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15889
|
+
setIsPlaying(false);
|
|
15890
|
+
setEventLog([]);
|
|
15891
|
+
}, []);
|
|
15892
|
+
const handleReset = useCallback(() => {
|
|
15893
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15894
|
+
setIsPlaying(false);
|
|
15895
|
+
setEventLog([]);
|
|
15896
|
+
setSelectedObjectId(objects[0] ? objId(objects[0]) : null);
|
|
15897
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
15898
|
+
}, [objects, playAgainEvent, emit]);
|
|
15899
|
+
if (!resolved) return null;
|
|
15900
|
+
const objectViewers = objects.map((obj) => {
|
|
15901
|
+
const states = objStates(obj);
|
|
15902
|
+
const currentState = objCurrentState(obj);
|
|
15903
|
+
const machine = {
|
|
15904
|
+
name: objName(obj),
|
|
15905
|
+
states,
|
|
15906
|
+
currentState,
|
|
15907
|
+
transitions: objRules(obj).map((r2) => ({
|
|
15908
|
+
from: currentState,
|
|
15909
|
+
to: states.find((s) => s !== currentState) || currentState,
|
|
15910
|
+
event: r2.whenEvent
|
|
15911
|
+
}))
|
|
15912
|
+
};
|
|
15913
|
+
return { obj, machine };
|
|
15914
|
+
});
|
|
15915
|
+
const hint = str(resolved.hint);
|
|
15916
|
+
const showHint = attempts >= 3 && hint;
|
|
15917
|
+
const theme = resolved.theme ?? void 0;
|
|
15918
|
+
const themeBackground = theme?.background;
|
|
15919
|
+
const headerImage = str(resolved.headerImage);
|
|
15920
|
+
const encourageKey = ENCOURAGEMENT_KEYS2[Math.min(attempts - 1, ENCOURAGEMENT_KEYS2.length - 1)] ?? ENCOURAGEMENT_KEYS2[0];
|
|
15921
|
+
return /* @__PURE__ */ jsxs(
|
|
15922
|
+
VStack,
|
|
15923
|
+
{
|
|
15924
|
+
className: cn("p-4 gap-6", className),
|
|
15925
|
+
style: {
|
|
15926
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
15927
|
+
backgroundSize: "cover",
|
|
15928
|
+
backgroundPosition: "center"
|
|
15929
|
+
},
|
|
15930
|
+
children: [
|
|
15931
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
15932
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15933
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
15934
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
|
|
15935
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-primary/10 border border-primary/30", gap: "xs", children: [
|
|
15936
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold", children: t("game.goal") + ":" }),
|
|
15937
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: str(resolved.goalCondition) })
|
|
15938
|
+
] })
|
|
15939
|
+
] }),
|
|
15940
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
15941
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("eventHandler.clickObject") + ":" }),
|
|
15942
|
+
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap", gap: "sm", children: objectViewers.map(({ obj, machine }) => {
|
|
15943
|
+
const oid = objId(obj);
|
|
15944
|
+
return /* @__PURE__ */ jsx(
|
|
15945
|
+
Box,
|
|
15946
|
+
{
|
|
15947
|
+
className: cn(
|
|
15948
|
+
"p-3 rounded-container border-2 cursor-pointer transition-all hover:scale-105",
|
|
15949
|
+
selectedObjectId === oid ? "border-primary bg-primary/10" : "border-border bg-card hover:border-muted-foreground"
|
|
15950
|
+
),
|
|
15951
|
+
onClick: () => setSelectedObjectId(oid),
|
|
15952
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "items-center min-w-[120px]", children: [
|
|
15953
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: objIcon(obj) }),
|
|
15954
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground font-medium", children: objName(obj) }),
|
|
15955
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "compact", size: "sm" })
|
|
15956
|
+
] })
|
|
15957
|
+
},
|
|
15958
|
+
oid
|
|
15959
|
+
);
|
|
15960
|
+
}) })
|
|
15961
|
+
] }),
|
|
15962
|
+
selectedObject && /* @__PURE__ */ jsx(
|
|
15963
|
+
ObjectRulePanel,
|
|
15964
|
+
{
|
|
15965
|
+
object: selectedObject,
|
|
15966
|
+
onRulesChange: handleRulesChange,
|
|
15967
|
+
disabled: isPlaying
|
|
15968
|
+
}
|
|
15969
|
+
),
|
|
15970
|
+
eventLog.length > 0 && /* @__PURE__ */ jsx(EventLog, { entries: eventLog }),
|
|
15971
|
+
isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("eventHandler.chainComplete") }) }),
|
|
15972
|
+
!isPlaying && !isSuccess && attempts > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
15973
|
+
/* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(encourageKey) }) }),
|
|
15974
|
+
showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
15975
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
15976
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
15977
|
+
] }) })
|
|
15978
|
+
] }),
|
|
15979
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
15980
|
+
!isPlaying && !isSuccess && attempts > 0 ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
|
|
15981
|
+
Button,
|
|
15982
|
+
{
|
|
15983
|
+
variant: "primary",
|
|
15984
|
+
onClick: handlePlay,
|
|
15985
|
+
disabled: isPlaying || isSuccess,
|
|
15986
|
+
children: "\u25B6 " + t("game.play")
|
|
15987
|
+
}
|
|
15988
|
+
),
|
|
15989
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
15990
|
+
] })
|
|
15991
|
+
]
|
|
15992
|
+
}
|
|
15993
|
+
);
|
|
15994
|
+
}
|
|
15995
|
+
var ENCOURAGEMENT_KEYS2;
|
|
15996
|
+
var init_EventHandlerBoard = __esm({
|
|
15997
|
+
"components/game/2d/organisms/EventHandlerBoard.tsx"() {
|
|
15998
|
+
init_atoms();
|
|
15999
|
+
init_cn();
|
|
16000
|
+
init_useEventBus();
|
|
16001
|
+
init_TraitStateViewer();
|
|
16002
|
+
init_ObjectRulePanel();
|
|
16003
|
+
init_EventLog();
|
|
16004
|
+
init_puzzleObject();
|
|
16005
|
+
init_boardEntity();
|
|
16006
|
+
ENCOURAGEMENT_KEYS2 = [
|
|
16007
|
+
"puzzle.tryAgain1",
|
|
16008
|
+
"puzzle.tryAgain2",
|
|
16009
|
+
"puzzle.tryAgain3"
|
|
16010
|
+
];
|
|
16011
|
+
EventHandlerBoard.displayName = "EventHandlerBoard";
|
|
16012
|
+
}
|
|
16013
|
+
});
|
|
16014
|
+
function StateNode({
|
|
16015
|
+
name,
|
|
16016
|
+
isCurrent = false,
|
|
16017
|
+
isSelected = false,
|
|
16018
|
+
isInitial = false,
|
|
16019
|
+
position,
|
|
16020
|
+
onClick,
|
|
16021
|
+
className
|
|
16022
|
+
}) {
|
|
16023
|
+
return /* @__PURE__ */ jsx(
|
|
16024
|
+
Box,
|
|
16025
|
+
{
|
|
16026
|
+
position: "absolute",
|
|
16027
|
+
display: "flex",
|
|
16028
|
+
className: cn(
|
|
16029
|
+
"items-center justify-center rounded-pill border-3 transition-all cursor-pointer select-none",
|
|
16030
|
+
"min-w-[80px] h-[80px] px-3",
|
|
16031
|
+
isCurrent && "bg-primary/20 border-primary shadow-lg shadow-primary/30 scale-110",
|
|
16032
|
+
isSelected && !isCurrent && "bg-accent/20 border-accent ring-2 ring-accent/50",
|
|
16033
|
+
!isCurrent && !isSelected && "bg-card border-border hover:border-muted-foreground hover:scale-105",
|
|
16034
|
+
className
|
|
16035
|
+
),
|
|
16036
|
+
style: {
|
|
16037
|
+
left: position.x,
|
|
16038
|
+
top: position.y,
|
|
16039
|
+
transform: "translate(-50%, -50%)"
|
|
16040
|
+
},
|
|
16041
|
+
onClick,
|
|
16042
|
+
children: /* @__PURE__ */ jsxs(Box, { className: "text-center", children: [
|
|
16043
|
+
isInitial && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground text-xs block", children: "\u25B6 start" }),
|
|
16044
|
+
/* @__PURE__ */ jsx(
|
|
16045
|
+
Typography,
|
|
16046
|
+
{
|
|
16047
|
+
variant: "body2",
|
|
16048
|
+
className: cn(
|
|
16049
|
+
"font-bold whitespace-nowrap",
|
|
16050
|
+
isCurrent ? "text-primary" : "text-foreground"
|
|
16051
|
+
),
|
|
16052
|
+
children: name
|
|
16053
|
+
}
|
|
16054
|
+
)
|
|
16055
|
+
] })
|
|
16056
|
+
}
|
|
16057
|
+
);
|
|
16058
|
+
}
|
|
16059
|
+
var init_StateNode = __esm({
|
|
16060
|
+
"components/game/2d/organisms/StateNode.tsx"() {
|
|
16061
|
+
init_atoms();
|
|
16062
|
+
init_cn();
|
|
16063
|
+
StateNode.displayName = "StateNode";
|
|
16064
|
+
}
|
|
16065
|
+
});
|
|
16066
|
+
function TransitionArrow({
|
|
16067
|
+
from,
|
|
16068
|
+
to,
|
|
16069
|
+
eventLabel,
|
|
16070
|
+
guardHint,
|
|
16071
|
+
isActive = false,
|
|
16072
|
+
onClick,
|
|
16073
|
+
className
|
|
16074
|
+
}) {
|
|
16075
|
+
const dx = to.x - from.x;
|
|
16076
|
+
const dy = to.y - from.y;
|
|
16077
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
16078
|
+
if (dist === 0) return /* @__PURE__ */ jsx(Fragment, {});
|
|
16079
|
+
const nx = dx / dist;
|
|
16080
|
+
const ny = dy / dist;
|
|
16081
|
+
const startX = from.x + nx * NODE_RADIUS;
|
|
16082
|
+
const startY = from.y + ny * NODE_RADIUS;
|
|
16083
|
+
const endX = to.x - nx * NODE_RADIUS;
|
|
16084
|
+
const endY = to.y - ny * NODE_RADIUS;
|
|
16085
|
+
const midX = (startX + endX) / 2;
|
|
16086
|
+
const midY = (startY + endY) / 2;
|
|
16087
|
+
const perpX = -ny * 20;
|
|
16088
|
+
const perpY = nx * 20;
|
|
16089
|
+
const ctrlX = midX + perpX;
|
|
16090
|
+
const ctrlY = midY + perpY;
|
|
16091
|
+
const path = `M ${startX} ${startY} Q ${ctrlX} ${ctrlY} ${endX} ${endY}`;
|
|
16092
|
+
return /* @__PURE__ */ jsxs("g", { className: cn("cursor-pointer", className), onClick, children: [
|
|
16093
|
+
/* @__PURE__ */ jsx(
|
|
16094
|
+
"path",
|
|
16095
|
+
{
|
|
16096
|
+
d: path,
|
|
16097
|
+
fill: "none",
|
|
16098
|
+
stroke: isActive ? "var(--color-primary)" : "var(--color-border)",
|
|
16099
|
+
strokeWidth: isActive ? 3 : 2,
|
|
16100
|
+
markerEnd: isActive ? "url(#arrowhead-active)" : "url(#arrowhead)"
|
|
16101
|
+
}
|
|
16102
|
+
),
|
|
16103
|
+
/* @__PURE__ */ jsx(
|
|
16104
|
+
"text",
|
|
16105
|
+
{
|
|
16106
|
+
x: ctrlX,
|
|
16107
|
+
y: ctrlY - 8,
|
|
16108
|
+
textAnchor: "middle",
|
|
16109
|
+
fill: isActive ? "var(--color-primary)" : "var(--color-foreground)",
|
|
16110
|
+
fontSize: 12,
|
|
16111
|
+
fontWeight: isActive ? "bold" : "normal",
|
|
16112
|
+
className: "select-none",
|
|
16113
|
+
children: eventLabel
|
|
16114
|
+
}
|
|
16115
|
+
),
|
|
16116
|
+
guardHint && /* @__PURE__ */ jsx(
|
|
16117
|
+
"text",
|
|
16118
|
+
{
|
|
16119
|
+
x: ctrlX,
|
|
16120
|
+
y: ctrlY + 6,
|
|
16121
|
+
textAnchor: "middle",
|
|
16122
|
+
fill: "var(--color-warning)",
|
|
16123
|
+
fontSize: 10,
|
|
16124
|
+
className: "select-none",
|
|
16125
|
+
children: "\u26A0 " + guardHint
|
|
16126
|
+
}
|
|
16127
|
+
)
|
|
16128
|
+
] });
|
|
16129
|
+
}
|
|
16130
|
+
var NODE_RADIUS;
|
|
16131
|
+
var init_TransitionArrow = __esm({
|
|
16132
|
+
"components/game/2d/organisms/TransitionArrow.tsx"() {
|
|
16133
|
+
init_cn();
|
|
16134
|
+
NODE_RADIUS = 40;
|
|
16135
|
+
TransitionArrow.displayName = "TransitionArrow";
|
|
16136
|
+
}
|
|
16137
|
+
});
|
|
16138
|
+
function VariablePanel({
|
|
16139
|
+
entityName,
|
|
16140
|
+
variables,
|
|
16141
|
+
className
|
|
16142
|
+
}) {
|
|
16143
|
+
const { t } = useTranslate();
|
|
16144
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
16145
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
|
|
16146
|
+
variables.map((v) => {
|
|
16147
|
+
const name = v.name == null ? "" : String(v.name);
|
|
16148
|
+
const value = numField(v.value);
|
|
16149
|
+
const max = numField(v.max, 100);
|
|
16150
|
+
const min = numField(v.min, 0);
|
|
16151
|
+
const unit = v.unit == null ? "" : String(v.unit);
|
|
16152
|
+
const pct = Math.round((value - min) / (max - min) * 100);
|
|
16153
|
+
const isHigh = pct > 80;
|
|
16154
|
+
const isLow = pct < 20;
|
|
16155
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
16156
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
16157
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: name }),
|
|
16158
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: cn(
|
|
16159
|
+
isHigh ? "text-error" : isLow ? "text-warning" : "text-foreground"
|
|
16160
|
+
), children: [
|
|
16161
|
+
value,
|
|
16162
|
+
unit,
|
|
16163
|
+
" / ",
|
|
16164
|
+
max,
|
|
16165
|
+
unit
|
|
16166
|
+
] })
|
|
16167
|
+
] }),
|
|
16168
|
+
/* @__PURE__ */ jsx(
|
|
16169
|
+
ProgressBar,
|
|
16170
|
+
{
|
|
16171
|
+
value: pct,
|
|
16172
|
+
color: isHigh ? "danger" : isLow ? "warning" : "primary",
|
|
16173
|
+
size: "sm"
|
|
16174
|
+
}
|
|
16175
|
+
)
|
|
16176
|
+
] }, name);
|
|
16177
|
+
})
|
|
16178
|
+
] });
|
|
16179
|
+
}
|
|
16180
|
+
var numField;
|
|
16181
|
+
var init_VariablePanel = __esm({
|
|
16182
|
+
"components/game/2d/organisms/VariablePanel.tsx"() {
|
|
16183
|
+
init_atoms();
|
|
16184
|
+
init_cn();
|
|
16185
|
+
numField = (v, fallback = 0) => {
|
|
16186
|
+
const n = Number(v);
|
|
16187
|
+
return Number.isFinite(n) ? n : fallback;
|
|
16188
|
+
};
|
|
16189
|
+
VariablePanel.displayName = "VariablePanel";
|
|
16190
|
+
}
|
|
16191
|
+
});
|
|
16192
|
+
function StateJsonView({
|
|
16193
|
+
data,
|
|
16194
|
+
label,
|
|
16195
|
+
defaultExpanded = false,
|
|
16196
|
+
className
|
|
16197
|
+
}) {
|
|
16198
|
+
const { t } = useTranslate();
|
|
16199
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
16200
|
+
const jsonString = JSON.stringify(data, null, 2);
|
|
16201
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
|
|
16202
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
|
|
16203
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
|
|
16204
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
|
|
16205
|
+
] }),
|
|
16206
|
+
expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
|
|
16207
|
+
Typography,
|
|
16208
|
+
{
|
|
16209
|
+
variant: "caption",
|
|
16210
|
+
className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
|
|
16211
|
+
children: jsonString
|
|
16212
|
+
}
|
|
16213
|
+
) })
|
|
16214
|
+
] });
|
|
16215
|
+
}
|
|
16216
|
+
var init_StateJsonView = __esm({
|
|
16217
|
+
"components/game/2d/organisms/StateJsonView.tsx"() {
|
|
16218
|
+
init_atoms();
|
|
16219
|
+
init_cn();
|
|
16220
|
+
StateJsonView.displayName = "StateJsonView";
|
|
16221
|
+
}
|
|
16222
|
+
});
|
|
16223
|
+
function layoutStates(states, width, height) {
|
|
16224
|
+
const cx = width / 2;
|
|
16225
|
+
const cy = height / 2;
|
|
16226
|
+
const radius = Math.min(cx, cy) - 60;
|
|
16227
|
+
const positions = {};
|
|
16228
|
+
states.forEach((state, i) => {
|
|
16229
|
+
const angle = 2 * Math.PI * i / states.length - Math.PI / 2;
|
|
16230
|
+
positions[state] = {
|
|
16231
|
+
x: cx + radius * Math.cos(angle),
|
|
16232
|
+
y: cy + radius * Math.sin(angle)
|
|
16233
|
+
};
|
|
16234
|
+
});
|
|
16235
|
+
return positions;
|
|
16236
|
+
}
|
|
16237
|
+
function StateArchitectBoard({
|
|
16238
|
+
entity,
|
|
16239
|
+
stepDurationMs = 600,
|
|
16240
|
+
testEvent,
|
|
16241
|
+
completeEvent,
|
|
16242
|
+
addTransitionEvent,
|
|
16243
|
+
removeTransitionEvent,
|
|
16244
|
+
playAgainEvent,
|
|
16245
|
+
className
|
|
16246
|
+
}) {
|
|
16247
|
+
const { emit } = useEventBus();
|
|
16248
|
+
const { t } = useTranslate();
|
|
16249
|
+
const resolved = boardEntity(entity);
|
|
16250
|
+
const entityStates = Array.isArray(resolved?.states) ? resolved.states : [];
|
|
16251
|
+
const initialState = str(resolved?.initialState);
|
|
16252
|
+
const entityName = str(resolved?.entityName);
|
|
16253
|
+
const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
|
|
16254
|
+
const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
|
|
16255
|
+
const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
|
|
16256
|
+
const eventsField = o["events"];
|
|
16257
|
+
return {
|
|
16258
|
+
events: Array.isArray(eventsField) ? eventsField : [],
|
|
16259
|
+
expectedState: str(o["expectedState"]),
|
|
16260
|
+
label: str(o["label"])
|
|
16261
|
+
};
|
|
16262
|
+
});
|
|
16263
|
+
const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
|
|
16264
|
+
const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
|
|
16265
|
+
return {
|
|
16266
|
+
id: str(o["id"]),
|
|
16267
|
+
from: str(o["from"]),
|
|
16268
|
+
to: str(o["to"]),
|
|
16269
|
+
event: str(o["event"]),
|
|
16270
|
+
...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
|
|
16271
|
+
};
|
|
16272
|
+
});
|
|
16273
|
+
const entityVariables = rows(resolved?.variables);
|
|
16274
|
+
const transitions = entityTransitions;
|
|
16275
|
+
const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
|
|
16276
|
+
const entityResult = str(resolved?.result) || "none";
|
|
16277
|
+
const isSuccess = entityResult === "win";
|
|
16278
|
+
const [isTesting, setIsTesting] = useState(false);
|
|
16279
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16280
|
+
const [currentState, setCurrentState] = useState(initialState);
|
|
16281
|
+
const [selectedState, setSelectedState] = useState(null);
|
|
16282
|
+
const [testResults, setTestResults] = useState([]);
|
|
16283
|
+
const [variables, setVariables] = useState(() => [...entityVariables]);
|
|
16284
|
+
const timerRef = useRef(null);
|
|
16285
|
+
const [addingFrom, setAddingFrom] = useState(null);
|
|
16286
|
+
useEffect(() => () => {
|
|
16287
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16288
|
+
}, []);
|
|
16289
|
+
const GRAPH_W = 500;
|
|
16290
|
+
const GRAPH_H = 400;
|
|
16291
|
+
const positions = useMemo(() => layoutStates(entityStates, GRAPH_W, GRAPH_H), [entityStates]);
|
|
16292
|
+
const handleStateClick = useCallback((state) => {
|
|
16293
|
+
if (isTesting) return;
|
|
16294
|
+
if (addingFrom) {
|
|
16295
|
+
if (addingFrom !== state) {
|
|
16296
|
+
const event = availableEvents[0] || "EVENT";
|
|
16297
|
+
const newTrans = {
|
|
16298
|
+
id: `t-${nextTransId++}`,
|
|
16299
|
+
from: addingFrom,
|
|
16300
|
+
to: state,
|
|
16301
|
+
event
|
|
16302
|
+
};
|
|
16303
|
+
if (addTransitionEvent) emit(`UI:${addTransitionEvent}`, { id: newTrans.id, from: newTrans.from, to: newTrans.to, event: newTrans.event });
|
|
16304
|
+
}
|
|
16305
|
+
setAddingFrom(null);
|
|
16306
|
+
} else {
|
|
16307
|
+
setSelectedState(state);
|
|
16308
|
+
}
|
|
16309
|
+
}, [isTesting, addingFrom, availableEvents, addTransitionEvent, emit]);
|
|
16310
|
+
const handleStartAddTransition = useCallback(() => {
|
|
16311
|
+
if (!selectedState) return;
|
|
16312
|
+
setAddingFrom(selectedState);
|
|
16313
|
+
}, [selectedState]);
|
|
16314
|
+
const handleRemoveTransition = useCallback((transId) => {
|
|
16315
|
+
if (removeTransitionEvent) emit(`UI:${removeTransitionEvent}`, { id: transId });
|
|
16316
|
+
}, [removeTransitionEvent, emit]);
|
|
16317
|
+
const machine = useMemo(() => ({
|
|
16318
|
+
name: entityName,
|
|
16319
|
+
description: str(resolved?.description),
|
|
16320
|
+
states: entityStates,
|
|
16321
|
+
currentState,
|
|
16322
|
+
transitions: transitions.map((t2) => ({
|
|
16323
|
+
from: t2.from,
|
|
16324
|
+
to: t2.to,
|
|
16325
|
+
event: t2.event,
|
|
16326
|
+
guardHint: t2.guardHint
|
|
16327
|
+
}))
|
|
16328
|
+
}), [entityName, resolved, entityStates, currentState, transitions]);
|
|
16329
|
+
const handleTest = useCallback(() => {
|
|
16330
|
+
if (isTesting) return;
|
|
16331
|
+
if (testEvent) emit(`UI:${testEvent}`, {});
|
|
16332
|
+
setIsTesting(true);
|
|
16333
|
+
setTestResults([]);
|
|
16334
|
+
const results = [];
|
|
16335
|
+
let testIdx = 0;
|
|
16336
|
+
const runNextTest = () => {
|
|
16337
|
+
if (testIdx >= testCases.length) {
|
|
16338
|
+
const allPassed = results.every((r2) => r2.passed);
|
|
16339
|
+
setIsTesting(false);
|
|
16340
|
+
setTestResults(results);
|
|
16341
|
+
if (allPassed && completeEvent) {
|
|
16342
|
+
emit(`UI:${completeEvent}`, {
|
|
16343
|
+
success: true,
|
|
16344
|
+
passedTests: results.filter((r2) => r2.passed).length
|
|
16345
|
+
});
|
|
16346
|
+
}
|
|
16347
|
+
return;
|
|
16348
|
+
}
|
|
16349
|
+
const testCase = testCases[testIdx];
|
|
16350
|
+
if (!testCase) return;
|
|
16351
|
+
let state = initialState;
|
|
16352
|
+
for (const event of testCase.events) {
|
|
16353
|
+
const trans = transitions.find((t2) => t2.from === state && t2.event === event);
|
|
16354
|
+
if (trans) {
|
|
16355
|
+
state = trans.to;
|
|
16356
|
+
}
|
|
16357
|
+
}
|
|
16358
|
+
setCurrentState(state);
|
|
16359
|
+
results.push({
|
|
16360
|
+
label: testCase.label,
|
|
16361
|
+
passed: state === testCase.expectedState,
|
|
16362
|
+
actualState: state,
|
|
16363
|
+
expectedState: testCase.expectedState
|
|
16364
|
+
});
|
|
16365
|
+
testIdx++;
|
|
16366
|
+
timerRef.current = setTimeout(runNextTest, stepDurationMs);
|
|
16367
|
+
};
|
|
16368
|
+
timerRef.current = setTimeout(runNextTest, stepDurationMs);
|
|
16369
|
+
}, [isTesting, transitions, testCases, initialState, stepDurationMs, testEvent, completeEvent, emit]);
|
|
16370
|
+
const handleTryAgain = useCallback(() => {
|
|
16371
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16372
|
+
setIsTesting(false);
|
|
16373
|
+
setCurrentState(initialState);
|
|
16374
|
+
setTestResults([]);
|
|
16375
|
+
}, [initialState]);
|
|
16376
|
+
const handleReset = useCallback(() => {
|
|
16377
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16378
|
+
setIsTesting(false);
|
|
16379
|
+
setCurrentState(initialState);
|
|
16380
|
+
setTestResults([]);
|
|
16381
|
+
setVariables([...entityVariables]);
|
|
16382
|
+
setSelectedState(null);
|
|
16383
|
+
setAddingFrom(null);
|
|
16384
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16385
|
+
}, [initialState, entityVariables, playAgainEvent, emit]);
|
|
16386
|
+
const codeData = useMemo(() => ({
|
|
16387
|
+
name: entityName,
|
|
16388
|
+
states: entityStates,
|
|
16389
|
+
initialState,
|
|
16390
|
+
transitions: transitions.map((t2) => ({
|
|
16391
|
+
from: t2.from,
|
|
16392
|
+
to: t2.to,
|
|
16393
|
+
event: t2.event,
|
|
16394
|
+
...t2.guardHint ? { guard: t2.guardHint } : {}
|
|
16395
|
+
}))
|
|
16396
|
+
}), [entityName, entityStates, initialState, transitions]);
|
|
16397
|
+
if (!resolved) return null;
|
|
16398
|
+
const theme = resolved.theme ?? void 0;
|
|
16399
|
+
const themeBackground = theme?.background;
|
|
16400
|
+
const headerImage = str(resolved.headerImage);
|
|
16401
|
+
const hint = str(resolved.hint);
|
|
16402
|
+
return /* @__PURE__ */ jsxs(
|
|
16403
|
+
VStack,
|
|
16404
|
+
{
|
|
16405
|
+
className: cn("p-4 gap-6", className),
|
|
16406
|
+
style: {
|
|
16407
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16408
|
+
backgroundSize: "cover",
|
|
16409
|
+
backgroundPosition: "center"
|
|
16410
|
+
},
|
|
16411
|
+
children: [
|
|
16412
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16413
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
16414
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
16415
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
|
|
16416
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-warning/10 border border-warning/30", gap: "xs", children: [
|
|
16417
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-warning font-bold", children: t("game.hint") + ":" }),
|
|
16418
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: hint })
|
|
16419
|
+
] })
|
|
16420
|
+
] }),
|
|
16421
|
+
/* @__PURE__ */ jsxs(HStack, { className: "flex-wrap items-start", gap: "lg", children: [
|
|
16422
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "flex-1 min-w-[300px]", children: [
|
|
16423
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
16424
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.graph") }),
|
|
16425
|
+
addingFrom && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent animate-pulse", children: t("stateArchitect.clickTarget", { state: addingFrom || "" }) })
|
|
16426
|
+
] }),
|
|
16427
|
+
/* @__PURE__ */ jsxs(
|
|
16428
|
+
Box,
|
|
16429
|
+
{
|
|
16430
|
+
position: "relative",
|
|
16431
|
+
className: "rounded-container border border-border bg-background overflow-hidden",
|
|
16432
|
+
style: { width: GRAPH_W, height: GRAPH_H },
|
|
16433
|
+
children: [
|
|
16434
|
+
/* @__PURE__ */ jsxs(
|
|
16435
|
+
"svg",
|
|
16436
|
+
{
|
|
16437
|
+
width: GRAPH_W,
|
|
16438
|
+
height: GRAPH_H,
|
|
16439
|
+
className: "absolute inset-0",
|
|
16440
|
+
style: { pointerEvents: "none" },
|
|
16441
|
+
children: [
|
|
16442
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
16443
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-border)" }) }),
|
|
16444
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead-active", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-primary)" }) })
|
|
16445
|
+
] }),
|
|
16446
|
+
transitions.map((t2) => {
|
|
16447
|
+
const fromPos = positions[t2.from];
|
|
16448
|
+
const toPos = positions[t2.to];
|
|
16449
|
+
if (!fromPos || !toPos) return null;
|
|
16450
|
+
const isActive = t2.from === currentState;
|
|
16451
|
+
return /* @__PURE__ */ jsx(
|
|
16452
|
+
TransitionArrow,
|
|
16453
|
+
{
|
|
16454
|
+
from: fromPos,
|
|
16455
|
+
to: toPos,
|
|
16456
|
+
eventLabel: t2.event,
|
|
16457
|
+
guardHint: t2.guardHint,
|
|
16458
|
+
isActive
|
|
16459
|
+
},
|
|
16460
|
+
t2.id
|
|
16461
|
+
);
|
|
16462
|
+
})
|
|
16463
|
+
]
|
|
16464
|
+
}
|
|
16465
|
+
),
|
|
16466
|
+
entityStates.map((state) => /* @__PURE__ */ jsx(
|
|
16467
|
+
StateNode,
|
|
16468
|
+
{
|
|
16469
|
+
name: state,
|
|
16470
|
+
position: positions[state],
|
|
16471
|
+
isCurrent: state === currentState,
|
|
16472
|
+
isSelected: state === selectedState,
|
|
16473
|
+
isInitial: state === initialState,
|
|
16474
|
+
onClick: () => handleStateClick(state)
|
|
16475
|
+
},
|
|
16476
|
+
state
|
|
16477
|
+
))
|
|
16478
|
+
]
|
|
16479
|
+
}
|
|
16480
|
+
),
|
|
16481
|
+
!isTesting && /* @__PURE__ */ jsx(HStack, { gap: "sm", children: /* @__PURE__ */ jsx(
|
|
16482
|
+
Button,
|
|
16483
|
+
{
|
|
16484
|
+
variant: "ghost",
|
|
16485
|
+
onClick: handleStartAddTransition,
|
|
16486
|
+
disabled: !selectedState,
|
|
16487
|
+
children: selectedState ? t("stateArchitect.addTransition", { state: selectedState }) : t("stateArchitect.addTransitionPrompt")
|
|
16488
|
+
}
|
|
16489
|
+
) }),
|
|
16490
|
+
transitions.length > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "p-3 rounded-container bg-muted/50 border border-border", children: [
|
|
16491
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: t("stateArchitect.transitions", { count: transitions.length }) + ":" }),
|
|
16492
|
+
transitions.map((t2) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
|
|
16493
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: t2.from }),
|
|
16494
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "\u2014[" }),
|
|
16495
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-medium", children: t2.event }),
|
|
16496
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "]\u2192" }),
|
|
16497
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-success", children: t2.to }),
|
|
16498
|
+
t2.guardHint && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-warning", children: [
|
|
16499
|
+
"(",
|
|
16500
|
+
t2.guardHint,
|
|
16501
|
+
")"
|
|
16502
|
+
] }),
|
|
16503
|
+
!isTesting && /* @__PURE__ */ jsx(
|
|
16504
|
+
Button,
|
|
16505
|
+
{
|
|
16506
|
+
variant: "ghost",
|
|
16507
|
+
onClick: () => handleRemoveTransition(t2.id),
|
|
16508
|
+
className: "text-xs ml-auto",
|
|
16509
|
+
children: "\xD7"
|
|
16510
|
+
}
|
|
16511
|
+
)
|
|
16512
|
+
] }, t2.id))
|
|
16513
|
+
] })
|
|
16514
|
+
] }),
|
|
16515
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "w-[280px] shrink-0", children: [
|
|
16516
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "full", size: "sm" }),
|
|
16517
|
+
/* @__PURE__ */ jsx(
|
|
16518
|
+
VariablePanel,
|
|
16519
|
+
{
|
|
16520
|
+
entityName,
|
|
16521
|
+
variables
|
|
16522
|
+
}
|
|
16523
|
+
),
|
|
16524
|
+
testResults.length > 0 && /* @__PURE__ */ jsxs(VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
|
|
16525
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.testResults") + ":" }),
|
|
16526
|
+
testResults.map((r2, i) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
|
|
16527
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: r2.passed ? "text-success" : "text-error", children: r2.passed ? "\u2714" : "\u2717" }),
|
|
16528
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground flex-1", children: r2.label }),
|
|
16529
|
+
!r2.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r2.actualState }) })
|
|
16530
|
+
] }, i))
|
|
16531
|
+
] }),
|
|
16532
|
+
resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
|
|
16533
|
+
] })
|
|
16534
|
+
] }),
|
|
16535
|
+
isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
|
|
16536
|
+
!isTesting && !isSuccess && testResults.some((r2) => !r2.passed) && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16537
|
+
/* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(ENCOURAGEMENT_KEYS3[Math.min(attempts - 1, ENCOURAGEMENT_KEYS3.length - 1)] ?? ENCOURAGEMENT_KEYS3[0]) }) }),
|
|
16538
|
+
!isSuccess && attempts >= 2 && Boolean(str(resolved?.hint)) && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
16539
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
16540
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
16541
|
+
] }) })
|
|
16542
|
+
] }),
|
|
16543
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
16544
|
+
!isTesting && !isSuccess && testResults.some((r2) => !r2.passed) ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
|
|
16545
|
+
Button,
|
|
16546
|
+
{
|
|
16547
|
+
variant: "primary",
|
|
16548
|
+
onClick: handleTest,
|
|
16549
|
+
disabled: isTesting,
|
|
16550
|
+
children: "\u25B6 " + t("game.runTests")
|
|
16551
|
+
}
|
|
16552
|
+
),
|
|
16553
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
16554
|
+
] })
|
|
16555
|
+
]
|
|
16556
|
+
}
|
|
16557
|
+
);
|
|
16558
|
+
}
|
|
16559
|
+
var ENCOURAGEMENT_KEYS3, nextTransId;
|
|
16560
|
+
var init_StateArchitectBoard = __esm({
|
|
16561
|
+
"components/game/2d/organisms/StateArchitectBoard.tsx"() {
|
|
16562
|
+
init_atoms();
|
|
16563
|
+
init_cn();
|
|
16564
|
+
init_useEventBus();
|
|
16565
|
+
init_TraitStateViewer();
|
|
16566
|
+
init_StateNode();
|
|
16567
|
+
init_TransitionArrow();
|
|
16568
|
+
init_VariablePanel();
|
|
16569
|
+
init_StateJsonView();
|
|
16570
|
+
init_boardEntity();
|
|
16571
|
+
ENCOURAGEMENT_KEYS3 = [
|
|
16572
|
+
"puzzle.tryAgain1",
|
|
16573
|
+
"puzzle.tryAgain2",
|
|
16574
|
+
"puzzle.tryAgain3"
|
|
16575
|
+
];
|
|
16576
|
+
nextTransId = 100;
|
|
16577
|
+
StateArchitectBoard.displayName = "StateArchitectBoard";
|
|
16578
|
+
}
|
|
16579
|
+
});
|
|
16580
|
+
function readSimulatorParameters(v) {
|
|
16581
|
+
if (!Array.isArray(v)) return [];
|
|
16582
|
+
const result = [];
|
|
16583
|
+
for (const item of v) {
|
|
16584
|
+
if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
|
|
16585
|
+
const param = item;
|
|
16586
|
+
if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
|
|
16587
|
+
result.push({
|
|
16588
|
+
id: str(param.id),
|
|
16589
|
+
label: str(param.label),
|
|
16590
|
+
unit: str(param.unit),
|
|
16591
|
+
min: num(param.min),
|
|
16592
|
+
max: num(param.max),
|
|
16593
|
+
step: num(param.step),
|
|
16594
|
+
initial: num(param.initial),
|
|
16595
|
+
correct: num(param.correct),
|
|
16596
|
+
tolerance: num(param.tolerance)
|
|
16597
|
+
});
|
|
16598
|
+
}
|
|
16599
|
+
}
|
|
16600
|
+
}
|
|
16601
|
+
return result;
|
|
16602
|
+
}
|
|
16603
|
+
function SimulatorBoard({
|
|
16604
|
+
entity,
|
|
16605
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
16606
|
+
setAEvent,
|
|
16607
|
+
setBEvent,
|
|
16608
|
+
checkEvent,
|
|
16609
|
+
playAgainEvent,
|
|
16610
|
+
assetManifest,
|
|
16611
|
+
className
|
|
16612
|
+
}) {
|
|
16613
|
+
const ui = assetManifest?.ui;
|
|
16614
|
+
const { emit } = useEventBus();
|
|
16615
|
+
const { t } = useTranslate();
|
|
16616
|
+
const resolved = boardEntity(entity);
|
|
16617
|
+
const parameters = readSimulatorParameters(resolved?.parameters);
|
|
16618
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16619
|
+
if (!resolved) return null;
|
|
16620
|
+
const paramA = num(resolved.paramA);
|
|
16621
|
+
const paramB = num(resolved.paramB);
|
|
16622
|
+
const output = num(resolved.output);
|
|
16623
|
+
const targetValue = num(resolved.target);
|
|
16624
|
+
const targetTolerance = num(resolved.tolerance);
|
|
16625
|
+
const attempts = num(resolved.attempts);
|
|
16626
|
+
const result = str(resolved.result);
|
|
16627
|
+
const isWin = result === "win";
|
|
16628
|
+
const isComplete = result !== "none" && result !== "";
|
|
16629
|
+
const paramAValue = parameters[0];
|
|
16630
|
+
const paramBValue = parameters[1];
|
|
16631
|
+
const sliderValues = [paramA, paramB];
|
|
16632
|
+
const sliderEvents = [setAEvent, setBEvent];
|
|
16633
|
+
const handleParameterChange = (index, value) => {
|
|
16634
|
+
if (isComplete) return;
|
|
16635
|
+
const ev = sliderEvents[index];
|
|
16636
|
+
if (ev) emit(`UI:${ev}`, { value });
|
|
16637
|
+
};
|
|
16638
|
+
const handleCheck = () => {
|
|
16639
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
16640
|
+
};
|
|
16641
|
+
const handlePlayAgain = () => {
|
|
16642
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16643
|
+
};
|
|
16644
|
+
const themeBackground = (() => {
|
|
16645
|
+
const t2 = resolved.theme;
|
|
16646
|
+
if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
|
|
16647
|
+
const bg = t2.background;
|
|
16648
|
+
return str(bg);
|
|
16649
|
+
}
|
|
16650
|
+
return "";
|
|
16651
|
+
})();
|
|
16652
|
+
const headerImage = str(resolved.headerImage);
|
|
16653
|
+
const hint = str(resolved.hint);
|
|
16654
|
+
const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
|
|
16655
|
+
const outputLabel = str(resolved.outputLabel);
|
|
16656
|
+
const outputUnit = str(resolved.outputUnit);
|
|
16657
|
+
return /* @__PURE__ */ jsx(
|
|
16658
|
+
Box,
|
|
16659
|
+
{
|
|
16660
|
+
className,
|
|
16661
|
+
style: {
|
|
16662
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16663
|
+
backgroundSize: "cover",
|
|
16664
|
+
backgroundPosition: "center"
|
|
16665
|
+
},
|
|
16666
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
16667
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16668
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16669
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
16670
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
16671
|
+
] }) }),
|
|
16672
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
|
|
16673
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("simulator.parameters") }),
|
|
16674
|
+
[paramAValue, paramBValue].map(
|
|
16675
|
+
(param, index) => param ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
16676
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
|
|
16677
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: param.label }),
|
|
16678
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
16679
|
+
sliderValues[index],
|
|
16680
|
+
" ",
|
|
16681
|
+
param.unit
|
|
16682
|
+
] })
|
|
16683
|
+
] }),
|
|
16684
|
+
/* @__PURE__ */ jsx(
|
|
16685
|
+
"input",
|
|
16686
|
+
{
|
|
16687
|
+
type: "range",
|
|
16688
|
+
min: param.min,
|
|
16689
|
+
max: param.max,
|
|
16690
|
+
step: param.step,
|
|
16691
|
+
value: sliderValues[index],
|
|
16692
|
+
onChange: (e) => handleParameterChange(index, Number(e.target.value)),
|
|
16693
|
+
disabled: isComplete,
|
|
16694
|
+
className: "w-full accent-foreground"
|
|
16695
|
+
}
|
|
16696
|
+
),
|
|
16697
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", children: [
|
|
16698
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16699
|
+
param.min,
|
|
16700
|
+
" ",
|
|
16701
|
+
param.unit
|
|
16702
|
+
] }),
|
|
16703
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16704
|
+
param.max,
|
|
16705
|
+
" ",
|
|
16706
|
+
param.unit
|
|
16707
|
+
] })
|
|
16708
|
+
] })
|
|
16709
|
+
] }, param.id ?? index) : null
|
|
16710
|
+
)
|
|
16711
|
+
] }) }),
|
|
16712
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
16713
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: outputLabel }),
|
|
16714
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "h3", weight: "bold", children: [
|
|
16715
|
+
output.toFixed(2),
|
|
16716
|
+
" ",
|
|
16717
|
+
outputUnit
|
|
16718
|
+
] }),
|
|
16719
|
+
isComplete && /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
16720
|
+
/* @__PURE__ */ jsx(
|
|
16721
|
+
GameIcon,
|
|
16722
|
+
{
|
|
16723
|
+
icon: isWin ? CheckCircle : XCircle,
|
|
16724
|
+
assetUrl: isWin ? ui?.["correct"] : ui?.["incorrect"],
|
|
16725
|
+
size: "sm",
|
|
16726
|
+
className: isWin ? "text-success" : "text-error"
|
|
16727
|
+
}
|
|
16728
|
+
),
|
|
16729
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", className: isWin ? "text-success" : "text-error", children: isWin ? str(resolved.successMessage) || t("simulator.correct") : str(resolved.failMessage) || t("simulator.incorrect") })
|
|
16730
|
+
] }),
|
|
16731
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16732
|
+
t("simulator.target"),
|
|
16733
|
+
": ",
|
|
16734
|
+
targetValue,
|
|
16735
|
+
" ",
|
|
16736
|
+
outputUnit,
|
|
16737
|
+
" (\xB1",
|
|
16738
|
+
targetTolerance,
|
|
16739
|
+
")"
|
|
16740
|
+
] })
|
|
16741
|
+
] }) }),
|
|
16742
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
16743
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
16744
|
+
!isComplete ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleCheck, children: [
|
|
16745
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Play, assetUrl: ui?.["play"], size: "sm" }),
|
|
16746
|
+
t("simulator.simulate")
|
|
16747
|
+
] }) : null,
|
|
16748
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
|
|
16749
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
16750
|
+
t("simulator.reset")
|
|
16751
|
+
] })
|
|
16752
|
+
] })
|
|
16753
|
+
] })
|
|
16754
|
+
}
|
|
16755
|
+
);
|
|
16756
|
+
}
|
|
16757
|
+
var init_SimulatorBoard = __esm({
|
|
16758
|
+
"components/game/2d/organisms/SimulatorBoard.tsx"() {
|
|
16759
|
+
init_atoms();
|
|
16760
|
+
init_useEventBus();
|
|
16761
|
+
init_boardEntity();
|
|
16762
|
+
init_GameIcon();
|
|
16763
|
+
SimulatorBoard.displayName = "SimulatorBoard";
|
|
16764
|
+
}
|
|
16765
|
+
});
|
|
16766
|
+
function ClassifierBoard({
|
|
16767
|
+
entity,
|
|
16768
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
16769
|
+
assignEvent,
|
|
16770
|
+
checkEvent,
|
|
16771
|
+
playAgainEvent,
|
|
16772
|
+
assetManifest,
|
|
16773
|
+
className
|
|
16774
|
+
}) {
|
|
16775
|
+
const ui = assetManifest?.ui;
|
|
16776
|
+
const { emit } = useEventBus();
|
|
16777
|
+
const { t } = useTranslate();
|
|
16778
|
+
const resolved = boardEntity(entity);
|
|
16779
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16780
|
+
const items = rows(resolved?.items);
|
|
16781
|
+
const categories = rows(resolved?.categories);
|
|
16782
|
+
const result = str(resolved?.result);
|
|
16783
|
+
const submitted = result === "win";
|
|
16784
|
+
const attempts = num(resolved?.attempts);
|
|
16785
|
+
const assignments = items.reduce((acc, item) => {
|
|
16786
|
+
if (item.assignedCategory != null && item.assignedCategory !== "") acc[item.id] = item.assignedCategory;
|
|
16787
|
+
return acc;
|
|
16788
|
+
}, {});
|
|
16789
|
+
const unassignedItems = items.filter((item) => !assignments[item.id]);
|
|
16790
|
+
const allAssigned = items.length > 0 && Object.keys(assignments).length === items.length;
|
|
16791
|
+
const results = submitted ? items.map((item) => ({
|
|
16792
|
+
item,
|
|
16793
|
+
assigned: assignments[item.id],
|
|
16794
|
+
correct: assignments[item.id] === item.correctCategory
|
|
16795
|
+
})) : [];
|
|
16796
|
+
const allCorrect = result === "win";
|
|
16797
|
+
const correctCount = results.filter((r2) => r2.correct).length;
|
|
16798
|
+
const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
|
|
16799
|
+
const handleAssign = (itemId, categoryId) => {
|
|
16800
|
+
if (submitted) return;
|
|
16801
|
+
if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId });
|
|
16802
|
+
};
|
|
16803
|
+
const handleUnassign = (itemId) => {
|
|
16804
|
+
if (submitted) return;
|
|
16805
|
+
if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId: "" });
|
|
16806
|
+
};
|
|
16807
|
+
const handleSubmit = () => {
|
|
16808
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
16809
|
+
if (allAssigned && items.every((item) => assignments[item.id] === item.correctCategory)) {
|
|
16810
|
+
emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
16811
|
+
}
|
|
16812
|
+
};
|
|
16813
|
+
const handleFullReset = () => {
|
|
16814
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16815
|
+
};
|
|
16816
|
+
if (!resolved) return null;
|
|
16817
|
+
const theme = resolved.theme ?? void 0;
|
|
16818
|
+
const themeBackground = theme?.background;
|
|
16819
|
+
const headerImage = str(resolved.headerImage);
|
|
16820
|
+
const hint = str(resolved.hint);
|
|
16821
|
+
const failMessage = str(resolved.failMessage);
|
|
16822
|
+
return /* @__PURE__ */ jsx(
|
|
16823
|
+
Box,
|
|
16824
|
+
{
|
|
16825
|
+
className,
|
|
16826
|
+
style: {
|
|
16827
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16828
|
+
backgroundSize: "cover",
|
|
16829
|
+
backgroundPosition: "center"
|
|
16830
|
+
},
|
|
16831
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
16832
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16833
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16834
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
16835
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
16836
|
+
] }) }),
|
|
16837
|
+
unassignedItems.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16838
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("classifier.itemsToSort") }),
|
|
16839
|
+
/* @__PURE__ */ jsx(HStack, { gap: "sm", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(Badge, { size: "md", className: "cursor-pointer", children: [
|
|
16840
|
+
item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block" }),
|
|
16841
|
+
item.label
|
|
16842
|
+
] }, item.id)) })
|
|
16843
|
+
] }) }),
|
|
16844
|
+
/* @__PURE__ */ jsx(VStack, { gap: "md", children: categories.map((cat) => {
|
|
16845
|
+
const catItems = items.filter((item) => assignments[item.id] === cat.id);
|
|
16846
|
+
return /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16847
|
+
cat.imageUrl && /* @__PURE__ */ jsx(Box, { className: "w-full h-16 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: cat.imageUrl, alt: "", className: "w-full h-full object-cover" }) }),
|
|
16848
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
|
|
16849
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: cat.label }),
|
|
16850
|
+
/* @__PURE__ */ jsx(Badge, { size: "sm", children: catItems.length })
|
|
16851
|
+
] }),
|
|
16852
|
+
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap min-h-[2rem]", children: catItems.map((item) => {
|
|
16853
|
+
const result2 = results.find((r2) => r2.item.id === item.id);
|
|
16854
|
+
return /* @__PURE__ */ jsxs(
|
|
16855
|
+
Badge,
|
|
16856
|
+
{
|
|
16857
|
+
size: "sm",
|
|
16858
|
+
className: `cursor-pointer ${result2 ? result2.correct ? "border-success bg-success/10" : "border-error bg-error/10" : ""}`,
|
|
16859
|
+
onClick: () => handleUnassign(item.id),
|
|
16860
|
+
children: [
|
|
16861
|
+
item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-3 h-3 object-contain inline-block" }),
|
|
16862
|
+
item.label,
|
|
16863
|
+
result2 && /* @__PURE__ */ jsx(
|
|
16864
|
+
GameIcon,
|
|
16865
|
+
{
|
|
16866
|
+
icon: result2.correct ? CheckCircle : XCircle,
|
|
16867
|
+
assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
|
|
16868
|
+
size: "sm",
|
|
16869
|
+
className: result2.correct ? "text-success" : "text-error"
|
|
16870
|
+
}
|
|
16871
|
+
)
|
|
16872
|
+
]
|
|
16873
|
+
},
|
|
16874
|
+
item.id
|
|
16875
|
+
);
|
|
16876
|
+
}) }),
|
|
16877
|
+
!submitted && unassignedItems.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
16878
|
+
Button,
|
|
16879
|
+
{
|
|
16880
|
+
size: "sm",
|
|
16881
|
+
variant: "ghost",
|
|
16882
|
+
onClick: () => handleAssign(item.id, cat.id),
|
|
16883
|
+
className: "text-xs opacity-50 hover:opacity-100",
|
|
16884
|
+
children: [
|
|
16885
|
+
"+ ",
|
|
16886
|
+
item.label
|
|
16887
|
+
]
|
|
16888
|
+
},
|
|
16889
|
+
item.id
|
|
16890
|
+
)) })
|
|
16891
|
+
] }) }, cat.id);
|
|
16892
|
+
}) }),
|
|
16893
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
16894
|
+
/* @__PURE__ */ jsx(
|
|
16895
|
+
GameIcon,
|
|
16896
|
+
{
|
|
16897
|
+
icon: allCorrect ? CheckCircle : XCircle,
|
|
16898
|
+
assetUrl: allCorrect ? ui?.["correct"] : ui?.["incorrect"],
|
|
16899
|
+
size: "lg",
|
|
16900
|
+
className: allCorrect ? "text-success" : "text-error"
|
|
16901
|
+
}
|
|
16902
|
+
),
|
|
16903
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
|
|
16904
|
+
!allCorrect && failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: failMessage })
|
|
16905
|
+
] }) }),
|
|
16906
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
16907
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
16908
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allAssigned, children: [
|
|
16909
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
|
|
16910
|
+
t("classifier.check")
|
|
16911
|
+
] }),
|
|
16912
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleFullReset, children: [
|
|
16913
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
16914
|
+
t("classifier.reset")
|
|
16915
|
+
] })
|
|
16916
|
+
] })
|
|
16917
|
+
] })
|
|
16918
|
+
}
|
|
16919
|
+
);
|
|
16920
|
+
}
|
|
16921
|
+
var init_ClassifierBoard = __esm({
|
|
16922
|
+
"components/game/2d/organisms/ClassifierBoard.tsx"() {
|
|
16923
|
+
init_atoms();
|
|
16924
|
+
init_useEventBus();
|
|
16925
|
+
init_boardEntity();
|
|
16926
|
+
init_GameIcon();
|
|
16927
|
+
ClassifierBoard.displayName = "ClassifierBoard";
|
|
16928
|
+
}
|
|
16929
|
+
});
|
|
16930
|
+
function BuilderBoard({
|
|
16931
|
+
entity,
|
|
16932
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
16933
|
+
placeEvent,
|
|
16934
|
+
checkEvent,
|
|
16935
|
+
playAgainEvent,
|
|
16936
|
+
assetManifest,
|
|
16937
|
+
className
|
|
16938
|
+
}) {
|
|
16939
|
+
const ui = assetManifest?.ui;
|
|
16940
|
+
const { emit } = useEventBus();
|
|
16941
|
+
const { t } = useTranslate();
|
|
16942
|
+
const resolved = boardEntity(entity);
|
|
16943
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16944
|
+
const [selectedComponent, setSelectedComponent] = useState(null);
|
|
16945
|
+
const components = rows(resolved?.components).map((r2) => ({
|
|
16946
|
+
id: str(r2.id),
|
|
16947
|
+
label: str(r2.label),
|
|
16948
|
+
description: str(r2.description) || void 0,
|
|
16949
|
+
iconEmoji: str(r2.iconEmoji) || void 0,
|
|
16950
|
+
iconUrl: str(r2.iconUrl) || void 0,
|
|
16951
|
+
category: str(r2.category) || void 0
|
|
16952
|
+
}));
|
|
16953
|
+
const slots = rows(resolved?.slots).map((r2) => ({
|
|
16954
|
+
id: str(r2.id),
|
|
16955
|
+
label: str(r2.label) || void 0,
|
|
16956
|
+
description: str(r2.description) || void 0,
|
|
16957
|
+
requiredComponentId: str(r2.requiredComponentId),
|
|
16958
|
+
placedComponentId: str(r2.placedComponentId) || void 0
|
|
16959
|
+
}));
|
|
16960
|
+
const placements = {};
|
|
16961
|
+
for (const slot of slots) {
|
|
16962
|
+
if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
|
|
16963
|
+
}
|
|
16964
|
+
const attempts = num(resolved?.attempts);
|
|
16965
|
+
const result = str(resolved?.result) || "none";
|
|
16966
|
+
const submitted = result === "win";
|
|
16967
|
+
const usedComponentIds = new Set(Object.values(placements));
|
|
16968
|
+
const availableComponents = components.filter((c) => !usedComponentIds.has(c.id));
|
|
16969
|
+
const allPlaced = slots.length > 0 && slots.every((s) => Boolean(placements[s.id]));
|
|
16970
|
+
const results = submitted ? slots.map((slot) => ({
|
|
16971
|
+
slot,
|
|
16972
|
+
placed: placements[slot.id],
|
|
16973
|
+
correct: placements[slot.id] === slot.requiredComponentId
|
|
16974
|
+
})) : [];
|
|
16975
|
+
const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
|
|
16976
|
+
const handlePlaceComponent = (slotId) => {
|
|
16977
|
+
if (submitted || !selectedComponent) return;
|
|
16978
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: selectedComponent });
|
|
16979
|
+
setSelectedComponent(null);
|
|
16980
|
+
};
|
|
16981
|
+
const handleRemoveFromSlot = (slotId) => {
|
|
16982
|
+
if (submitted) return;
|
|
16983
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: "" });
|
|
16984
|
+
};
|
|
16985
|
+
const handleSubmit = () => {
|
|
16986
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
16987
|
+
const solved = slots.length > 0 && slots.every((s) => placements[s.id] === s.requiredComponentId);
|
|
16988
|
+
if (solved && completeEvent) {
|
|
16989
|
+
emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
16990
|
+
}
|
|
16991
|
+
};
|
|
16992
|
+
const handlePlayAgain = () => {
|
|
16993
|
+
setSelectedComponent(null);
|
|
16994
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16995
|
+
};
|
|
16996
|
+
const getComponentById = (id) => components.find((c) => c.id === id);
|
|
16997
|
+
if (!resolved) return null;
|
|
16998
|
+
const theme = resolved.theme ?? void 0;
|
|
16999
|
+
const themeBackground = theme?.background;
|
|
17000
|
+
const headerImage = str(resolved.headerImage);
|
|
17001
|
+
const hint = str(resolved.hint);
|
|
17002
|
+
return /* @__PURE__ */ jsx(
|
|
17003
|
+
Box,
|
|
17004
|
+
{
|
|
17005
|
+
className,
|
|
17006
|
+
style: {
|
|
17007
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17008
|
+
backgroundSize: "cover",
|
|
17009
|
+
backgroundPosition: "center"
|
|
17010
|
+
},
|
|
17011
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17012
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17013
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17014
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
17015
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
17016
|
+
] }) }),
|
|
17017
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17018
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.components") }),
|
|
17019
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "flex-wrap", children: [
|
|
17020
|
+
availableComponents.map((comp) => /* @__PURE__ */ jsxs(
|
|
17021
|
+
Button,
|
|
17022
|
+
{
|
|
17023
|
+
size: "sm",
|
|
17024
|
+
variant: selectedComponent === comp.id ? "primary" : "secondary",
|
|
17025
|
+
onClick: () => setSelectedComponent(selectedComponent === comp.id ? null : comp.id),
|
|
17026
|
+
disabled: submitted,
|
|
17027
|
+
children: [
|
|
17028
|
+
comp.iconUrl ? /* @__PURE__ */ jsx("img", { src: comp.iconUrl, alt: "", className: "w-5 h-5 object-contain inline-block mr-1" }) : comp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17029
|
+
comp.iconEmoji,
|
|
17030
|
+
" "
|
|
17031
|
+
] }) : null,
|
|
17032
|
+
comp.label
|
|
17033
|
+
]
|
|
17034
|
+
},
|
|
17035
|
+
comp.id
|
|
17036
|
+
)),
|
|
17037
|
+
availableComponents.length === 0 && !submitted && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.allPlaced") })
|
|
17038
|
+
] })
|
|
17039
|
+
] }) }),
|
|
17040
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17041
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.blueprint") }),
|
|
17042
|
+
/* @__PURE__ */ jsx(VStack, { gap: "sm", children: slots.map((slot) => {
|
|
17043
|
+
const placedComp = placements[slot.id] ? getComponentById(placements[slot.id]) : null;
|
|
17044
|
+
const result2 = results.find((r2) => r2.slot.id === slot.id);
|
|
17045
|
+
return /* @__PURE__ */ jsxs(
|
|
17046
|
+
HStack,
|
|
17047
|
+
{
|
|
17048
|
+
gap: "sm",
|
|
17049
|
+
align: "center",
|
|
17050
|
+
className: `p-3 border-2 rounded ${result2 ? result2.correct ? "border-success" : "border-error" : selectedComponent ? "border-dashed border-foreground cursor-pointer" : "border-border"}`,
|
|
17051
|
+
onClick: () => handlePlaceComponent(slot.id),
|
|
17052
|
+
children: [
|
|
17053
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", className: "flex-1", children: [
|
|
17054
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: slot.label }),
|
|
17055
|
+
slot.description && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: slot.description })
|
|
17056
|
+
] }),
|
|
17057
|
+
placedComp ? /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
17058
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", onClick: () => handleRemoveFromSlot(slot.id), children: [
|
|
17059
|
+
placedComp.iconUrl ? /* @__PURE__ */ jsx("img", { src: placedComp.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block mr-1" }) : placedComp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17060
|
+
placedComp.iconEmoji,
|
|
17061
|
+
" "
|
|
17062
|
+
] }) : null,
|
|
17063
|
+
placedComp.label
|
|
17064
|
+
] }),
|
|
17065
|
+
result2 && /* @__PURE__ */ jsx(
|
|
17066
|
+
GameIcon,
|
|
17067
|
+
{
|
|
17068
|
+
icon: result2.correct ? CheckCircle : XCircle,
|
|
17069
|
+
assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
|
|
17070
|
+
size: "sm",
|
|
17071
|
+
className: result2.correct ? "text-success" : "text-error"
|
|
17072
|
+
}
|
|
17073
|
+
)
|
|
17074
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.empty") })
|
|
17075
|
+
]
|
|
17076
|
+
},
|
|
17077
|
+
slot.id
|
|
17078
|
+
);
|
|
17079
|
+
}) })
|
|
17080
|
+
] }) }),
|
|
17081
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
17082
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: "text-success" }),
|
|
17083
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: str(resolved.successMessage) || t("builder.success") })
|
|
17084
|
+
] }) }),
|
|
17085
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17086
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
17087
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allPlaced, children: [
|
|
17088
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Wrench, assetUrl: ui?.["build"], size: "sm" }),
|
|
17089
|
+
t("builder.build")
|
|
17090
|
+
] }),
|
|
17091
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
|
|
17092
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
17093
|
+
t("builder.reset")
|
|
17094
|
+
] })
|
|
17095
|
+
] })
|
|
17096
|
+
] })
|
|
17097
|
+
}
|
|
17098
|
+
);
|
|
17099
|
+
}
|
|
17100
|
+
var init_BuilderBoard = __esm({
|
|
17101
|
+
"components/game/2d/organisms/BuilderBoard.tsx"() {
|
|
17102
|
+
init_atoms();
|
|
17103
|
+
init_useEventBus();
|
|
17104
|
+
init_boardEntity();
|
|
17105
|
+
init_GameIcon();
|
|
17106
|
+
BuilderBoard.displayName = "BuilderBoard";
|
|
17107
|
+
}
|
|
17108
|
+
});
|
|
17109
|
+
function toDebuggerLine(v) {
|
|
17110
|
+
if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
|
|
17111
|
+
const id = v["id"];
|
|
17112
|
+
const content = v["content"];
|
|
17113
|
+
const isBug = v["isBug"];
|
|
17114
|
+
if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
|
|
17115
|
+
const isFlagged = v["isFlagged"];
|
|
17116
|
+
const explanation = v["explanation"];
|
|
17117
|
+
return {
|
|
17118
|
+
id,
|
|
17119
|
+
content,
|
|
17120
|
+
isBug,
|
|
17121
|
+
isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
|
|
17122
|
+
explanation: typeof explanation === "string" ? explanation : void 0
|
|
17123
|
+
};
|
|
17124
|
+
}
|
|
17125
|
+
function DebuggerBoard({
|
|
17126
|
+
entity,
|
|
17127
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
17128
|
+
toggleFlagEvent,
|
|
17129
|
+
checkEvent,
|
|
17130
|
+
playAgainEvent,
|
|
17131
|
+
assetManifest,
|
|
17132
|
+
className
|
|
17133
|
+
}) {
|
|
17134
|
+
const ui = assetManifest?.ui;
|
|
17135
|
+
const { emit } = useEventBus();
|
|
17136
|
+
const { t } = useTranslate();
|
|
17137
|
+
const resolved = boardEntity(entity);
|
|
17138
|
+
const [headerError, setHeaderError] = useState(false);
|
|
17139
|
+
const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
|
|
17140
|
+
const l = toDebuggerLine(v);
|
|
17141
|
+
return l ? [l] : [];
|
|
17142
|
+
}) : [];
|
|
17143
|
+
const result = str(resolved?.result) || "none";
|
|
17144
|
+
const attempts = num(resolved?.attempts);
|
|
17145
|
+
const submitted = result === "win";
|
|
17146
|
+
const showHint = !submitted && attempts >= 2 && Boolean(str(resolved?.hint));
|
|
17147
|
+
const bugLines = lines.filter((l) => l.isBug);
|
|
17148
|
+
const flaggedLines = lines.filter((l) => l.isFlagged);
|
|
17149
|
+
const correctFlags = lines.filter((l) => l.isBug && l.isFlagged);
|
|
17150
|
+
const falseFlags = lines.filter((l) => !l.isBug && l.isFlagged);
|
|
17151
|
+
const allCorrect = submitted;
|
|
17152
|
+
const toggleLine = (lineId) => {
|
|
17153
|
+
if (submitted) return;
|
|
17154
|
+
if (toggleFlagEvent) emit(`UI:${toggleFlagEvent}`, { lineId });
|
|
17155
|
+
};
|
|
17156
|
+
const handleSubmit = useCallback(() => {
|
|
17157
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
17158
|
+
const correct = correctFlags.length === bugLines.length && falseFlags.length === 0;
|
|
17159
|
+
if (correct) emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
17160
|
+
}, [checkEvent, correctFlags.length, bugLines.length, falseFlags.length, attempts, completeEvent, emit]);
|
|
17161
|
+
const handleReset = () => {
|
|
17162
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
17163
|
+
};
|
|
17164
|
+
if (!resolved) return null;
|
|
17165
|
+
const theme = resolved.theme ?? void 0;
|
|
17166
|
+
const themeBackground = theme?.background;
|
|
17167
|
+
const headerImage = str(resolved.headerImage);
|
|
17168
|
+
const hint = str(resolved.hint);
|
|
17169
|
+
return /* @__PURE__ */ jsx(
|
|
17170
|
+
Box,
|
|
17171
|
+
{
|
|
17172
|
+
className,
|
|
17173
|
+
style: {
|
|
17174
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17175
|
+
backgroundSize: "cover",
|
|
17176
|
+
backgroundPosition: "center"
|
|
17177
|
+
},
|
|
17178
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17179
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17180
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17181
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
17182
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm" }),
|
|
17183
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) })
|
|
17184
|
+
] }),
|
|
17185
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
|
|
17186
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(lines.filter((l) => l.isBug).length) }) })
|
|
17187
|
+
] }) }),
|
|
17188
|
+
/* @__PURE__ */ jsx(Card, { className: "p-0 overflow-hidden", children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: lines.map((line, i) => {
|
|
17189
|
+
const isFlagged = !!line.isFlagged;
|
|
17190
|
+
let lineStyle = "";
|
|
17191
|
+
if (submitted) {
|
|
17192
|
+
if (line.isBug && isFlagged) lineStyle = "bg-success/10";
|
|
17193
|
+
else if (line.isBug && !isFlagged) lineStyle = "bg-warning/10";
|
|
17194
|
+
else if (!line.isBug && isFlagged) lineStyle = "bg-error/10";
|
|
17195
|
+
} else if (isFlagged) {
|
|
17196
|
+
lineStyle = "bg-error/10";
|
|
17197
|
+
}
|
|
17198
|
+
return /* @__PURE__ */ jsxs(
|
|
17199
|
+
HStack,
|
|
17200
|
+
{
|
|
17201
|
+
gap: "none",
|
|
17202
|
+
align: "stretch",
|
|
17203
|
+
className: `border-b border-border cursor-pointer hover:bg-muted ${lineStyle}`,
|
|
17204
|
+
onClick: () => toggleLine(line.id),
|
|
17205
|
+
children: [
|
|
17206
|
+
/* @__PURE__ */ jsx(Box, { className: "w-10 flex-shrink-0 flex items-center justify-center border-r border-border text-muted-foreground", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: i + 1 }) }),
|
|
17207
|
+
/* @__PURE__ */ jsx(Box, { className: "flex-1 px-3 py-1.5 font-mono text-sm whitespace-pre", children: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "font-mono text-sm", children: line.content }) }),
|
|
17208
|
+
/* @__PURE__ */ jsxs(Box, { className: "w-8 flex-shrink-0 flex items-center justify-center", children: [
|
|
17209
|
+
isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-error" }),
|
|
17210
|
+
submitted && line.isBug && !isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-warning" })
|
|
17211
|
+
] })
|
|
17212
|
+
]
|
|
17213
|
+
},
|
|
17214
|
+
line.id
|
|
17215
|
+
);
|
|
17216
|
+
}) }) }),
|
|
17217
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17218
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
|
|
17219
|
+
bugLines.map((line) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "start", children: [
|
|
17220
|
+
/* @__PURE__ */ jsx(
|
|
17221
|
+
GameIcon,
|
|
17222
|
+
{
|
|
17223
|
+
icon: line.isFlagged ? CheckCircle : XCircle,
|
|
17224
|
+
assetUrl: line.isFlagged ? ui?.["correct"] : ui?.["incorrect"],
|
|
17225
|
+
size: "sm",
|
|
17226
|
+
className: line.isFlagged ? "text-success mt-0.5" : "text-warning mt-0.5"
|
|
17227
|
+
}
|
|
17228
|
+
),
|
|
17229
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
17230
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", weight: "bold", className: "font-mono", children: line.content.trim() }),
|
|
17231
|
+
line.explanation && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: line.explanation })
|
|
17232
|
+
] })
|
|
17233
|
+
] }, line.id))
|
|
17234
|
+
] }) }),
|
|
17235
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17236
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
17237
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: flaggedLines.length === 0, children: [
|
|
17238
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
|
|
17239
|
+
t("debugger.submit")
|
|
17240
|
+
] }),
|
|
17241
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleReset, children: [
|
|
17242
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
17243
|
+
t("debugger.reset")
|
|
17244
|
+
] })
|
|
17245
|
+
] })
|
|
17246
|
+
] })
|
|
17247
|
+
}
|
|
17248
|
+
);
|
|
17249
|
+
}
|
|
17250
|
+
var init_DebuggerBoard = __esm({
|
|
17251
|
+
"components/game/2d/organisms/DebuggerBoard.tsx"() {
|
|
17252
|
+
init_atoms();
|
|
17253
|
+
init_useEventBus();
|
|
17254
|
+
init_boardEntity();
|
|
17255
|
+
init_GameIcon();
|
|
17256
|
+
DebuggerBoard.displayName = "DebuggerBoard";
|
|
17257
|
+
}
|
|
17258
|
+
});
|
|
17259
|
+
function NegotiatorBoard({
|
|
17260
|
+
entity,
|
|
17261
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
17262
|
+
playRoundEvent,
|
|
17263
|
+
finishEvent,
|
|
17264
|
+
playAgainEvent,
|
|
17265
|
+
assetManifest,
|
|
17266
|
+
className
|
|
17267
|
+
}) {
|
|
17268
|
+
const ui = assetManifest?.ui;
|
|
17269
|
+
const { emit } = useEventBus();
|
|
17270
|
+
const { t } = useTranslate();
|
|
17271
|
+
const resolved = boardEntity(entity);
|
|
17272
|
+
const [history, setHistory] = useState([]);
|
|
17273
|
+
const [headerError, setHeaderError] = useState(false);
|
|
17274
|
+
const [showHint, setShowHint] = useState(false);
|
|
17275
|
+
const totalRounds = num(resolved?.maxRounds);
|
|
17276
|
+
const targetScore = num(resolved?.targetScore);
|
|
17277
|
+
const currentRound = num(resolved?.round);
|
|
17278
|
+
const result = str(resolved?.result) || "none";
|
|
17279
|
+
const playerTotal = num(resolved?.score);
|
|
17280
|
+
const isComplete = result !== "none" || totalRounds > 0 && currentRound >= totalRounds;
|
|
17281
|
+
const won = result === "win";
|
|
17282
|
+
const lastPlayerAction = str(resolved?.lastPlayerAction);
|
|
17283
|
+
const lastOpponentAction = str(resolved?.lastOpponentAction);
|
|
17284
|
+
const lastPayoff = num(resolved?.lastPayoff);
|
|
17285
|
+
const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
|
|
17286
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
|
|
17287
|
+
return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
|
|
17288
|
+
return [];
|
|
17289
|
+
}) : [];
|
|
17290
|
+
const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
|
|
17291
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
|
|
17292
|
+
return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
|
|
17293
|
+
return [];
|
|
17294
|
+
}) : [];
|
|
17295
|
+
const prevRoundRef = useRef(currentRound);
|
|
17296
|
+
useEffect(() => {
|
|
17297
|
+
if (currentRound > prevRoundRef.current && lastPlayerAction) {
|
|
17298
|
+
const opponentPayoffEntry = payoffMatrix.find(
|
|
17299
|
+
(p) => p.playerAction === lastPlayerAction && p.opponentAction === lastOpponentAction
|
|
17300
|
+
);
|
|
17301
|
+
setHistory((prev) => [
|
|
17302
|
+
...prev,
|
|
17303
|
+
{
|
|
17304
|
+
round: currentRound,
|
|
17305
|
+
playerAction: lastPlayerAction,
|
|
17306
|
+
opponentAction: lastOpponentAction,
|
|
17307
|
+
playerPayoff: lastPayoff,
|
|
17308
|
+
opponentPayoff: opponentPayoffEntry?.opponentPayoff ?? 0
|
|
17309
|
+
}
|
|
17310
|
+
]);
|
|
17311
|
+
}
|
|
17312
|
+
prevRoundRef.current = currentRound;
|
|
17313
|
+
}, [currentRound, lastPlayerAction, lastOpponentAction, lastPayoff, payoffMatrix]);
|
|
17314
|
+
const opponentTotal = useMemo(() => history.reduce((s, r2) => s + r2.opponentPayoff, 0), [history]);
|
|
17315
|
+
const handleAction = useCallback((actionId) => {
|
|
17316
|
+
if (isComplete) return;
|
|
17317
|
+
if (playRoundEvent) {
|
|
17318
|
+
emit(`UI:${playRoundEvent}`, { playerAction: actionId, payoff: 0 });
|
|
17319
|
+
}
|
|
17320
|
+
if (totalRounds > 0 && currentRound + 1 >= totalRounds) {
|
|
17321
|
+
if (finishEvent) {
|
|
17322
|
+
emit(`UI:${finishEvent}`, {});
|
|
17323
|
+
}
|
|
17324
|
+
if (str(resolved?.hint)) {
|
|
17325
|
+
setShowHint(true);
|
|
17326
|
+
}
|
|
17327
|
+
}
|
|
17328
|
+
}, [isComplete, resolved, totalRounds, currentRound, playRoundEvent, finishEvent, emit]);
|
|
17329
|
+
const handleReset = useCallback(() => {
|
|
17330
|
+
setHistory([]);
|
|
17331
|
+
setShowHint(false);
|
|
17332
|
+
prevRoundRef.current = 0;
|
|
17333
|
+
if (playAgainEvent) {
|
|
17334
|
+
emit(`UI:${playAgainEvent}`, {});
|
|
17335
|
+
}
|
|
17336
|
+
}, [playAgainEvent, emit]);
|
|
17337
|
+
const completedRef = useRef(false);
|
|
17338
|
+
useEffect(() => {
|
|
17339
|
+
if (result === "win" && !completedRef.current) {
|
|
17340
|
+
completedRef.current = true;
|
|
17341
|
+
emit(`UI:${completeEvent}`, { success: true, score: playerTotal });
|
|
17342
|
+
} else if (result === "none") {
|
|
17343
|
+
completedRef.current = false;
|
|
17344
|
+
}
|
|
17345
|
+
}, [result, playerTotal, completeEvent, emit]);
|
|
17346
|
+
const getActionLabel = (id) => actions.find((a) => a.id === id)?.label ?? id;
|
|
17347
|
+
if (!resolved) return null;
|
|
17348
|
+
const theme = resolved.theme ?? void 0;
|
|
17349
|
+
const themeBackground = theme?.background;
|
|
17350
|
+
const headerImage = str(resolved.headerImage);
|
|
17351
|
+
const hint = str(resolved.hint);
|
|
17352
|
+
return /* @__PURE__ */ jsx(
|
|
17353
|
+
Box,
|
|
17354
|
+
{
|
|
17355
|
+
className,
|
|
17356
|
+
style: {
|
|
17357
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17358
|
+
backgroundSize: "cover",
|
|
17359
|
+
backgroundPosition: "center"
|
|
17360
|
+
},
|
|
17361
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17362
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17363
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17364
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
17365
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
|
|
17366
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
|
|
17367
|
+
/* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(totalRounds) }) }),
|
|
17368
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
17369
|
+
t("negotiator.target"),
|
|
17370
|
+
": ",
|
|
17371
|
+
targetScore
|
|
17372
|
+
] })
|
|
17373
|
+
] })
|
|
17374
|
+
] }) }),
|
|
17375
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "md", justify: "center", children: [
|
|
17376
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
|
|
17377
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.you") }),
|
|
17378
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: playerTotal })
|
|
17379
|
+
] }) }),
|
|
17380
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
|
|
17381
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.opponent") }),
|
|
17382
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: opponentTotal })
|
|
17383
|
+
] }) })
|
|
17384
|
+
] }),
|
|
17385
|
+
!isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17386
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.chooseAction") }),
|
|
17387
|
+
/* @__PURE__ */ jsx(HStack, { gap: "sm", justify: "center", className: "flex-wrap", children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
17388
|
+
Button,
|
|
17389
|
+
{
|
|
17390
|
+
variant: "primary",
|
|
17391
|
+
onClick: () => handleAction(action.id),
|
|
17392
|
+
children: action.label
|
|
17393
|
+
},
|
|
17394
|
+
action.id
|
|
17395
|
+
)) })
|
|
17396
|
+
] }) }),
|
|
17397
|
+
history.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17398
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.history") }),
|
|
17399
|
+
history.map((round) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", className: "text-sm", children: [
|
|
17400
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
17401
|
+
"R",
|
|
17402
|
+
round.round
|
|
17403
|
+
] }),
|
|
17404
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.playerAction) }),
|
|
17405
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "vs" }),
|
|
17406
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.opponentAction) }),
|
|
17407
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: ArrowRight, assetUrl: ui?.["arrow"], size: "sm" }),
|
|
17408
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", weight: "bold", className: "text-success", children: [
|
|
17409
|
+
"+",
|
|
17410
|
+
round.playerPayoff
|
|
17411
|
+
] }),
|
|
17412
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
17413
|
+
"/ +",
|
|
17414
|
+
round.opponentPayoff
|
|
17415
|
+
] })
|
|
17416
|
+
] }, round.round))
|
|
17417
|
+
] }) }),
|
|
17418
|
+
isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
17419
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: won ? "text-success" : "text-error" }),
|
|
17420
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? str(resolved.successMessage) || t("negotiator.success") : str(resolved.failMessage) || t("negotiator.failed") }),
|
|
17421
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
17422
|
+
t("negotiator.finalScore"),
|
|
17423
|
+
": ",
|
|
17424
|
+
playerTotal,
|
|
17425
|
+
"/",
|
|
17426
|
+
targetScore
|
|
17427
|
+
] })
|
|
17428
|
+
] }) }),
|
|
17429
|
+
showHint && hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17430
|
+
isComplete && !won && /* @__PURE__ */ jsx(HStack, { justify: "center", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleReset, children: t("negotiator.playAgain") }) })
|
|
17431
|
+
] })
|
|
17432
|
+
}
|
|
17433
|
+
);
|
|
17434
|
+
}
|
|
17435
|
+
var init_NegotiatorBoard = __esm({
|
|
17436
|
+
"components/game/2d/organisms/NegotiatorBoard.tsx"() {
|
|
17437
|
+
init_atoms();
|
|
17438
|
+
init_useEventBus();
|
|
17439
|
+
init_boardEntity();
|
|
17440
|
+
init_GameIcon();
|
|
17441
|
+
NegotiatorBoard.displayName = "NegotiatorBoard";
|
|
17442
|
+
}
|
|
17443
|
+
});
|
|
15361
17444
|
|
|
15362
17445
|
// components/game/shared/lib/mechanics.ts
|
|
15363
17446
|
var projectileMotion, pendulum, springOscillator;
|
|
@@ -15565,7 +17648,7 @@ function SimulationCanvas({
|
|
|
15565
17648
|
}
|
|
15566
17649
|
var PRESET_BY_ID;
|
|
15567
17650
|
var init_SimulationCanvas = __esm({
|
|
15568
|
-
"components/game/2d/
|
|
17651
|
+
"components/game/2d/organisms/SimulationCanvas.tsx"() {
|
|
15569
17652
|
init_cn();
|
|
15570
17653
|
init_atoms();
|
|
15571
17654
|
init_verificationRegistry();
|
|
@@ -16187,7 +18270,7 @@ var init_ErrorBoundary = __esm({
|
|
|
16187
18270
|
}
|
|
16188
18271
|
);
|
|
16189
18272
|
};
|
|
16190
|
-
ErrorBoundary = class extends
|
|
18273
|
+
ErrorBoundary = class extends React104__default.Component {
|
|
16191
18274
|
constructor(props) {
|
|
16192
18275
|
super(props);
|
|
16193
18276
|
__publicField(this, "reset", () => {
|
|
@@ -16232,15 +18315,15 @@ function HeaderSkeleton({ className }) {
|
|
|
16232
18315
|
] })
|
|
16233
18316
|
] });
|
|
16234
18317
|
}
|
|
16235
|
-
function TableSkeleton({ rows = 5, columns = 4, className }) {
|
|
18318
|
+
function TableSkeleton({ rows: rows2 = 5, columns = 4, className }) {
|
|
16236
18319
|
return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: cn("border border-border rounded-lg overflow-hidden", className), children: [
|
|
16237
18320
|
/* @__PURE__ */ jsx(HStack, { className: "px-4 py-3 bg-muted/30 border-b border-border", children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsx(SkeletonBlock, { className: "h-4 flex-1 mx-2" }, i)) }),
|
|
16238
|
-
Array.from({ length:
|
|
18321
|
+
Array.from({ length: rows2 }).map((_, rowIdx) => /* @__PURE__ */ jsx(
|
|
16239
18322
|
HStack,
|
|
16240
18323
|
{
|
|
16241
18324
|
className: cn(
|
|
16242
18325
|
"px-4 py-3",
|
|
16243
|
-
rowIdx <
|
|
18326
|
+
rowIdx < rows2 - 1 && "border-b border-border"
|
|
16244
18327
|
),
|
|
16245
18328
|
children: Array.from({ length: columns }).map((_2, colIdx) => /* @__PURE__ */ jsx(SkeletonLine, { className: "flex-1 mx-2" }, colIdx))
|
|
16246
18329
|
},
|
|
@@ -16288,18 +18371,18 @@ function CardSkeleton({ className }) {
|
|
|
16288
18371
|
}
|
|
16289
18372
|
);
|
|
16290
18373
|
}
|
|
16291
|
-
function TextSkeleton({ rows = 3, className }) {
|
|
16292
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className, children: Array.from({ length:
|
|
18374
|
+
function TextSkeleton({ rows: rows2 = 3, className }) {
|
|
18375
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className, children: Array.from({ length: rows2 }).map((_, i) => /* @__PURE__ */ jsx(
|
|
16293
18376
|
SkeletonLine,
|
|
16294
18377
|
{
|
|
16295
|
-
className: i ===
|
|
18378
|
+
className: i === rows2 - 1 ? "w-2/3" : "w-full"
|
|
16296
18379
|
},
|
|
16297
18380
|
i
|
|
16298
18381
|
)) });
|
|
16299
18382
|
}
|
|
16300
18383
|
function Skeleton({
|
|
16301
18384
|
variant = "text",
|
|
16302
|
-
rows,
|
|
18385
|
+
rows: rows2,
|
|
16303
18386
|
columns,
|
|
16304
18387
|
fields,
|
|
16305
18388
|
className
|
|
@@ -16309,15 +18392,15 @@ function Skeleton({
|
|
|
16309
18392
|
case "header":
|
|
16310
18393
|
return /* @__PURE__ */ jsx(HeaderSkeleton, { className });
|
|
16311
18394
|
case "table":
|
|
16312
|
-
return /* @__PURE__ */ jsx(TableSkeleton, { rows, columns, className });
|
|
18395
|
+
return /* @__PURE__ */ jsx(TableSkeleton, { rows: rows2, columns, className });
|
|
16313
18396
|
case "form":
|
|
16314
18397
|
return /* @__PURE__ */ jsx(FormSkeleton, { fields, className });
|
|
16315
18398
|
case "card":
|
|
16316
18399
|
return /* @__PURE__ */ jsx(CardSkeleton, { className });
|
|
16317
18400
|
case "text":
|
|
16318
|
-
return /* @__PURE__ */ jsx(TextSkeleton, { rows, className });
|
|
18401
|
+
return /* @__PURE__ */ jsx(TextSkeleton, { rows: rows2, className });
|
|
16319
18402
|
default:
|
|
16320
|
-
return /* @__PURE__ */ jsx(TextSkeleton, { rows, className });
|
|
18403
|
+
return /* @__PURE__ */ jsx(TextSkeleton, { rows: rows2, className });
|
|
16321
18404
|
}
|
|
16322
18405
|
}
|
|
16323
18406
|
var pulseClass;
|
|
@@ -16469,7 +18552,7 @@ var init_Container = __esm({
|
|
|
16469
18552
|
as: Component = "div"
|
|
16470
18553
|
}) => {
|
|
16471
18554
|
const resolvedSize = maxWidth ?? size ?? "lg";
|
|
16472
|
-
return
|
|
18555
|
+
return React104__default.createElement(
|
|
16473
18556
|
Component,
|
|
16474
18557
|
{
|
|
16475
18558
|
className: cn(
|
|
@@ -18310,7 +20393,7 @@ var init_CodeBlock = __esm({
|
|
|
18310
20393
|
DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
|
|
18311
20394
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
18312
20395
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
18313
|
-
CodeBlock =
|
|
20396
|
+
CodeBlock = React104__default.memo(
|
|
18314
20397
|
({
|
|
18315
20398
|
code: rawCode,
|
|
18316
20399
|
language = "text",
|
|
@@ -18479,24 +20562,24 @@ var init_CodeBlock = __esm({
|
|
|
18479
20562
|
return;
|
|
18480
20563
|
}
|
|
18481
20564
|
lineEls.forEach((el) => {
|
|
18482
|
-
const
|
|
18483
|
-
if (hiddenLines.has(
|
|
20565
|
+
const num2 = parseInt(el.getAttribute("data-line") ?? "-1", 10);
|
|
20566
|
+
if (hiddenLines.has(num2)) {
|
|
18484
20567
|
el.style.display = "none";
|
|
18485
20568
|
return;
|
|
18486
20569
|
}
|
|
18487
20570
|
el.style.display = "";
|
|
18488
20571
|
el.style.position = "relative";
|
|
18489
20572
|
el.style.paddingLeft = "1.2em";
|
|
18490
|
-
const region = foldStartMap.get(
|
|
20573
|
+
const region = foldStartMap.get(num2);
|
|
18491
20574
|
if (!region) return;
|
|
18492
|
-
const isCollapsed = collapsed.has(
|
|
20575
|
+
const isCollapsed = collapsed.has(num2);
|
|
18493
20576
|
const toggle = document.createElement("span");
|
|
18494
20577
|
toggle.className = "fold-toggle";
|
|
18495
20578
|
toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
|
|
18496
20579
|
toggle.style.cssText = "position:absolute;left:0;top:0;width:1.2em;text-align:center;cursor:pointer;color:#858585;font-size:10px;user-select:none;line-height:inherit;height:100%";
|
|
18497
20580
|
toggle.addEventListener("click", (e) => {
|
|
18498
20581
|
e.stopPropagation();
|
|
18499
|
-
toggleFoldRef.current(
|
|
20582
|
+
toggleFoldRef.current(num2);
|
|
18500
20583
|
});
|
|
18501
20584
|
el.insertBefore(toggle, el.firstChild);
|
|
18502
20585
|
if (isCollapsed) {
|
|
@@ -18897,7 +20980,7 @@ var init_MarkdownContent = __esm({
|
|
|
18897
20980
|
init_Box();
|
|
18898
20981
|
init_CodeBlock();
|
|
18899
20982
|
init_cn();
|
|
18900
|
-
MarkdownContent =
|
|
20983
|
+
MarkdownContent = React104__default.memo(
|
|
18901
20984
|
({ content, direction = "ltr", className }) => {
|
|
18902
20985
|
const { t: _t } = useTranslate();
|
|
18903
20986
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -19466,7 +21549,7 @@ var init_QuizBlock = __esm({
|
|
|
19466
21549
|
QuizBlock.displayName = "QuizBlock";
|
|
19467
21550
|
}
|
|
19468
21551
|
});
|
|
19469
|
-
var
|
|
21552
|
+
var StateNode2, TransitionBundleArrow, BundleTooltip, EntityBox, OutputsBox, Legend, StateMachineView;
|
|
19470
21553
|
var init_StateMachineView = __esm({
|
|
19471
21554
|
"components/core/organisms/StateMachineView.tsx"() {
|
|
19472
21555
|
"use client";
|
|
@@ -19478,7 +21561,7 @@ var init_StateMachineView = __esm({
|
|
|
19478
21561
|
init_Icon();
|
|
19479
21562
|
init_useEventBus();
|
|
19480
21563
|
init_cn();
|
|
19481
|
-
|
|
21564
|
+
StateNode2 = ({ state, config }) => {
|
|
19482
21565
|
const { t } = useTranslate();
|
|
19483
21566
|
const size = state.radius * 2;
|
|
19484
21567
|
let borderColor = config.colors.nodeBorder;
|
|
@@ -20224,8 +22307,8 @@ var init_StateMachineView = __esm({
|
|
|
20224
22307
|
style: { top: title ? 30 : 0 },
|
|
20225
22308
|
children: [
|
|
20226
22309
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
20227
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
20228
|
-
|
|
22310
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React104__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
22311
|
+
StateNode2,
|
|
20229
22312
|
{
|
|
20230
22313
|
state,
|
|
20231
22314
|
config
|
|
@@ -25862,8 +27945,8 @@ var init_Menu = __esm({
|
|
|
25862
27945
|
"bottom-end": "bottom-start"
|
|
25863
27946
|
};
|
|
25864
27947
|
const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
|
|
25865
|
-
const triggerChild =
|
|
25866
|
-
const triggerElement =
|
|
27948
|
+
const triggerChild = React104__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
|
|
27949
|
+
const triggerElement = React104__default.cloneElement(
|
|
25867
27950
|
triggerChild,
|
|
25868
27951
|
{
|
|
25869
27952
|
ref: triggerRef,
|
|
@@ -25958,14 +28041,14 @@ function useDataDnd(args) {
|
|
|
25958
28041
|
const isZone = Boolean(dragGroup || accepts || sortable);
|
|
25959
28042
|
const enabled = isZone || Boolean(dndRoot);
|
|
25960
28043
|
const eventBus = useEventBus();
|
|
25961
|
-
const parentRoot =
|
|
28044
|
+
const parentRoot = React104__default.useContext(RootCtx);
|
|
25962
28045
|
const isRoot = enabled && parentRoot === null;
|
|
25963
|
-
const zoneId =
|
|
28046
|
+
const zoneId = React104__default.useId();
|
|
25964
28047
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
25965
|
-
const [optimisticOrders, setOptimisticOrders] =
|
|
25966
|
-
const optimisticOrdersRef =
|
|
28048
|
+
const [optimisticOrders, setOptimisticOrders] = React104__default.useState(() => /* @__PURE__ */ new Map());
|
|
28049
|
+
const optimisticOrdersRef = React104__default.useRef(optimisticOrders);
|
|
25967
28050
|
optimisticOrdersRef.current = optimisticOrders;
|
|
25968
|
-
const clearOptimisticOrder =
|
|
28051
|
+
const clearOptimisticOrder = React104__default.useCallback((group) => {
|
|
25969
28052
|
setOptimisticOrders((prev) => {
|
|
25970
28053
|
if (!prev.has(group)) return prev;
|
|
25971
28054
|
const next = new Map(prev);
|
|
@@ -25990,7 +28073,7 @@ function useDataDnd(args) {
|
|
|
25990
28073
|
const raw = it[dndItemIdField];
|
|
25991
28074
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
25992
28075
|
}).join("|");
|
|
25993
|
-
const itemIds =
|
|
28076
|
+
const itemIds = React104__default.useMemo(
|
|
25994
28077
|
() => orderedItems.map((it, idx) => {
|
|
25995
28078
|
const raw = it[dndItemIdField];
|
|
25996
28079
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
@@ -26001,7 +28084,7 @@ function useDataDnd(args) {
|
|
|
26001
28084
|
const raw = it[dndItemIdField];
|
|
26002
28085
|
return raw != null ? String(raw) : `__${idx}`;
|
|
26003
28086
|
}).join("|");
|
|
26004
|
-
|
|
28087
|
+
React104__default.useEffect(() => {
|
|
26005
28088
|
const root = isRoot ? null : parentRoot;
|
|
26006
28089
|
if (root) {
|
|
26007
28090
|
root.clearOptimisticOrder(ownGroup);
|
|
@@ -26009,20 +28092,20 @@ function useDataDnd(args) {
|
|
|
26009
28092
|
clearOptimisticOrder(ownGroup);
|
|
26010
28093
|
}
|
|
26011
28094
|
}, [itemsContentSig, ownGroup]);
|
|
26012
|
-
const zonesRef =
|
|
26013
|
-
const registerZone =
|
|
28095
|
+
const zonesRef = React104__default.useRef(/* @__PURE__ */ new Map());
|
|
28096
|
+
const registerZone = React104__default.useCallback((zoneId2, meta2) => {
|
|
26014
28097
|
zonesRef.current.set(zoneId2, meta2);
|
|
26015
28098
|
}, []);
|
|
26016
|
-
const unregisterZone =
|
|
28099
|
+
const unregisterZone = React104__default.useCallback((zoneId2) => {
|
|
26017
28100
|
zonesRef.current.delete(zoneId2);
|
|
26018
28101
|
}, []);
|
|
26019
|
-
const [activeDrag, setActiveDrag] =
|
|
26020
|
-
const [overZoneGroup, setOverZoneGroup] =
|
|
26021
|
-
const meta =
|
|
28102
|
+
const [activeDrag, setActiveDrag] = React104__default.useState(null);
|
|
28103
|
+
const [overZoneGroup, setOverZoneGroup] = React104__default.useState(null);
|
|
28104
|
+
const meta = React104__default.useMemo(
|
|
26022
28105
|
() => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
|
|
26023
28106
|
[ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
|
|
26024
28107
|
);
|
|
26025
|
-
|
|
28108
|
+
React104__default.useEffect(() => {
|
|
26026
28109
|
const target = isRoot ? null : parentRoot;
|
|
26027
28110
|
if (!target) {
|
|
26028
28111
|
zonesRef.current.set(zoneId, meta);
|
|
@@ -26041,7 +28124,7 @@ function useDataDnd(args) {
|
|
|
26041
28124
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
26042
28125
|
const sensors = useAlmadarDndSensors(true);
|
|
26043
28126
|
const collisionDetection = almadarDndCollisionDetection;
|
|
26044
|
-
const findZoneByItem =
|
|
28127
|
+
const findZoneByItem = React104__default.useCallback(
|
|
26045
28128
|
(id) => {
|
|
26046
28129
|
for (const z of zonesRef.current.values()) {
|
|
26047
28130
|
if (z.itemIds.includes(id)) return z;
|
|
@@ -26050,7 +28133,7 @@ function useDataDnd(args) {
|
|
|
26050
28133
|
},
|
|
26051
28134
|
[]
|
|
26052
28135
|
);
|
|
26053
|
-
|
|
28136
|
+
React104__default.useCallback(
|
|
26054
28137
|
(group) => {
|
|
26055
28138
|
for (const z of zonesRef.current.values()) {
|
|
26056
28139
|
if (z.group === group) return z;
|
|
@@ -26059,7 +28142,7 @@ function useDataDnd(args) {
|
|
|
26059
28142
|
},
|
|
26060
28143
|
[]
|
|
26061
28144
|
);
|
|
26062
|
-
const handleDragEnd =
|
|
28145
|
+
const handleDragEnd = React104__default.useCallback(
|
|
26063
28146
|
(event) => {
|
|
26064
28147
|
const { active, over } = event;
|
|
26065
28148
|
const activeIdStr = String(active.id);
|
|
@@ -26150,8 +28233,8 @@ function useDataDnd(args) {
|
|
|
26150
28233
|
},
|
|
26151
28234
|
[eventBus]
|
|
26152
28235
|
);
|
|
26153
|
-
const sortableData =
|
|
26154
|
-
const SortableItem =
|
|
28236
|
+
const sortableData = React104__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
28237
|
+
const SortableItem = React104__default.useCallback(
|
|
26155
28238
|
({ id, children }) => {
|
|
26156
28239
|
const {
|
|
26157
28240
|
attributes,
|
|
@@ -26191,7 +28274,7 @@ function useDataDnd(args) {
|
|
|
26191
28274
|
id: droppableId,
|
|
26192
28275
|
data: sortableData
|
|
26193
28276
|
});
|
|
26194
|
-
const ctx =
|
|
28277
|
+
const ctx = React104__default.useContext(RootCtx);
|
|
26195
28278
|
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
26196
28279
|
const overZoneGroup2 = ctx?.overZoneGroup ?? null;
|
|
26197
28280
|
const isThisZoneOver = overZoneGroup2 === ownGroup;
|
|
@@ -26206,7 +28289,7 @@ function useDataDnd(args) {
|
|
|
26206
28289
|
showForeignPlaceholder,
|
|
26207
28290
|
ctxAvailable: ctx != null
|
|
26208
28291
|
});
|
|
26209
|
-
|
|
28292
|
+
React104__default.useEffect(() => {
|
|
26210
28293
|
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
26211
28294
|
}, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
|
|
26212
28295
|
return /* @__PURE__ */ jsx(
|
|
@@ -26220,11 +28303,11 @@ function useDataDnd(args) {
|
|
|
26220
28303
|
}
|
|
26221
28304
|
);
|
|
26222
28305
|
};
|
|
26223
|
-
const rootContextValue =
|
|
28306
|
+
const rootContextValue = React104__default.useMemo(
|
|
26224
28307
|
() => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
|
|
26225
28308
|
[registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
|
|
26226
28309
|
);
|
|
26227
|
-
const handleDragStart =
|
|
28310
|
+
const handleDragStart = React104__default.useCallback((event) => {
|
|
26228
28311
|
const sourceZone = findZoneByItem(event.active.id);
|
|
26229
28312
|
const rect = event.active.rect.current.initial;
|
|
26230
28313
|
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
@@ -26243,7 +28326,7 @@ function useDataDnd(args) {
|
|
|
26243
28326
|
isRoot
|
|
26244
28327
|
});
|
|
26245
28328
|
}, [findZoneByItem, isRoot, zoneId]);
|
|
26246
|
-
const handleDragOver =
|
|
28329
|
+
const handleDragOver = React104__default.useCallback((event) => {
|
|
26247
28330
|
const { active, over } = event;
|
|
26248
28331
|
const overData = over?.data?.current;
|
|
26249
28332
|
const overGroup = overData?.dndGroup ?? null;
|
|
@@ -26313,7 +28396,7 @@ function useDataDnd(args) {
|
|
|
26313
28396
|
return next;
|
|
26314
28397
|
});
|
|
26315
28398
|
}, []);
|
|
26316
|
-
const handleDragCancel =
|
|
28399
|
+
const handleDragCancel = React104__default.useCallback((event) => {
|
|
26317
28400
|
setActiveDrag(null);
|
|
26318
28401
|
setOverZoneGroup(null);
|
|
26319
28402
|
dndLog.warn("dragCancel", {
|
|
@@ -26321,12 +28404,12 @@ function useDataDnd(args) {
|
|
|
26321
28404
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
26322
28405
|
});
|
|
26323
28406
|
}, []);
|
|
26324
|
-
const handleDragEndWithCleanup =
|
|
28407
|
+
const handleDragEndWithCleanup = React104__default.useCallback((event) => {
|
|
26325
28408
|
handleDragEnd(event);
|
|
26326
28409
|
setActiveDrag(null);
|
|
26327
28410
|
setOverZoneGroup(null);
|
|
26328
28411
|
}, [handleDragEnd]);
|
|
26329
|
-
const wrapContainer =
|
|
28412
|
+
const wrapContainer = React104__default.useCallback(
|
|
26330
28413
|
(children) => {
|
|
26331
28414
|
if (!enabled) return children;
|
|
26332
28415
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
@@ -26380,7 +28463,7 @@ var init_useDataDnd = __esm({
|
|
|
26380
28463
|
init_useAlmadarDndCollision();
|
|
26381
28464
|
init_Box();
|
|
26382
28465
|
dndLog = createLogger("almadar:ui:dnd");
|
|
26383
|
-
RootCtx =
|
|
28466
|
+
RootCtx = React104__default.createContext(null);
|
|
26384
28467
|
}
|
|
26385
28468
|
});
|
|
26386
28469
|
function renderIconInput(icon, props) {
|
|
@@ -26906,7 +28989,7 @@ function DataList({
|
|
|
26906
28989
|
}) {
|
|
26907
28990
|
const eventBus = useEventBus();
|
|
26908
28991
|
const { t } = useTranslate();
|
|
26909
|
-
const [visibleCount, setVisibleCount] =
|
|
28992
|
+
const [visibleCount, setVisibleCount] = React104__default.useState(pageSize || Infinity);
|
|
26910
28993
|
const fieldDefs = fields ?? columns ?? [];
|
|
26911
28994
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
26912
28995
|
const dnd = useDataDnd({
|
|
@@ -26925,7 +29008,7 @@ function DataList({
|
|
|
26925
29008
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
26926
29009
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
26927
29010
|
const hasRenderProp = typeof children === "function";
|
|
26928
|
-
|
|
29011
|
+
React104__default.useEffect(() => {
|
|
26929
29012
|
const renderItemTypeOf = typeof schemaRenderItem;
|
|
26930
29013
|
const childrenTypeOf = typeof children;
|
|
26931
29014
|
if (data.length > 0 && !hasRenderProp) {
|
|
@@ -27029,7 +29112,7 @@ function DataList({
|
|
|
27029
29112
|
const items2 = [...data];
|
|
27030
29113
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
27031
29114
|
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
27032
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
29115
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
27033
29116
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
27034
29117
|
group.items.map((itemData, index) => {
|
|
27035
29118
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -27170,7 +29253,7 @@ function DataList({
|
|
|
27170
29253
|
className
|
|
27171
29254
|
),
|
|
27172
29255
|
children: [
|
|
27173
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
29256
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
27174
29257
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
27175
29258
|
group.items.map(
|
|
27176
29259
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -27255,7 +29338,7 @@ var init_FormSection = __esm({
|
|
|
27255
29338
|
columns = 1,
|
|
27256
29339
|
className
|
|
27257
29340
|
}) => {
|
|
27258
|
-
const [collapsed, setCollapsed] =
|
|
29341
|
+
const [collapsed, setCollapsed] = React104__default.useState(defaultCollapsed);
|
|
27259
29342
|
const { t } = useTranslate();
|
|
27260
29343
|
const eventBus = useEventBus();
|
|
27261
29344
|
const gridClass = {
|
|
@@ -27263,7 +29346,7 @@ var init_FormSection = __esm({
|
|
|
27263
29346
|
2: "grid-cols-1 md:grid-cols-2",
|
|
27264
29347
|
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
27265
29348
|
}[columns];
|
|
27266
|
-
|
|
29349
|
+
React104__default.useCallback(() => {
|
|
27267
29350
|
if (collapsible) {
|
|
27268
29351
|
setCollapsed((prev) => !prev);
|
|
27269
29352
|
eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
|
|
@@ -28213,7 +30296,7 @@ var init_Flex = __esm({
|
|
|
28213
30296
|
flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
|
|
28214
30297
|
}
|
|
28215
30298
|
}
|
|
28216
|
-
return
|
|
30299
|
+
return React104__default.createElement(Component, {
|
|
28217
30300
|
className: cn(
|
|
28218
30301
|
inline ? "inline-flex" : "flex",
|
|
28219
30302
|
directionStyles[direction],
|
|
@@ -28319,7 +30402,7 @@ var init_Grid = __esm({
|
|
|
28319
30402
|
};
|
|
28320
30403
|
Grid = ({
|
|
28321
30404
|
cols = 1,
|
|
28322
|
-
rows,
|
|
30405
|
+
rows: rows2,
|
|
28323
30406
|
gap = "md",
|
|
28324
30407
|
rowGap,
|
|
28325
30408
|
colGap,
|
|
@@ -28331,8 +30414,8 @@ var init_Grid = __esm({
|
|
|
28331
30414
|
children,
|
|
28332
30415
|
as: Component = "div"
|
|
28333
30416
|
}) => {
|
|
28334
|
-
const mergedStyle =
|
|
28335
|
-
return
|
|
30417
|
+
const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
|
|
30418
|
+
return React104__default.createElement(
|
|
28336
30419
|
Component,
|
|
28337
30420
|
{
|
|
28338
30421
|
className: cn(
|
|
@@ -28528,9 +30611,9 @@ var init_Popover = __esm({
|
|
|
28528
30611
|
onMouseLeave: handleClose,
|
|
28529
30612
|
onPointerDown: tapTriggerProps.onPointerDown
|
|
28530
30613
|
};
|
|
28531
|
-
const childElement =
|
|
30614
|
+
const childElement = React104__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
28532
30615
|
const childPointerDown = childElement.props.onPointerDown;
|
|
28533
|
-
const triggerElement =
|
|
30616
|
+
const triggerElement = React104__default.cloneElement(
|
|
28534
30617
|
childElement,
|
|
28535
30618
|
{
|
|
28536
30619
|
ref: triggerRef,
|
|
@@ -29132,9 +31215,9 @@ var init_Tooltip = __esm({
|
|
|
29132
31215
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
29133
31216
|
};
|
|
29134
31217
|
}, []);
|
|
29135
|
-
const triggerElement =
|
|
31218
|
+
const triggerElement = React104__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
29136
31219
|
const childPointerDown = triggerElement.props.onPointerDown;
|
|
29137
|
-
const trigger =
|
|
31220
|
+
const trigger = React104__default.cloneElement(triggerElement, {
|
|
29138
31221
|
ref: triggerRef,
|
|
29139
31222
|
onMouseEnter: handleMouseEnter,
|
|
29140
31223
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29224,7 +31307,7 @@ var init_WizardProgress = __esm({
|
|
|
29224
31307
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
|
|
29225
31308
|
const isActive = index === currentStep;
|
|
29226
31309
|
const isCompleted = index < currentStep;
|
|
29227
|
-
return /* @__PURE__ */ jsxs(
|
|
31310
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
29228
31311
|
/* @__PURE__ */ jsx(
|
|
29229
31312
|
"button",
|
|
29230
31313
|
{
|
|
@@ -30784,13 +32867,13 @@ var init_MapView = __esm({
|
|
|
30784
32867
|
shadowSize: [41, 41]
|
|
30785
32868
|
});
|
|
30786
32869
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
30787
|
-
const { useEffect:
|
|
32870
|
+
const { useEffect: useEffect71, useRef: useRef67, useCallback: useCallback105, useState: useState105 } = React104__default;
|
|
30788
32871
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
30789
32872
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
30790
32873
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
30791
32874
|
const map = useMap();
|
|
30792
|
-
const prevRef =
|
|
30793
|
-
|
|
32875
|
+
const prevRef = useRef67({ centerLat, centerLng, zoom });
|
|
32876
|
+
useEffect71(() => {
|
|
30794
32877
|
const prev = prevRef.current;
|
|
30795
32878
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
30796
32879
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -30801,7 +32884,7 @@ var init_MapView = __esm({
|
|
|
30801
32884
|
}
|
|
30802
32885
|
function MapClickHandler({ onMapClick }) {
|
|
30803
32886
|
const map = useMap();
|
|
30804
|
-
|
|
32887
|
+
useEffect71(() => {
|
|
30805
32888
|
if (!onMapClick) return;
|
|
30806
32889
|
const handler = (e) => {
|
|
30807
32890
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -30829,8 +32912,8 @@ var init_MapView = __esm({
|
|
|
30829
32912
|
showAttribution = true
|
|
30830
32913
|
}) {
|
|
30831
32914
|
const eventBus = useEventBus2();
|
|
30832
|
-
const [clickedPosition, setClickedPosition] =
|
|
30833
|
-
const handleMapClick =
|
|
32915
|
+
const [clickedPosition, setClickedPosition] = useState105(null);
|
|
32916
|
+
const handleMapClick = useCallback105((lat, lng) => {
|
|
30834
32917
|
if (showClickedPin) {
|
|
30835
32918
|
setClickedPosition({ lat, lng });
|
|
30836
32919
|
}
|
|
@@ -30839,7 +32922,7 @@ var init_MapView = __esm({
|
|
|
30839
32922
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
30840
32923
|
}
|
|
30841
32924
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
30842
|
-
const handleMarkerClick =
|
|
32925
|
+
const handleMarkerClick = useCallback105((marker) => {
|
|
30843
32926
|
onMarkerClick?.(marker);
|
|
30844
32927
|
if (markerClickEvent) {
|
|
30845
32928
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -31699,8 +33782,8 @@ function TableView({
|
|
|
31699
33782
|
}) {
|
|
31700
33783
|
const eventBus = useEventBus();
|
|
31701
33784
|
const { t } = useTranslate();
|
|
31702
|
-
const [visibleCount, setVisibleCount] =
|
|
31703
|
-
const [localSelected, setLocalSelected] =
|
|
33785
|
+
const [visibleCount, setVisibleCount] = React104__default.useState(pageSize > 0 ? pageSize : Infinity);
|
|
33786
|
+
const [localSelected, setLocalSelected] = React104__default.useState(/* @__PURE__ */ new Set());
|
|
31704
33787
|
const colDefs = columns ?? fields ?? [];
|
|
31705
33788
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
31706
33789
|
const dnd = useDataDnd({
|
|
@@ -31895,12 +33978,12 @@ function TableView({
|
|
|
31895
33978
|
]
|
|
31896
33979
|
}
|
|
31897
33980
|
);
|
|
31898
|
-
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(
|
|
33981
|
+
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React104__default.Fragment, { children: rowInner }, id);
|
|
31899
33982
|
};
|
|
31900
33983
|
const items = Array.from(data);
|
|
31901
33984
|
const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
|
|
31902
33985
|
let runningIndex = 0;
|
|
31903
|
-
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
33986
|
+
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
31904
33987
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
|
|
31905
33988
|
group.items.map((row) => renderRow(row, runningIndex++))
|
|
31906
33989
|
] }, gi)) });
|
|
@@ -33257,7 +35340,7 @@ var init_StepFlow = __esm({
|
|
|
33257
35340
|
className
|
|
33258
35341
|
}) => {
|
|
33259
35342
|
if (orientation === "vertical") {
|
|
33260
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
35343
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React104__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
33261
35344
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
33262
35345
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
33263
35346
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -33268,7 +35351,7 @@ var init_StepFlow = __esm({
|
|
|
33268
35351
|
] })
|
|
33269
35352
|
] }) }, index)) });
|
|
33270
35353
|
}
|
|
33271
|
-
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(
|
|
35354
|
+
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(React104__default.Fragment, { children: [
|
|
33272
35355
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
33273
35356
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
33274
35357
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -33994,11 +36077,11 @@ function LatticeSVG({
|
|
|
33994
36077
|
}) {
|
|
33995
36078
|
const paths = [];
|
|
33996
36079
|
const cols = 5;
|
|
33997
|
-
const
|
|
36080
|
+
const rows2 = Math.ceil(h / (w / cols));
|
|
33998
36081
|
const cellW = w / cols;
|
|
33999
36082
|
const cellH = cellW;
|
|
34000
36083
|
const bulge = cellW * 0.3;
|
|
34001
|
-
for (let row = 0; row <
|
|
36084
|
+
for (let row = 0; row < rows2; row++) {
|
|
34002
36085
|
for (let col = 0; col < cols; col++) {
|
|
34003
36086
|
const cx = col * cellW + cellW / 2;
|
|
34004
36087
|
const cy = row * cellH + cellH / 2;
|
|
@@ -34253,7 +36336,7 @@ var init_LikertScale = __esm({
|
|
|
34253
36336
|
md: "text-base",
|
|
34254
36337
|
lg: "text-lg"
|
|
34255
36338
|
};
|
|
34256
|
-
LikertScale =
|
|
36339
|
+
LikertScale = React104__default.forwardRef(
|
|
34257
36340
|
({
|
|
34258
36341
|
question,
|
|
34259
36342
|
options = DEFAULT_LIKERT_OPTIONS,
|
|
@@ -34265,7 +36348,7 @@ var init_LikertScale = __esm({
|
|
|
34265
36348
|
variant = "radios",
|
|
34266
36349
|
className
|
|
34267
36350
|
}, ref) => {
|
|
34268
|
-
const groupId =
|
|
36351
|
+
const groupId = React104__default.useId();
|
|
34269
36352
|
const eventBus = useEventBus();
|
|
34270
36353
|
const handleSelect = useCallback(
|
|
34271
36354
|
(next) => {
|
|
@@ -34419,7 +36502,7 @@ var init_MatrixQuestion = __esm({
|
|
|
34419
36502
|
};
|
|
34420
36503
|
MatrixQuestion = ({
|
|
34421
36504
|
title,
|
|
34422
|
-
rows,
|
|
36505
|
+
rows: rows2,
|
|
34423
36506
|
columns = DEFAULT_MATRIX_COLUMNS,
|
|
34424
36507
|
values,
|
|
34425
36508
|
onChange,
|
|
@@ -34429,7 +36512,7 @@ var init_MatrixQuestion = __esm({
|
|
|
34429
36512
|
className
|
|
34430
36513
|
}) => {
|
|
34431
36514
|
const styles = sizeStyles12[size];
|
|
34432
|
-
const safeRows =
|
|
36515
|
+
const safeRows = rows2 ?? [];
|
|
34433
36516
|
const safeValues = values ?? {};
|
|
34434
36517
|
const eventBus = useEventBus();
|
|
34435
36518
|
const handleChange = useCallback(
|
|
@@ -36547,7 +38630,7 @@ var init_DocBreadcrumb = __esm({
|
|
|
36547
38630
|
"aria-label": t("aria.breadcrumb"),
|
|
36548
38631
|
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
|
|
36549
38632
|
const isLast = idx === items.length - 1;
|
|
36550
|
-
return /* @__PURE__ */ jsxs(
|
|
38633
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
36551
38634
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
36552
38635
|
Icon,
|
|
36553
38636
|
{
|
|
@@ -37211,7 +39294,7 @@ var init_PageHeader = __esm({
|
|
|
37211
39294
|
info: "bg-info/10 text-info"
|
|
37212
39295
|
};
|
|
37213
39296
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
37214
|
-
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(
|
|
39297
|
+
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(React104__default.Fragment, { children: [
|
|
37215
39298
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
37216
39299
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
37217
39300
|
"a",
|
|
@@ -37569,7 +39652,7 @@ var init_Section = __esm({
|
|
|
37569
39652
|
as: Component = "section"
|
|
37570
39653
|
}) => {
|
|
37571
39654
|
const hasHeader = title || description || action;
|
|
37572
|
-
return
|
|
39655
|
+
return React104__default.createElement(
|
|
37573
39656
|
Component,
|
|
37574
39657
|
{
|
|
37575
39658
|
className: cn(
|
|
@@ -37893,8 +39976,8 @@ var init_WizardContainer = __esm({
|
|
|
37893
39976
|
return void 0;
|
|
37894
39977
|
if (typeof controlledStep === "number") return controlledStep;
|
|
37895
39978
|
if (typeof controlledStep === "string") return parseInt(controlledStep, 10);
|
|
37896
|
-
const
|
|
37897
|
-
return isNaN(
|
|
39979
|
+
const num2 = Number(controlledStep);
|
|
39980
|
+
return isNaN(num2) ? void 0 : num2;
|
|
37898
39981
|
})();
|
|
37899
39982
|
const currentStep = normalizedControlledStep !== void 0 ? normalizedControlledStep : internalStep;
|
|
37900
39983
|
const totalSteps = steps.length;
|
|
@@ -37943,7 +40026,7 @@ var init_WizardContainer = __esm({
|
|
|
37943
40026
|
const isCompleted = index < currentStep;
|
|
37944
40027
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
37945
40028
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
37946
|
-
return /* @__PURE__ */ jsxs(
|
|
40029
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
37947
40030
|
/* @__PURE__ */ jsx(
|
|
37948
40031
|
Button,
|
|
37949
40032
|
{
|
|
@@ -39920,7 +42003,7 @@ function getBadgeVariant(fieldName, value) {
|
|
|
39920
42003
|
return "default";
|
|
39921
42004
|
}
|
|
39922
42005
|
function formatFieldLabel(fieldName) {
|
|
39923
|
-
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (
|
|
42006
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase());
|
|
39924
42007
|
}
|
|
39925
42008
|
function formatFieldValue(value, fieldName) {
|
|
39926
42009
|
if (typeof value === "number") {
|
|
@@ -39939,26 +42022,26 @@ function formatFieldValue(value, fieldName) {
|
|
|
39939
42022
|
}
|
|
39940
42023
|
function renderRichFieldValue(value, fieldName, fieldType) {
|
|
39941
42024
|
if (value === void 0 || value === null) return "\u2014";
|
|
39942
|
-
const
|
|
42025
|
+
const str2 = String(value);
|
|
39943
42026
|
switch (fieldType) {
|
|
39944
42027
|
case "image":
|
|
39945
42028
|
case "url": {
|
|
39946
|
-
if (
|
|
42029
|
+
if (str2.match(/\.(png|jpe?g|gif|svg|webp|avif)(\?|$)/i) || str2.startsWith("data:image/")) {
|
|
39947
42030
|
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
39948
42031
|
"img",
|
|
39949
42032
|
{
|
|
39950
|
-
src:
|
|
42033
|
+
src: str2,
|
|
39951
42034
|
alt: formatFieldLabel(fieldName),
|
|
39952
42035
|
className: "max-w-full max-h-64 rounded-md object-contain",
|
|
39953
42036
|
loading: "lazy"
|
|
39954
42037
|
}
|
|
39955
42038
|
) });
|
|
39956
42039
|
}
|
|
39957
|
-
return
|
|
42040
|
+
return str2;
|
|
39958
42041
|
}
|
|
39959
42042
|
case "markdown":
|
|
39960
42043
|
case "richtext":
|
|
39961
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "break-words", children:
|
|
42044
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "break-words", children: str2 }), children: /* @__PURE__ */ jsx(
|
|
39962
42045
|
Box,
|
|
39963
42046
|
{
|
|
39964
42047
|
className: "prose prose-sm max-w-none",
|
|
@@ -39976,11 +42059,11 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
39976
42059
|
"--tw-prose-th-borders": "var(--color-border)",
|
|
39977
42060
|
"--tw-prose-td-borders": "var(--color-border)"
|
|
39978
42061
|
},
|
|
39979
|
-
children: /* @__PURE__ */ jsx(ReactMarkdown2, { children:
|
|
42062
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown2, { children: str2 })
|
|
39980
42063
|
}
|
|
39981
42064
|
) });
|
|
39982
42065
|
case "code":
|
|
39983
|
-
return /* @__PURE__ */ jsx(Box, { className: "mt-1 rounded-md bg-muted p-3 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-sm font-mono whitespace-pre-wrap break-words m-0", children: /* @__PURE__ */ jsx("code", { children:
|
|
42066
|
+
return /* @__PURE__ */ jsx(Box, { className: "mt-1 rounded-md bg-muted p-3 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-sm font-mono whitespace-pre-wrap break-words m-0", children: /* @__PURE__ */ jsx("code", { children: str2 }) }) });
|
|
39984
42067
|
case "html":
|
|
39985
42068
|
return /* @__PURE__ */ jsx(
|
|
39986
42069
|
Box,
|
|
@@ -40000,12 +42083,12 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
40000
42083
|
"--tw-prose-th-borders": "var(--color-border)",
|
|
40001
42084
|
"--tw-prose-td-borders": "var(--color-border)"
|
|
40002
42085
|
},
|
|
40003
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "body", children:
|
|
42086
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: str2 })
|
|
40004
42087
|
}
|
|
40005
42088
|
);
|
|
40006
42089
|
case "date":
|
|
40007
42090
|
case "datetime": {
|
|
40008
|
-
const d = new Date(
|
|
42091
|
+
const d = new Date(str2);
|
|
40009
42092
|
if (!isNaN(d.getTime())) {
|
|
40010
42093
|
return d.toLocaleDateString(void 0, {
|
|
40011
42094
|
year: "numeric",
|
|
@@ -40014,7 +42097,7 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
40014
42097
|
...fieldType === "datetime" ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
40015
42098
|
});
|
|
40016
42099
|
}
|
|
40017
|
-
return
|
|
42100
|
+
return str2;
|
|
40018
42101
|
}
|
|
40019
42102
|
default:
|
|
40020
42103
|
return formatFieldValue(value, fieldName);
|
|
@@ -40376,7 +42459,7 @@ var init_DetailPanel = __esm({
|
|
|
40376
42459
|
}
|
|
40377
42460
|
});
|
|
40378
42461
|
function extractTitle(children) {
|
|
40379
|
-
if (!
|
|
42462
|
+
if (!React104__default.isValidElement(children)) return void 0;
|
|
40380
42463
|
const props = children.props;
|
|
40381
42464
|
if (typeof props.title === "string") {
|
|
40382
42465
|
return props.title;
|
|
@@ -40726,12 +42809,12 @@ var init_Form = __esm({
|
|
|
40726
42809
|
const isSchemaEntity = isOrbitalEntitySchema(entity);
|
|
40727
42810
|
const resolvedEntity = isSchemaEntity ? entity : void 0;
|
|
40728
42811
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
40729
|
-
const normalizedInitialData =
|
|
42812
|
+
const normalizedInitialData = React104__default.useMemo(() => {
|
|
40730
42813
|
const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
|
|
40731
42814
|
const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
|
|
40732
42815
|
return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
|
|
40733
42816
|
}, [entity, initialData]);
|
|
40734
|
-
const entityDerivedFields =
|
|
42817
|
+
const entityDerivedFields = React104__default.useMemo(() => {
|
|
40735
42818
|
if (fields && fields.length > 0) return void 0;
|
|
40736
42819
|
if (!resolvedEntity) return void 0;
|
|
40737
42820
|
return resolvedEntity.fields.map(
|
|
@@ -40752,16 +42835,16 @@ var init_Form = __esm({
|
|
|
40752
42835
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
40753
42836
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
40754
42837
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
40755
|
-
const [formData, setFormData] =
|
|
42838
|
+
const [formData, setFormData] = React104__default.useState(
|
|
40756
42839
|
normalizedInitialData
|
|
40757
42840
|
);
|
|
40758
|
-
const [collapsedSections, setCollapsedSections] =
|
|
42841
|
+
const [collapsedSections, setCollapsedSections] = React104__default.useState(
|
|
40759
42842
|
/* @__PURE__ */ new Set()
|
|
40760
42843
|
);
|
|
40761
|
-
const [submitError, setSubmitError] =
|
|
40762
|
-
const formRef =
|
|
42844
|
+
const [submitError, setSubmitError] = React104__default.useState(null);
|
|
42845
|
+
const formRef = React104__default.useRef(null);
|
|
40763
42846
|
const formMode = props.mode;
|
|
40764
|
-
const mountedRef =
|
|
42847
|
+
const mountedRef = React104__default.useRef(false);
|
|
40765
42848
|
if (!mountedRef.current) {
|
|
40766
42849
|
mountedRef.current = true;
|
|
40767
42850
|
debug("forms", "mount", {
|
|
@@ -40774,7 +42857,7 @@ var init_Form = __esm({
|
|
|
40774
42857
|
});
|
|
40775
42858
|
}
|
|
40776
42859
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
40777
|
-
const evalContext =
|
|
42860
|
+
const evalContext = React104__default.useMemo(
|
|
40778
42861
|
() => ({
|
|
40779
42862
|
formValues: formData,
|
|
40780
42863
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -40783,7 +42866,7 @@ var init_Form = __esm({
|
|
|
40783
42866
|
}),
|
|
40784
42867
|
[formData, externalContext]
|
|
40785
42868
|
);
|
|
40786
|
-
|
|
42869
|
+
React104__default.useEffect(() => {
|
|
40787
42870
|
debug("forms", "initialData-sync", {
|
|
40788
42871
|
mode: formMode,
|
|
40789
42872
|
normalizedInitialData,
|
|
@@ -40794,7 +42877,7 @@ var init_Form = __esm({
|
|
|
40794
42877
|
setFormData(normalizedInitialData);
|
|
40795
42878
|
}
|
|
40796
42879
|
}, [normalizedInitialData]);
|
|
40797
|
-
const processCalculations =
|
|
42880
|
+
const processCalculations = React104__default.useCallback(
|
|
40798
42881
|
(changedFieldId, newFormData) => {
|
|
40799
42882
|
if (!hiddenCalculations.length) return;
|
|
40800
42883
|
const context = {
|
|
@@ -40819,7 +42902,7 @@ var init_Form = __esm({
|
|
|
40819
42902
|
},
|
|
40820
42903
|
[hiddenCalculations, externalContext, eventBus]
|
|
40821
42904
|
);
|
|
40822
|
-
const checkViolations =
|
|
42905
|
+
const checkViolations = React104__default.useCallback(
|
|
40823
42906
|
(changedFieldId, newFormData) => {
|
|
40824
42907
|
if (!violationTriggers.length) return;
|
|
40825
42908
|
const context = {
|
|
@@ -40857,7 +42940,7 @@ var init_Form = __esm({
|
|
|
40857
42940
|
processCalculations(name, newFormData);
|
|
40858
42941
|
checkViolations(name, newFormData);
|
|
40859
42942
|
};
|
|
40860
|
-
const isFieldVisible =
|
|
42943
|
+
const isFieldVisible = React104__default.useCallback(
|
|
40861
42944
|
(fieldName) => {
|
|
40862
42945
|
const condition = conditionalFields[fieldName];
|
|
40863
42946
|
if (!condition) return true;
|
|
@@ -40865,7 +42948,7 @@ var init_Form = __esm({
|
|
|
40865
42948
|
},
|
|
40866
42949
|
[conditionalFields, evalContext]
|
|
40867
42950
|
);
|
|
40868
|
-
const isSectionVisible =
|
|
42951
|
+
const isSectionVisible = React104__default.useCallback(
|
|
40869
42952
|
(section) => {
|
|
40870
42953
|
if (!section.condition) return true;
|
|
40871
42954
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -40941,7 +43024,7 @@ var init_Form = __esm({
|
|
|
40941
43024
|
eventBus.emit(`UI:${onCancel}`);
|
|
40942
43025
|
}
|
|
40943
43026
|
};
|
|
40944
|
-
const renderField =
|
|
43027
|
+
const renderField = React104__default.useCallback(
|
|
40945
43028
|
(field) => {
|
|
40946
43029
|
const fieldName = field.name || field.field;
|
|
40947
43030
|
if (!fieldName) return null;
|
|
@@ -40962,7 +43045,7 @@ var init_Form = __esm({
|
|
|
40962
43045
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
40963
43046
|
);
|
|
40964
43047
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
40965
|
-
const normalizedFields =
|
|
43048
|
+
const normalizedFields = React104__default.useMemo(() => {
|
|
40966
43049
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
40967
43050
|
return effectiveFields.map((field) => {
|
|
40968
43051
|
if (typeof field === "string") {
|
|
@@ -40986,7 +43069,7 @@ var init_Form = __esm({
|
|
|
40986
43069
|
return field;
|
|
40987
43070
|
});
|
|
40988
43071
|
}, [effectiveFields, resolvedEntity]);
|
|
40989
|
-
const schemaFields =
|
|
43072
|
+
const schemaFields = React104__default.useMemo(() => {
|
|
40990
43073
|
if (normalizedFields.length === 0) return null;
|
|
40991
43074
|
if (isDebugEnabled()) {
|
|
40992
43075
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -40996,7 +43079,7 @@ var init_Form = __esm({
|
|
|
40996
43079
|
}
|
|
40997
43080
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
40998
43081
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
40999
|
-
const sectionElements =
|
|
43082
|
+
const sectionElements = React104__default.useMemo(() => {
|
|
41000
43083
|
if (!sections || sections.length === 0) return null;
|
|
41001
43084
|
return sections.map((section) => {
|
|
41002
43085
|
if (!isSectionVisible(section)) {
|
|
@@ -41575,7 +43658,7 @@ function formatValue3(value, fieldName) {
|
|
|
41575
43658
|
return String(value);
|
|
41576
43659
|
}
|
|
41577
43660
|
function formatFieldLabel2(fieldName) {
|
|
41578
|
-
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (
|
|
43661
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).replace(/Id$/, "").trim();
|
|
41579
43662
|
}
|
|
41580
43663
|
var STATUS_STYLES2, StatusBadge, ProgressIndicator, List3;
|
|
41581
43664
|
var init_List = __esm({
|
|
@@ -41721,7 +43804,7 @@ var init_List = __esm({
|
|
|
41721
43804
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
41722
43805
|
return [];
|
|
41723
43806
|
}, [entity]);
|
|
41724
|
-
const getItemActions =
|
|
43807
|
+
const getItemActions = React104__default.useCallback(
|
|
41725
43808
|
(item) => {
|
|
41726
43809
|
if (!itemActions) return [];
|
|
41727
43810
|
if (typeof itemActions === "function") {
|
|
@@ -42196,7 +44279,7 @@ var init_MediaGallery = __esm({
|
|
|
42196
44279
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
42197
44280
|
);
|
|
42198
44281
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
42199
|
-
const items =
|
|
44282
|
+
const items = React104__default.useMemo(() => {
|
|
42200
44283
|
if (propItems) return propItems;
|
|
42201
44284
|
if (entityData.length === 0) return [];
|
|
42202
44285
|
return entityData.map((record, idx) => {
|
|
@@ -42359,7 +44442,7 @@ var init_MediaGallery = __esm({
|
|
|
42359
44442
|
}
|
|
42360
44443
|
});
|
|
42361
44444
|
function extractTitle2(children) {
|
|
42362
|
-
if (!
|
|
44445
|
+
if (!React104__default.isValidElement(children)) return void 0;
|
|
42363
44446
|
const props = children.props;
|
|
42364
44447
|
if (typeof props.title === "string") {
|
|
42365
44448
|
return props.title;
|
|
@@ -42633,7 +44716,7 @@ var init_debugRegistry = __esm({
|
|
|
42633
44716
|
}
|
|
42634
44717
|
});
|
|
42635
44718
|
function useDebugData() {
|
|
42636
|
-
const [data, setData] =
|
|
44719
|
+
const [data, setData] = React104.useState(() => ({
|
|
42637
44720
|
traits: [],
|
|
42638
44721
|
ticks: [],
|
|
42639
44722
|
guards: [],
|
|
@@ -42647,7 +44730,7 @@ function useDebugData() {
|
|
|
42647
44730
|
},
|
|
42648
44731
|
lastUpdate: Date.now()
|
|
42649
44732
|
}));
|
|
42650
|
-
|
|
44733
|
+
React104.useEffect(() => {
|
|
42651
44734
|
const updateData = () => {
|
|
42652
44735
|
setData({
|
|
42653
44736
|
traits: getAllTraits(),
|
|
@@ -42756,12 +44839,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
|
|
|
42756
44839
|
return positions;
|
|
42757
44840
|
}
|
|
42758
44841
|
function WalkMinimap() {
|
|
42759
|
-
const [walkStep, setWalkStep] =
|
|
42760
|
-
const [traits2, setTraits] =
|
|
42761
|
-
const [coveredEdges, setCoveredEdges] =
|
|
42762
|
-
const [completedTraits, setCompletedTraits] =
|
|
42763
|
-
const prevTraitRef =
|
|
42764
|
-
|
|
44842
|
+
const [walkStep, setWalkStep] = React104.useState(null);
|
|
44843
|
+
const [traits2, setTraits] = React104.useState([]);
|
|
44844
|
+
const [coveredEdges, setCoveredEdges] = React104.useState([]);
|
|
44845
|
+
const [completedTraits, setCompletedTraits] = React104.useState(/* @__PURE__ */ new Set());
|
|
44846
|
+
const prevTraitRef = React104.useRef(null);
|
|
44847
|
+
React104.useEffect(() => {
|
|
42765
44848
|
const interval = setInterval(() => {
|
|
42766
44849
|
const w = window;
|
|
42767
44850
|
const step = w.__orbitalWalkStep;
|
|
@@ -43197,15 +45280,15 @@ var init_EntitiesTab = __esm({
|
|
|
43197
45280
|
});
|
|
43198
45281
|
function EventFlowTab({ events: events2 }) {
|
|
43199
45282
|
const { t } = useTranslate();
|
|
43200
|
-
const [filter, setFilter] =
|
|
43201
|
-
const containerRef =
|
|
43202
|
-
const [autoScroll, setAutoScroll] =
|
|
43203
|
-
|
|
45283
|
+
const [filter, setFilter] = React104.useState("all");
|
|
45284
|
+
const containerRef = React104.useRef(null);
|
|
45285
|
+
const [autoScroll, setAutoScroll] = React104.useState(true);
|
|
45286
|
+
React104.useEffect(() => {
|
|
43204
45287
|
if (autoScroll && containerRef.current) {
|
|
43205
45288
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
43206
45289
|
}
|
|
43207
45290
|
}, [events2.length, autoScroll]);
|
|
43208
|
-
const filteredEvents =
|
|
45291
|
+
const filteredEvents = React104.useMemo(() => {
|
|
43209
45292
|
if (filter === "all") return events2;
|
|
43210
45293
|
return events2.filter((e) => e.type === filter);
|
|
43211
45294
|
}, [events2, filter]);
|
|
@@ -43321,7 +45404,7 @@ var init_EventFlowTab = __esm({
|
|
|
43321
45404
|
});
|
|
43322
45405
|
function GuardsPanel({ guards }) {
|
|
43323
45406
|
const { t } = useTranslate();
|
|
43324
|
-
const [filter, setFilter] =
|
|
45407
|
+
const [filter, setFilter] = React104.useState("all");
|
|
43325
45408
|
if (guards.length === 0) {
|
|
43326
45409
|
return /* @__PURE__ */ jsx(
|
|
43327
45410
|
EmptyState,
|
|
@@ -43334,7 +45417,7 @@ function GuardsPanel({ guards }) {
|
|
|
43334
45417
|
}
|
|
43335
45418
|
const passedCount = guards.filter((g) => g.result).length;
|
|
43336
45419
|
const failedCount = guards.length - passedCount;
|
|
43337
|
-
const filteredGuards =
|
|
45420
|
+
const filteredGuards = React104.useMemo(() => {
|
|
43338
45421
|
if (filter === "all") return guards;
|
|
43339
45422
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
43340
45423
|
return guards.filter((g) => !g.result);
|
|
@@ -43497,10 +45580,10 @@ function EffectBadge({ effect }) {
|
|
|
43497
45580
|
}
|
|
43498
45581
|
function TransitionTimeline({ transitions }) {
|
|
43499
45582
|
const { t } = useTranslate();
|
|
43500
|
-
const containerRef =
|
|
43501
|
-
const [autoScroll, setAutoScroll] =
|
|
43502
|
-
const [expandedId, setExpandedId] =
|
|
43503
|
-
|
|
45583
|
+
const containerRef = React104.useRef(null);
|
|
45584
|
+
const [autoScroll, setAutoScroll] = React104.useState(true);
|
|
45585
|
+
const [expandedId, setExpandedId] = React104.useState(null);
|
|
45586
|
+
React104.useEffect(() => {
|
|
43504
45587
|
if (autoScroll && containerRef.current) {
|
|
43505
45588
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
43506
45589
|
}
|
|
@@ -43780,9 +45863,9 @@ function getAllEvents(traits2) {
|
|
|
43780
45863
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
43781
45864
|
const eventBus = useEventBus();
|
|
43782
45865
|
const { t } = useTranslate();
|
|
43783
|
-
const [log11, setLog] =
|
|
43784
|
-
const prevStatesRef =
|
|
43785
|
-
|
|
45866
|
+
const [log11, setLog] = React104.useState([]);
|
|
45867
|
+
const prevStatesRef = React104.useRef(/* @__PURE__ */ new Map());
|
|
45868
|
+
React104.useEffect(() => {
|
|
43786
45869
|
for (const trait of traits2) {
|
|
43787
45870
|
const prev = prevStatesRef.current.get(trait.id);
|
|
43788
45871
|
if (prev && prev !== trait.currentState) {
|
|
@@ -43951,10 +46034,10 @@ function VerifyModePanel({
|
|
|
43951
46034
|
localCount
|
|
43952
46035
|
}) {
|
|
43953
46036
|
const { t } = useTranslate();
|
|
43954
|
-
const [expanded, setExpanded] =
|
|
43955
|
-
const scrollRef =
|
|
43956
|
-
const prevCountRef =
|
|
43957
|
-
|
|
46037
|
+
const [expanded, setExpanded] = React104.useState(true);
|
|
46038
|
+
const scrollRef = React104.useRef(null);
|
|
46039
|
+
const prevCountRef = React104.useRef(0);
|
|
46040
|
+
React104.useEffect(() => {
|
|
43958
46041
|
if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
|
|
43959
46042
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
43960
46043
|
}
|
|
@@ -44011,10 +46094,10 @@ function RuntimeDebugger({
|
|
|
44011
46094
|
schema
|
|
44012
46095
|
}) {
|
|
44013
46096
|
const { t } = useTranslate();
|
|
44014
|
-
const [isCollapsed, setIsCollapsed] =
|
|
44015
|
-
const [isVisible, setIsVisible] =
|
|
46097
|
+
const [isCollapsed, setIsCollapsed] = React104.useState(mode === "verify" ? true : defaultCollapsed);
|
|
46098
|
+
const [isVisible, setIsVisible] = React104.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
44016
46099
|
const debugData = useDebugData();
|
|
44017
|
-
|
|
46100
|
+
React104.useEffect(() => {
|
|
44018
46101
|
if (mode === "inline") return;
|
|
44019
46102
|
return onDebugToggle((enabled) => {
|
|
44020
46103
|
setIsVisible(enabled);
|
|
@@ -44023,7 +46106,7 @@ function RuntimeDebugger({
|
|
|
44023
46106
|
}
|
|
44024
46107
|
});
|
|
44025
46108
|
}, [mode]);
|
|
44026
|
-
|
|
46109
|
+
React104.useEffect(() => {
|
|
44027
46110
|
if (mode === "inline") return;
|
|
44028
46111
|
const handleKeyDown = (e) => {
|
|
44029
46112
|
if (e.key === "`" && isVisible) {
|
|
@@ -44543,7 +46626,7 @@ var init_StatCard = __esm({
|
|
|
44543
46626
|
const labelToUse = propLabel ?? propTitle;
|
|
44544
46627
|
const eventBus = useEventBus();
|
|
44545
46628
|
const { t } = useTranslate();
|
|
44546
|
-
const handleActionClick =
|
|
46629
|
+
const handleActionClick = React104__default.useCallback(() => {
|
|
44547
46630
|
if (action?.event) {
|
|
44548
46631
|
eventBus.emit(`UI:${action.event}`, {});
|
|
44549
46632
|
}
|
|
@@ -44554,7 +46637,7 @@ var init_StatCard = __esm({
|
|
|
44554
46637
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
44555
46638
|
const isLoading = externalLoading ?? false;
|
|
44556
46639
|
const error = externalError;
|
|
44557
|
-
const computeMetricValue =
|
|
46640
|
+
const computeMetricValue = React104__default.useCallback(
|
|
44558
46641
|
(metric, items) => {
|
|
44559
46642
|
if (metric.value !== void 0) {
|
|
44560
46643
|
return metric.value;
|
|
@@ -44593,7 +46676,7 @@ var init_StatCard = __esm({
|
|
|
44593
46676
|
},
|
|
44594
46677
|
[]
|
|
44595
46678
|
);
|
|
44596
|
-
const schemaStats =
|
|
46679
|
+
const schemaStats = React104__default.useMemo(() => {
|
|
44597
46680
|
if (!metrics || metrics.length === 0) return null;
|
|
44598
46681
|
return metrics.map((metric) => ({
|
|
44599
46682
|
label: metric.label,
|
|
@@ -44601,7 +46684,7 @@ var init_StatCard = __esm({
|
|
|
44601
46684
|
format: metric.format
|
|
44602
46685
|
}));
|
|
44603
46686
|
}, [metrics, data, computeMetricValue]);
|
|
44604
|
-
const calculatedTrend =
|
|
46687
|
+
const calculatedTrend = React104__default.useMemo(() => {
|
|
44605
46688
|
if (manualTrend !== void 0) return manualTrend;
|
|
44606
46689
|
if (previousValue === void 0 || currentValue === void 0)
|
|
44607
46690
|
return void 0;
|
|
@@ -45241,8 +47324,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
45241
47324
|
] });
|
|
45242
47325
|
};
|
|
45243
47326
|
InlineActivityStream = ({ activities, autoScroll = true, className }) => {
|
|
45244
|
-
const endRef =
|
|
45245
|
-
|
|
47327
|
+
const endRef = React104__default.useRef(null);
|
|
47328
|
+
React104__default.useEffect(() => {
|
|
45246
47329
|
if (!autoScroll) return;
|
|
45247
47330
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
45248
47331
|
}, [activities.length, autoScroll]);
|
|
@@ -45336,7 +47419,7 @@ var init_SubagentTracePanel = __esm({
|
|
|
45336
47419
|
};
|
|
45337
47420
|
SubagentRichCard = ({ subagent }) => {
|
|
45338
47421
|
const { t } = useTranslate();
|
|
45339
|
-
const activities =
|
|
47422
|
+
const activities = React104__default.useMemo(
|
|
45340
47423
|
() => subagentMessagesToActivities(subagent.messages),
|
|
45341
47424
|
[subagent.messages]
|
|
45342
47425
|
);
|
|
@@ -45413,8 +47496,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
45413
47496
|
] });
|
|
45414
47497
|
};
|
|
45415
47498
|
CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
|
|
45416
|
-
const endRef =
|
|
45417
|
-
|
|
47499
|
+
const endRef = React104__default.useRef(null);
|
|
47500
|
+
React104__default.useEffect(() => {
|
|
45418
47501
|
if (!autoScroll) return;
|
|
45419
47502
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
45420
47503
|
}, [messages.length, autoScroll]);
|
|
@@ -45844,7 +47927,7 @@ var init_Timeline = __esm({
|
|
|
45844
47927
|
}) => {
|
|
45845
47928
|
const { t } = useTranslate();
|
|
45846
47929
|
const entityData = entity ?? [];
|
|
45847
|
-
const items =
|
|
47930
|
+
const items = React104__default.useMemo(() => {
|
|
45848
47931
|
if (propItems) return propItems;
|
|
45849
47932
|
if (entityData.length === 0) return [];
|
|
45850
47933
|
return entityData.map((record, idx) => {
|
|
@@ -45946,7 +48029,7 @@ var init_Timeline = __esm({
|
|
|
45946
48029
|
}
|
|
45947
48030
|
});
|
|
45948
48031
|
function extractToastProps(children) {
|
|
45949
|
-
if (!
|
|
48032
|
+
if (!React104__default.isValidElement(children)) {
|
|
45950
48033
|
if (typeof children === "string") {
|
|
45951
48034
|
return { message: children };
|
|
45952
48035
|
}
|
|
@@ -45988,7 +48071,7 @@ var init_ToastSlot = __esm({
|
|
|
45988
48071
|
eventBus.emit(`${prefix}CLOSE`);
|
|
45989
48072
|
};
|
|
45990
48073
|
if (!isVisible) return null;
|
|
45991
|
-
const isCustomContent =
|
|
48074
|
+
const isCustomContent = React104__default.isValidElement(children) && !message;
|
|
45992
48075
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
45993
48076
|
Toast,
|
|
45994
48077
|
{
|
|
@@ -46005,7 +48088,7 @@ var init_ToastSlot = __esm({
|
|
|
46005
48088
|
}
|
|
46006
48089
|
});
|
|
46007
48090
|
function lazyThree(name, loader) {
|
|
46008
|
-
const Lazy =
|
|
48091
|
+
const Lazy = React104__default.lazy(
|
|
46009
48092
|
() => loader().then((m) => {
|
|
46010
48093
|
const Resolved = m[name];
|
|
46011
48094
|
if (!Resolved) {
|
|
@@ -46017,13 +48100,13 @@ function lazyThree(name, loader) {
|
|
|
46017
48100
|
})
|
|
46018
48101
|
);
|
|
46019
48102
|
function ThreeWrapper(props) {
|
|
46020
|
-
return
|
|
48103
|
+
return React104__default.createElement(
|
|
46021
48104
|
ThreeBoundary,
|
|
46022
48105
|
{ name },
|
|
46023
|
-
|
|
46024
|
-
|
|
48106
|
+
React104__default.createElement(
|
|
48107
|
+
React104__default.Suspense,
|
|
46025
48108
|
{ fallback: null },
|
|
46026
|
-
|
|
48109
|
+
React104__default.createElement(Lazy, props)
|
|
46027
48110
|
)
|
|
46028
48111
|
);
|
|
46029
48112
|
}
|
|
@@ -46059,6 +48142,7 @@ var init_component_registry_generated = __esm({
|
|
|
46059
48142
|
init_LayoutPatterns();
|
|
46060
48143
|
init_BranchingLogicBuilder();
|
|
46061
48144
|
init_Breadcrumb();
|
|
48145
|
+
init_BuilderBoard();
|
|
46062
48146
|
init_CTABanner();
|
|
46063
48147
|
init_CalendarGrid();
|
|
46064
48148
|
init_Canvas2D();
|
|
@@ -46074,6 +48158,7 @@ var init_component_registry_generated = __esm({
|
|
|
46074
48158
|
init_Checkbox();
|
|
46075
48159
|
init_ChemistryCanvas();
|
|
46076
48160
|
init_ChoiceButton();
|
|
48161
|
+
init_ClassifierBoard();
|
|
46077
48162
|
init_CodeBlock();
|
|
46078
48163
|
init_CodeRunnerPanel();
|
|
46079
48164
|
init_ComboCounter();
|
|
@@ -46097,6 +48182,7 @@ var init_component_registry_generated = __esm({
|
|
|
46097
48182
|
init_DateRangePicker();
|
|
46098
48183
|
init_DateRangeSelector();
|
|
46099
48184
|
init_DayCell();
|
|
48185
|
+
init_DebuggerBoard();
|
|
46100
48186
|
init_DetailPanel();
|
|
46101
48187
|
init_Dialog();
|
|
46102
48188
|
init_DialogueBubble();
|
|
@@ -46112,6 +48198,7 @@ var init_component_registry_generated = __esm({
|
|
|
46112
48198
|
init_EmptyState();
|
|
46113
48199
|
init_ErrorBoundary();
|
|
46114
48200
|
init_ErrorState();
|
|
48201
|
+
init_EventHandlerBoard();
|
|
46115
48202
|
init_EventLog();
|
|
46116
48203
|
init_FeatureCard();
|
|
46117
48204
|
init_FeatureDetailPageTemplate();
|
|
@@ -46178,6 +48265,7 @@ var init_component_registry_generated = __esm({
|
|
|
46178
48265
|
init_ModalSlot();
|
|
46179
48266
|
init_ModuleCard();
|
|
46180
48267
|
init_Navigation();
|
|
48268
|
+
init_NegotiatorBoard();
|
|
46181
48269
|
init_NumberStepper();
|
|
46182
48270
|
init_OptionConstraintGroup();
|
|
46183
48271
|
init_OrbitalVisualization();
|
|
@@ -46216,6 +48304,7 @@ var init_component_registry_generated = __esm({
|
|
|
46216
48304
|
init_SegmentRenderer();
|
|
46217
48305
|
init_Select();
|
|
46218
48306
|
init_SequenceBar();
|
|
48307
|
+
init_SequencerBoard();
|
|
46219
48308
|
init_ServiceCatalog();
|
|
46220
48309
|
init_ShowcaseCard();
|
|
46221
48310
|
init_ShowcaseOrganism();
|
|
@@ -46224,6 +48313,7 @@ var init_component_registry_generated = __esm({
|
|
|
46224
48313
|
init_SignaturePad();
|
|
46225
48314
|
init_SimpleGrid();
|
|
46226
48315
|
init_SimulationCanvas();
|
|
48316
|
+
init_SimulatorBoard();
|
|
46227
48317
|
init_Skeleton();
|
|
46228
48318
|
init_SocialProof();
|
|
46229
48319
|
init_SortableList();
|
|
@@ -46237,6 +48327,7 @@ var init_component_registry_generated = __esm({
|
|
|
46237
48327
|
init_StatBadge();
|
|
46238
48328
|
init_StatCard();
|
|
46239
48329
|
init_StatDisplay();
|
|
48330
|
+
init_StateArchitectBoard();
|
|
46240
48331
|
init_StateIndicator();
|
|
46241
48332
|
init_StateMachineView();
|
|
46242
48333
|
init_StatsGrid();
|
|
@@ -46291,7 +48382,7 @@ var init_component_registry_generated = __esm({
|
|
|
46291
48382
|
init_WizardContainer();
|
|
46292
48383
|
init_WizardNavigation();
|
|
46293
48384
|
init_WizardProgress();
|
|
46294
|
-
ThreeBoundary = class extends
|
|
48385
|
+
ThreeBoundary = class extends React104__default.Component {
|
|
46295
48386
|
constructor() {
|
|
46296
48387
|
super(...arguments);
|
|
46297
48388
|
__publicField(this, "state", { failed: false });
|
|
@@ -46301,7 +48392,7 @@ var init_component_registry_generated = __esm({
|
|
|
46301
48392
|
}
|
|
46302
48393
|
render() {
|
|
46303
48394
|
if (this.state.failed) {
|
|
46304
|
-
return
|
|
48395
|
+
return React104__default.createElement(
|
|
46305
48396
|
"div",
|
|
46306
48397
|
{
|
|
46307
48398
|
"data-testid": "three-unavailable",
|
|
@@ -46347,6 +48438,7 @@ var init_component_registry_generated = __esm({
|
|
|
46347
48438
|
"BoxPattern": BoxPattern,
|
|
46348
48439
|
"BranchingLogicBuilder": BranchingLogicBuilder,
|
|
46349
48440
|
"Breadcrumb": Breadcrumb,
|
|
48441
|
+
"BuilderBoard": BuilderBoard,
|
|
46350
48442
|
"Button": ButtonPattern,
|
|
46351
48443
|
"ButtonPattern": ButtonPattern,
|
|
46352
48444
|
"CTABanner": CTABanner,
|
|
@@ -46364,6 +48456,7 @@ var init_component_registry_generated = __esm({
|
|
|
46364
48456
|
"Checkbox": Checkbox,
|
|
46365
48457
|
"ChemistryCanvas": ChemistryCanvas,
|
|
46366
48458
|
"ChoiceButton": ChoiceButton,
|
|
48459
|
+
"ClassifierBoard": ClassifierBoard,
|
|
46367
48460
|
"CodeBlock": CodeBlock,
|
|
46368
48461
|
"CodeRunnerPanel": CodeRunnerPanel,
|
|
46369
48462
|
"ComboCounter": ComboCounter,
|
|
@@ -46387,6 +48480,7 @@ var init_component_registry_generated = __esm({
|
|
|
46387
48480
|
"DateRangePicker": DateRangePicker,
|
|
46388
48481
|
"DateRangeSelector": DateRangeSelector,
|
|
46389
48482
|
"DayCell": DayCell,
|
|
48483
|
+
"DebuggerBoard": DebuggerBoard,
|
|
46390
48484
|
"DetailPanel": DetailPanel,
|
|
46391
48485
|
"Dialog": Dialog,
|
|
46392
48486
|
"DialogueBubble": DialogueBubble,
|
|
@@ -46404,6 +48498,7 @@ var init_component_registry_generated = __esm({
|
|
|
46404
48498
|
"EmptyState": EmptyState,
|
|
46405
48499
|
"ErrorBoundary": ErrorBoundary,
|
|
46406
48500
|
"ErrorState": ErrorState,
|
|
48501
|
+
"EventHandlerBoard": EventHandlerBoard,
|
|
46407
48502
|
"EventLog": EventLog,
|
|
46408
48503
|
"FeatureCard": FeatureCard,
|
|
46409
48504
|
"FeatureDetailPageTemplate": FeatureDetailPageTemplate,
|
|
@@ -46478,6 +48573,7 @@ var init_component_registry_generated = __esm({
|
|
|
46478
48573
|
"ModalSlot": ModalSlot,
|
|
46479
48574
|
"ModuleCard": ModuleCard,
|
|
46480
48575
|
"Navigation": Navigation,
|
|
48576
|
+
"NegotiatorBoard": NegotiatorBoard,
|
|
46481
48577
|
"NumberStepper": NumberStepper,
|
|
46482
48578
|
"OptionConstraintGroup": OptionConstraintGroup,
|
|
46483
48579
|
"OrbitalVisualization": OrbitalVisualization,
|
|
@@ -46516,6 +48612,7 @@ var init_component_registry_generated = __esm({
|
|
|
46516
48612
|
"SegmentRenderer": SegmentRenderer,
|
|
46517
48613
|
"Select": Select,
|
|
46518
48614
|
"SequenceBar": SequenceBar,
|
|
48615
|
+
"SequencerBoard": SequencerBoard,
|
|
46519
48616
|
"ServiceCatalog": ServiceCatalog,
|
|
46520
48617
|
"ShowcaseCard": ShowcaseCard,
|
|
46521
48618
|
"ShowcaseOrganism": ShowcaseOrganism,
|
|
@@ -46524,6 +48621,7 @@ var init_component_registry_generated = __esm({
|
|
|
46524
48621
|
"SignaturePad": SignaturePad,
|
|
46525
48622
|
"SimpleGrid": SimpleGrid,
|
|
46526
48623
|
"SimulationCanvas": SimulationCanvas,
|
|
48624
|
+
"SimulatorBoard": SimulatorBoard,
|
|
46527
48625
|
"Skeleton": Skeleton,
|
|
46528
48626
|
"SocialProof": SocialProof,
|
|
46529
48627
|
"SortableList": SortableList,
|
|
@@ -46540,6 +48638,7 @@ var init_component_registry_generated = __esm({
|
|
|
46540
48638
|
"StatBadge": StatBadge,
|
|
46541
48639
|
"StatCard": StatCard,
|
|
46542
48640
|
"StatDisplay": StatDisplay,
|
|
48641
|
+
"StateArchitectBoard": StateArchitectBoard,
|
|
46543
48642
|
"StateIndicator": StateIndicator,
|
|
46544
48643
|
"StateMachineView": StateMachineView,
|
|
46545
48644
|
"StatsGrid": StatsGrid,
|
|
@@ -46613,7 +48712,7 @@ function SuspenseConfigProvider({
|
|
|
46613
48712
|
config,
|
|
46614
48713
|
children
|
|
46615
48714
|
}) {
|
|
46616
|
-
return
|
|
48715
|
+
return React104__default.createElement(
|
|
46617
48716
|
SuspenseConfigContext.Provider,
|
|
46618
48717
|
{ value: config },
|
|
46619
48718
|
children
|
|
@@ -46655,7 +48754,7 @@ function enrichFormFields(fields, entityDef) {
|
|
|
46655
48754
|
}
|
|
46656
48755
|
return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
|
|
46657
48756
|
}
|
|
46658
|
-
if (field && typeof field === "object" && !Array.isArray(field) && !
|
|
48757
|
+
if (field && typeof field === "object" && !Array.isArray(field) && !React104__default.isValidElement(field) && !(field instanceof Date)) {
|
|
46659
48758
|
const obj = field;
|
|
46660
48759
|
const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
|
|
46661
48760
|
if (!fieldName) return field;
|
|
@@ -47108,7 +49207,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
47108
49207
|
const key = `${parentId}-${index}-trait:${traitName}`;
|
|
47109
49208
|
return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
|
|
47110
49209
|
}
|
|
47111
|
-
return /* @__PURE__ */ jsx(
|
|
49210
|
+
return /* @__PURE__ */ jsx(React104__default.Fragment, { children: child }, `${parentId}-${index}`);
|
|
47112
49211
|
}
|
|
47113
49212
|
if (!child || typeof child !== "object") return null;
|
|
47114
49213
|
const childId = `${parentId}-${index}`;
|
|
@@ -47148,14 +49247,14 @@ function isPatternConfig(value) {
|
|
|
47148
49247
|
if (value === null || value === void 0) return false;
|
|
47149
49248
|
if (typeof value !== "object") return false;
|
|
47150
49249
|
if (Array.isArray(value)) return false;
|
|
47151
|
-
if (
|
|
49250
|
+
if (React104__default.isValidElement(value)) return false;
|
|
47152
49251
|
if (value instanceof Date) return false;
|
|
47153
49252
|
if (typeof value === "function") return false;
|
|
47154
49253
|
const record = value;
|
|
47155
49254
|
return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
|
|
47156
49255
|
}
|
|
47157
49256
|
function isPlainConfigObject(value) {
|
|
47158
|
-
if (
|
|
49257
|
+
if (React104__default.isValidElement(value)) return false;
|
|
47159
49258
|
if (value instanceof Date) return false;
|
|
47160
49259
|
const proto = Object.getPrototypeOf(value);
|
|
47161
49260
|
return proto === Object.prototype || proto === null;
|
|
@@ -47281,7 +49380,7 @@ function SlotContentRenderer({
|
|
|
47281
49380
|
for (const slotKey of CONTENT_NODE_SLOTS) {
|
|
47282
49381
|
const slotVal = restProps[slotKey];
|
|
47283
49382
|
if (slotVal === void 0 || slotVal === null) continue;
|
|
47284
|
-
if (
|
|
49383
|
+
if (React104__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
|
|
47285
49384
|
if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
|
|
47286
49385
|
nodeSlotOverrides[slotKey] = renderPatternChildren(
|
|
47287
49386
|
slotVal,
|
|
@@ -47330,7 +49429,7 @@ function SlotContentRenderer({
|
|
|
47330
49429
|
const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
|
|
47331
49430
|
if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
|
|
47332
49431
|
const sample = resolvedItems[0];
|
|
47333
|
-
if (sample && typeof sample === "object" && !Array.isArray(sample) && !
|
|
49432
|
+
if (sample && typeof sample === "object" && !Array.isArray(sample) && !React104__default.isValidElement(sample) && !(sample instanceof Date)) {
|
|
47334
49433
|
const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
|
|
47335
49434
|
finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
|
|
47336
49435
|
}
|
|
@@ -47693,7 +49792,7 @@ var AvlTransition = ({
|
|
|
47693
49792
|
opacity = 1,
|
|
47694
49793
|
className
|
|
47695
49794
|
}) => {
|
|
47696
|
-
const ids =
|
|
49795
|
+
const ids = React104__default.useMemo(() => {
|
|
47697
49796
|
avlTransitionId += 1;
|
|
47698
49797
|
return { arrow: `avl-tr-${avlTransitionId}-arrow` };
|
|
47699
49798
|
}, []);
|
|
@@ -48254,7 +50353,7 @@ var AvlStateMachine = ({
|
|
|
48254
50353
|
color = "var(--color-primary)",
|
|
48255
50354
|
animated = false
|
|
48256
50355
|
}) => {
|
|
48257
|
-
const ids =
|
|
50356
|
+
const ids = React104__default.useMemo(() => {
|
|
48258
50357
|
avlSmId += 1;
|
|
48259
50358
|
const base = `avl-sm-${avlSmId}`;
|
|
48260
50359
|
return { glow: `${base}-glow`, grad: `${base}-grad` };
|
|
@@ -48453,7 +50552,7 @@ var AvlOrbitalUnit = ({
|
|
|
48453
50552
|
color = "var(--color-primary)",
|
|
48454
50553
|
animated = false
|
|
48455
50554
|
}) => {
|
|
48456
|
-
const ids =
|
|
50555
|
+
const ids = React104__default.useMemo(() => {
|
|
48457
50556
|
avlOuId += 1;
|
|
48458
50557
|
const base = `avl-ou-${avlOuId}`;
|
|
48459
50558
|
return { glow: `${base}-glow`, grad: `${base}-grad` };
|
|
@@ -48549,7 +50648,7 @@ var AvlClosedCircuit = ({
|
|
|
48549
50648
|
color = "var(--color-primary)",
|
|
48550
50649
|
animated = false
|
|
48551
50650
|
}) => {
|
|
48552
|
-
const ids =
|
|
50651
|
+
const ids = React104__default.useMemo(() => {
|
|
48553
50652
|
avlCcId += 1;
|
|
48554
50653
|
const base = `avl-cc-${avlCcId}`;
|
|
48555
50654
|
return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
|
|
@@ -48704,7 +50803,7 @@ var AvlEmitListen = ({
|
|
|
48704
50803
|
color = "var(--color-primary)",
|
|
48705
50804
|
animated = false
|
|
48706
50805
|
}) => {
|
|
48707
|
-
const ids =
|
|
50806
|
+
const ids = React104__default.useMemo(() => {
|
|
48708
50807
|
avlElId += 1;
|
|
48709
50808
|
const base = `avl-el-${avlElId}`;
|
|
48710
50809
|
return { arrow: `${base}-arrow`, grad: `${base}-grad` };
|
|
@@ -48978,7 +51077,7 @@ function renderNode(node, color, glowId) {
|
|
|
48978
51077
|
const baseR = node.type === "operator" ? 20 : 16;
|
|
48979
51078
|
const r2 = Math.max(baseR, labelLen * 3.5 + 6);
|
|
48980
51079
|
const nc = nodeColor(node.type, color);
|
|
48981
|
-
return /* @__PURE__ */ jsxs(
|
|
51080
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
48982
51081
|
node.children.map((child, i) => {
|
|
48983
51082
|
const childR = Math.max(
|
|
48984
51083
|
child.type === "operator" ? 20 : 16,
|
|
@@ -49035,7 +51134,7 @@ var AvlExprTree = ({
|
|
|
49035
51134
|
className,
|
|
49036
51135
|
color = "var(--color-primary)"
|
|
49037
51136
|
}) => {
|
|
49038
|
-
const ids =
|
|
51137
|
+
const ids = React104__default.useMemo(() => {
|
|
49039
51138
|
avlEtId += 1;
|
|
49040
51139
|
return { glow: `avl-et-${avlEtId}-glow` };
|
|
49041
51140
|
}, []);
|
|
@@ -49588,10 +51687,10 @@ function parseApplicationLevel(schema) {
|
|
|
49588
51687
|
}
|
|
49589
51688
|
const count = schema.orbitals.length;
|
|
49590
51689
|
const cols = Math.ceil(Math.sqrt(count));
|
|
49591
|
-
const
|
|
51690
|
+
const rows2 = Math.ceil(count / cols);
|
|
49592
51691
|
const spacing = 200;
|
|
49593
51692
|
const gridW = cols * spacing;
|
|
49594
|
-
const gridH =
|
|
51693
|
+
const gridH = rows2 * spacing;
|
|
49595
51694
|
const originX = (600 - gridW) / 2 + spacing / 2;
|
|
49596
51695
|
const originY = (400 - gridH) / 2 + spacing / 2;
|
|
49597
51696
|
schema.orbitals.forEach((orbital, i) => {
|
|
@@ -49870,7 +51969,7 @@ var SystemNode = ({ data }) => {
|
|
|
49870
51969
|
stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
|
|
49871
51970
|
const tc = transitionCounts[s.name] ?? 0;
|
|
49872
51971
|
const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
|
|
49873
|
-
return /* @__PURE__ */ jsxs(
|
|
51972
|
+
return /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
49874
51973
|
/* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
|
|
49875
51974
|
i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
|
|
49876
51975
|
] }, s.name);
|
|
@@ -51015,7 +53114,7 @@ function resolveLambdaBindings(body, params, item, index) {
|
|
|
51015
53114
|
if (Array.isArray(body)) {
|
|
51016
53115
|
return body.map((b) => recur(b));
|
|
51017
53116
|
}
|
|
51018
|
-
if (body !== null && typeof body === "object" && !
|
|
53117
|
+
if (body !== null && typeof body === "object" && !React104__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
51019
53118
|
const out = {};
|
|
51020
53119
|
for (const [k, v] of Object.entries(body)) {
|
|
51021
53120
|
out[k] = recur(v);
|
|
@@ -51034,7 +53133,7 @@ function getSlotContentRenderer2() {
|
|
|
51034
53133
|
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
51035
53134
|
return (item, index) => {
|
|
51036
53135
|
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
51037
|
-
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" ||
|
|
53136
|
+
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React104__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
51038
53137
|
return null;
|
|
51039
53138
|
}
|
|
51040
53139
|
const record = resolvedBody;
|
|
@@ -51053,7 +53152,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
|
51053
53152
|
props: childProps,
|
|
51054
53153
|
priority: 0
|
|
51055
53154
|
};
|
|
51056
|
-
return
|
|
53155
|
+
return React104__default.createElement(SlotContentRenderer2, { content: childContent });
|
|
51057
53156
|
};
|
|
51058
53157
|
}
|
|
51059
53158
|
function convertNode(node, callerKey) {
|
|
@@ -51072,7 +53171,7 @@ function convertNode(node, callerKey) {
|
|
|
51072
53171
|
});
|
|
51073
53172
|
return anyChanged ? mapped : node;
|
|
51074
53173
|
}
|
|
51075
|
-
if (typeof node === "object" && !
|
|
53174
|
+
if (typeof node === "object" && !React104__default.isValidElement(node) && !(node instanceof Date)) {
|
|
51076
53175
|
return convertObjectProps(node);
|
|
51077
53176
|
}
|
|
51078
53177
|
return node;
|
|
@@ -52061,11 +54160,11 @@ function buildMockData(schema) {
|
|
|
52061
54160
|
result[entityName] = entity.instances;
|
|
52062
54161
|
continue;
|
|
52063
54162
|
}
|
|
52064
|
-
const
|
|
54163
|
+
const rows2 = Array.from(
|
|
52065
54164
|
{ length: 10 },
|
|
52066
54165
|
(_, i) => generateEntityRow(entity, i + 1)
|
|
52067
54166
|
);
|
|
52068
|
-
result[entityName] =
|
|
54167
|
+
result[entityName] = rows2;
|
|
52069
54168
|
}
|
|
52070
54169
|
for (const orbital of schema.orbitals) {
|
|
52071
54170
|
for (const traitRef of orbital.traits ?? []) {
|
|
@@ -52735,8 +54834,8 @@ function CanvasDndProvider({
|
|
|
52735
54834
|
}) {
|
|
52736
54835
|
const eventBus = useEventBus();
|
|
52737
54836
|
const sensors = useAlmadarDndSensors(false);
|
|
52738
|
-
const [activePayload, setActivePayload] =
|
|
52739
|
-
const handleDragStart =
|
|
54837
|
+
const [activePayload, setActivePayload] = React104__default.useState(null);
|
|
54838
|
+
const handleDragStart = React104__default.useCallback((e) => {
|
|
52740
54839
|
const data = e.active.data.current;
|
|
52741
54840
|
const payload = data?.payload;
|
|
52742
54841
|
if (payload) {
|
|
@@ -52747,7 +54846,7 @@ function CanvasDndProvider({
|
|
|
52747
54846
|
log9.warn("dragStart:missing-payload", { id: e.active.id });
|
|
52748
54847
|
}
|
|
52749
54848
|
}, [eventBus]);
|
|
52750
|
-
const handleDragEnd =
|
|
54849
|
+
const handleDragEnd = React104__default.useCallback((e) => {
|
|
52751
54850
|
setActivePayload(null);
|
|
52752
54851
|
const activeData = e.active.data.current;
|
|
52753
54852
|
const payload = activeData?.payload;
|
|
@@ -52776,7 +54875,7 @@ function CanvasDndProvider({
|
|
|
52776
54875
|
const suppressed = onDrop ? onDrop(drop) === true : false;
|
|
52777
54876
|
if (!suppressed) defaultEmit(eventBus, drop);
|
|
52778
54877
|
}, [eventBus, onDrop]);
|
|
52779
|
-
const handleDragCancel =
|
|
54878
|
+
const handleDragCancel = React104__default.useCallback(() => {
|
|
52780
54879
|
setActivePayload(null);
|
|
52781
54880
|
log9.info("dragCancel");
|
|
52782
54881
|
}, []);
|
|
@@ -53534,7 +55633,7 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
53534
55633
|
}
|
|
53535
55634
|
);
|
|
53536
55635
|
};
|
|
53537
|
-
var OrbPreviewNode =
|
|
55636
|
+
var OrbPreviewNode = React104__default.memo(OrbPreviewNodeInner);
|
|
53538
55637
|
OrbPreviewNode.displayName = "OrbPreviewNode";
|
|
53539
55638
|
orbPreviewLog.debug("export-resolved", () => ({
|
|
53540
55639
|
type: typeof OrbPreviewNode,
|
|
@@ -53639,7 +55738,7 @@ var EventFlowEdgeInner = (props) => {
|
|
|
53639
55738
|
) })
|
|
53640
55739
|
] });
|
|
53641
55740
|
};
|
|
53642
|
-
var EventFlowEdge =
|
|
55741
|
+
var EventFlowEdge = React104__default.memo(EventFlowEdgeInner);
|
|
53643
55742
|
EventFlowEdge.displayName = "EventFlowEdge";
|
|
53644
55743
|
|
|
53645
55744
|
// components/avl/molecules/BehaviorComposeNode.tsx
|
|
@@ -53786,7 +55885,7 @@ var BehaviorComposeNodeInner = (props) => {
|
|
|
53786
55885
|
}
|
|
53787
55886
|
);
|
|
53788
55887
|
};
|
|
53789
|
-
var BehaviorComposeNode =
|
|
55888
|
+
var BehaviorComposeNode = React104__default.memo(BehaviorComposeNodeInner);
|
|
53790
55889
|
BehaviorComposeNode.displayName = "BehaviorComposeNode";
|
|
53791
55890
|
|
|
53792
55891
|
// components/avl/lib/avl-behavior-compose-converter.ts
|
|
@@ -54812,7 +56911,7 @@ var TraitCardNodeInner = (props) => {
|
|
|
54812
56911
|
}
|
|
54813
56912
|
);
|
|
54814
56913
|
};
|
|
54815
|
-
var TraitCardNode =
|
|
56914
|
+
var TraitCardNode = React104__default.memo(TraitCardNodeInner);
|
|
54816
56915
|
TraitCardNode.displayName = "TraitCardNode";
|
|
54817
56916
|
|
|
54818
56917
|
// components/avl/organisms/FlowCanvas.tsx
|
|
@@ -54885,7 +56984,7 @@ function FlowCanvasInner({
|
|
|
54885
56984
|
initialOrbital
|
|
54886
56985
|
);
|
|
54887
56986
|
const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
|
|
54888
|
-
const screenSizeUserOverrideRef =
|
|
56987
|
+
const screenSizeUserOverrideRef = React104__default.useRef(false);
|
|
54889
56988
|
const [screenSize, setScreenSize] = useState(
|
|
54890
56989
|
() => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
|
|
54891
56990
|
);
|
|
@@ -55269,7 +57368,7 @@ var ZoomBreadcrumb = ({
|
|
|
55269
57368
|
if (eventName && band === "detail") {
|
|
55270
57369
|
segments.push({ icon: "\u26A1", label: eventName });
|
|
55271
57370
|
}
|
|
55272
|
-
return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(
|
|
57371
|
+
return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
55273
57372
|
i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
|
|
55274
57373
|
/* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
|
|
55275
57374
|
/* @__PURE__ */ jsx("span", { children: seg.label })
|
|
@@ -55581,18 +57680,18 @@ function layoutOrbitals(count, containerW, containerH) {
|
|
|
55581
57680
|
if (count === 0) return [];
|
|
55582
57681
|
if (count === 1) return [{ cx: containerW / 2, cy: containerH / 2 }];
|
|
55583
57682
|
const cols = Math.min(count, Math.ceil(Math.sqrt(count)));
|
|
55584
|
-
const
|
|
57683
|
+
const rows2 = Math.ceil(count / cols);
|
|
55585
57684
|
const edgePad = 24;
|
|
55586
57685
|
const fitMinCx = UNIT_DISPLAY_W / 2 + edgePad;
|
|
55587
57686
|
const fitMinCy = UNIT_DISPLAY_H / 2 + edgePad;
|
|
55588
57687
|
const fitMaxCx = Math.max(fitMinCx, containerW - UNIT_DISPLAY_W / 2 - edgePad);
|
|
55589
57688
|
const fitMaxCy = Math.max(fitMinCy, containerH - UNIT_DISPLAY_H / 2 - edgePad);
|
|
55590
57689
|
const fitStepX = cols > 1 ? (fitMaxCx - fitMinCx) / (cols - 1) : 0;
|
|
55591
|
-
const fitStepY =
|
|
57690
|
+
const fitStepY = rows2 > 1 ? (fitMaxCy - fitMinCy) / (rows2 - 1) : 0;
|
|
55592
57691
|
const stepX = Math.min(fitStepX, UNIT_DISPLAY_W * 3.5);
|
|
55593
57692
|
const stepY = Math.min(fitStepY, UNIT_DISPLAY_H * 3.5);
|
|
55594
57693
|
const gridW = (cols - 1) * stepX;
|
|
55595
|
-
const gridH = (
|
|
57694
|
+
const gridH = (rows2 - 1) * stepY;
|
|
55596
57695
|
const originX = (containerW - gridW) / 2;
|
|
55597
57696
|
const originY = (containerH - gridH) / 2;
|
|
55598
57697
|
return Array.from({ length: count }, (_, i) => ({
|
|
@@ -55610,7 +57709,7 @@ var EventWireOverlay = ({
|
|
|
55610
57709
|
containerW,
|
|
55611
57710
|
containerH
|
|
55612
57711
|
}) => {
|
|
55613
|
-
const ids =
|
|
57712
|
+
const ids = React104__default.useMemo(() => {
|
|
55614
57713
|
avlOczWireId += 1;
|
|
55615
57714
|
return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
|
|
55616
57715
|
}, []);
|
|
@@ -55977,7 +58076,7 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
55977
58076
|
borderRadius: 6,
|
|
55978
58077
|
border: `1px solid ${color}`
|
|
55979
58078
|
},
|
|
55980
|
-
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(
|
|
58079
|
+
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React104__default.Fragment, { children: [
|
|
55981
58080
|
i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
|
|
55982
58081
|
i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
|
|
55983
58082
|
Box,
|