/**
 * Публичный API движка. Игры импортируют ТОЛЬКО отсюда.
 */

// re-export PixiJS-типов, чтобы игре не нужен был прямой импорт pixi.js
export { Container, Graphics, Text, Sprite, Texture } from 'pixi.js';

// core
export { Engine, type EngineOptions } from './core/Engine';
export { GameLoop } from './core/GameLoop';
export { FpsMeter } from './core/FpsMeter';
export { EventBus } from './core/EventBus';
export { TweenManager, type TweenOptions, type TweenHandle } from './core/Tween';
export { Updatables, type Updatable } from './core/Updatables';
export {
    linear,
    quadIn,
    quadOut,
    cubicIn,
    cubicOut,
    sineInOut,
    backOut,
    type EaseFn
} from './core/easing';

// agent (инструменты ИИ-агента: снапшоты, шаги, ввод, инварианты)
export { EngineAgent, ENGINE_SNAPSHOT_KEYS } from './agent/EngineAgent';
export {
    type AgentHost,
    type EngineSnapshot,
    type Invariant,
    type SceneAgent,
    type SnapshotLayer,
    type JsonValue,
    type WaitForOptions
} from './agent/types';
export {
    checkFinite,
    checkRange,
    checkBounds,
    checkWalkable,
    mergeInvariants
} from './agent/invariants';

// state (см. core)
export { GameState, type GameStateData } from './core/GameState';
export { StateMachine, type StateDef } from './core/StateMachine';
export { Cooldown } from './core/Cooldown';
export { Settings, type SettingsData } from './core/Settings';

// inventory
export {
    Inventory,
    inventoryFromData,
    type InventoryData,
    type InventoryOptions,
    type InventoryChange,
    type InventoryChangeKind
} from './inventory/Inventory';
// cutscene
export { CutsceneRunner, type CutsceneStep, type Movable } from './cutscene/CutsceneRunner';
export { applyEase } from './cutscene/tween';

// scene
export { SceneManager, type Scene, type SceneTransition } from './scene/SceneManager';
export {
    SceneRegistry,
    type SceneObjectDef,
    type SceneObject
} from './scene/SceneRegistry';

// ecs
export { World, type Entity, type System } from './ecs/ecs';

// math
export { add, sub, len, dist, moveTo, type Vec2 } from './math/Vec2';
export {
    isoToScreen,
    screenToIso,
    worldToScreen,
    screenToWorld,
    unitsToPx,
    worldLen,
    worldNorm,
    worldDist,
    moveTowardsW,
    tileToWorld,
    worldToTile,
    worldRectToScreen,
    DEFAULT_ISO,
    type IsoLayout
} from './math/iso';
export { createRng, hashTile, type Rng } from './math/rng';
export {
    inCircle,
    inCircleW,
    inCone,
    inConeW,
    angleBetween,
    nearest
} from './math/shapes';

// map
export {
    IsometricTileMap,
    type TileMapData,
    type TallSpec,
    type PropData,
    type PropPlaced,
    type PropView,
    type DecorData
} from './map/IsometricTileMap';
export { findPath, findPathToNeighbor, type Grid } from './map/pathfinding';
export {
    gridOf,
    circleFits,
    moveCircle,
    separateCircles
} from './map/collision';
export {
    encodeMap,
    parseMap,
    type MapFile,
    type MapFileV1
} from './map/mapFormat';
export { fromTiledIso, type TiledMap } from './map/tiled';

// render
export { Renderer, type RendererOptions } from './render/Renderer';
export { Camera } from './render/Camera';
export { IsoDepthLayer } from './render/IsoDepthLayer';
export { computeScale } from './render/scale';
export { ParticleEmitter, type EmitterOptions } from './render/Particles';
export {
    Lighting,
    makeGlowTexture,
    makeVignetteTexture,
    type LightingOptions,
    type DarkSpotDef
} from './render/Lighting';
export { Shake } from './render/shake';
export { SpriteFlash } from './render/spriteFx';

