import { A as metricSchema, C as clipboardPayloadSchema, D as MutationActionName, E as MutationActionInput, F as transitionSchema, M as differentialEquationSchema, N as parameterSchema, O as mutationActionInputSchemas, P as placeSchema, S as ClipboardPayload, T as createPetrinautActions, _ as ApplyAutoLayoutResult, a as PetrinautMutations, b as createPetrinautCommands, c as DocChangeEvent, d as HistoryEntry, f as PetrinautDocHandle, g as createJsonDocHandle, h as ReadableStore, i as PetrinautCommands, j as colorSchema, k as scenarioSchema, l as DocHandleState, m as PetrinautPatch, n as EventStream, o as createPetrinaut, p as PetrinautHistory, r as Petrinaut, s as CreateJsonDocHandleOptions, t as CreatePetrinautConfig, u as DocumentId, v as ApplyClipboardPasteResult, w as MutationHelperFunctions, x as CLIPBOARD_FORMAT_VERSION, y as CommandHelperFunctions } from "./instance-CBnoTOa_.js";
import { C as CommandActionInput, E as commandActionInputSchemas, S as AiCommandActionName, T as aiCommandActionInputSchemas, _ as readPetrinautDocToolInputSchema, a as PetrinautAiWritableCallbacks, b as setNetTitleToolName, c as getLatestNetDefinitionToolName, d as petrinautAiMutationTools, f as petrinautAiPrompt, g as petrinautDocSummaries, h as petrinautDocNames, i as PetrinautAiTools, l as getNetCompilationErrorsToolName, m as petrinautAiTools, n as PetrinautAiToolInput, o as PetrinautDocName, r as PetrinautAiToolName, s as createPetrinautAiWritableCallbacks, t as PetrinautAiTool, u as petrinautAiCommandTools, v as readPetrinautDocToolName, w as CommandActionName, x as AiCommandActionInput, y as setNetTitleToolInputSchema } from "./ai-DeVI4U0V.js";
import { a as Metric, c as OutputArc, d as SDCPN, f as Scenario, i as InputArc, l as Parameter, m as Transition, n as DifferentialEquation, o as MinimalNetMetadata, p as ScenarioParameter, r as ID, s as MutateSDCPN, t as Color, u as Place } from "./sdcpn-CayOVwJM.js";
import { n as WorkerFactoryLike, r as WorkerLike, t as AbortSignalLike } from "./environment-Cg8b3IqY.js";
import { _ as WorkerFactory, a as InitialPlaceMarking, c as SimulationConfig, d as SimulationFrameReader, f as SimulationFrameState, g as SimulationTransport, h as SimulationState, i as InitialMarking, l as SimulationErrorEvent, m as SimulationPlaceTokenValues, n as BackpressureConfig, o as Simulation, p as SimulationFrameSummary, r as CreateSimulationConfig, s as SimulationCompleteEvent, u as SimulationEvent } from "./internal-frame-DSPOSuKI.js";
import { A as MonteCarloActiveRunPlaceCountsVisitor, B as MonteCarloRunFrameMetricView, C as MonteCarloRunConfig, D as MonteCarloRunUntilCompleteOptions, E as MonteCarloRunSummary, F as MonteCarloMetricRunOutput, G as MonteCarloUserDefinedMetricAggregation, H as MonteCarloTransitionFiringCountMetricSpec, I as MonteCarloMetricRunStatus, J as MonteCarloUserDefinedMetricFrame, K as MonteCarloUserDefinedMetricConfig, L as MonteCarloMetricSpec, M as MonteCarloFrameMetric, N as MonteCarloFrameMetricContext, O as MonteCarloSimulator, P as MonteCarloMetricDistributionBinning, Q as MonteCarloUserDefinedScalarMetricFrame, R as MonteCarloMetricSpecBase, S as MonteCarloAdvanceResult, T as MonteCarloRunStatus, U as MonteCarloUserDefinedDistributionMetricFrame, V as MonteCarloRunFrameMetricVisitor, W as MonteCarloUserDefinedMetric, X as MonteCarloUserDefinedMetricSampleRuns, Y as MonteCarloUserDefinedMetricMeasureInput, Z as MonteCarloUserDefinedMetricTimeAggregation, _ as MonteCarloMetricNumericAccumulatorState, b as createMonteCarloMetricHistogramAccumulator, f as MonteCarloWorkerProgress, g as MonteCarloMetricMonoid, h as MonteCarloMetricHistogramAccumulatorState, j as MonteCarloExpressionMetricSpec, k as MonteCarloSimulatorConfig, m as createMonteCarloUserDefinedMetricConfigsFromSpecs, p as createMonteCarloUserDefinedMetric, q as MonteCarloUserDefinedMetricDistributionBin, v as MonteCarloMetricValueAccumulator, w as MonteCarloRunSnapshot, x as createMonteCarloMetricNumericAccumulator, y as addAllMonteCarloMetricValues, z as MonteCarloPlaceTokenCountMeanMetricSpec } from "./messages-CXQE4ofj.js";
import { a as ServerMessage, i as ScenarioSessionParams, n as MetricSessionParams, t as ClientMessage } from "./protocol-CdK67XNp.js";
import { z } from "zod";
import { CompletionItem, CompletionItemKind, CompletionList, CompletionList as CompletionList$1, Diagnostic, Diagnostic as Diagnostic$1, DiagnosticSeverity, DocumentUri, DocumentUri as DocumentUri$1, Hover, Hover as Hover$1, MarkupContent, MarkupKind, Position, Position as Position$1, Range, SignatureHelp, SignatureHelp as SignatureHelp$1, TextDocumentIdentifier } from "vscode-languageserver-types";
//#region src/layout/calculate-graph-layout.d.ts
type NodePosition = {
  x: number;
  y: number;
};
type LayoutDimensions = {
  place: {
    width: number;
    height: number;
  };
  transition: {
    width: number;
    height: number;
  };
};
/**
 * Calculates the optimal layout positions for nodes in an SDCPN graph using the ELK (Eclipse Layout Kernel) algorithm.
 *
 * This is a pure function that takes an SDCPN as input and returns the calculated positions.
 * It does not mutate any state or trigger side effects.
 *
 * ## Design note: layout-stable dimensions
 *
 * `dimensions` should be **stable across the user's visualization choice**
 * (compact vs. classic). Layout output must not depend on rendering mode —
 * otherwise toggling `compactNodes` would shift every node and visually
 * scramble the graph. Callers should normally pass {@link layoutNodeDimensions}
 * from `./dimensions`.
 *
 * @param sdcpn - The SDCPN to layout
 * @param dimensions - Node dimensions for places and transitions; should be
 *   layout-stable (independent of rendering mode), see note above.
 * @returns A promise that resolves to a map of node IDs to their calculated positions
 */
