import { useEffect, useMemo, useRef, useState } from "react"; import { INITIAL_STATE, reduceFrontendState } from "./store"; import { ReactWorkerClient } from "./worker-client"; import { XyzacToolPreviewFromSnapshot } from "./XyzacToolPreview"; import { XyzacMachineViewFromSnapshot } from "./XyzacMachineView"; import { WEB_SETTINGS } from "../../workspace/web-settings.mjs"; import { MachineImportPanel } from "./MachineImportPanel"; import { loadImportedMachine, configureImportedMachine, updateImportedMachineGeometry, disposeMachineScene, type ImportedMachine } from "./imported-machine"; import { MAX_MACHINE_BYTES } from "./machine-urdf"; import { TrtGeometryPanel } from "./TrtGeometryPanel"; import { readTrtGeometry } from "../../workspace/trt-geometry.mjs"; import { loadSimulationCase, toWorkerConfiguration } from "../../workspace/sim-case-loader.mjs"; import { axisIcon } from "./sourceAssets"; import { HoldButton } from "./HoldButton"; import { MachineStatus } from "./MachineStatus"; import { AxisOperationController } from "../../app/axis-operation-controller.mjs"; import { XyzacDiagnostics, XyzacLiveParameters, XyzacProgramPane, XyzacTrtPanel } from "./XyzacTrtPanel"; import { projectXyzacPanel, type XyzacOperationTrace } from "./xyzac-panel-contract"; import { DEFAULT_MACHINE, MACHINE_DEFINITIONS, machineDefinition } from "../../workspace/machine-definitions.mjs"; import { RtcpProgramLibrary, type RtcpProgram } from "./RtcpProgramLibrary"; import { MachineManagerPanel } from "./MachineManagerPanel"; export const SELECTED_XYZAC_CASE = DEFAULT_MACHINE.entrypoint; const DEFAULT_CASE = DEFAULT_MACHINE.entrypoint; const normalizeProgramSource = (source: string) => source.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); // Button-to-command sequencing is defined in // docs/linuxcnc-axis-web-control-panel-source-logic.md; React only projects // Worker gates and emits the documented operation. type Action = (kind: string, payload?: Record) => Promise | void; type IconButtonProps = { controlId: string; label: string; asset: string; onClick?: () => void; disabled?: boolean; disabledReason?: string; danger?: boolean; pressed?: boolean; feature?: string }; function IconButton({ controlId, label, asset, onClick, disabled = false, disabledReason, danger = false, pressed = false, feature = "AXIS-UI-05" }: IconButtonProps) { return ; } function TextButton({ controlId, children, onClick, onPointerDown, onPointerUp, onPointerCancel, onPointerLeave, ariaLabel, disabled = false, disabledReason, danger = false, feature = "AXIS-UI-07" }: { controlId: string; children: React.ReactNode; onClick?: () => void; onPointerDown?: React.PointerEventHandler; onPointerUp?: React.PointerEventHandler; onPointerCancel?: React.PointerEventHandler; onPointerLeave?: React.PointerEventHandler; ariaLabel?: string; disabled?: boolean; disabledReason?: string; danger?: boolean; feature?: string }) { return ; } function Separator() { return