declare const NOT_RESOLVED: unique symbol;
declare const MERGE_KEY: unique symbol;
type ScalarRepresent = (data: any) => string;
type SequenceRepresent = (data: any) => ArrayLike<unknown>;
type MappingRepresent = (data: any) => Map<unknown, unknown>;
type IdentifyFn = (data: any) => boolean;
type RepresentTagNameFn = (data: any) => string;
interface ScalarTagDefinition<Result = unknown> {
    tagName: string;
    nodeKind: 'scalar';
    implicit: boolean;
    matchByTagPrefix: boolean;
    implicitFirstChars: readonly string[] | null;
    resolve: (source: string, isExplicit: boolean, tagName: string) => Result | typeof NOT_RESOLVED;
    identify: IdentifyFn | null;
    represent: ScalarRepresent;
    representTagName: RepresentTagNameFn | null;
}
interface SequenceTagDefinition<Carrier = unknown, Result = Carrier> {
    tagName: string;
    nodeKind: 'sequence';
    implicit: false;
    matchByTagPrefix: boolean;
    create: (tagName: string) => Carrier;
    addItem: (carrier: Carrier, item: unknown, index: number) => void | string;
    finalize: (carrier: Carrier) => Result;
    carrierIsResult: boolean;
    identify: IdentifyFn | null;
    represent: SequenceRepresent;
    representTagName: RepresentTagNameFn | null;
}
interface MappingTagDefinition<Carrier = unknown, Result = Carrier> {
    tagName: string;
    nodeKind: 'mapping';
    implicit: false;
    matchByTagPrefix: boolean;
    create: (tagName: string) => Carrier;
    addPair: (carrier: Carrier, key: unknown, value: unknown) => string;
    has: (carrier: Carrier, key: unknown) => boolean;
    keys: (result: Result) => Iterable<unknown>;
    get: (result: Result, key: unknown) => unknown;
    finalize: (carrier: Carrier) => Result;
    carrierIsResult: boolean;
    identify: IdentifyFn | null;
    represent: MappingRepresent;
    representTagName: RepresentTagNameFn | null;
}
type TagDefinition = ScalarTagDefinition<any> | SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>;
interface ScalarTagOptions<Result> {
    implicit?: boolean;
    matchByTagPrefix?: boolean;
    implicitFirstChars?: readonly string[] | null;
    resolve: ScalarTagDefinition<Result>['resolve'];
    identify?: ScalarTagDefinition<Result>['identify'];
    represent?: ScalarTagDefinition<Result>['represent'];
    representTagName?: ScalarTagDefinition<Result>['representTagName'];
}
type RepresentOptions<Container, Canonical, Represent> = {
    identify?: null;
    represent?: Represent;
    representTagName?: RepresentTagNameFn | null;
} | (Container extends Canonical ? {
    identify?: IdentifyFn | null;
    represent?: Represent;
    representTagName?: RepresentTagNameFn | null;
} : {
    identify: IdentifyFn;
    represent: Represent;
    representTagName?: RepresentTagNameFn | null;
});
type SequenceTagOptions<Carrier, Result = Carrier> = {
    matchByTagPrefix?: boolean;
    create: SequenceTagDefinition<Carrier, Result>['create'];
    addItem: SequenceTagDefinition<Carrier, Result>['addItem'];
    finalize?: SequenceTagDefinition<Carrier, Result>['finalize'];
} & RepresentOptions<Result, ArrayLike<unknown>, SequenceRepresent>;
type MappingTagOptions<Carrier, Result = Carrier> = {
    matchByTagPrefix?: boolean;
    create: MappingTagDefinition<Carrier, Result>['create'];
    addPair: MappingTagDefinition<Carrier, Result>['addPair'];
    has: MappingTagDefinition<Carrier, Result>['has'];
    keys: MappingTagDefinition<Carrier, Result>['keys'];
    get: MappingTagDefinition<Carrier, Result>['get'];
    finalize?: MappingTagDefinition<Carrier, Result>['finalize'];
} & RepresentOptions<Result, Map<unknown, unknown>, MappingRepresent>;
declare function defineScalarTag<Result>(tagName: string, options: ScalarTagOptions<Result>): ScalarTagDefinition<Result>;
declare function defineSequenceTag<Carrier, Result = Carrier>(tagName: string, options: SequenceTagOptions<Carrier, Result>): SequenceTagDefinition<Carrier, Result>;
declare function defineMappingTag<Carrier, Result = Carrier>(tagName: string, options: MappingTagOptions<Carrier, Result>): MappingTagDefinition<Carrier, Result>;

