import { IMediaInstance as IMediaInstance$1, PlayOptions, Options, SoundLibrary, Sound } from '@pixi/sound';
import * as canvasUtils from '@drincs/pixi-vn/canvas';
import { StoredChoiceInterface, StorageElementType as StorageElementType$1, OpenedLabel as OpenedLabel$1 } from '@drincs/pixi-vn/canvas';
export * from '@drincs/pixi-vn/canvas';
import * as characterUtils from '@drincs/pixi-vn/characters';
export * from '@drincs/pixi-vn/characters';
import { OnErrorHandler, GameUnifier } from '@drincs/pixi-vn/core';
export * from '@drincs/pixi-vn/core';
import * as historyUtils from '@drincs/pixi-vn/history';
export * from '@drincs/pixi-vn/history';
import * as narrationUtils from '@drincs/pixi-vn/narration';
import { NarrationGameState } from '@drincs/pixi-vn/narration';
export * from '@drincs/pixi-vn/narration';
import { UPDATE_PRIORITY, PointData, Container, ContainerOptions, ApplicationOptions } from '@drincs/pixi-vn/pixi.js';
export { AllFederatedEventMap, ApplicationOptions, AssetSrc, AssetsBundle, AssetsManifest, FederatedEvent, LoadParserName, ResolvedAsset, ResolvedSrc, UnresolvedAsset } from '@drincs/pixi-vn/pixi.js';
import * as soundUtils from '@drincs/pixi-vn/sound';
export * from '@drincs/pixi-vn/sound';
import * as storageUtils from '@drincs/pixi-vn/storage';
export * from '@drincs/pixi-vn/storage';
import { LRUCache } from 'lru-cache';
import { CharacterInterface, GameStepState } from '@drincs/pixi-vn';
import { Difference } from 'microdiff';
import { Devtools } from '@pixi/devtools';

type IMediaInstance = Omit<IMediaInstance$1, "on" | "destroy" | "init" | "off" | "once" | "toString">;

interface SoundOptions extends Omit<Options, "complete" | "loaded" | "sprites" | "source"> {
}
interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
    /**
     * The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
     */
    delay?: number;
    /**
     * Whether the sound is paused. If specified, the sound will be paused or unpaused according to the value. If not specified, the sound will play without being paused or unpaused.
     */
    paused?: boolean;
}
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
    /**
     * The alias of the audio channel to play the sound on. If the channel does not exist, it will be created.
     * If not specified, the sound will be played on the default channel (see `SoundManagerInterface.defaultChannelAlias`).
     */
    channel?: string;
}
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume" | "paused"> {
    /**
     * Whether this channel is a background channel.
     * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
     */
    background?: boolean;
}