// fx (слой one-shot эффектов и пресеты)
export { FxLayer, type FxLayerOptions } from './render/fx/FxLayer';
export { FxRing } from './render/fx/FxRing';
export { FxFloatText } from './render/fx/FxFloatText';
export { FxFade, type FxFadeOptions } from './render/fx/FxFade';
export { FxPop } from './render/fx/FxPop';
export { FxTrail } from './render/fx/FxTrail';
export { sparkPreset, smokePreset, emberPreset, dustPreset } from './render/fx/particlePresets';
export {
    sampleRing,
    ringDuration,
    sampleFloat,
    readSeconds,
    sampleFade,
    samplePop,
    type FxRingSpec,
    type FxRingSample,
    type FxFloatSpec,
    type FxFloatSample,
    type FxFadeSpec,
    type FxPopSpec
} from './render/fx/fxSim';
export {
    GLOW_BASE_PX,
    flickerFactor,
    lightFrame,
    lerpAmbient,
    dimColor,
    pulseEnvelope,
    pulseTotal,
    dayNightFactor,
    DEFAULT_DAY_NIGHT,
    dayNightAmbient,
    DUSK_PEAK,
    DEFAULT_DUSK_COLOR,
    type LightDef,
    type LightFrame,
    type PulseSpec,
    type DayNightSpec
} from './render/lightSim';
export {
    stepParticle,
    sampleSpawn,
    sampleBurst,
    mergeEmitterOptions,
    type ParticleState,
    type ParticleSimOptions,
    type ParticleVisual
} from './render/particleSim';

// input
export { InputManager, type PointerState } from './input/InputManager';
export { VirtualJoystick, type VirtualJoystickOptions } from './input/VirtualJoystick';

// anim
export { TintFlash, lerpColor } from './anim/flash';
export { SpriteAnimator } from './anim/SpriteAnimator';
export type { SpriteClip, SpriteAnimatorOptions } from './anim/SpriteAnimator';
export { stepClip } from './anim/clip';
export type { ClipLoop, ClipDef, ClipTick } from './anim/clip';
export { sampleMotion } from './anim/motion';
export type { MotionParams, MotionSample, BobParams, SwayParams, PulseParams, BlinkParams } from './anim/motion';
export { SpriteMotion } from './anim/SpriteMotion';
export type { SpriteMotionOptions } from './anim/SpriteMotion';

// dialogue: модель графа и чистые предикаты (graph.ts) + рантайм обхода
export {
    DialogueRunner,
    type DialogueView
} from './dialogue/DialogueRunner';
export {
    evalConditions,
    hasConditions,
    type DialogueGraph,
    type DialogueNode,
    type DialogueChoice,
    type DialogueWorld,
    type DialogueConditions,
    type DialogueEffects,
    type DialogueEffectOp,
    type DialogueResult,
    type DialogueHooks,
    type VarCondition
} from './dialogue/graph';

// ui
export { DialogueBox, type DialogueLine, type DialogueBoxOptions } from './ui/DialogueBox';
export { revealText, type RevealState } from './ui/reveal';
export { PixelText, type PixelTextOptions, ensurePixelFont, setPixelTextResolution } from './ui/PixelText';
export { Panel, type PanelOptions } from './ui/Panel';
export { Button, type ButtonOptions } from './ui/Button';
export { MenuList, type MenuListOptions, type MenuItem } from './ui/MenuList';
export { ListScroll } from './ui/listScroll';
export { readMenuInput, type MenuActionMap, type MenuNavEvent, type MenuInputSource } from './ui/menuInput';
export { MenuSceneBase, type MenuSceneContext } from './ui/MenuSceneBase';

// audio
export { AudioManager, type AudioBuses, type BusName, type MusicHandle, type PlayOptions, type SfxHandle } from './audio/AudioManager';
export { renderSpec, RATE, type SoundSpec, type SoundKind, type SpecVoice } from './audio/SoundSpec';
export { renderMusic, renderMusicStereo, type MusicSpec, type TrackSpec, type NoteEvent, type InstrumentKind } from './audio/Music';

// assets
export { AssetLoader } from './assets/AssetLoader';

// save
export { SaveManager, type StorageLike } from './save/SaveManager';

// debug
export { DebugOverlay } from './debug/DebugOverlay';
export { SpriteDebugView } from './ui/SpriteDebugView';