interface TagDefinitionMap {
    scalar: Record<string, ScalarTagDefinition>;
    sequence: Record<string, SequenceTagDefinition>;
    mapping: Record<string, MappingTagDefinition>;
}
interface TagDefinitionListMap {
    scalar: ScalarTagDefinition[];
    sequence: SequenceTagDefinition[];
    mapping: MappingTagDefinition[];
}
declare class Schema {
    readonly tags: readonly TagDefinition[];
    readonly implicitScalarTags: readonly ScalarTagDefinition[];
    readonly implicitScalarByFirstChar: ReadonlyMap<string, readonly ScalarTagDefinition[]>;
    readonly implicitScalarAnyFirstChar: readonly ScalarTagDefinition[];
    readonly defaultScalarTag: ScalarTagDefinition;
    readonly defaultSequenceTag: SequenceTagDefinition | undefined;
    readonly defaultMappingTag: MappingTagDefinition | undefined;
    readonly exact: TagDefinitionMap;
    readonly prefix: TagDefinitionListMap;
    constructor(tags: readonly TagDefinition[]);
    withTags(...tags: Array<TagDefinition | readonly TagDefinition[]>): Schema;
}
declare const FAILSAFE_SCHEMA: Schema;
declare const JSON_SCHEMA: Schema;
declare const CORE_SCHEMA: Schema;
declare const YAML11_SCHEMA: Schema;

declare const strTag: ScalarTagDefinition<string>;

declare const nullCoreTag: ScalarTagDefinition<null>;

declare const nullJsonTag: ScalarTagDefinition<null>;

declare const nullYaml11Tag: ScalarTagDefinition<null>;

declare const boolCoreTag: ScalarTagDefinition<boolean>;

declare const boolJsonTag: ScalarTagDefinition<boolean>;

declare const boolYaml11Tag: ScalarTagDefinition<boolean>;

declare const intCoreTag: ScalarTagDefinition<number>;

declare const intJsonTag: ScalarTagDefinition<number>;

declare const intYaml11Tag: ScalarTagDefinition<number>;

declare const floatCoreTag: ScalarTagDefinition<number>;

declare const floatJsonTag: ScalarTagDefinition<number>;

declare const floatYaml11Tag: ScalarTagDefinition<number>;

declare const mergeTag: ScalarTagDefinition<typeof MERGE_KEY>;

declare const binaryTag: ScalarTagDefinition<Uint8Array<ArrayBuffer>>;

declare const timestampTag: ScalarTagDefinition<Date>;

declare const seqTag: SequenceTagDefinition<unknown[], unknown[]>;

interface OmapCarrier {
    list: unknown[];
    seen: Set<unknown>;
}
declare const omapTag: SequenceTagDefinition<OmapCarrier, unknown[]>;

type Pair = [unknown, unknown];
declare const pairsTag: SequenceTagDefinition<Pair[], Pair[]>;

type StringMapping$1 = Record<string, unknown>;
declare const mapTag: MappingTagDefinition<StringMapping$1, StringMapping$1>;

type RealMapping = Map<unknown, unknown>;
declare const realMapTag: MappingTagDefinition<RealMapping, RealMapping>;

type StringMapping = Record<string, unknown>;
declare const legacyMapTag: MappingTagDefinition<StringMapping, StringMapping>;

declare const setTag: MappingTagDefinition<Set<unknown>, Set<unknown>>;

