/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
import type { Value, TreeChunk } from "../../../core/index.js";
import { type ChunkDecoder, type StreamCursor } from "./chunkCodecUtilities.js";
import { DecoderContext } from "./chunkDecodingGeneric.js";
import type { IncrementalDecoder } from "./codecs.js";
import { type EncodedChunkShapeV1OrV2, type EncodedChunkShapeV2, type EncodedFieldBatchV1OrV2, type EncodedInlineArrayShape, type EncodedNestedArrayShape, type EncodedNodeShape, type EncodedValueShape } from "./format/index.js";
export interface IdDecodingContext {
    idCompressor: IIdCompressor;
    /**
     * The creator of any local Ids to be decoded.
     */
    originatorId: SessionId;
    /**
     * {@inheritdoc FieldBatchEncodingContext.isSummary}
     */
    isSummary: boolean;
    /**
     * See {@link FieldBatchEncodingContext.healUnresolvableIdentifiersOnDecode}.
     */
    healUnresolvableIdentifiersOnDecode?: boolean;
    /**
     * See {@link FieldBatchEncodingContext.sharedObjectId}.
     */
    sharedObjectId?: string;
}
/**
 * Decode `chunk` into a TreeChunk.
 */
export declare function decode(chunk: EncodedFieldBatchV1OrV2, idDecodingContext: IdDecodingContext, incrementalDecoder?: IncrementalDecoder): TreeChunk[];
/**
 * Decode a node's value from `stream` using its shape.
 */
export declare function readValue(stream: StreamCursor, shape: EncodedValueShape, idDecodingContext: IdDecodingContext): Value;
/**
 * Normalize a {@link TreeChunk} into an array.
 *
 * Unwraps {@link SequenceChunk}s, and wraps other chunks.
 */
export declare function deaggregateChunks(chunk: TreeChunk): TreeChunk[];
/**
 * Normalize a {@link TreeChunk}[] into a single TreeChunk.
 *
 * Avoids creating nested or less than 2 child {@link SequenceChunk}s.
 */
export declare function aggregateChunks(input: TreeChunk[]): TreeChunk;
/**
 * Decoder for {@link EncodedNestedArrayShape}s.
 */
export declare class NestedArrayDecoder implements ChunkDecoder {
    private readonly shape;
    constructor(shape: EncodedNestedArrayShape);
    decode(decoders: readonly ChunkDecoder[], stream: StreamCursor): TreeChunk;
}
/**
 * Decoder for {@link EncodedInlineArrayShape}s.
 */
export declare class InlineArrayDecoder implements ChunkDecoder {
    private readonly shape;
    constructor(shape: EncodedInlineArrayShape);
    decode(decoders: readonly ChunkDecoder[], stream: StreamCursor): TreeChunk;
}
/**
 * Decoder for {@link EncodedIncrementalChunkShape}s.
 */
export declare class IncrementalChunkDecoder implements ChunkDecoder {
    private readonly context;
    constructor(context: DecoderContext<EncodedChunkShapeV2>);
    decode(_: readonly ChunkDecoder[], stream: StreamCursor): TreeChunk;
}
/**
 * Decoder for {@link EncodedAnyShape}s.
 */
export declare const anyDecoder: ChunkDecoder;
/**
 * Decoder for {@link EncodedNodeShape}s.
 */
export declare class NodeDecoder implements ChunkDecoder {
    private readonly shape;
    private readonly context;
    private readonly type?;
    private readonly fieldDecoders;
    constructor(shape: EncodedNodeShape, context: DecoderContext<EncodedChunkShapeV1OrV2>);
    decode(decoders: readonly ChunkDecoder[], stream: StreamCursor): TreeChunk;
}
//# sourceMappingURL=chunkDecoding.d.ts.map