declare const calculateGraphLayout: (sdcpn: SDCPN, dimensions: LayoutDimensions) => Promise<Record<string, NodePosition>>;
//#endregion
//#region src/layout/dimensions.d.ts
/**
 * Layout-stable node dimensions used by {@link calculateGraphLayout}.
 *
 * Per-axis maximum of the compact and classic rendering dimensions (see
 * `ui/views/SDCPN/node-dimensions.ts`) so auto-layout output is invariant to
 * the user's compact/classic visualization choice. Without this, toggling
 * `userSettings.compactNodes` after running layout would visually shift every
 * node.
 */
declare const layoutNodeDimensions: LayoutDimensions;
//#endregion
//#region src/simulation/monte-carlo/monte-carlo-simulator.d.ts
/**
 * Creates the synchronous Monte Carlo engine controller.
 *
 * Callers drive the returned simulator directly with `advanceAll()` or
 * `runUntilComplete()`, making this API useful for tests, scripts, and custom
 * in-memory metrics where running on the current thread is acceptable.
 */
declare function createMonteCarloSimulator(config: MonteCarloSimulatorConfig): MonteCarloSimulator;
//#endregion
//#region src/simulation/monte-carlo/runtime/experiment.d.ts
type MonteCarloExperimentState = "Initializing" | "Ready" | "Running" | "Complete" | "Error" | "Cancelled";
type MonteCarloExperimentMetrics = {
  frames: readonly MonteCarloUserDefinedMetricFrame[];
  latestByMetricId: Readonly<Record<string, MonteCarloUserDefinedMetricFrame>>;
};
type MonteCarloExperimentEvent = {
  type: "complete";
  progress: MonteCarloWorkerProgress;
} | {
  type: "cancelled";
  progress: MonteCarloWorkerProgress | null;
} | {
  type: "error";
  message: string;
  itemId: string | null;
};
type CreateMonteCarloExperimentBaseConfig = {
  sdcpn: SDCPN;
  initialMarking: InitialMarking;
  parameterValues: Record<string, string>;
  seed: number;
  dt: number;
  maxTime: number;
  runCount: number;
  batchSize?: number;
  signal?: AbortSignalLike;
};
type CreateMonteCarloExperimentConfig = CreateMonteCarloExperimentBaseConfig & ({
  createWorker: WorkerFactory;
  transport?: never;
  metrics?: never;
  metricSpecs?: readonly MonteCarloMetricSpec[];
} | {
  transport: SimulationTransport;
  createWorker?: never;
  metrics?: never;
  metricSpecs?: readonly MonteCarloMetricSpec[];
} | {
  metrics: readonly MonteCarloUserDefinedMetricConfig[];
  createWorker?: never;
  transport?: never;
  metricSpecs?: never;
} | {
  metricSpecs: readonly MonteCarloMetricSpec[];
  createWorker?: never;
  transport?: never;
  metrics?: never;
});
interface MonteCarloExperiment {
  readonly status: ReadableStore<MonteCarloExperimentState>;
  readonly progress: ReadableStore<MonteCarloWorkerProgress | null>;
  readonly metrics: ReadableStore<MonteCarloExperimentMetrics>;
  readonly events: EventStream<MonteCarloExperimentEvent>;
  start(this: void): void;
  cancel(this: void): void;
  dispose(this: void): void;
}
/**
 * Creates a Monte Carlo experiment handle for app/runtime use.
 *
 * The returned handle exposes status, progress, streamed metric frames,
 * lifecycle events, start/cancel controls, and cleanup around the core Monte
 * Carlo simulator. Worker-backed experiments use a transport; metric specs are
 * sent to the worker while executable metric callback configs run locally.
 */