declare const EVENT_DOCUMENT = 1;
declare const EVENT_SEQUENCE = 2;
declare const EVENT_MAPPING = 3;
declare const EVENT_SCALAR = 4;
declare const EVENT_ALIAS = 5;
declare const EVENT_POP = 6;
declare const SCALAR_STYLE_PLAIN = 1;
declare const SCALAR_STYLE_SINGLE_QUOTED = 2;
declare const SCALAR_STYLE_DOUBLE_QUOTED = 3;
declare const SCALAR_STYLE_LITERAL_BLOCK = 4;
declare const SCALAR_STYLE_FOLDED_BLOCK = 5;
type ScalarStyle = typeof SCALAR_STYLE_PLAIN | typeof SCALAR_STYLE_SINGLE_QUOTED | typeof SCALAR_STYLE_DOUBLE_QUOTED | typeof SCALAR_STYLE_LITERAL_BLOCK | typeof SCALAR_STYLE_FOLDED_BLOCK;
declare const COLLECTION_STYLE_BLOCK = 1;
declare const COLLECTION_STYLE_FLOW = 2;
type CollectionStyle = typeof COLLECTION_STYLE_BLOCK | typeof COLLECTION_STYLE_FLOW;
declare const CHOMPING_CLIP = 1;
declare const CHOMPING_STRIP = 2;
declare const CHOMPING_KEEP = 3;
type Chomping = typeof CHOMPING_CLIP | typeof CHOMPING_STRIP | typeof CHOMPING_KEEP;
type DocumentDirective = {
    kind: 'yaml';
    version: string;
} | {
    kind: 'tag';
    handle: string;
    prefix: string;
};
interface DocumentEvent {
    type: typeof EVENT_DOCUMENT;
    explicitStart: boolean;
    explicitEnd: boolean;
    directives: DocumentDirective[];
}
interface SequenceEvent {
    type: typeof EVENT_SEQUENCE;
    start: number;
    anchorStart: number;
    anchorEnd: number;
    tagStart: number;
    tagEnd: number;
    style: CollectionStyle;
}
interface MappingEvent {
    type: typeof EVENT_MAPPING;
    start: number;
    anchorStart: number;
    anchorEnd: number;
    tagStart: number;
    tagEnd: number;
    style: CollectionStyle;
}
interface ScalarEvent {
    type: typeof EVENT_SCALAR;
    valueStart: number;
    valueEnd: number;
    anchorStart: number;
    anchorEnd: number;
    tagStart: number;
    tagEnd: number;
    style: ScalarStyle;
    chomping: Chomping;
    indent: number;
    fast: boolean;
}
interface AliasEvent {
    type: typeof EVENT_ALIAS;
    anchorStart: number;
    anchorEnd: number;
}
interface PopEvent {
    type: typeof EVENT_POP;
}
type Event = DocumentEvent | SequenceEvent | MappingEvent | ScalarEvent | AliasEvent | PopEvent;

interface ConstructorOptions {
    source: string;
    filename?: string;
    schema?: Schema;
    json?: boolean;
    maxTotalMergeKeys?: number;
    maxAliases?: number;
}
declare function constructFromEvents(events: Event[], options: ConstructorOptions): unknown[];

interface ParserOptions {
    filename?: string;
    maxDepth?: number;
}
declare function parseEvents(input: string, options: ParserOptions): Event[];

interface LoadOptions extends ParserOptions, Omit<ConstructorOptions, 'source'> {
}
type LoadAllIterator = (document: unknown) => void;
declare function loadAll(input: string, options?: LoadOptions): unknown[];
declare function loadAll(input: string, iterator: null, options?: LoadOptions): unknown[];
declare function loadAll(input: string, iterator: LoadAllIterator, options?: LoadOptions): void;
declare function load(input: string, options?: LoadOptions): unknown;

declare class Style {
    tagged: boolean;
    flow: boolean;
    singleQuoted: boolean;
    doubleQuoted: boolean;
    literal: boolean;
    folded: boolean;
}
interface NodeBase {
    tag: string;
    style: Style;
    anchor?: string;
    commentBefore?: string;
    comment?: string;
    commentAfter?: string;
    blankBefore?: number;
}
interface ScalarNode extends NodeBase {
    kind: 'scalar';
    value: string;
}
interface SequenceNode extends NodeBase {
    kind: 'sequence';
    items: Node[];
}
interface MappingNode extends NodeBase {
    kind: 'mapping';
    items: Array<{
        key: Node;
        value: Node;
    }>;
}
interface AliasNode extends NodeBase {
    kind: 'alias';
    anchor: string;
}
type Node = ScalarNode | SequenceNode | MappingNode | AliasNode;
interface Document {
    contents: Node | null;
    explicitStart?: boolean;
    explicitEnd?: boolean;
    directives: DocumentDirective[];
}

