/**
 * Section runtime engine adapter (M7 — Variant C, layered).
 *
 * The adapter is the single I/O seam between the pure FSM core
 * (`SectionEngineCore`) and the rest of the world (DOM, coordinator,
 * framework-error bus, host subscribers, instrumentation). It does
 * exactly two jobs:
 *
 *   1. Translate **host inputs** (from kernels, the toolkit CE, or
 *      direct facade callers) into `SectionEngineInput`s and forward
 *      them to the core via `core.dispatch(input)`.
 *
 *   2. Subscribe to the core's output stream and **route each output**
 *      through the bridges in a deterministic order so the public DOM
 *      surface, framework-error bus, instrumentation hook, and host
 *      subscribers all see exactly the same fan-out with
 *      byte-identical detail shapes.
 *
 * Output routing is a single exhaustive `switch` (`assertNever` on
 * the default branch) so adding a new `SectionEngineOutput` kind in
 * `engine-output.ts` is a compile error here until the adapter knows
 * what to do with it.
 *
 * **Routing order per output:**
 *   - canonical DOM event (`pie-stage-change`, `pie-loading-complete`,
 *     `framework-error`)
 *   - framework-error bus (single fan-out for in-process subscribers)
 *   - instrumentation hook
 *   - public subscriber fan-out (batched, runs once per
 *     `core.dispatch`)
 *
 * The `readiness-change` / `interaction-ready` / `ready`
 * DOM events and their event bridge were removed in the
 * broad architecture review compat sweep; the corresponding output
 * kinds are gone from `engine-output.ts`.
 *
 * **Layering constraint.** The adapter is plain TS. It must not
 * import `svelte` — the M7 implementation plan and
 * `scripts/check-engine-core-purity.mjs` enforce the core's purity;
 * the adapter follows the same constraint by convention so it stays
 * usable from non-Svelte hosts (Node tests, Storybook, or future
 * non-Svelte consumers). `bun run check:custom-elements` already
 * blocks `.svelte` imports in published `dist`; adding a Svelte
 * dependency here would also leak through that gate.
 */
import type { FrameworkErrorReporter } from "../../services/framework-error-bus.js";
import { SectionEngineCore } from "../core/SectionEngineCore.js";
import type { SectionEngineInput } from "../core/engine-input.js";
import type { SectionEngineOutput } from "../core/engine-output.js";
import type { SectionEngineState } from "../core/engine-state.js";
import { type CoordinatorPort, type ResolveSectionControllerArgs } from "./coordinator-bridge.js";
import { type InstrumentationHook } from "./instrumentation-bridge.js";
import { type EngineOutputListener } from "./subscriber-fanout.js";
export interface SectionEngineAdapterOptions {
    /** Element on which DOM events are dispatched. */
    host: EventTarget;
    /** Stable runtime id for this engine instance. */
    runtimeId: string;
    /**
     * Tag name of the host CE without the `--version-<encoded>` suffix.
     */
    sourceCe: string;
    /**
     * Framework-error bus (write side). Shared with the toolkit CE so
     * subscribers via `coordinator.subscribeFrameworkErrors` see the
     * same fan-out.
     */
    frameworkErrorBus: FrameworkErrorReporter;
    /**
     * Optional toolkit coordinator. When supplied, the adapter wires
     * its framework-error subscription, controller resolution, and
     * disposal through the coordinator-bridge. Standalone callers (no
     * coordinator) can omit this and feed `framework-error` and
     * `section-controller-resolved` inputs directly.
     */
    coordinator?: CoordinatorPort;
    /** Optional one-shot observability hook. */
    instrumentationHook?: InstrumentationHook;
    /** Clock injection for the DOM bridge. Defaults to `Date.now()`. */
    now?: () => string;
    /**
     * Optional pre-constructed core. Defaults to a fresh
     * `SectionEngineCore`. Tests pass a mocked core to assert dispatch
     * ordering; production callers use the default.
     */
    core?: SectionEngineCore;
}
export declare class SectionEngineAdapter {
    private readonly core;
    private readonly domEventBridge;
    private readonly frameworkErrorBridge;
    private readonly instrumentationBridge;
    private readonly subscriberFanout;
    private readonly coordinatorBridge;
    private readonly unsubscribeCore;
    private disposed;
    constructor(options: SectionEngineAdapterOptions);
    /**
     * Read-only snapshot of the FSM state. Mirrors
     * `SectionEngineCore.getState()`.
     */
    getState(): Readonly<SectionEngineState>;
    /**
     * Forward a host-constructed input to the core. Returns the outputs
     * that resulted (the bridges have already received them).
     */
    dispatchInput(input: SectionEngineInput): readonly SectionEngineOutput[];
    /**
     * Subscribe to batched output streams, one batch per
     * `dispatchInput`.
     */
    subscribe(listener: EngineOutputListener): () => void;
    /**
     * Update the host element after construction (e.g. when the kernel
     * receives its host element via Svelte action / context).
     */
    setHost(host: EventTarget): void;
    /**
     * Update the instrumentation hook at runtime.
     */
    setInstrumentationHook(hook: InstrumentationHook | undefined): void;
    /**
     * Resolve a section controller through the configured coordinator.
     *
     * Throws if the adapter was constructed without a coordinator.
     * Standalone callers should manually feed
     * `{ kind: "section-controller-resolved" }` after their own
     * controller resolution path completes.
     */
    resolveSectionController(args: ResolveSectionControllerArgs): Promise<void>;
    /**
     * Tear the adapter down. Safe to call more than once. Disposes the
     * coordinator bridge (which in turn disposes the section
     * controller for the current cohort), detaches the core
     * subscription, and clears subscribers.
     *
     * Does **not** dispose the framework-error bus — its lifetime is
     * owned by the toolkit CE / host.
     */
    dispose(): Promise<void>;
    private routeOutputs;
    private routeOne;
}