declare function createMonteCarloExperiment(config: CreateMonteCarloExperimentConfig): Promise<MonteCarloExperiment>;
//#endregion
//#region src/simulation/runtime/simulation.d.ts
/**
 * Build and start a simulation. Resolves with the live {@link Simulation}
 * handle once the worker reports `ready`. Rejects (and disposes) if the worker
 * errors during initialization, or if `signal` aborts before init completes.
 *
 * Either pass a `createWorker` factory (the function builds a transport) or a
 * pre-built `transport` (ownership transfers to the simulation; it'll be
 * terminated on `dispose()`).
 *
 * The simulation runs against the `sdcpn` snapshot and is independent of any
 * `Petrinaut` instance — pass `instance.handle.doc()` (or any other SDCPN
 * value) and you're done.
 */
declare function createSimulation(config: CreateSimulationConfig): Promise<Simulation>;
//#endregion
//#region src/simulation/runtime/transport.d.ts
/**
 * Wrap a `Worker` factory in a {@link SimulationTransport}. Messages sent
 * before the worker is ready are queued and flushed once it boots.
 */
declare function createWorkerTransport(createWorker: WorkerFactory): SimulationTransport;
//#endregion
//#region src/lsp/transport.d.ts
/**
 * Protocol-level abstraction over the language-server worker. Decouples the
 * {@link LanguageClient} from how the server is actually run — Web Worker,
 * inline same-thread, recorded replay, or a Node `worker_threads` polyfill
 * all satisfy this shape. Mirrors {@link import("../simulation").SimulationTransport}.
 */
interface LspTransport {
  /** Send a message to the server. May queue if the transport is not yet ready. */
  send(message: ClientMessage): void;
  /** Subscribe to messages from the server. Returns an unsubscribe function. */
  onMessage(listener: (message: ServerMessage) => void): () => void;
  /** Tear down the underlying worker / runtime. Idempotent. */
  terminate(): void;
}
type LspWorkerFactory = WorkerFactoryLike<ClientMessage, ServerMessage>;
/**
 * Wrap a `Worker` factory in an {@link LspTransport}. Messages sent before the
 * worker is ready are queued and flushed once it boots.
 */
declare function createWorkerLspTransport(createWorker: LspWorkerFactory): LspTransport;
//#endregion
//#region src/lsp/language-client.d.ts
type DiagnosticsSnapshot = {
  byUri: Map<DocumentUri$1, Diagnostic$1[]>;
  total: number;
};
/**
 * `this: void` on every method makes the methods safe to pass as references
 * (e.g. `<X onChange={client.notifyDocumentChanged} />`) without `this`-loss
 * concerns. See [06-react-bindings.md §6.3]. Same applies to {@link import("../instance").Petrinaut}
 * and the simulation handle (planned cleanup).
 */
interface LanguageClient {
  /** Per-URI diagnostics pushed from the server, plus a total count. */
  readonly diagnostics: ReadableStore<DiagnosticsSnapshot>;
  initialize(this: void, sdcpn: SDCPN): void;
  notifySDCPNChanged(this: void, sdcpn: SDCPN): void;
  notifyDocumentChanged(this: void, uri: DocumentUri$1, text: string): void;
  initializeScenarioSession(this: void, params: ScenarioSessionParams): void;
  updateScenarioSession(this: void, params: ScenarioSessionParams): void;
  killScenarioSession(this: void, sessionId: string): void;
  initializeMetricSession(this: void, params: MetricSessionParams): void;
  updateMetricSession(this: void, params: MetricSessionParams): void;
  killMetricSession(this: void, sessionId: string): void;
  requestCompletion(this: void, uri: DocumentUri$1, position: Position$1): Promise<CompletionList$1>;
  requestHover(this: void, uri: DocumentUri$1, position: Position$1): Promise<Hover$1 | null>;
  requestSignatureHelp(this: void, uri: DocumentUri$1, position: Position$1): Promise<SignatureHelp$1 | null>;
  /**
   * Tear down the transport. Pending requests reject with "Worker terminated".
   * Idempotent.
   */
  dispose(this: void): void;
}
type CreateLanguageClientConfig = {
  createWorker: LspWorkerFactory;
  transport?: never;
} | {
  transport: LspTransport;
  createWorker?: never;
};
/**
 * Build a {@link LanguageClient} that talks to a language-server worker.
 *
 * Either pass a `createWorker` factory (the function builds a transport) or a
 * pre-built `transport` (ownership transfers — `dispose()` will terminate it).
 */
declare function createLanguageClient(config: CreateLanguageClientConfig): LanguageClient;
//#endregion
//#region src/playback/playback.d.ts
type PlaybackState = "Stopped" | "Playing" | "Paused";
/**
 * Play mode determines how simulation computation is handled during playback.
 * - `viewOnly`: Only plays existing frames, no further computation.
 * - `computeBuffer`: Computes minimally, only when ahead-buffer is shallow.
 * - `computeMax`: Computes as fast as possible while playing.
 */
type PlayMode = "viewOnly" | "computeBuffer" | "computeMax";
type ComputePlayMode = Exclude<PlayMode, "viewOnly">;
declare const PLAYBACK_SPEEDS: readonly [1, 2, 5, 10, 30, 60, 120, number];
type PlaybackSpeed = (typeof PLAYBACK_SPEEDS)[number];
declare function formatPlaybackSpeed(speed: PlaybackSpeed): string;
/**
 * Backpressure configuration for a compute play mode. Used to tell the
 * simulation worker how aggressively to compute new frames.
 *
 * `viewOnly` intentionally has no backpressure shape: it is a frame viewing
 * mode, not a worker computation mode.
 */