interface PresenterOptions {
    schema: Schema;
    indent?: number;
    seqNoIndent?: boolean;
    seqInlineFirst?: boolean;
    sortKeys?: boolean | ((a: any, b: any) => number);
    lineWidth?: number;
    flowBracketPadding?: boolean;
    flowSkipCommaSpace?: boolean;
    flowSkipColonSpace?: boolean;
    quoteFlowKeys?: boolean;
    quoteStyle?: 'single' | 'double';
    forceQuotes?: boolean;
    tagBeforeAnchor?: boolean;
}
declare function present(documents: Document[], options: PresenterOptions): string;

interface DumpOptions extends Omit<PresenterOptions, 'schema'> {
    schema?: Schema;
    skipInvalid?: boolean;
    noRefs?: boolean;
    flowLevel?: number;
    transform?: (documents: Document[]) => void;
}
declare function dump(input: any, options?: DumpOptions): string;

interface SnippetMark {
    name?: string | null;
    buffer: string;
    position: number;
    line: number;
    column: number;
    snippet?: string | null;
}

declare class YAMLException extends Error {
    reason: string;
    mark?: SnippetMark;
    constructor(reason: string, mark?: SnippetMark);
    toString(compact?: boolean): string;
}

declare function getScalarValue(input: string, scalar: ScalarEvent): string;

interface FromEventsOptions {
    source: string;
    schema: Schema;
}
declare function eventsToAst(events: Event[], options: FromEventsOptions): Document[];

interface FromJsOptions {
    noRefs?: boolean;
    skipInvalid?: boolean;
}
declare function jsToAst(input: unknown, schema: Schema, options?: FromJsOptions): Document[];

declare const VISIT_BREAK: unique symbol;
declare const VISIT_SKIP: unique symbol;
type VisitControl = typeof VISIT_BREAK | typeof VISIT_SKIP | undefined | void;
interface VisitContext {
    depth: number;
    parent: Node | null;
    isKey: boolean;
}
type Visitor = (node: Node, ctx: VisitContext) => VisitControl;
declare function visit(documents: Document[], visitor: Visitor): void;

export { CHOMPING_CLIP, CHOMPING_KEEP, CHOMPING_STRIP, COLLECTION_STYLE_BLOCK, COLLECTION_STYLE_FLOW, CORE_SCHEMA, EVENT_ALIAS, EVENT_DOCUMENT, EVENT_MAPPING, EVENT_POP, EVENT_SCALAR, EVENT_SEQUENCE, FAILSAFE_SCHEMA, JSON_SCHEMA, MERGE_KEY, NOT_RESOLVED, SCALAR_STYLE_DOUBLE_QUOTED, SCALAR_STYLE_FOLDED_BLOCK, SCALAR_STYLE_LITERAL_BLOCK, SCALAR_STYLE_PLAIN, SCALAR_STYLE_SINGLE_QUOTED, Schema, Style, VISIT_BREAK, VISIT_SKIP, YAML11_SCHEMA, YAMLException, binaryTag, boolCoreTag, boolJsonTag, boolYaml11Tag, constructFromEvents, defineMappingTag, defineScalarTag, defineSequenceTag, dump, eventsToAst, floatCoreTag, floatJsonTag, floatYaml11Tag, getScalarValue, intCoreTag, intJsonTag, intYaml11Tag, jsToAst, legacyMapTag, load, loadAll, mapTag, mergeTag, nullCoreTag, nullJsonTag, nullYaml11Tag, omapTag, pairsTag, parseEvents, present, realMapTag, seqTag, setTag, strTag, timestampTag, visit };
export type { AliasEvent, AliasNode, ConstructorOptions, Document, DocumentDirective, DocumentEvent, DumpOptions, Event, FromEventsOptions, FromJsOptions, LoadOptions, MappingEvent, MappingNode, MappingTagDefinition, MappingTagOptions, Node, NodeBase, ParserOptions, PopEvent, PresenterOptions, ScalarEvent, ScalarNode, ScalarTagDefinition, ScalarTagOptions, SequenceEvent, SequenceNode, SequenceTagDefinition, SequenceTagOptions, TagDefinition, VisitContext, Visitor };
