/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
import { type NodeIdentifierManager, Context } from "../feature-libraries/index.js";
import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type TreeView, type TreeViewEvents, type TreeViewConfiguration, type TreeViewAlpha, type InsertableField, type ReadableField, type ReadSchema, type UnsafeUnknownSchema, type TreeBranchEvents, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type RunTransactionParams, type TreeBranchAlpha } from "../simple-tree/index.js";
import { type Breakable, type JsonCompatibleReadOnly, type WithBreakable } from "../util/index.js";
import type { TreeCheckout } from "./treeCheckout.js";
/**
 * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
 * exists and error if creating a second.
 */
export declare const ViewSlot: import("../core/index.js").AnchorSlot<TreeView<ImplicitFieldSchema>>;
/**
 * Implementation of TreeView wrapping a FlexTreeView.
 */
export declare class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> implements TreeViewAlpha<TRootSchema>, WithBreakable {
    readonly checkout: TreeCheckout;
    readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>;
    readonly nodeKeyManager: NodeIdentifierManager;
    private readonly onDispose?;
    /**
     * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
     *
     * The view schema may be incompatible with the stored schema. Use `compatibility` to check.
     */
    private flexTreeContext;
    /**
     * Undefined iff uninitialized or disposed.
     */
    private currentCompatibility;
    readonly events: Listenable<TreeViewEvents & TreeBranchEvents> & IEmitter<TreeViewEvents & TreeBranchEvents> & HasListeners<TreeViewEvents & TreeBranchEvents>;
    private readonly viewSchema;
    /**
     * Events to unregister upon flex-tree view disposal.
     */
    private readonly flexTreeViewUnregisterCallbacks;
    /**
     * Events to unregister upon disposal.
     */
    private readonly unregisterCallbacks;
    disposed: boolean;
    /**
     * This is set to true while an edit impacting the document schema is in progress.
     * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.
     * This is useful especially for some initialization edits, since document initialization can involve transient schemas
     * which are implementation details and should not be exposed to the user.
     */
    private midUpgrade;
    /**
     * Hydration work deferred until Context has been created.
     */
    private pendingHydration?;
    private readonly rootFieldSchema;
    readonly breaker: Breakable;
    constructor(checkout: TreeCheckout, config: TreeViewConfiguration<ReadSchema<TRootSchema>>, nodeKeyManager: NodeIdentifierManager, onDispose?: (() => void) | undefined);
    isBranch(): this is TreeBranchAlpha;
    applyChange(change: JsonCompatibleReadOnly): void;
    hasRootSchema<TSchema extends ImplicitFieldSchema>(schema: TSchema): this is TreeViewAlpha<TSchema>;
    get schema(): ReadSchema<TRootSchema>;
    initialize(content: InsertableField<TRootSchema>): void;
    upgradeSchema(): void;
    /**
     * Gets the flex-tree context. Throws when disposed or out of schema.
     */
    getFlexTreeContext(): Context;
    runTransaction<TSuccessValue, TFailureValue>(transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>, params?: RunTransactionParams): TransactionResultExt<TSuccessValue, TFailureValue>;
    runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult;
    runTransactionAsync<TSuccessValue, TFailureValue>(transaction: () => Promise<TransactionCallbackStatus<TSuccessValue, TFailureValue>>, params?: RunTransactionParams): Promise<TransactionResultExt<TSuccessValue, TFailureValue>>;
    runTransactionAsync(transaction: () => Promise<VoidTransactionCallbackStatus | void>, params?: RunTransactionParams): Promise<TransactionResult>;
    private ensureUndisposed;
    private failDisposed;
    /**
     * Updates `this.view` and the current compatibility status.
     * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.
     * Handles re-registering for events to call update in the future.
     * @remarks
     * This does not check if the view needs to be replaced, it replaces it unconditionally:
     * callers should do any checking to detect if it's really needed before calling `update`.
     * @privateRemarks
     * This implementation avoids making any edits, which prevents it from being invoked reentrantly.
     * If implicit initialization (or some other edit) is desired, it should be done outside of this method.
     */
    private update;
    private runSchemaEdit;
    private disposeFlexView;
    get compatibility(): SchemaCompatibilityStatus;
    dispose(): void;
    private get flexRoot();
    get root(): ReadableField<TRootSchema>;
    set root(newRoot: InsertableField<TRootSchema>);
    fork(): ReturnType<TreeBranchAlpha["fork"]> & SchematizingSimpleTreeView<TRootSchema>;
    merge(context: TreeBranchAlpha, disposeMerged?: boolean): void;
    rebaseOnto(context: TreeBranchAlpha): void;
}
//# sourceMappingURL=schematizingTreeView.d.ts.map