type PlayModeBackpressure = {
  maxFramesAhead: number;
  batchSize: number;
};
declare function getPlayModeBackpressure(mode: ComputePlayMode): PlayModeBackpressure;
type PlaybackSnapshot = {
  playState: PlaybackState;
  frameIndex: number;
  speed: PlaybackSpeed;
  mode: PlayMode;
};
/**
 * Result of a {@link Playback.tick} call. The caller can react to these
 * signals (e.g. pause the underlying simulation when `reachedEnd` is true and
 * mode is `viewOnly`).
 */
type TickResult = {
  /** New frame index after the tick. */frameIndex: number; /** True if the tick caused frameIndex to change. */
  advanced: boolean; /** True if the tick reached the last available frame. */
  reachedEnd: boolean;
};
type TickInput = {
  /** Current high-resolution timestamp (ms), e.g. from `performance.now()`. */currentTime: number; /** Simulation time-step, seconds. */
  dt: number; /** Total computed frames available right now. */
  totalFrames: number; /** True if the simulation has finished computing (Complete or Error). */
  simulationDone: boolean;
};
interface Playback {
  readonly state: ReadableStore<PlaybackSnapshot>;
  play(this: void): void;
  pause(this: void): void;
  stop(this: void): void;
  setFrameIndex(this: void, index: number, totalFrames: number): void;
  setSpeed(this: void, speed: PlaybackSpeed): void;
  setMode(this: void, mode: PlayMode): void;
  /**
   * Advance one tick of the playback timing loop. Caller is responsible for
   * driving this — e.g. via `requestAnimationFrame` in the browser, or by
   * calling it manually for headless replay/test scenarios.
   *
   * Updates the snapshot's `frameIndex` based on elapsed time since the
   * previous tick. Returns details about what happened so the caller can
   * react (e.g. auto-pause when reaching the end in viewOnly mode).
   */
  tick(this: void, input: TickInput): TickResult;
  /**
   * Reset internal timing state (last tick time, accumulated time). Call
   * after pausing-then-resuming to avoid a "jump" on the next tick.
   */
  resetTiming(this: void): void;
  dispose(this: void): void;
}
/**
 * Create a {@link Playback} handle. Pure timing model: tracks playback state,
 * frame index, speed, and mode, and advances frame index on `tick()`. Does
 * **not** know about simulations or `requestAnimationFrame` — those concerns
 * live in the consumer (e.g. the React {@link import("../../react/playback").PlaybackProvider}).
 */
declare function createPlayback(initial?: Partial<PlaybackSnapshot>): Playback;
//#endregion
//#region src/types/selection.d.ts
/**
 * Selection types describe SDCPN entities the user might select, plus the
 * synthetic "arc" tag for arcs (which aren't first-class SDCPN entities — see
 * `core/arc-id.ts`).
 *
 * The *types* live in `/core` because they're SDCPN-shaped. The current
 * selection *state* (a `SelectionMap` held by the editor) lives in
 * `/react/state/editor-context`.
 */
type SelectionItemType = "place" | "transition" | "arc" | "type" | "differentialEquation" | "parameter";
type SelectionItem = {
  type: "place";
  id: string;
} | {
  type: "transition";
  id: string;
} | {
  type: "arc";
  id: string;
} | {
  type: "type";
  id: string;
} | {
  type: "differentialEquation";
  id: string;
} | {
  type: "parameter";
  id: string;
};
/** Map from item ID -> typed SelectionItem. O(1) lookup for ReactFlow bridge. */
type SelectionMap = Map<string, SelectionItem>;
type PanelTarget = {
  kind: "none";
} | {
  kind: "single";
  item: SelectionItem;
} | {
  kind: "multi";
  items: SelectionItem[];
};
declare function parseArcId(arcId: string): {
  sourceId: string;
  targetId: string;
} | null;
//#endregion
//#region src/arc-id.d.ts
/**
 * Arc identity helpers. Arcs are not first-class entities in SDCPN — they
 * live inside transitions as `inputArcs` / `outputArcs`. The editor still
 * needs stable IDs for selection, hover, and ReactFlow keys, so we synthesise
 * them by combining the source and target IDs:
 *
 *     "$A_<inputId>___<outputId>"
 *
 * Pure SDCPN ID conventions — no React, no DOM. Lives in `/core` so any
 * layer can read or generate arc IDs.
 */
declare const ARC_ID_PREFIX = "$A_";
type ArcIdPrefix = typeof ARC_ID_PREFIX;
declare const ARC_ID_SEPARATOR = "___";
declare function generateArcId({
  inputId,
  outputId
}: {
  inputId: string;
  outputId: string;
}): `${ArcIdPrefix}${string}`;
//#endregion
//#region src/grid-size.d.ts
/**
 * Shared model/grid unit used by bundled example SDCPNs.
 *
 * This lives in core because example documents are headless domain data, but
 * their persisted node coordinates still need to line up with the editor grid
 * rendered by `@hashintel/petrinaut`.
 */
declare const GRID_SIZE = 15;
//#endregion
//#region src/parameter-values.d.ts
/**
 * A type-safe representation of parameter values that can be used in the simulation.
 */
type DefaultParameterValues = Record<string, number | boolean>;
/**
 * Pure function to derive default parameter values from a list of parameters.
 * This can be used in non-React contexts or for testing.
 *
 * @param parameters - The list of parameters from the SDCPN definition
 * @returns A record mapping parameter variable names to their default values
 */
declare function deriveDefaultParameterValues(parameters: Parameter[]): DefaultParameterValues;
/**
 * Merges parameter values from SimulationStore with SDCPN defaults.
 * SimulationStore values take precedence, with SDCPN defaults as fallback.
 *
 * @param simulationStoreValues - Parameter values from SimulationStore (as strings)
 * @param defaultValues - Default parameter values from SDCPN definition
 * @returns Merged parameter values with proper type conversion
 */
declare function mergeParameterValues(simulationStoreValues: Record<string, string>, defaultValues: DefaultParameterValues): DefaultParameterValues;
//#endregion
//#region src/errors.d.ts
/**
 * Custom error class that includes an itemId to identify the SDCPN element
 * (place, transition, differential equation, etc.) where the error occurred.
 * This allows the UI to provide a "jump to item" feature when displaying errors.
 */
declare class SDCPNItemError extends Error {
  readonly itemId: string;
  constructor(message: string, itemId: string);
}
//#endregion
//#region src/lib/deep-equal.d.ts
/**
 * Check if two SDCPN definitions are structurally identical.
 *
 * Performs a recursive deep comparison of all fields, so that
 * additions to the SDCPN type are automatically covered.
 */
declare const isSDCPNEqual: (a: SDCPN, b: SDCPN) => boolean;
//#endregion
//#region src/lib/get-connections.d.ts
/**
 * Given a list of transitions and a set of selected item IDs,
 * returns a {@link SelectionMap} of all items (places, transitions, arcs)
 * that are directly connected to any selected item via an arc.
 *
 * An item is included if it shares an arc with a selected item:
 * - A selected place includes its connected transitions and arcs.
 * - A selected transition includes its connected places and arcs.
 * - A selected arc includes its source and target nodes.
 */
declare function getNodeConnections(transitions: readonly Transition[], selectedIds: ReadonlySet<string>): SelectionMap;
//#endregion
//#region src/default-codes.d.ts
declare function generateDefaultVisualizerCode(type: Color): string;
declare const DEFAULT_VISUALIZER_CODE = "// This function defines how to visualize the tokens in the place.\n// It receives the current tokens and parameters.\nexport default Visualization(({ tokens, parameters }) => {\n  // Example: simple console log visualization\n  return <svg>\n    <circle cx=\"50\" cy=\"50\" r=\"40\" stroke=\"black\" strokeWidth=\"3\" fill=\"red\" />\n  </svg>\n});";
declare function generateDefaultDifferentialEquationCode(type: Color): string;
declare const DEFAULT_DIFFERENTIAL_EQUATION_CODE = "// This function defines the differential equation for the place.\n// The function receives the current tokens in all places and the parameters.\n// It should return the derivative of the token value in this place.\nexport default Dynamics((tokens, parameters) => {\n  return tokens.map(({ x, y }) => {\n    return { x: 1, y: 1 }; // dx/dt = 1, dy/dt = 1\n  });\n});";
declare const generateDefaultLambdaCode: (lambdaType: "predicate" | "stochastic") => string;
declare function generateDefaultTransitionKernelCode(_inputs: {
  placeName: string;
  type: Color;
  weight: number;
}[], outputs: {
  placeName: string;
  type: Color;
  weight: number;
}[]): string;
declare const DEFAULT_TRANSITION_KERNEL_CODE = "/**\n* This function defines the kernel for the transition.\n* It receives tokens from input places,\n* and any global parameters defined,\n* and should return tokens for output places keyed by place name.\n*/\nexport default TransitionKernel((placesTokens, parameters) => {\n  // Return an object with output place names as keys\n  return {\n    // Example: tokens for output place named \"OutputPlace\"\n    OutputPlace: [\n      { x: 0, y: 0 } // Each token is an object with named dimensions\n    ],\n    // If there are more output places, add them here\n  };\n});";
//#endregion
//#region src/simulation/authoring/metric/compile-metric.d.ts
/**
 * State of a single place exposed to a compiled metric.
 *
 * - `count`: number of tokens currently in the place.
 * - `tokens`: for colored places, an array of token objects keyed by the
 *   color element names (see `Color.elements`). Empty for uncolored places.
 */
interface MetricPlaceState {
  count: number;
  tokens: Record<string, number>[];
}
/**
 * Snapshot of the SDCPN state passed to a compiled metric on every frame.
 *
 * Keyed by place **name** (not ID) for ergonomic author-facing access:
 * `state.places.Infected.count`.
 */
interface MetricState {
  places: Record<string, MetricPlaceState>;
}
type CompiledMetric = (state: MetricState) => number;
type CompileMetricOutcome = {
  ok: true;
  fn: CompiledMetric;
} | {
  ok: false;
  error: string;
};
/**
 * Compile a metric's user code into an executable `(state) => number` function.
 *
 * The supplied code is treated as a function body that must `return` a number.
 * It runs in strict mode with dangerous globals shadowed, the `state` argument
 * frozen with no prototype chain, and the `.constructor` chain blocked on
 * built-in prototypes for the duration of the call (see `runSandboxed`).
 *
 * On invalid output (non-number / NaN / non-finite), the returned function
 * throws — callers should catch and decide how to render the failed frame.
 */
declare function compileMetric(metric: Metric): CompileMetricOutcome;
//#endregion
//#region src/simulation/authoring/scenario/compile-scenario.d.ts
/**
 * Compiled initial state entry for a single place.
 * - Uncolored places: token count number.
 * - Colored places: array of token records keyed by color element name.
 */
type CompiledPlaceMarking = InitialPlaceMarking;
interface CompiledScenarioResult {
  /**
   * Resolved parameter values keyed by variableName (matches the format
   * expected by the simulation worker).
   */
  parameterValues: Record<string, string>;
  /**
   * Resolved initial marking keyed by place ID.
   */
  initialState: InitialMarking;
}
interface ScenarioCompilationError {
  /** Which field failed: "parameterOverride", "initialState", or "scenarioParameter" */
  source: "parameterOverride" | "initialState" | "scenarioParameter";
  /** ID of the parameter or place that failed */
  itemId: string;
  /** Human-readable error message */
  message: string;
}
type CompileScenarioOutcome = {
  ok: true;
  result: CompiledScenarioResult;
} | {
  ok: false;
  errors: ScenarioCompilationError[];
};
type ScenarioParameterValues = Record<string, number>;
interface CompileScenarioOptions {
  /**
   * Concrete scenario parameter values keyed by scenario parameter identifier.
   * When omitted, the scenario's own default values are used.
   */
  scenarioParameterValues?: ScenarioParameterValues;
}
/**
 * Compile a scenario into concrete parameter values and initial token counts.
 *
 * Evaluation order (dependencies flow top-down):
 * 1. Scenario parameter defaults → builds the `scenario` object
 * 2. Parameter overrides → each expression evaluated with `{ parameters, scenario }`
 *    → produces the final `parameters` object
 * 3. Initial state expressions → each evaluated with the resolved `{ parameters, scenario }`
 *    → produces per-place token counts
 *
 * @param scenario - The scenario to compile
 * @param netParameters - The net-level parameter definitions (for defaults and variable names)
 * @param places - All places in the SDCPN (needed for code-mode name→ID mapping)
 * @param types - All color types (needed for code-mode token flattening)
 */
declare function compileScenario(scenario: Scenario, netParameters: Parameter[], places?: Place[], types?: Color[], options?: CompileScenarioOptions): CompileScenarioOutcome;
//#endregion
//#region src/simulation/frames/metric-state.d.ts
/**
 * Reshape a simulation frame reader into the `MetricState` shape exposed to
 * compiled metric functions. Place state is keyed by place **name** so author
 * code can read e.g. `state.places.Infected.count`.
 */
declare function buildMetricState(frame: SimulationFrameReader, places: Place[], types: Color[]): MetricState;
//#endregion
//#region src/validation/display-name.d.ts
/**
 * Display name for entities like transitions, types, differential equations,
 * and parameters. Less restrictive than entity names — allows spaces and
 * most characters, only requires non-empty after trimming.
 *
 * Valid:   "Quality Check", "Start Production", "My Transition 2"
 * Invalid: "", "   "
 */
declare const displayNameSchema: z.ZodString;
type DisplayNameValidationResult = {
  valid: true;
  name: string;
} | {
  valid: false;
  error: string;
};
/**
 * Validate a display name (non-empty after trimming).
 * Returns the trimmed name on success, or the validation error message.
 *
 * FE-521: Also enforce in MutationProvider and surface in Diagnostics tab.
 */
declare function validateDisplayName(input: string): DisplayNameValidationResult;
//#endregion
//#region src/validation/entity-name.d.ts
declare const entityNameSchema: z.ZodString;
type EntityNameValidationError = {
  valid: false;
  error: string;
};
type EntityNameValidationSuccess = {
  valid: true;
  name: string;
};
type EntityNameValidationResult = EntityNameValidationSuccess | EntityNameValidationError;
/**
 * Validate a name for a place or transition.
 * Returns the trimmed name on success, or the first validation error message.
 *
 * FE-521: Also enforce in MutationProvider and surface in Diagnostics tab.
 */
declare function validateEntityName(input: string): EntityNameValidationResult;
//#endregion
//#region src/validation/variable-name.d.ts
type VariableNameValidationError = {
  valid: false;
  error: string;
};
type VariableNameValidationSuccess = {
  valid: true;
  name: string;
};
type VariableNameValidationResult = VariableNameValidationSuccess | VariableNameValidationError;
/**
 * Validate a variable name for a parameter.
 * Returns the trimmed name on success, or the first validation error message.
 *
 * FE-521: Also enforce in MutationProvider and surface in Diagnostics tab.
 */
declare function validateVariableName(input: string): VariableNameValidationResult;
//#endregion
//#region src/file-format/parse-sdcpn-file.d.ts
type SDCPNWithTitle = SDCPN & {
  title: string;
};
/**
 * Result of attempting to import an SDCPN file.
 */
type ImportResult = {
  ok: true;
  sdcpn: SDCPNWithTitle;
  hadMissingPositions: boolean;
} | {
  ok: false;
  error: string;
};
/**
 * Parses raw JSON data into an SDCPN, handling versioned, legacy, and old
 * pre-2025-11-28 formats. Pure — no DOM, no I/O. Callers (e.g. the `/ui`
 * file-picker wrapper) are responsible for sourcing the data.
 */
declare const parseSDCPNFile: (data: unknown) => ImportResult;
//#endregion
//#region src/file-format/serialize-sdcpn.d.ts
/**
 * Serialize an SDCPN to the canonical JSON file format string.
 *
 * The output includes format metadata (`version`, `meta.generator`) and the
 * editor-supplied `title`. When `removeVisualInfo` is true, places/transitions
 * lose their `x`/`y` and types lose their `displayColor`/`iconSlug` — useful
 * when sharing the structural definition without baking in a particular
 * layout / palette.
 *
 * Pure — no DOM, no I/O. Callers are responsible for delivering the result
 * (browser download, clipboard, server upload, …).
 */
declare function serializeSDCPN({
  petriNetDefinition,
  title,
  removeVisualInfo
}: {
  petriNetDefinition: SDCPN;
  title: string;
  removeVisualInfo?: boolean;
}): string;
//#endregion
//#region src/file-format/sdcpn-to-tikz.d.ts
/**
 * Pure conversion: SDCPN → TikZ/LaTeX source string.
 *
 * Renders places as circles, transitions as filled bars, and arcs as directed
 * edges. Arc weights are labelled when not equal to 1. Visual x/y positions
 * are preserved (scaled to fit ~{@link MAX_DIAGRAM_SIZE_CM} cm).
 *
 * No DOM, no I/O — callers are responsible for delivering the output (browser
 * download, clipboard write, file save, …).
 */
declare function sdcpnToTikZ(sdcpn: SDCPN, title: string): string;
//#endregion
//#region src/clipboard/paste.d.ts
/**
 * Paste a clipboard payload into an SDCPN, creating new UUIDs and deduplicating names.
 * This mutates the sdcpn in place (designed to be called inside mutatePetriNetDefinition).
 *
 * Returns the IDs of the newly created items so they can be selected.
 */
declare function pastePayloadIntoSDCPN(sdcpn: SDCPN, payload: ClipboardPayload): {
  newItemIds: Array<{
    type: string;
    id: string;
  }>;
};
//#endregion
//#region src/clipboard/serialize.d.ts
/**
 * Collect the selected items from the SDCPN into a clipboard payload.
 * Arcs between selected nodes are automatically included within their transitions.
 */
declare function serializeSelection(sdcpn: SDCPN, selection: SelectionMap, documentId: string | null): ClipboardPayload;
/**
 * Try to parse a clipboard string into a ClipboardPayload.
 * Returns null if the string is not a valid petrinaut clipboard payload.
 */