interface AudioChannelInterface {
    /**
     * The alias of the audio channel. This is used to reference the channel when playing sounds. The alias must be unique among all channels.
     */
    readonly alias: string;
    /**
     * Plays a sound.
     * @param alias The media and sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(alias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Plays a sound.
     * @param mediaAlias The media alias reference.
     * @param soundAlias The sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Plays a non-persistent sound on this channel.
     * The returned media is not tracked by the sound manager and is therefore excluded from save/export state.
     * @param soundAlias The sound (asset) alias reference.
     * @param options The options.
     * @return The sound instance.
     */
    playTransient(soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Stops all media instances that were started with {@link playTransient} on this channel.
     * Instances that have already ended are automatically removed, so this only affects
     * those that are still playing or paused.
     * @return Instance for chaining.
     */
    stopTransientAll(): this;
    /**
     * The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
     */
    volume: number;
    /**
     * Whether the audio channel is muted. This is combined with the muted state of each sound played through this channel.
     */
    muted: boolean;
    /**
     * The MediaInstances currently playing through this channel. This is read-only and cannot be modified directly. Use the play method to add new MediaInstances to this channel.
     */
    readonly mediaInstances: IMediaInstance[];
    /**
     * Whether this channel is a background channel.
     * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
     */
    readonly background: boolean;
    /**
     * Stops all media currently playing through this channel.
     * @return Instance for chaining.
     */
    stopAll(): this;
    /**
     * Pauses any playing sounds.
     * @return Instance for chaining.
     */
    pauseAll(): this;
    /**
     * Temporarily pauses this channel without mutating each media instance's persisted paused option.
     * Useful for overlays (for example settings/pause menus) where pause state must not be saved.
     * @return Instance for chaining.
     */
    pauseUnsavedAll(): this;
    /**
     * Restores this channel after `pauseUnsavedAll()`, reapplying each media instance's persisted paused option.
     * @return Instance for chaining.
     */
    resumeUnsavedAll(): this;
    /**
     * Resumes any sounds.
     * @return Instance for chaining.
     */
    resumeAll(): this;
    /**
     * Toggle muted property for all sounds.
     * @return `true` if all sounds are muted.
     */
    toggleMuteAll(): boolean;
}

type DistortionFilter = {
    type: "DistortionFilter";
    amount?: number;
};
type EqualizerFilter = {
    type: "EqualizerFilter";
    f32?: number;
    f64?: number;
    f125?: number;
    f250?: number;
    f500?: number;
    f1k?: number;
    f2k?: number;
    f4k?: number;
    f8k?: number;
    f16k?: number;
};
type MonoFilter = {
    type: "MonoFilter";
};
type ReverbFilter = {
    type: "ReverbFilter";
    seconds?: number;
    decay?: number;
    reverse?: boolean;
};
type StereoFilter = {
    type: "StereoFilter";
    pan?: number;
};
type StreamFilter = {
    type: "StreamFilter";
};
type TelephoneFilter = {
    type: "TelephoneFilter";
};
type SoundFilterMemory = DistortionFilter | EqualizerFilter | MonoFilter | ReverbFilter | StereoFilter | StreamFilter | TelephoneFilter;

interface ExportedSound {
    options: SoundOptions;
    filters?: SoundFilterMemory[];
}
interface SoundPlay {
    stepIndex: number;
    paused: boolean;
    options?: SoundPlayOptions | string;
}
interface ExportedSoundPlay extends SoundPlay {
    sound: ExportedSound;
}
/**
 * Interface exported sounds
 */
interface SoundGameState {
    filters?: SoundFilterMemory[];
    /**
     * @deprecated
     */
    soundsPlaying?: {
        [key: string]: ExportedSoundPlay;
    };
    mediaInstances: {
        [key: string]: {
            channelAlias: string;
            soundAlias: string;
            stepCounter: number;
            options: Omit<SoundPlayOptions, "filters"> & {
                filters?: SoundFilterMemory[];
            };
            /**
             * @deprecated Use options.paused instead.
             */
            paused?: boolean;
        };
    };
}

interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "add" | "play" | "volume" | "speed" | "remove" | "exists" | "find" | "stop" | "pause" | "resume" | "pauseAll" | "resumeAll" | "muteAll" | "unmuteAll" | "stopAll" | "removeAll" | "togglePauseAll"> {
    /**
     * @deprecated You can define sound assets directly in `PIXI.Assets`
     */
    add(alias: string, options: string): Sound;
    /**
     * Plays a sound.
     * @param alias The media and sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    /**
     * Plays a non-persistent sound (for example UI/menu sounds).
     * This playback is not tracked in save/export state.
     * @param alias The sound (asset) alias reference.
     * @param options The options.
     * @return The sound instance.
     */
    playTransient(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    /**
     * Stops all transient media instances started with {@link playTransient}.
     * If `channel` is provided only instances on that channel are stopped;
     * otherwise all channels are affected.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    stopTransientAll(channel?: string): this;
    /**
     * Find a media by alias.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    find(alias: string): IMediaInstance | undefined;
    /**
     * Stops a media and removes it from the manager.
     * @param alias - The media alias reference.
     */
    stop(alias: string): void;
    /**
     * Pauses a media.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    pause(alias: string): IMediaInstance | undefined;
    /**
     * Resumes a media.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    resume(alias: string): IMediaInstance | undefined;
    /**
     * Edits the options of an existing sound (asset).
     * If the asset is not yet loaded, it will be loaded with the new options.
     */
    edit(alias: string, options: SoundOptions): Promise<void>;
    /**
     * Pauses any playing sounds.
     * @return Instance for chaining.
     */
    pauseAll(): this;
    /**
     * Resumes any sounds.
     * @return Instance for chaining.
     */
    resumeAll(): this;
    /**
     * Temporarily pauses all sounds across all channels (or just the given channel) without
     * mutating each media instance's persisted paused option.
     * Useful for overlays (for example settings/pause menus) where pause state must not be saved.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    pauseUnsavedAll(channel?: string): this;
    /**
     * Restores all channels (or just the given channel) after `pauseUnsavedAll()`,
     * reapplying each media instance's persisted paused option.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    resumeUnsavedAll(channel?: string): this;
    /**
     * Mutes all playing sounds.
     * @return Instance for chaining.
     */
    muteAll(): this;
    /**
     * Unmutes all playing sounds.
     * @return Instance for chaining.
     */
    unmuteAll(): this;
    /**
     * Stops all sounds.
     * @return Instance for chaining.
     */
    stopAll(): this;
    load(alias: string | string[]): Promise<Sound[]>;
    backgroundLoad(alias: string | string[]): Promise<void>;
    backgroundLoadBundle(alias: string): Promise<void>;
    clear(): void;
    /**
     * Adds a new audio channel with the specified alias(es).
     * @param alias The alias or aliases for the new channel.
     * @returns The created AudioChannelInterface instance, or undefined if a channel with the alias already exists.
     */
    addChannel(alias: string | string[], options?: ChannelOptions): AudioChannelInterface | undefined;
    /**
     * Finds and returns the audio channel associated with the given alias. If the channel does not exist, it will be created.
     * @param alias The alias of the audio channel to find.
     * @returns The AudioChannelInterface instance associated with the alias.
     */
    findChannel(alias: string): AudioChannelInterface;
    /**
     * Returns an array of all existing audio channels.
     */
    readonly channels: AudioChannelInterface[];
    /**
     * The default channel alias to use when playing a sound without specifying a channel.
     * By default, this is set to `GENERAL_CHANNEL` ("general"), but it can be changed to any string; if the channel does not yet exist, it will be created on demand when used.
     */
    defaultChannelAlias: string;
    export(): SoundGameState;
    restore(data: object): Promise<void>;
}

declare class CachedMap<K extends {}, V extends {}> implements Map<K, V> {
    readonly cache: LRUCache<K, V>;
    readonly map: Map<K, V>;
    constructor(options: {
        cacheSize: number;
    });
    get [Symbol.iterator](): () => MapIterator<[K, V]>;
    get [Symbol.toStringTag](): string;
    clear(): void;
    delete(key: K): boolean;
    get forEach(): (callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) => void;
    get(key: K): V | undefined;
    has(key: K): boolean;
    set(key: K, value: V): this;
    get size(): number;
    entries(): MapIterator<[K, V]>;
    keys(): MapIterator<K>;
    values(): MapIterator<V>;
}

interface TickerArgs {
}

interface TickerHistory<TArgs extends TickerArgs> {
    id: string;
    args: TArgs;
    /**
     * The aliases of the canvas elements that are connected to this ticker
     */
    canvasElementAliases: string[];
    priority?: UPDATE_PRIORITY;
    duration?: number;
    paused?: boolean;
}

type PauseType = {
    /**
     * The type of the value
     */
    type: "pause";
    /**
     * Duration in seconds
     */
    duration: number;
};

type RepeatType = "repeat";

interface TickersStep<TArgs extends TickerArgs> {
    /**
     * Ticker class name
     */
    ticker: string;
    /**
     * Duration in seconds. If is undefined, the step will end only when the animation is finished.
     */
    duration?: number;
    /**
     * Arguments to pass to the ticker
     */
    args: TArgs;
    /**
     * Priority of the ticker
     */
    priority?: UPDATE_PRIORITY;
}
/**
 * The steps of the tickers
 */
interface TickersSequence {
    /**
     * The step number
     */
    currentStepNumber: number;
    /**
     * The steps of the tickers
     */
    steps: (TickersStep<any> | RepeatType | PauseType)[];
}

/**
 * This class is used to create a canvas element to add into a Pixi Application.
 * You can use {@link canvas.add()} to add this element into the application.
 * This class should be implemented and the memory method should be overridden.
 * You must use the {@link canvasComponentDecorator} to register the canvas in the game.
 * In Ren'Py is a displayable.
 * @example
 * ```typescript
 * const CANVAS_EXAMPLE_ID = "CanvasExample";
 *
 * \@canvasComponentDecorator({
 *     name: CANVAS_EXAMPLE_ID,
 * })
 * export class CanvasExample extends Container implements CanvasBaseItem<Memory> {
 *     get memory(): Memory {
 *         return {
 *             pixivnId: CANVAS_EXAMPLE_ID,
 *             // ... other properties
 *         }
 *     }
 *     async setMemory(value: Memory) {
 *         // ... set other properties
 *     }
 * }
 * ```
 */
declare class CanvasBaseItem<T2 extends CanvasBaseItemMemory> {
    constructor(..._options: any);
    /**
     * This method return the memory of the canvas element.
     * @throws {PixiError} when the method is not overridden in the subclass.
     */
    get memory(): T2;
    /**
     * This method set the memory of the canvas element.
     * @throws {PixiError} when the method is not overridden in the subclass.
     */
    setMemory(_value: T2): Promise<void> | void;
    /**
     * Get the id of the canvas element. This variable is used in the system to get the canvas element by id
     */
    pixivnId: string;
}

/**
 * Interface for the canvas base memory
 */
interface CanvasBaseItemMemory {
    pixivnId: string;
    /**
     * The index of the container in its parent, if it has one
     */
    index?: number;
    /**
     * The label of the parent container, if it has one
     */
    parentLabel?: string;
    label?: string;
    zIndex?: number;
}

/**
 * Interface exported canvas
 */
interface CanvasGameState {
    tickers: {
        [id: string]: TickerHistory<any>;
    };
    tickersSteps: {
        [alias: string]: {
            [tickerId: string]: TickersSequence;
        };
    };
    elements: {
        [alias: string]: CanvasBaseItemMemory;
    };
    stage: Partial<ContainerMemory>;
    /**
     * @deprecated
     */
    elementAliasesOrder: string[];
    tickersToCompleteOnStepEnd: {
        tikersIds: {
            id: string;
        }[];
        stepAlias: {
            id: string;
            alias: string;
        }[];
    };
}

interface AdditionalPositionsExtensionProps {
    /**
     * is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
     * For example:
     * - if you set align to 0.5, the element will be in the center of the canvas.
     * - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
     * - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
     */
    align?: Partial<PointData> | number;
    /**
     * is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
     * For example:
     * - if you set align to 0.5, the element will be in the center of the canvas.
     * - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
     * - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
     */
    xAlign?: number;
    /**
     * is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
     * For example:
     * - if you set align to 0.5, the element will be in the center of the canvas.
     * - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
     * - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
     */
    yAlign?: number;
    /**
     * is a way to set the position of the element in the canvas calculated in percentage.
     * For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
     * - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
     * - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
     * - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
     */
    percentagePosition?: Partial<PointData> | number;
    /**
     * is a way to set the position of the element in the canvas calculated in percentage.
     * For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
     * - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
     * - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
     * - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
     */
    percentageX?: number;
    /**
     * is a way to set the position of the element in the canvas calculated in percentage.
     * For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
     * - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
     * - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
     * - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
     *
     * **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
     */
    percentageY?: number;
}

type ContainerChild = Container & CanvasBaseItem<any>;

interface ListenerExtensionMemory {
    onEvents?: OnEventsHandlers;
}
interface OnEventsHandlers {
    [name: string]: string;
}

/**
 * Interface for the canvas container memory
 */
interface ContainerMemory<C extends ContainerChild = ContainerChild> extends ContainerOptions<C>, CanvasBaseItemMemory, ListenerExtensionMemory, AdditionalPositionsExtensionProps {
    /**
     * The elements contained in this container
     */
    elements: CanvasBaseItemMemory[];
}

var version = "1.7.2";

/**
 * @deprecated
 */
declare const Repeat: RepeatType;
/**
 * Pause the tickers for a duration.
 * @param duration Duration in seconds
 * @returns The pause object
 * @deprecated
 */
declare function Pause(duration: number): PauseType;
/**
 * Is a special alias to indicate the game layer.
 */
declare const CANVAS_APP_GAME_LAYER_ALIAS = "__game_layer__";
/**
 * The default audio channel for sounds that don't specify one.
 */
declare const GENERAL_CHANNEL = "general";
declare const SYSTEM_RESERVED_STORAGE_KEYS: {
    /**
     * The key of the current dialogue memory
     */
    CURRENT_DIALOGUE_MEMORY_KEY: string;
    /**
     * The key of step counter of the current dialogue memory
     */
    LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
    /**
     * The key of the current menu options memory
     */
    CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
    /**
     * The key of the last menu options added in the step memory
     */
    LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
    /**
     * The key of the input memory. This value can be read by pixi-vn json importer
     */
    CURRENT_INPUT_VALUE_MEMORY_KEY: string;
    /**
     * The key of the last input added in the step memory
     */
    LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY: string;
    /**
     * The key of the current input info
     */
    CURRENT_INPUT_INFO_MEMORY_KEY: string;
    /**
     * The key of the characters memory
     */
    CHARACTER_CATEGORY_KEY: string;
    /**
     * This variable is used to add the next dialog text into the current dialog memory.
     * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue
     */
    ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY: string;
    /**
     * The key of a list of all labels that have been opened during the progression of the steps.
     */
    OPENED_LABELS_COUNTER_KEY: string;
    /**
     * The key of a list of all choices that have been made during the progression of the steps.
     */
    ALL_CHOICES_MADE_KEY: string;
    /**
     * The key of the current step times counter.
     * This value was added to introduce Ink Sequences, cycles and other alternatives https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#sequences-cycles-and-other-alternatives
     */
    CURRENT_STEP_TIMES_COUNTER_KEY: string;
    /**
     * The key of the last dialogue step glued in the step memory
     */
    LAST_STEP_GLUED: string;
};

type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
type NonFunctionStorage = string | number | boolean | undefined | null | NonFunctionStorage[] | {
    [key: string | number | symbol]: NonFunctionStorage;
};
/**
 * StorageElementType are all the types that can be stored in the storage
 */
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
    [key: string | number | symbol]: StorageElementType;
} | StorageObjectType[] | (StorageElementPrimaryType | StorageElementInternalType | StorageElementType)[] | {
    [key: string | number | symbol]: NonFunctionStorage;
};
/**
 * StorageObjectType are all the types that can be stored in the storage
 */
type StorageObjectType = Record<string | number | symbol, StorageElementType>;

interface StorageGameStateItem<T = StorageElementType> {
    key: string;
    value: T;
}
/**
 * Interface exported storage data
 */
type StorageGameState = {
    /**
     * @deprecated
     */
    base?: StorageGameStateItem[];
    /**
     * @deprecated
     */
    temp?: StorageGameStateItem[];
    tempDeadlines: StorageGameStateItem<number>[];
    /**
     * @deprecated
     */
    flags?: string[];
    main: StorageGameStateItem[];
};

/**
 * is a string containing the name of the label.
 * It is used to {@link narration.registeredLabels} to get the label class.
 */
type LabelIdType = string;

interface DialogueInterface {
    /**
     * The text of the dialogue.
     */
    text: string | string[];
    /**
     * The id of the character that is speaking.
     */
    character?: CharacterInterface | string;
}
type StoredDialogue = Omit<DialogueInterface, "character"> & {
    character: string | undefined;
};

interface HistoryStep {
    /**
     * The difference between the previous step and the current step.
     */
    diff?: Difference[];
    /**
     * The label id of the current step.
     */
    currentLabel?: LabelIdType;
    /**
     * The sha1 of the step function.
     */
    stepSha1: string;
    /**
     * Equivalent to the narration.stepCounter
     */
    index: number;
    /**
     * The data of the step of the label.
     */
    labelStepIndex: number | null;
    /**
     * Dialogue to be shown in the game
     */
    dialogue?: StoredDialogue;
    /**
     * List of choices asked of the player
     */
    choices?: StoredChoiceInterface[];
    /**
     * List of choices already made by the player
     */
    alreadyMadeChoices?: number[];
    /**
     * The input value of the player
     */
    inputValue?: StorageElementType$1;
    /**
     * The choice made by the player
     */
    choiceIndexMade?: number;
    /**
     * If true, the current dialogue will be glued to the previous one.
     */
    isGlued?: boolean;
    /**
     * Opened Labels in the current step.
     */
    openedLabels?: OpenedLabel$1[];
}

interface OpenedLabel {
    label: LabelIdType;
    currentStepIndex: number;
}

/**
 * Interface exported step data
 */
interface HistoryGameState {
    stepsHistory: HistoryStep[];
    originalStepData: GameStepState | undefined;
}

interface GameState {
    pixivn_version: string;
    stepData: NarrationGameState;
    storageData: StorageGameState;
    canvasData: CanvasGameState;
    soundData: SoundGameState;
    historyData: HistoryGameState;
    path: string;
}

/**
 * It is a interface that contains the information of a step.
 */
interface GameStepStateData {
    /**
     * The browser path that occurred during the progression of the steps.
     */
    path: string;
    /**
     * The storage that occurred during the progression of the steps.
     */
    storage: StorageGameState;
    /**
     * The index of the label that occurred during the progression of the steps.
     */
    labelIndex: number;
    /**
     * The canvas that occurred during the progression of the steps.
     */
    canvas: CanvasGameState;
    /**
     * The opened labels that occurred during the progression of the steps.
     */
    openedLabels: OpenedLabel[];
    /**
     * The sound data that occurred during the progression of the steps.
     */
    sound: SoundGameState;
}

/**
 * This function is used to create a deep copy of the element
 * @param element The element to be copied
 * @returns The copied element
 * @throws {PixiError} when the element is not JSON serializable (e.g. contains functions or class instances).
 */
declare function createExportableElement<T>(element: T): T;

declare namespace Game {
    /**
     * Initialize the Game and PixiJS Application and the interface div.
     * This method should be called before any other method.
     * @param element The html element where I will put the canvas. Example: document.body
     * @param width The width of the canvas
     * @param height The height of the canvas
     * @param options The options of PixiJS Application and other options
     * @param devtoolsOptions The options of the devtools. You can read more about it in the [PixiJS Devtools documentation](https://pixijs.io/devtools/docs/plugin/)
     * @example
     * ```typescript
     * const body = document.body
     * if (!body) {
     *     throw new Error('body element not found')
     * }
     * await Game.initialize(body, {
     *     navigate: (path) => {
     *         // navigate to the path
     *     },
     *     width: 1920,
     *     height: 1080,
     *     backgroundColor: "#303030"
     *     resizeMode: "contain"
     * })
     * ```
     */
    function init(element: HTMLElement, options: Partial<ApplicationOptions> & {
        /**
         * The id of the canvas element.
         * @default "pixi-vn-canvas"
         */
        id?: string;
        /**
         * The route navigate function.
         * You can set this function after the initialization using {@link GameUnifier.navigate}
         * @param path The path to navigate to.
         * @returns
         */
        navigate?: (path: string) => void | Promise<void>;
        /**
         * The resize mode of the canvas.
         * @default "contain"
         */
        resizeMode?: "contain" | "none";
    }, devtoolsOptions?: Devtools): Promise<void>;
    /**
     * Initialize only the GameUnifier, and not the PixiJS Application and the interface div.
     * This method can be used if you want to use only the GameUnifier features, such as save/load game,
     * without initializing the canvas.
     */
    function init(): Promise<void>;
    /**
     * Clear all game data. This function is used to reset the game.
     */
    function clear(): void;
    /**
     * Get all the game data. It can be used to save the game.
     * @returns The game data
     */
    function exportGameState(): GameState;
    /**
     * Load the save data
     * @param data The save data
     */
    function restoreGameState(data: GameState): Promise<void>;
    /**
     * @deprecated Use `restoreGameState(data)` (without the `navigate` argument) and configure navigation via `Game.init({ navigate })` or `Game.onNavigate(...)`.
     * @param data The save data
     * @param navigate Navigation function to use for this restore call.
     */
    function restoreGameState(data: GameState, navigate: (path: string) => void | Promise<void>): Promise<void>;
    /**
     * Start the game with a label. This function will clear all the game data and start the narration from the specified label.
     * @param label The label to start the game with. It can be a string or a LabelAbstract instance. If it is a string, it will be used as the id of the label to start. If it is a LabelAbstract instance, it will be used directly. If the label is not found, an error will be thrown.
     * @param props The properties to pass to the label. It will be passed to the {@link StepLabelType} of the label when it is executed.
     * @returns The result of the label execution. It can be a {@link StepLabelResultType} or a Promise that resolves to a {@link StepLabelResultType}.
     */
    function start<T extends {} = {}>(label: narrationUtils.LabelAbstract<any, T> | string, props: narrationUtils.StepLabelPropsType<T>): Promise<narrationUtils.StepLabelResultType>;
    /**
     * Convert a JSON string to a save data
     * @param json The JSON string
     * @returns The save data
     */
    function jsonToGameState(json: string): GameState;
    /**
     * Function to be executed at the end of the game. It should be set in the game initialization.
     * @example
     * ```typescript
     * Game.onEnd(async (props) => {
     *    props.navigate("/end")
     * })
     * ```
     */
    function onEnd(value: narrationUtils.StepLabelType): void;
    /**
     * @deprecated Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers.
     */
    function onError(handler: (type: "step", error: any, props: narrationUtils.StepLabelPropsType) => void | Promise<void>): () => void;
    /**
     * Register an error handler. Multiple handlers can be registered; they
     * will be executed in registration order.
     * @example
     * ```typescript
     * // Register a synchronous error handler
     * Game.addOnError((error, props) => {
     *    props.notify("An error occurred")
     *    // send a notification to GlitchTip, Sentry, etc...
     * })
     *
     * // Register an asynchronous error handler
     * Game.addOnError(async (error, props) => {
     *    await logErrorToServer(error)
     *    props.notify("An error occurred")
     * })
     *
     * // Register an error handler with step restoration/rollback
     * Game.addOnError(async (error, props) => {
     *    // Restore the game state to the previous step
     *    await stepHistory.back(props)
     *    props.notify("An error occurred, returning to previous step")
     * })
     * ```
     */
    function addOnError(value: OnErrorHandler): () => void;
    /**
     * Remove a previously registered error handler.
     */
    function removeOnError(handler: OnErrorHandler): void;
    /**
     * Is a function that will be executed before any step is executed.
     * @param stepId Step id
     * @param label Label
     * @returns
     */
    function onStepStart(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
    /**
     * Is a function that will be executed in {@link Game.onStepStart} if the id of the step is 0
     * and when the user laods a save file.
     * When you load a save file, will be executed all onLoadingLabel functions of the {@link narrationUtils.narration}.openedLabels.
     * It is useful for example to make sure all images used have been cached
     * @param stepId Step id
     * @param label Label
     * @returns
     * @example
     * ```typescript
     * Game.onLoadingLabel(async (stepId, label) => {
     *     await Assets.load('path/to/image1.png')
     *     await Assets.load('path/to/image2.png')
     * })
     * ```
     */
    function onLoadingLabel(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
    /**
     * Is a function that will be executed when the step ends.
     * @param stepId Step id
     * @param label Label
     * @returns
     */
    function onStepEnd(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
    /**
     * Function to be executed when navigation is requested.
     * @example
     * ```typescript
     * Game.onNavigate(async (path) => {
     *    // custom navigation logic
     *    window.history.pushState({}, "title", path)
     * })
     * ```
     */
    function onNavigate(value: (path: string) => void | Promise<void>): void;
    /**
     * Register a handler to run immediately before a narration "continue" operation.
     * Handlers are executed in registration order and may be async. Use
     * `{@link addOnPreContinue}` / `{@link removeOnPreContinue}` to manage them programmatically.
     */
    function addOnPreContinue(handler: () => Promise<void> | void): void;
    function removeOnPreContinue(handler: () => Promise<void> | void): void;
}
declare const _default: {
    canvas: canvasUtils.CanvasManagerInterface;
    narration: narrationUtils.NarrationManagerInterface;
    sound: SoundManagerInterface;
    storage: storageUtils.StorageManagerInterface;
    history: historyUtils.HistoryManagerInterface;
    Game: typeof Game;
    GameUnifier: typeof GameUnifier;
    createExportableElement: typeof createExportableElement;
    characterUtils: typeof characterUtils;
    canvasUtils: typeof canvasUtils;
    narrationUtils: typeof narrationUtils;
    soundUtils: typeof soundUtils;
    CANVAS_APP_GAME_LAYER_ALIAS: string;
    Pause: typeof Pause;
    Repeat: "repeat";
    PIXIVN_VERSION: string;
};

export { CANVAS_APP_GAME_LAYER_ALIAS, CachedMap, GENERAL_CHANNEL, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, Pause, Repeat, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };
