/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { type FieldKey, type MapTree } from "../core/index.js";
import { type CursorWithNode, type FlexTreeNodeSchema, FlexTreeSchema, type AllowedTypeSet, FlexFieldSchema, typeNameSymbol } from "../feature-libraries/index.js";
import { InsertableContent } from "./proxies.js";
/**
 * Module notes:
 *
 * The flow of the below code is in terms of the structure of the input data. We then verify that the associated
 * schema is appropriate for that kind of data. This is fine while we have a 1:1 mapping of kind of input data to
 * the kind of schema we expect for it (e.g. an input that is an array always need to be associated with a sequence in
 * the schema). If/when we begin accepting kinds of input data that are ambiguous (e.g. accepting an input that is an
 * array of key/value tuples to instantiate a map) we may need to rethink the structure here to be based more on the
 * schema than on the input data.
 */
/**
 * Transforms an input {@link TypedNode} tree to a {@link MapTree}, and wraps the tree in a {@link CursorWithNode}.
 * @param data - The input tree to be converted.
 * @param globalSchema - Schema for the whole tree for interperting `Any`.
 * @param typeSet - The set of types allowed by the parent context. Used to validate the input tree.
 *
 * @returns A cursor (in nodes mode) for the mapped tree if the input data was defined. Otherwise, returns `undefined`.
 */
export declare function cursorFromNodeData(data: InsertableContent, globalSchema: FlexTreeSchema, typeSet: AllowedTypeSet): CursorWithNode<MapTree> | undefined;
type InsertableTreeField = InsertableContent | undefined | InsertableContent[];
/**
 * Transforms an input {@link TreeField} tree to an array of {@link MapTree}s, and wraps the tree in a {@link CursorWithNode}.
 * @param data - The input tree to be converted.
 * @param globalSchema - Schema for the whole tree for interperting `Any`.
 */
export declare function cursorFromFieldData(data: InsertableTreeField, globalSchema: FlexTreeSchema, fieldSchema: FlexFieldSchema): CursorWithNode<MapTree>;
/**
 * Transforms an input {@link TypedNode} tree to a {@link MapTree}.
 * @param data - The input tree to be converted.
 * If the data is an unsupported value (e.g. NaN), a fallback value will be used when supported,
 * otherwise an error will be thrown.
 *
 * Fallbacks:
 *
 * * `NaN` =\> `null`
 *
 * * `+/-∞` =\> `null`
 *
 * * `-0` =\> `+0`
 *
 * @param globalSchema - Schema for the whole tree for interperting `Any`.
 * @param typeSet - The set of types allowed by the parent context. Used to validate the input tree.
 */
export declare function nodeDataToMapTree(data: InsertableContent, globalSchema: FlexTreeSchema, typeSet: AllowedTypeSet): MapTree;
/**
 * Transforms an input {@link TreeField} tree to an array of {@link MapTree}s.
 * @param data - The input tree to be converted.
 * If the input is a sequence containing 1 or more `undefined` values, those values will be mapped as `null` if supported.
 * Othewise, an error will be thrown.
 * @param globalSchema - Schema for the whole tree. Used to select the valid types when encountering `any`.
 */
export declare function fieldDataToMapTrees(data: InsertableTreeField, globalSchema: FlexTreeSchema, fieldSchema: FlexFieldSchema): MapTree[];
/**
 * @returns all types for which the data is schema-compatible.
 */
export declare function getPossibleTypes(globalSchema: FlexTreeSchema, typeSet: AllowedTypeSet, data: ContextuallyTypedNodeData): FlexTreeNodeSchema[];
/**
 * Content of a tree which needs external schema information to interpret.
 *
 * This format is intended for concise authoring of tree literals when the schema is statically known.
 *
 * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.
 */
export type ContextuallyTypedNodeData = ContextuallyTypedNodeDataObject | number | string | boolean | null | readonly ContextuallyTypedNodeData[];
/**
 * Content of a field which needs external schema information to interpret.
 *
 * This format is intended for concise authoring of tree literals when the schema is statically known.
 *
 * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.
 */
export type ContextuallyTypedFieldData = ContextuallyTypedNodeData | undefined;
/**
 * Object case of {@link ContextuallyTypedNodeData}.
 */
export interface ContextuallyTypedNodeDataObject {
    /**
     * The type of the node.
     * If this node is well-formed, it must follow this schema.
     */
    readonly [typeNameSymbol]?: string;
    /**
     * Fields of this node, indexed by their field keys.
     *
     * Allow explicit undefined for compatibility with EditableTree, and type-safety on read.
     */
    [key: FieldKey]: ContextuallyTypedFieldData;
    /**
     * Fields of this node, indexed by their field keys as strings.
     *
     * Allow unbranded field keys as a convenience for literals.
     */
    [key: string]: ContextuallyTypedFieldData;
}
export {};
//# sourceMappingURL=toMapTree.d.ts.map