declare function parseClipboardPayload(text: string): ClipboardPayload | null;
//#endregion
//#region src/lsp/lib/checker.d.ts
type ItemType = "transition-lambda" | "transition-kernel" | "differential-equation";
//#endregion
//#region src/lsp/lib/document-uris.d.ts
type ScenarioItemType = "scenario-param-override" | "scenario-initial-state" | "scenario-initial-state-full-code";
/** Build a document URI for a given SDCPN item (used as Monaco model URI). */
declare function getDocumentUri(itemType: ItemType, itemId: string): string;
/** Build a document URI for a scenario expression (used as Monaco model URI). */
declare function getScenarioDocumentUri(itemType: ScenarioItemType, sessionId: string, itemId: string): string;
/** Build a document URI for a metric expression (used as Monaco model URI). */
declare function getMetricDocumentUri(sessionId: string): string;
/** Extract `(itemType, itemId)` from a document URI string. */
declare function parseDocumentUri(uri: string): {
  itemType: ItemType;
  itemId: string;
} | null;
//#endregion
export { ARC_ID_PREFIX, ARC_ID_SEPARATOR, type AbortSignalLike, type AiCommandActionInput, type AiCommandActionInput as PetrinautAiCommandToolInput, type AiCommandActionName, type AiCommandActionName as PetrinautAiCommandToolName, type ApplyAutoLayoutResult, type ApplyClipboardPasteResult, type ArcIdPrefix, type BackpressureConfig, CLIPBOARD_FORMAT_VERSION, type ClipboardPayload, Color, type CommandActionInput, type CommandActionName, type CommandHelperFunctions, type CompileMetricOutcome, type CompileScenarioOptions, type CompileScenarioOutcome, type CompiledMetric, type CompiledPlaceMarking, type CompiledScenarioResult, type CompletionItem, CompletionItemKind, type CompletionList, type ComputePlayMode, type CreateJsonDocHandleOptions, type CreateLanguageClientConfig, type CreateMonteCarloExperimentConfig, type CreatePetrinautConfig, type CreateSimulationConfig, DEFAULT_DIFFERENTIAL_EQUATION_CODE, DEFAULT_TRANSITION_KERNEL_CODE, DEFAULT_VISUALIZER_CODE, type DefaultParameterValues, type Diagnostic, DiagnosticSeverity, type DiagnosticsSnapshot, DifferentialEquation, type DocChangeEvent, type DocHandleState, type DocumentId, type DocumentUri, type EventStream, GRID_SIZE, type HistoryEntry, type Hover, ID, type ImportResult, type InitialMarking, type InitialPlaceMarking, InputArc, type LanguageClient, type LayoutDimensions, type LspTransport, type LspWorkerFactory, type MarkupContent, MarkupKind, Metric, type MetricPlaceState, type MetricState, MinimalNetMetadata, type MonteCarloActiveRunPlaceCountsVisitor, type MonteCarloAdvanceResult, type MonteCarloExperiment, type MonteCarloExperimentEvent, type MonteCarloExperimentMetrics, type MonteCarloExperimentState, type MonteCarloExpressionMetricSpec, type MonteCarloFrameMetric, type MonteCarloFrameMetricContext, type MonteCarloMetricDistributionBinning, type MonteCarloMetricHistogramAccumulatorState, type MonteCarloMetricMonoid, type MonteCarloMetricNumericAccumulatorState, type MonteCarloMetricRunOutput, type MonteCarloMetricRunStatus, type MonteCarloMetricSpec, type MonteCarloMetricSpecBase, type MonteCarloMetricValueAccumulator, type MonteCarloPlaceTokenCountMeanMetricSpec, type MonteCarloRunConfig, type MonteCarloRunFrameMetricView, type MonteCarloRunFrameMetricVisitor, type MonteCarloRunSnapshot, type MonteCarloRunStatus, type MonteCarloRunSummary, type MonteCarloRunUntilCompleteOptions, type MonteCarloSimulator, type MonteCarloSimulatorConfig, type MonteCarloTransitionFiringCountMetricSpec, type MonteCarloUserDefinedDistributionMetricFrame, type MonteCarloUserDefinedMetric, type MonteCarloUserDefinedMetricAggregation, type MonteCarloUserDefinedMetricConfig, type MonteCarloUserDefinedMetricDistributionBin, type MonteCarloUserDefinedMetricFrame, type MonteCarloUserDefinedMetricMeasureInput, type MonteCarloUserDefinedMetricSampleRuns, type MonteCarloUserDefinedMetricTimeAggregation, type MonteCarloUserDefinedScalarMetricFrame, type MonteCarloWorkerProgress, MutateSDCPN, type MutationHelperFunctions, type NodePosition, OutputArc, PLAYBACK_SPEEDS, PanelTarget, Parameter, type Petrinaut, type MutationActionInput as PetrinautAiMutationToolInput, type MutationActionName as PetrinautAiMutationToolName, type PetrinautAiTool, type PetrinautAiToolInput, type PetrinautAiToolName, type PetrinautAiTools, type PetrinautAiWritableCallbacks, type PetrinautCommands, type PetrinautDocHandle, type PetrinautDocName, type PetrinautHistory, type PetrinautMutations, type PetrinautPatch, Place, type PlayMode, type PlayModeBackpressure, type Playback, type PlaybackSnapshot, type PlaybackSpeed, type PlaybackState, Position, Range, type ReadableStore, SDCPN, SDCPNItemError, Scenario, type ScenarioCompilationError, ScenarioParameter, type ScenarioParameterValues, SelectionItem, SelectionItemType, SelectionMap, type SignatureHelp, type Simulation, type SimulationCompleteEvent, type SimulationConfig, type SimulationErrorEvent, type SimulationEvent, type SimulationFrameReader, type SimulationFrameState, type SimulationFrameSummary, type SimulationPlaceTokenValues, type SimulationState, type SimulationTransport, type TextDocumentIdentifier, type TickInput, type TickResult, Transition, type WorkerFactory, type WorkerFactoryLike, type WorkerLike, addAllMonteCarloMetricValues, aiCommandActionInputSchemas, buildMetricState, calculateGraphLayout, clipboardPayloadSchema, colorSchema, commandActionInputSchemas, compileMetric, compileScenario, createJsonDocHandle, createLanguageClient, createMonteCarloExperiment, createMonteCarloMetricHistogramAccumulator, createMonteCarloMetricNumericAccumulator, createMonteCarloSimulator, createMonteCarloUserDefinedMetric, createMonteCarloUserDefinedMetricConfigsFromSpecs, createPetrinaut, createPetrinautActions, createPetrinautAiWritableCallbacks, createPetrinautCommands, createPlayback, createSimulation, createWorkerLspTransport, createWorkerTransport, deriveDefaultParameterValues, differentialEquationSchema, displayNameSchema, entityNameSchema, formatPlaybackSpeed, generateArcId, generateDefaultDifferentialEquationCode, generateDefaultLambdaCode, generateDefaultTransitionKernelCode, generateDefaultVisualizerCode, getDocumentUri, getLatestNetDefinitionToolName, getMetricDocumentUri, getNetCompilationErrorsToolName, getNodeConnections, getPlayModeBackpressure, getScenarioDocumentUri, isSDCPNEqual, layoutNodeDimensions, mergeParameterValues, metricSchema, mutationActionInputSchemas, parameterSchema, parseArcId, parseClipboardPayload, parseDocumentUri, parseSDCPNFile, pastePayloadIntoSDCPN, petrinautAiCommandTools, petrinautAiMutationTools, petrinautAiPrompt, petrinautAiTools, petrinautDocNames, petrinautDocSummaries, placeSchema, readPetrinautDocToolInputSchema, readPetrinautDocToolName, scenarioSchema, sdcpnToTikZ, serializeSDCPN, serializeSelection, setNetTitleToolInputSchema, setNetTitleToolName, transitionSchema, validateDisplayName, validateEntityName, validateVariableName };
//# sourceMappingURL=index.d.d.ts.map