{"version":3,"file":"js-yaml.esm.min.mjs","names":[],"sources":["../../src/tag.ts","../../src/tag/scalar/str.ts","../../src/tag/scalar/null_core.ts","../../src/tag/scalar/null_json.ts","../../src/tag/scalar/null_yaml11.ts","../../src/tag/scalar/bool_core.ts","../../src/tag/scalar/bool_json.ts","../../src/tag/scalar/bool_yaml11.ts","../../src/tag/scalar/int_core.ts","../../src/tag/scalar/int_json.ts","../../src/tag/scalar/int_yaml11.ts","../../src/tag/scalar/float_core.ts","../../src/tag/scalar/float_json.ts","../../src/tag/scalar/float_yaml11.ts","../../src/tag/scalar/merge.ts","../../src/tag/scalar/binary.ts","../../src/tag/scalar/timestamp.ts","../../src/tag/sequence/seq.ts","../../src/tag/sequence/omap.ts","../../src/tag/sequence/pairs.ts","../../src/common/object.ts","../../src/tag/mapping/map.ts","../../src/tag/mapping/set.ts","../../src/schema.ts","../../src/tag/mapping/real_map.ts","../../src/tag/mapping/legacy_map.ts","../../src/common/snippet.ts","../../src/common/exception.ts","../../src/parser/events.ts","../../src/parser/parser_scalar.ts","../../src/common/tagname.ts","../../src/parser/constructor.ts","../../src/parser/parser.ts","../../src/load.ts","../../src/ast/nodes.ts","../../src/ast/from_js.ts","../../src/ast/visit.ts","../../src/ast/presenter.ts","../../src/dump.ts","../../src/ast/from_events.ts"],"sourcesContent":["const NOT_RESOLVED: unique symbol = Symbol('NOT_RESOLVED')\nconst MERGE_KEY: unique symbol = Symbol('MERGE_KEY')\n\ntype ScalarRepresent = (data: any) => string\ntype SequenceRepresent = (data: any) => ArrayLike<unknown>\ntype MappingRepresent = (data: any) => Map<unknown, unknown>\n\ntype IdentifyFn = (data: any) => boolean\ntype RepresentTagNameFn = (data: any) => string\n\ninterface ScalarTagDefinition<Result = unknown> {\n  tagName: string\n  nodeKind: 'scalar'\n  implicit: boolean\n  matchByTagPrefix: boolean\n  // Set of `source.charAt(0)` keys for which `resolve` may succeed (a superset of\n  // what it really matches). A key is either a single character or '' (empty\n  // source). `null` means \"no constraint, always try\". Used by the composer to\n  // dispatch implicit scalars by first character without running every resolver.\n  implicitFirstChars: readonly string[] | null\n  // `isExplicit` is true for an explicit tag (`!!tag`), false for implicit plain\n  // scalar resolution.\n  resolve: (source: string, isExplicit: boolean, tagName: string) => Result | typeof NOT_RESOLVED\n  identify: IdentifyFn | null\n  // A scalar's printed form is text, so `represent` always yields a string. The\n  // factory supplies a `String(data)` default when a tag omits it.\n  represent: ScalarRepresent\n  representTagName: RepresentTagNameFn | null\n}\n\ninterface SequenceTagDefinition<Carrier = unknown, Result = Carrier> {\n  tagName: string\n  nodeKind: 'sequence'\n  implicit: false\n  matchByTagPrefix: boolean\n  create: (tagName: string) => Carrier\n  addItem: (carrier: Carrier, item: unknown, index: number) => void | string\n  finalize: (carrier: Carrier) => Result\n  carrierIsResult: boolean\n  identify: IdentifyFn | null\n  represent: SequenceRepresent\n  representTagName: RepresentTagNameFn | null\n}\n\ninterface MappingTagDefinition<Carrier = unknown, Result = Carrier> {\n  tagName: string\n  nodeKind: 'mapping'\n  implicit: false\n  matchByTagPrefix: boolean\n  create: (tagName: string) => Carrier\n  // Writes a pair. Returns '' on success, a non-empty error message otherwise\n  // (key does not fit the representation, value rejected, ...). Always a string\n  // so the hot path never allocates an exception wrapper.\n  addPair: (carrier: Carrier, key: unknown, value: unknown) => string\n  // Read side, mirrors `Map` — defining a representation means defining how to\n  // read it back. `has` is the hot dedup probe (membership without fetching the\n  // value); `keys`/`get` are used only on the cold merge path (`<<`).\n  has: (carrier: Carrier, key: unknown) => boolean\n  keys: (result: Result) => Iterable<unknown>\n  get: (result: Result, key: unknown) => unknown\n  finalize: (carrier: Carrier) => Result\n  carrierIsResult: boolean\n  identify: IdentifyFn | null\n  represent: MappingRepresent\n  representTagName: RepresentTagNameFn | null\n}\n\ntype TagDefinition =\n  | ScalarTagDefinition<any>\n  | SequenceTagDefinition<any, any>\n  | MappingTagDefinition<any, any>\n\ninterface ScalarTagOptions<Result> {\n  implicit?: boolean\n  matchByTagPrefix?: boolean\n  implicitFirstChars?: readonly string[] | null\n  resolve: ScalarTagDefinition<Result>['resolve']\n  identify?: ScalarTagDefinition<Result>['identify']\n  represent?: ScalarTagDefinition<Result>['represent']\n  representTagName?: ScalarTagDefinition<Result>['representTagName']\n}\n\ntype RepresentOptions<Container, Canonical, Represent> =\n  | {\n      identify?: null\n      represent?: Represent\n      representTagName?: RepresentTagNameFn | null\n    }\n  | (Container extends Canonical\n      ? {\n          identify?: IdentifyFn | null\n          represent?: Represent\n          representTagName?: RepresentTagNameFn | null\n        }\n      : {\n          identify: IdentifyFn\n          represent: Represent\n          representTagName?: RepresentTagNameFn | null\n        })\n\ntype SequenceTagOptions<Carrier, Result = Carrier> = {\n  matchByTagPrefix?: boolean\n  create: SequenceTagDefinition<Carrier, Result>['create']\n  addItem: SequenceTagDefinition<Carrier, Result>['addItem']\n  finalize?: SequenceTagDefinition<Carrier, Result>['finalize']\n} & RepresentOptions<Result, ArrayLike<unknown>, SequenceRepresent>\n\ntype MappingTagOptions<Carrier, Result = Carrier> = {\n  matchByTagPrefix?: boolean\n  create: MappingTagDefinition<Carrier, Result>['create']\n  addPair: MappingTagDefinition<Carrier, Result>['addPair']\n  has: MappingTagDefinition<Carrier, Result>['has']\n  keys: MappingTagDefinition<Carrier, Result>['keys']\n  get: MappingTagDefinition<Carrier, Result>['get']\n  finalize?: MappingTagDefinition<Carrier, Result>['finalize']\n} & RepresentOptions<Result, Map<unknown, unknown>, MappingRepresent>\n\nfunction defineScalarTag<Result> (tagName: string, options: ScalarTagOptions<Result>): ScalarTagDefinition<Result> {\n  return {\n    tagName,\n    nodeKind: 'scalar',\n    implicit: options.implicit ?? false,\n    matchByTagPrefix: options.matchByTagPrefix ?? false,\n    implicitFirstChars: options.implicitFirstChars ?? null,\n    resolve: options.resolve,\n    identify: options.identify ?? null,\n    represent: options.represent ?? (data => String(data)),\n    representTagName: options.representTagName ?? null\n  }\n}\n\nfunction defineSequenceTag<Carrier, Result = Carrier> (tagName: string, options: SequenceTagOptions<Carrier, Result>): SequenceTagDefinition<Carrier, Result> {\n  const carrierIsResult = options.finalize === undefined\n\n  return {\n    tagName,\n    nodeKind: 'sequence',\n    implicit: false,\n    matchByTagPrefix: options.matchByTagPrefix ?? false,\n    create: options.create,\n    addItem: options.addItem,\n    finalize: options.finalize ?? (carrier => carrier as unknown as Result),\n    carrierIsResult,\n    identify: options.identify ?? null,\n    represent: options.represent ?? (data => data as ArrayLike<unknown>),\n    representTagName: options.representTagName ?? null\n  }\n}\n\nfunction defineMappingTag<Carrier, Result = Carrier> (tagName: string, options: MappingTagOptions<Carrier, Result>): MappingTagDefinition<Carrier, Result> {\n  const carrierIsResult = options.finalize === undefined\n\n  return {\n    tagName,\n    nodeKind: 'mapping',\n    implicit: false,\n    matchByTagPrefix: options.matchByTagPrefix ?? false,\n    create: options.create,\n    addPair: options.addPair,\n    has: options.has,\n    keys: options.keys,\n    get: options.get,\n    finalize: options.finalize ?? (carrier => carrier as unknown as Result),\n    carrierIsResult,\n    identify: options.identify ?? null,\n    represent: options.represent ?? (data => data as Map<unknown, unknown>),\n    representTagName: options.representTagName ?? null\n  }\n}\n\nexport {\n  NOT_RESOLVED,\n  MERGE_KEY,\n  defineScalarTag,\n  defineSequenceTag,\n  defineMappingTag,\n\n  type ScalarTagDefinition,\n  type SequenceTagDefinition,\n  type MappingTagDefinition,\n  type TagDefinition,\n  type ScalarTagOptions,\n  type SequenceTagOptions,\n  type MappingTagOptions,\n  type ScalarRepresent,\n  type SequenceRepresent,\n  type MappingRepresent\n}\n","import { defineScalarTag } from '../../tag.ts'\n\nconst strTag = defineScalarTag('tag:yaml.org,2002:str', {\n  resolve: (source) => source,\n  identify: (data) => typeof data === 'string'\n})\n\nexport { strTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst NULL_VALUES = ['', '~', 'null', 'Null', 'NULL']\n\nconst nullCoreTag = defineScalarTag('tag:yaml.org,2002:null', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: '' (empty), '~', 'null'/'Null'/'NULL'.\n  implicitFirstChars: ['', '~', 'n', 'N'],\n  resolve: (source) => {\n    if (NULL_VALUES.indexOf(source) !== -1) return null\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => object === null,\n  represent: () => 'null'\n})\n\nexport { nullCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst nullJsonTag = defineScalarTag('tag:yaml.org,2002:null', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: null.\n  implicitFirstChars: ['n'],\n  resolve: (source, isExplicit) => {\n    if (source === 'null' || (isExplicit && source === '')) return null\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => object === null,\n  represent: () => 'null'\n})\n\nexport { nullJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst NULL_VALUES = ['', '~', 'null', 'Null', 'NULL']\n\nconst nullYaml11Tag = defineScalarTag('tag:yaml.org,2002:null', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: '' (empty), '~', 'null'/'Null'/'NULL'.\n  implicitFirstChars: ['', '~', 'n', 'N'],\n  resolve: (source) => {\n    if (NULL_VALUES.indexOf(source) !== -1) return null\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => object === null,\n  represent: () => 'null'\n})\n\nexport { nullYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true', 'True', 'TRUE']\nconst FALSE_VALUES = ['false', 'False', 'FALSE']\n\nconst boolCoreTag = defineScalarTag('tag:yaml.org,2002:bool', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: true/True/TRUE, false/False/FALSE.\n  implicitFirstChars: ['t', 'T', 'f', 'F'],\n  resolve: (source) => {\n    if (TRUE_VALUES.indexOf(source) !== -1) return true\n    if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n  represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true']\nconst FALSE_VALUES = ['false']\n\nconst boolJsonTag = defineScalarTag('tag:yaml.org,2002:bool', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: true, false.\n  implicitFirstChars: ['t', 'f'],\n  resolve: (source) => {\n    if (TRUE_VALUES.indexOf(source) !== -1) return true\n    if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n  represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst TRUE_VALUES = ['true', 'True', 'TRUE', 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON']\nconst FALSE_VALUES = ['false', 'False', 'FALSE', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF']\n\nconst boolYaml11Tag = defineScalarTag('tag:yaml.org,2002:bool', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs.\n  implicitFirstChars: ['y', 'Y', 'n', 'N', 't', 'T', 'f', 'F', 'o', 'O'],\n  resolve: (source) => {\n    if (TRUE_VALUES.indexOf(source) !== -1) return true\n    if (FALSE_VALUES.indexOf(source) !== -1) return false\n\n    return NOT_RESOLVED\n  },\n  identify: (object) => Object.prototype.toString.call(object) === '[object Boolean]',\n  represent: (object) => object ? 'true' : 'false'\n})\n\nexport { boolYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 Core schema implicit resolution:\n// [-+]? [0-9]+ | 0o [0-7]+ | 0x [0-9a-fA-F]+\nconst YAML_INTEGER_IMPLICIT_PATTERN = new RegExp(\n  // 0o123\n  '^(?:0o[0-7]+' +\n  // 0x1A\n  '|0x[0-9a-fA-F]+' +\n  // 12345\n  '|[-+]?[0-9]+)$')\n\n// Explicit `!!int` validation is separate from Core implicit resolution.\nconst YAML_INTEGER_EXPLICIT_PATTERN = new RegExp(\n  // 0b1010\n  '^(?:[-+]?0b[0-1]+' +\n  // 0o123\n  '|[-+]?0o[0-7]+' +\n  // 0x1A\n  '|[-+]?0x[0-9a-fA-F]+' +\n  // 12345\n  '|[-+]?[0-9]+)$')\n\nfunction parseYamlInteger (source: string) {\n  let value = source\n  let sign = 1\n\n  if (value[0] === '-' || value[0] === '+') {\n    if (value[0] === '-') sign = -1\n    value = value.slice(1)\n  }\n\n  if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n  if (value.startsWith('0o')) return sign * parseInt(value.slice(2), 8)\n  if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n  return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string, isExplicit: boolean) {\n  if (isExplicit) {\n    if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n  } else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) {\n    return NOT_RESOLVED\n  }\n\n  const result = parseYamlInteger(source)\n  return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\nconst intCoreTag = defineScalarTag('tag:yaml.org,2002:int', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional sign + decimal digit.\n  implicitFirstChars: ['-', '+', ...'0123456789'],\n  resolve: resolveYamlInteger,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    Number.isInteger(object) &&\n    // Negative zero => !!float\n    !Object.is(object, -0) &&\n    // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n    object.toString(10).indexOf('e') < 0,\n  represent: (object: number) => object.toString(10)\n})\n\nexport { intCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 JSON schema implicit resolution:\n// -? ( 0 | [1-9] [0-9]* )\nconst YAML_INTEGER_IMPLICIT_PATTERN = new RegExp(\n  '^-?(?:0|[1-9][0-9]*)$')\n\n// Explicit `!!int` validation is separate from JSON implicit resolution.\nconst YAML_INTEGER_EXPLICIT_PATTERN = new RegExp(\n  // 0b1010\n  '^(?:[-+]?0b[0-1]+' +\n  // 0o123\n  '|[-+]?0o[0-7]+' +\n  // 0x1A\n  '|[-+]?0x[0-9a-fA-F]+' +\n  // 12345\n  '|[-+]?[0-9]+)$')\n\nfunction parseYamlInteger (source: string) {\n  let value = source\n  let sign = 1\n\n  if (value[0] === '-' || value[0] === '+') {\n    if (value[0] === '-') sign = -1\n    value = value.slice(1)\n  }\n\n  if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n  if (value.startsWith('0o')) return sign * parseInt(value.slice(2), 8)\n  if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n  return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string, isExplicit: boolean) {\n  if (isExplicit) {\n    if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n  } else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) {\n    return NOT_RESOLVED\n  }\n\n  const result = parseYamlInteger(source)\n  return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\nconst intJsonTag = defineScalarTag('tag:yaml.org,2002:int', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional '-' or digit.\n  implicitFirstChars: ['-', ...'0123456789'],\n  resolve: resolveYamlInteger,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    Number.isInteger(object) &&\n    // Negative zero => !!float\n    !Object.is(object, -0) &&\n    // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n    object.toString(10).indexOf('e') < 0,\n  represent: (object: number) => object.toString(10)\n})\n\nexport { intJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_INTEGER_PATTERN = new RegExp(\n  // 0b1010\n  '^(?:[-+]?0b[0-1_]+' +\n  // 0123\n  '|[-+]?0[0-7_]+' +\n  // 0x1A\n  '|[-+]?0x[0-9a-fA-F_]+' +\n  // 1:23\n  '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+' +\n  // 12345\n  '|[-+]?(?:0|[1-9][0-9_]*))$')\n\nfunction parseYamlInteger (source: string) {\n  let value = source.replace(/_/g, '')\n  let sign = 1\n\n  if (value[0] === '-' || value[0] === '+') {\n    if (value[0] === '-') sign = -1\n    value = value.slice(1)\n  }\n\n  if (value.startsWith('0b')) return sign * parseInt(value.slice(2), 2)\n  if (value.startsWith('0x')) return sign * parseInt(value.slice(2), 16)\n\n  if (value.includes(':')) {\n    let result = 0\n    for (const part of value.split(':')) result = result * 60 + Number(part)\n    return sign * result\n  }\n\n  if (value !== '0' && value[0] === '0') return sign * parseInt(value, 8)\n\n  return sign * parseInt(value, 10)\n}\n\nfunction resolveYamlInteger (source: string) {\n  if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED\n\n  const result = parseYamlInteger(source)\n  return Number.isFinite(result) ? result : NOT_RESOLVED\n}\n\nconst intYaml11Tag = defineScalarTag('tag:yaml.org,2002:int', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional sign + decimal digit.\n  implicitFirstChars: ['-', '+', ...'0123456789'],\n  resolve: resolveYamlInteger,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    Number.isInteger(object) &&\n    // Negative zero => !!float\n    !Object.is(object, -0) &&\n    // Exponential form => !!float, round-trip for !!int 1e21 will be broken\n    object.toString(10).indexOf('e') < 0,\n  represent: (object: number) => object.toString(10)\n})\n\nexport { intYaml11Tag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_FLOAT_PATTERN = new RegExp(\n  // 2.5e4, 2.5 and integers\n  '^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +\n  // .2e4, .2\n  '|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +\n  // .inf\n  '|[-+]?\\\\.(?:inf|Inf|INF)' +\n  // .nan\n  '|\\\\.(?:nan|NaN|NAN))$')\n\nconst YAML_FLOAT_SPECIAL_PATTERN = new RegExp(\n  '^(?:' +\n  // .inf\n  '[-+]?\\\\.(?:inf|Inf|INF)' +\n  // .nan\n  '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string) {\n  if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED\n\n  let value = source.toLowerCase()\n  const sign = value[0] === '-' ? -1 : 1\n\n  if ('+-'.includes(value[0])) value = value.slice(1)\n\n  if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n  if (value === '.nan') return NaN\n\n  const result = sign * parseFloat(value)\n\n  if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result\n  return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n  if (isNaN(object)) return '.nan'\n  if (object === Number.POSITIVE_INFINITY) return '.inf'\n  if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n  if (Object.is(object, -0)) return '-0.0'\n\n  const result = object.toString(10)\n  return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\nconst floatCoreTag = defineScalarTag('tag:yaml.org,2002:float', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional sign, '.', or digit\n  // ('.inf'/'.nan' start with '.').\n  implicitFirstChars: ['-', '+', '.', ...'0123456789'],\n  resolve: resolveYamlFloat,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    typeof object === 'number' &&\n    (\n      // We land here all numbers, not handled (declined) by !!int `.identify`\n      // The same condition as for !!int, but reversed.\n\n      // Filter out integers...\n      !Number.isInteger(object) ||\n      // but allow negative zero\n      Object.is(object, -0) ||\n      // and integers with exponential form\n      object.toString(10).indexOf('e') >= 0\n    ),\n  represent: representYamlFloat\n})\n\nexport { floatCoreTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\n// YAML 1.2 JSON schema implicit resolution:\n// -? ( 0 | [1-9] [0-9]* ) ( \\. [0-9]* )? ( [eE] [-+]? [0-9]+ )?\nconst YAML_FLOAT_IMPLICIT_PATTERN = new RegExp(\n  // 2.5e4, 2.5 and integers\n  '^-?(?:0|[1-9][0-9]*)(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$')\n\n// Explicit `!!float` validation is separate from JSON implicit resolution.\nconst YAML_FLOAT_EXPLICIT_PATTERN = new RegExp(\n  // 2.5e4, 2.5 and integers\n  '^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +\n  // .2e4, .2\n  '|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +\n  // .inf\n  '|[-+]?\\\\.(?:inf|Inf|INF)' +\n  // .nan\n  '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string, isExplicit: boolean) {\n  if (isExplicit) {\n    if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n\n    let value = source.toLowerCase()\n    const sign = value[0] === '-' ? -1 : 1\n\n    if ('+-'.includes(value[0])) value = value.slice(1)\n\n    if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n    if (value === '.nan') return NaN\n\n    const result = sign * parseFloat(value)\n    return Number.isFinite(result) ? result : NOT_RESOLVED\n  }\n\n  if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED\n\n  const result = Number(source)\n\n  if (Number.isFinite(result)) return result\n  return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n  if (isNaN(object)) return '.nan'\n  if (object === Number.POSITIVE_INFINITY) return '.inf'\n  if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n  if (Object.is(object, -0)) return '-0.0'\n\n  const result = object.toString(10)\n  return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\nconst floatJsonTag = defineScalarTag('tag:yaml.org,2002:float', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional '-' or digit.\n  implicitFirstChars: ['-', ...'0123456789'],\n  resolve: resolveYamlFloat,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    typeof object === 'number' &&\n    (\n      // We land here all numbers, not handled (declined) by !!int `.identify`\n      // The same condition as for !!int, but reversed.\n\n      // Filter out integers...\n      !Number.isInteger(object) ||\n      // but allow negative zero\n      Object.is(object, -0) ||\n      // and integers with exponential form\n      object.toString(10).indexOf('e') >= 0\n    ),\n  represent: representYamlFloat\n})\n\nexport { floatJsonTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_FLOAT_PATTERN = new RegExp(\n  // 2.5e4, 2.5 and integers\n  '^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\\\.[0-9_]*)(?:[eE][-+][0-9]+)?' +\n  // 190:20:30.15\n  '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*' +\n  // .inf\n  '|[-+]?\\\\.(?:inf|Inf|INF)' +\n  // .nan\n  '|\\\\.(?:nan|NaN|NAN))$')\n\nconst YAML_FLOAT_SPECIAL_PATTERN = new RegExp(\n  '^(?:' +\n  // .inf\n  '[-+]?\\\\.(?:inf|Inf|INF)' +\n  // .nan\n  '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (source: string) {\n  if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED\n\n  let value = source.toLowerCase().replace(/_/g, '')\n  const sign = value[0] === '-' ? -1 : 1\n\n  if ('+-'.includes(value[0])) value = value.slice(1)\n\n  if (value === '.inf') return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n  if (value === '.nan') return NaN\n\n  let result = 0\n\n  if (value.includes(':')) {\n    for (const part of value.split(':')) result = result * 60 + Number(part)\n    result *= sign\n  } else {\n    result = sign * parseFloat(value)\n  }\n\n  if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result\n  return NOT_RESOLVED\n}\n\nfunction representYamlFloat (object: number) {\n  if (isNaN(object)) return '.nan'\n  if (object === Number.POSITIVE_INFINITY) return '.inf'\n  if (object === Number.NEGATIVE_INFINITY) return '-.inf'\n  if (Object.is(object, -0)) return '-0.0'\n\n  const result = object.toString(10)\n  return /^[-+]?[0-9]+e/.test(result) ? result.replace('e', '.e') : result\n}\n\nconst floatYaml11Tag = defineScalarTag('tag:yaml.org,2002:float', {\n  implicit: true,\n  // Superset of source.charAt(0) over all matched inputs: optional sign, '.', or digit\n  // ('.inf'/'.nan' start with '.').\n  implicitFirstChars: ['-', '+', '.', ...'0123456789'],\n  resolve: resolveYamlFloat,\n  identify: (object) =>\n    // No ancient boxed numbers support\n    typeof object === 'number' &&\n    (\n      // We land here all numbers, not handled (declined) by !!int `.identify`\n      // The same condition as for !!int, but reversed.\n\n      // Filter out integers...\n      !Number.isInteger(object) ||\n      // but allow negative zero\n      Object.is(object, -0) ||\n      // and integers with exponential form\n      object.toString(10).indexOf('e') >= 0\n    ),\n  represent: representYamlFloat\n})\n\nexport { floatYaml11Tag }\n","import { defineScalarTag, MERGE_KEY, NOT_RESOLVED } from '../../tag.ts'\n\nconst mergeTag = defineScalarTag('tag:yaml.org,2002:merge', {\n  implicit: true,\n  // source.charAt(0) over matched implicit inputs: '<' ('<<').\n  implicitFirstChars: ['<'],\n  resolve: (source, isExplicit) => {\n    if (source === '<<' || (isExplicit && source === '')) return MERGE_KEY\n    return NOT_RESOLVED\n  }\n})\n\nexport { mergeTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/\n\nfunction resolveYamlBinary (source: string) {\n  // Strip allowed whitespace first, so validation stays a plain base64 check.\n  const input = source.replace(/\\s/g, '')\n  if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED\n\n  const binary = atob(input)\n  const result = new Uint8Array(binary.length)\n  for (let index = 0; index < binary.length; index++) {\n    result[index] = binary.charCodeAt(index)\n  }\n  return result\n}\n\nfunction representYamlBinary (object: Uint8Array) {\n  let binary = ''\n  for (let index = 0; index < object.length; index++) {\n    binary += String.fromCharCode(object[index])\n  }\n  return btoa(binary)\n}\n\nconst binaryTag = defineScalarTag('tag:yaml.org,2002:binary', {\n  resolve: resolveYamlBinary,\n  identify: (object) => Object.prototype.toString.call(object) === '[object Uint8Array]',\n  represent: representYamlBinary\n})\n\nexport { binaryTag }\n","import { defineScalarTag, NOT_RESOLVED } from '../../tag.ts'\n\nconst YAML_DATE_REGEXP = new RegExp(\n  '^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$')\n\nconst YAML_TIMESTAMP_REGEXP = new RegExp(\n  '^([0-9][0-9][0-9][0-9])' +\n  '-([0-9][0-9]?)' +\n  '-([0-9][0-9]?)' +\n  '(?:[Tt]|[ \\\\t]+)' +\n  '([0-9][0-9]?)' +\n  ':([0-9][0-9])' +\n  ':([0-9][0-9])' +\n  '(?:\\\\.([0-9]*))?' +\n  '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' +\n  '(?::([0-9][0-9]))?))?$')\n\nfunction resolveYamlTimestamp (source: string) {\n  let match = YAML_DATE_REGEXP.exec(source)\n  if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source)\n  if (match === null) return NOT_RESOLVED\n\n  const year = +(match[1])\n  const month = +(match[2]) - 1\n  const day = +(match[3])\n\n  // Date-only form (`YYYY-MM-DD`) has no time captures.\n  if (!match[4]) {\n    const date = new Date(Date.UTC(year, month, day))\n    // Reject dates that JS would normalize, e.g. 2023-02-29 -> 2023-03-01.\n    if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n      return NOT_RESOLVED\n    }\n    return date\n  }\n\n  const hour = +(match[4])\n  const minute = +(match[5])\n  const second = +(match[6])\n  let fraction = 0\n\n  // Reject times that JS would normalize into the next minute/hour/day.\n  if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED\n\n  if (match[7]) {\n    let value = match[7].slice(0, 3)\n    while (value.length < 3) value += '0'\n    fraction = +value\n  }\n\n  const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction))\n\n  // Reject invalid calendar dates before applying timezone offset.\n  if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n    return NOT_RESOLVED\n  }\n\n  if (match[9]) {\n    const offsetHour = +(match[10])\n    const offsetMinute = +(match[11] || 0)\n    // Reject timezone offsets that JS date arithmetic would otherwise accept.\n    if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED\n\n    const offset = (offsetHour * 60 + offsetMinute) * 60000\n    date.setTime(date.getTime() - (match[9] === '-' ? -offset : offset))\n  }\n\n  return date\n}\n\nconst timestampTag = defineScalarTag('tag:yaml.org,2002:timestamp', {\n  implicit: true,\n  // Both patterns start with a 4-digit year, so source.charAt(0) is always a digit.\n  implicitFirstChars: [...'0123456789'],\n  resolve: resolveYamlTimestamp,\n  identify: (object) => object instanceof Date,\n  represent: (object: Date) => object.toISOString()\n})\n\nexport { timestampTag }\n","import { defineSequenceTag } from '../../tag.ts'\n\nconst seqTag = defineSequenceTag('tag:yaml.org,2002:seq', {\n  create: () => [] as unknown[],\n  addItem: (container, item) => {\n    container.push(item)\n  },\n  identify: Array.isArray\n})\n\nexport { seqTag }\n","import { defineSequenceTag } from '../../tag.ts'\n\ntype OmapItem = Record<string, unknown>\n\nconst omapTag = defineSequenceTag('tag:yaml.org,2002:omap', {\n  create: () => [] as OmapItem[],\n  addItem: (container, item) => {\n    if (Object.prototype.toString.call(item) !== '[object Object]') {\n      return 'cannot resolve an ordered map item'\n    }\n\n    const object = item as OmapItem\n    const itemKeys = Object.keys(object)\n\n    if (itemKeys.length !== 1) return 'cannot resolve an ordered map item'\n    for (const existing of container) {\n      if (Object.prototype.hasOwnProperty.call(existing, itemKeys[0])) {\n        return 'cannot resolve an ordered map item'\n      }\n    }\n\n    container.push(object)\n    return ''\n  }\n})\n\nexport { omapTag }\n","import { defineSequenceTag } from '../../tag.ts'\n\ntype Pair = [unknown, unknown]\n\nconst pairsTag = defineSequenceTag('tag:yaml.org,2002:pairs', {\n  create: () => [] as Pair[],\n  addItem: (container, item) => {\n    if (item instanceof Map) {\n      if (item.size !== 1) return 'cannot resolve a pairs item'\n\n      container.push(item.entries().next().value!)\n      return ''\n    }\n\n    if (Object.prototype.toString.call(item) !== '[object Object]') {\n      return 'cannot resolve a pairs item'\n    }\n\n    const object = item as Record<string, unknown>\n    const keys = Object.keys(object)\n\n    if (keys.length !== 1) return 'cannot resolve a pairs item'\n\n    container.push([keys[0], object[keys[0]]] satisfies Pair)\n    return ''\n  }\n})\n\nexport { pairsTag }\n","function isPlainObject (data: unknown): boolean {\n  if (data === null || typeof data !== 'object' || Array.isArray(data)) return false\n  const prototype = Object.getPrototypeOf(data)\n  return prototype === null || prototype === Object.prototype\n}\n\n// Project `object` onto `keys`. Absent keys are skipped (so the result can be\n// safely spread over defaults without clobbering them with `undefined`), hence\n// the `Partial` return.\nfunction pick<T extends object, K extends keyof T> (object: T, keys: readonly K[]): Partial<Pick<T, K>> {\n  const result: Partial<Pick<T, K>> = {}\n  for (const key of keys) {\n    if (object[key] !== undefined) result[key] = object[key]\n  }\n  return result\n}\n\nexport {\n  isPlainObject,\n  pick\n}\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\ntype StringMapping = Record<string, unknown>\n\nconst mapTag = defineMappingTag('tag:yaml.org,2002:map', {\n  create: (): StringMapping => ({}),\n  identify: isPlainObject,\n  // Dump side: wrap the plain object into the canonical `Map` form the writer\n  // walks. Shallow — keys/values stay references to the originals.\n  represent: (o: StringMapping) => {\n    const map = new Map<string, unknown>()\n    for (const key of Object.keys(o)) map.set(key, o[key])\n    return map\n  },\n  addPair: (container, key, value) => {\n    if (key !== null && typeof key === 'object') {\n      return 'object-based map does not support complex keys'\n    }\n    const normalizedKey = String(key)\n    if (normalizedKey === '__proto__') {\n      // Define as an own data property so a literal `__proto__` key stays data\n      // and never invokes the prototype setter.\n      Object.defineProperty(container, normalizedKey, {\n        value, enumerable: true, configurable: true, writable: true\n      })\n    } else {\n      container[normalizedKey] = value\n    }\n    return ''\n  },\n  // hasOwn, not `in`: a plain object inherits `toString` and friends.\n  has: (container, key) => {\n    if (key !== null && typeof key === 'object') return false\n    return Object.prototype.hasOwnProperty.call(container, String(key))\n  },\n  keys: (container) => Object.keys(container),\n  get: (container, key) => container[String(key)]\n})\n\nexport { mapTag, isPlainObject, type StringMapping }\n","import { defineMappingTag } from '../../tag.ts'\n\nconst setTag = defineMappingTag('tag:yaml.org,2002:set', {\n  create: () => new Set<unknown>(),\n  identify: (data) => data instanceof Set,\n  represent: (data: Set<unknown>) => {\n    const map = new Map<unknown, null>()\n    for (const key of data) map.set(key, null)\n    return map\n  },\n  addPair: (container, key, value) => {\n    if (value !== null) return 'cannot resolve a set item'\n    container.add(key)\n    return ''\n  },\n  has: (container, key) => container.has(key),\n  keys: (container) => container.keys(),\n  get: () => null\n})\n\nexport { setTag }\n","import {\n  type MappingTagDefinition,\n  type ScalarTagDefinition,\n  type SequenceTagDefinition,\n  type TagDefinition\n} from './tag.ts'\nimport { strTag } from './tag/scalar/str.ts'\nimport { nullCoreTag } from './tag/scalar/null_core.ts'\nimport { nullJsonTag } from './tag/scalar/null_json.ts'\nimport { nullYaml11Tag } from './tag/scalar/null_yaml11.ts'\nimport { boolCoreTag } from './tag/scalar/bool_core.ts'\nimport { boolJsonTag } from './tag/scalar/bool_json.ts'\nimport { boolYaml11Tag } from './tag/scalar/bool_yaml11.ts'\nimport { intCoreTag } from './tag/scalar/int_core.ts'\nimport { intJsonTag } from './tag/scalar/int_json.ts'\nimport { intYaml11Tag } from './tag/scalar/int_yaml11.ts'\nimport { floatCoreTag } from './tag/scalar/float_core.ts'\nimport { floatJsonTag } from './tag/scalar/float_json.ts'\nimport { floatYaml11Tag } from './tag/scalar/float_yaml11.ts'\nimport { mergeTag } from './tag/scalar/merge.ts'\nimport { binaryTag } from './tag/scalar/binary.ts'\nimport { timestampTag } from './tag/scalar/timestamp.ts'\nimport { seqTag } from './tag/sequence/seq.ts'\nimport { omapTag } from './tag/sequence/omap.ts'\nimport { pairsTag } from './tag/sequence/pairs.ts'\nimport { mapTag } from './tag/mapping/map.ts'\nimport { setTag } from './tag/mapping/set.ts'\n\ninterface TagDefinitionMap {\n  scalar: Record<string, ScalarTagDefinition>\n  sequence: Record<string, SequenceTagDefinition>\n  mapping: Record<string, MappingTagDefinition>\n}\n\ninterface TagDefinitionListMap {\n  scalar: ScalarTagDefinition[]\n  sequence: SequenceTagDefinition[]\n  mapping: MappingTagDefinition[]\n}\n\nfunction createTagDefinitionMap (): TagDefinitionMap {\n  return {\n    scalar: {},\n    sequence: {},\n    mapping: {}\n  }\n}\n\nfunction createTagDefinitionListMap (): TagDefinitionListMap {\n  return {\n    scalar: [],\n    sequence: [],\n    mapping: []\n  }\n}\n\nfunction compileTags (tags: readonly TagDefinition[]) {\n  const result: TagDefinition[] = []\n\n  for (const tag of tags) {\n    let index = result.length\n\n    for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {\n      const previous = result[previousIndex]\n\n      if (previous.nodeKind === tag.nodeKind &&\n          previous.tagName === tag.tagName &&\n          previous.matchByTagPrefix === tag.matchByTagPrefix) {\n        index = previousIndex\n        break\n      }\n    }\n\n    result[index] = tag\n  }\n\n  return result\n}\n\nclass Schema {\n  readonly tags: readonly TagDefinition[]\n  readonly implicitScalarTags: readonly ScalarTagDefinition[]\n  // Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds the\n  // resolvers that may match that key, in schema order; a key absent from the map\n  // uses `implicitScalarAnyFirstChar` (resolvers that declared no first-char\n  // constraint, so they apply to any first character).\n  readonly implicitScalarByFirstChar: ReadonlyMap<string, readonly ScalarTagDefinition[]>\n  readonly implicitScalarAnyFirstChar: readonly ScalarTagDefinition[]\n  // The default scalar tag (`!!str`), resolved once so the composer's fallback for\n  // unresolved plain scalars avoids a keyed lookup per scalar.\n  readonly defaultScalarTag: ScalarTagDefinition\n  // The default container tags (`!!seq` / `!!map`), used by the dumper: when a\n  // value is identified by its default tag, the tag is implicit and not printed.\n  // Undefined if the schema does not define them (then such values can't be dumped).\n  readonly defaultSequenceTag: SequenceTagDefinition | undefined\n  readonly defaultMappingTag: MappingTagDefinition | undefined\n  readonly exact: TagDefinitionMap\n  readonly prefix: TagDefinitionListMap\n\n  constructor (tags: readonly TagDefinition[]) {\n    const compiledTags = compileTags(tags)\n    const implicitScalarTags: ScalarTagDefinition[] = []\n    const exact = createTagDefinitionMap()\n    const prefix = createTagDefinitionListMap()\n\n    for (const tag of compiledTags) {\n      if (tag.nodeKind === 'scalar' && tag.implicit) {\n        if (tag.matchByTagPrefix) {\n          throw new Error('Implicit scalar tags cannot match by tag prefix')\n        }\n\n        implicitScalarTags.push(tag)\n      }\n\n      switch (tag.nodeKind) {\n        case 'scalar':\n          if (tag.matchByTagPrefix) prefix.scalar.push(tag)\n          else exact.scalar[tag.tagName] = tag\n          break\n        case 'sequence':\n          if (tag.matchByTagPrefix) prefix.sequence.push(tag)\n          else exact.sequence[tag.tagName] = tag\n          break\n        case 'mapping':\n          if (tag.matchByTagPrefix) prefix.mapping.push(tag)\n          else exact.mapping[tag.tagName] = tag\n          break\n      }\n    }\n\n    const implicitScalarAnyFirstChar = implicitScalarTags.filter(tag => tag.implicitFirstChars === null)\n\n    const keys = new Set<string>()\n    for (const tag of implicitScalarTags) {\n      if (tag.implicitFirstChars !== null) {\n        for (const key of tag.implicitFirstChars) keys.add(key)\n      }\n    }\n\n    const implicitScalarByFirstChar = new Map<string, ScalarTagDefinition[]>()\n    for (const key of keys) {\n      implicitScalarByFirstChar.set(key, implicitScalarTags.filter(tag =>\n        tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1))\n    }\n\n    const defaultScalarTag = exact.scalar['tag:yaml.org,2002:str']\n    if (!defaultScalarTag) throw new Error('schema does not define the default scalar tag (tag:yaml.org,2002:str)')\n\n    this.tags = compiledTags\n    this.implicitScalarTags = implicitScalarTags\n    this.implicitScalarByFirstChar = implicitScalarByFirstChar\n    this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar\n    this.defaultScalarTag = defaultScalarTag\n    this.defaultSequenceTag = exact.sequence['tag:yaml.org,2002:seq']\n    this.defaultMappingTag = exact.mapping['tag:yaml.org,2002:map']\n    this.exact = exact\n    this.prefix = prefix\n  }\n\n  withTags (...tags: Array<TagDefinition | readonly TagDefinition[]>): Schema {\n    let flatTags: TagDefinition[] = []\n    for (const tag of tags) flatTags = flatTags.concat(tag)\n\n    return new Schema([...this.tags, ...flatTags])\n  }\n}\n\nconst FAILSAFE_SCHEMA = new Schema([\n  strTag,\n  seqTag,\n  mapTag\n])\n\nconst JSON_SCHEMA = new Schema([\n  ...FAILSAFE_SCHEMA.tags,\n  nullJsonTag,\n  boolJsonTag,\n  intJsonTag,\n  floatJsonTag\n])\n\nconst CORE_SCHEMA = new Schema([\n  ...FAILSAFE_SCHEMA.tags,\n  nullCoreTag,\n  boolCoreTag,\n  intCoreTag,\n  floatCoreTag\n])\n\nconst YAML11_SCHEMA = new Schema([\n  ...FAILSAFE_SCHEMA.tags,\n  nullYaml11Tag,\n  boolYaml11Tag,\n  intYaml11Tag,\n  floatYaml11Tag,\n  timestampTag,\n  mergeTag,\n  binaryTag,\n  omapTag,\n  pairsTag,\n  setTag\n])\n\nexport {\n  Schema,\n  FAILSAFE_SCHEMA,\n  JSON_SCHEMA,\n  CORE_SCHEMA,\n  YAML11_SCHEMA,\n\n  type TagDefinitionMap,\n  type TagDefinitionListMap\n}\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\ntype RealMapping = Map<unknown, unknown>\n\n// A mapping represented as a real `Map`: keys keep their constructed type,\n// nothing is stringified. Drop-in replacement for the default `!!map` tag\n// (same tag name) — `CORE_SCHEMA.withTags(realMapTag)`.\nconst realMapTag = defineMappingTag('tag:yaml.org,2002:map', {\n  create: () => new Map<unknown, unknown>(),\n  addPair: (container: RealMapping, key, value) => {\n    container.set(key, value)\n    return ''\n  },\n  has: (container: RealMapping, key) => container.has(key),\n  keys: (container: RealMapping) => container.keys(),\n  get: (container: RealMapping, key) => container.get(key),\n  // Dump side: handle both a real `Map` and a plain object, so this tag fully\n  // replaces the default map representation when dumping too.\n  identify: (data) => data instanceof Map || isPlainObject(data),\n  // Dump side: the canonical mapping form is a `Map`. A real `Map` passes\n  // through untouched (keys keep their type); a plain object is wrapped\n  // shallowly. Lossless — nothing is stringified.\n  represent: (data) => {\n    if (data instanceof Map) return data\n    const map = new Map<unknown, unknown>()\n    const obj = data as Record<string, unknown>\n    for (const key of Object.keys(obj)) map.set(key, obj[key])\n    return map\n  }\n})\n\nexport { realMapTag }\n","import { defineMappingTag } from '../../tag.ts'\nimport { isPlainObject } from '../../common/object.ts'\n\ntype StringMapping = Record<string, unknown>\n\n// Coerce a constructed key into the string identity a `{}` representation uses.\n// Returns null for a nested array key (an array element that is itself an\n// array), which would otherwise blow up exponentially when stringified via\n// aliases.\nfunction normalizeKey (key: unknown): string | null {\n  if (Array.isArray(key)) {\n    const array = Array.prototype.slice.call(key) as unknown[]\n\n    for (let index = 0; index < array.length; index++) {\n      if (Array.isArray(array[index])) return null\n\n      if (typeof array[index] === 'object' &&\n          Object.prototype.toString.call(array[index]) === '[object Object]') {\n        array[index] = '[object Object]'\n      }\n    }\n\n    return String(array)\n  }\n\n  if (typeof key === 'object' &&\n      Object.prototype.toString.call(key) === '[object Object]') {\n    return '[object Object]'\n  }\n\n  return String(key)\n}\n\nconst legacyMapTag = defineMappingTag('tag:yaml.org,2002:map', {\n  create: (): StringMapping => ({}),\n  identify: isPlainObject,\n  // Dump side: wrap the plain object into the canonical `Map` form the writer\n  // walks. Shallow — keys/values stay references to the originals.\n  represent: (o: StringMapping) => {\n    const map = new Map<string, unknown>()\n    for (const key of Object.keys(o)) map.set(key, o[key])\n    return map\n  },\n  addPair: (container, key, value) => {\n    const normalizedKey = normalizeKey(key)\n    if (normalizedKey === null) return 'nested arrays are not supported inside keys'\n    if (normalizedKey === '__proto__') {\n      // Define as an own data property so a literal `__proto__` key stays data\n      // and never invokes the prototype setter.\n      Object.defineProperty(container, normalizedKey, {\n        value, enumerable: true, configurable: true, writable: true\n      })\n    } else {\n      container[normalizedKey] = value\n    }\n    return ''\n  },\n  // hasOwn, not `in`: a plain object inherits `toString` and friends.\n  has: (container, key) => {\n    const normalizedKey = normalizeKey(key)\n    return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey)\n  },\n  keys: (container) => Object.keys(container),\n  get: (container, key) => container[String(key)]\n})\n\nexport { legacyMapTag, isPlainObject, type StringMapping }\n","export interface SnippetMark {\n  name?: string | null\n  buffer: string\n  position: number\n  line: number\n  column: number\n  snippet?: string | null\n}\n\ninterface SnippetOptions {\n  maxLength?: number\n  indent?: number\n  linesBefore?: number\n  linesAfter?: number\n}\n\nconst DEFAULT_SNIPPET_OPTIONS: Required<SnippetOptions> = {\n  maxLength: 79,\n  indent: 1,\n  linesBefore: 3,\n  linesAfter: 2\n}\n\n// get snippet for a single line, respecting maxLength\nfunction getLine (buffer: string, lineStart: number, lineEnd: number, position: number, maxLineLength: number) {\n  let head = ''\n  let tail = ''\n  const maxHalfLength = Math.floor(maxLineLength / 2) - 1\n\n  if (position - lineStart > maxHalfLength) {\n    head = ' ... '\n    lineStart = position - maxHalfLength + head.length\n  }\n\n  if (lineEnd - position > maxHalfLength) {\n    tail = ' ...'\n    lineEnd = position + maxHalfLength - tail.length\n  }\n\n  return {\n    str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '→') + tail,\n    pos: position - lineStart + head.length // relative position\n  }\n}\n\nfunction padStart (string: string, max: number) {\n  // max() protects from negativa value, to avoid exception.\n  return ' '.repeat(Math.max(max - string.length, 0)) + string\n}\n\nfunction makeSnippet (mark: SnippetMark, options?: SnippetOptions) {\n  if (!mark.buffer) return null\n\n  const opts = { ...DEFAULT_SNIPPET_OPTIONS, ...options }\n\n  const re = /\\r?\\n|\\r|\\0/g\n  const lineStarts = [0]\n  const lineEnds: number[] = []\n  let match: RegExpExecArray | null\n  let foundLineNo = -1\n\n  while ((match = re.exec(mark.buffer))) {\n    lineEnds.push(match.index)\n    lineStarts.push(match.index + match[0].length)\n\n    if (mark.position <= match.index && foundLineNo < 0) {\n      foundLineNo = lineStarts.length - 2\n    }\n  }\n\n  if (foundLineNo < 0) foundLineNo = lineStarts.length - 1\n\n  let result = ''\n  const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length\n  const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3)\n\n  for (let i = 1; i <= opts.linesBefore; i++) {\n    if (foundLineNo - i < 0) break\n    const line = getLine(\n      mark.buffer,\n      lineStarts[foundLineNo - i],\n      lineEnds[foundLineNo - i],\n      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\n      maxLineLength\n    )\n    result = `${' '.repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line.str}\\n${result}`\n  }\n\n  const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength)\n  result += `${' '.repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}\\n`\n  result += `${'-'.repeat(opts.indent + lineNoLength + 3 + line.pos)}^\\n`\n\n  for (let i = 1; i <= opts.linesAfter; i++) {\n    if (foundLineNo + i >= lineEnds.length) break\n    const line = getLine(\n      mark.buffer,\n      lineStarts[foundLineNo + i],\n      lineEnds[foundLineNo + i],\n      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\n      maxLineLength\n    )\n    result += `${' '.repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line.str}\\n`\n  }\n\n  return result.replace(/\\n$/, '')\n}\n\nexport default makeSnippet\n","import makeSnippet, { type SnippetMark } from './snippet.ts'\n\n// YAML error class. http://stackoverflow.com/questions/8458984\n//\nfunction formatError (exception: YAMLException, compact?: boolean) {\n  let where = ''\n\n  if (!exception.mark) return exception.reason\n\n  if (exception.mark.name) {\n    where += `in \"${exception.mark.name}\" `\n  }\n\n  where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`\n\n  if (!compact && exception.mark.snippet) {\n    where += `\\n\\n${exception.mark.snippet}`\n  }\n\n  return `${exception.reason} ${where}`\n}\n\nclass YAMLException extends Error {\n  reason: string\n  mark?: SnippetMark\n\n  constructor (reason: string, mark?: SnippetMark) {\n    super()\n\n    this.name = 'YAMLException'\n    this.reason = reason\n    this.mark = mark\n    this.message = formatError(this, false)\n\n    // Guard for ancient browsers\n    if (Error.captureStackTrace) {\n      // Include stack trace in error object,\n      Error.captureStackTrace(this, this.constructor)\n    }\n  }\n\n  toString (compact?: boolean) {\n    return `${this.name}: ${formatError(this, compact)}`\n  }\n}\n\n// Build a YAMLException with a source snippet and throw it. `source` is the\n// raw input text (no parser sentinel); `position` is an offset into it.\nfunction throwErrorAt (source: string, position: number, message: string, filename = ''): never {\n  let line = 0\n  let lineStart = 0\n\n  for (let index = 0; index < position; index++) {\n    const ch = source.charCodeAt(index)\n\n    if (ch === 0x0A/* LF */) {\n      line++\n      lineStart = index + 1\n    } else if (ch === 0x0D/* CR */) {\n      line++\n      if (source.charCodeAt(index + 1) === 0x0A/* LF */) index++\n      lineStart = index + 1\n    }\n  }\n\n  const mark: SnippetMark = {\n    name: filename,\n    buffer: source,\n    position,\n    line,\n    column: position - lineStart\n  }\n\n  mark.snippet = makeSnippet(mark)\n  throw new YAMLException(message, mark)\n}\n\nexport { YAMLException, throwErrorAt }\n","const EVENT_DOCUMENT = 1\nconst EVENT_SEQUENCE = 2\nconst EVENT_MAPPING = 3\nconst EVENT_SCALAR = 4\nconst EVENT_ALIAS = 5\nconst EVENT_POP = 6\n\ntype EventType =\n  typeof EVENT_DOCUMENT | typeof EVENT_SEQUENCE | typeof EVENT_MAPPING |\n  typeof EVENT_SCALAR | typeof EVENT_ALIAS | typeof EVENT_POP\n\nconst SCALAR_STYLE_PLAIN = 1\nconst SCALAR_STYLE_SINGLE_QUOTED = 2\nconst SCALAR_STYLE_DOUBLE_QUOTED = 3\nconst SCALAR_STYLE_LITERAL_BLOCK = 4\nconst SCALAR_STYLE_FOLDED_BLOCK = 5\n\ntype ScalarStyle =\n  typeof SCALAR_STYLE_PLAIN | typeof SCALAR_STYLE_SINGLE_QUOTED |\n  typeof SCALAR_STYLE_DOUBLE_QUOTED | typeof SCALAR_STYLE_LITERAL_BLOCK |\n  typeof SCALAR_STYLE_FOLDED_BLOCK\n\nconst COLLECTION_STYLE_BLOCK = 1\nconst COLLECTION_STYLE_FLOW = 2\n\ntype CollectionStyle =\n  typeof COLLECTION_STYLE_BLOCK | typeof COLLECTION_STYLE_FLOW\n\nconst CHOMPING_CLIP = 1\nconst CHOMPING_STRIP = 2\nconst CHOMPING_KEEP = 3\n\ntype Chomping =\n  typeof CHOMPING_CLIP | typeof CHOMPING_STRIP | typeof CHOMPING_KEEP\n\ntype DocumentDirective =\n  { kind: 'yaml', version: string } |\n  { kind: 'tag', handle: string, prefix: string }\n\ntype TagHandlers = Record<string, string>\n\ninterface DocumentEvent {\n  type: typeof EVENT_DOCUMENT\n  explicitStart: boolean\n  explicitEnd: boolean\n  directives: DocumentDirective[]\n}\n\ninterface SequenceEvent {\n  type: typeof EVENT_SEQUENCE\n  start: number\n  anchorStart: number\n  anchorEnd: number\n  tagStart: number\n  tagEnd: number\n  style: CollectionStyle\n}\n\ninterface MappingEvent {\n  type: typeof EVENT_MAPPING\n  start: number\n  anchorStart: number\n  anchorEnd: number\n  tagStart: number\n  tagEnd: number\n  style: CollectionStyle\n}\n\ninterface ScalarEvent {\n  type: typeof EVENT_SCALAR\n  valueStart: number\n  valueEnd: number\n  anchorStart: number\n  anchorEnd: number\n  tagStart: number\n  tagEnd: number\n  style: ScalarStyle\n  chomping: Chomping\n  indent: number\n  fast: boolean\n}\n\ninterface AliasEvent {\n  type: typeof EVENT_ALIAS\n  anchorStart: number\n  anchorEnd: number\n}\n\ninterface PopEvent {\n  type: typeof EVENT_POP\n}\n\ntype Event =\n  DocumentEvent |\n  SequenceEvent |\n  MappingEvent |\n  ScalarEvent |\n  AliasEvent |\n  PopEvent\n\nexport {\n  EVENT_DOCUMENT,\n  EVENT_SEQUENCE,\n  EVENT_MAPPING,\n  EVENT_SCALAR,\n  EVENT_ALIAS,\n  EVENT_POP,\n\n  SCALAR_STYLE_PLAIN,\n  SCALAR_STYLE_SINGLE_QUOTED,\n  SCALAR_STYLE_DOUBLE_QUOTED,\n  SCALAR_STYLE_LITERAL_BLOCK,\n  SCALAR_STYLE_FOLDED_BLOCK,\n\n  COLLECTION_STYLE_BLOCK,\n  COLLECTION_STYLE_FLOW,\n\n  CHOMPING_CLIP,\n  CHOMPING_STRIP,\n  CHOMPING_KEEP,\n\n  type EventType,\n  type ScalarStyle,\n  type CollectionStyle,\n\n  type Chomping,\n  type DocumentDirective,\n  type TagHandlers,\n  type DocumentEvent,\n  type SequenceEvent,\n  type MappingEvent,\n  type ScalarEvent,\n  type AliasEvent,\n  type PopEvent,\n  type Event\n}\n","import {\n  SCALAR_STYLE_SINGLE_QUOTED,\n  SCALAR_STYLE_DOUBLE_QUOTED,\n  SCALAR_STYLE_LITERAL_BLOCK,\n  SCALAR_STYLE_FOLDED_BLOCK,\n  CHOMPING_STRIP,\n  CHOMPING_KEEP,\n  type ScalarEvent\n} from './events.ts'\n\nconst NO_RANGE = -1\n\n// --- character helpers (mirrors src/loader.ts, kept self-contained here) ---\n\nfunction simpleEscapeSequence (c: number) {\n  switch (c) {\n    case 0x30/* 0 */: return '\\x00'\n    case 0x61/* a */: return '\\x07'\n    case 0x62/* b */: return '\\x08'\n    case 0x74/* t */: return '\\x09'\n    case 0x09/* Tab */: return '\\x09'\n    case 0x6E/* n */: return '\\x0A'\n    case 0x76/* v */: return '\\x0B'\n    case 0x66/* f */: return '\\x0C'\n    case 0x72/* r */: return '\\x0D'\n    case 0x65/* e */: return '\\x1B'\n    case 0x20/* Space */: return ' '\n    case 0x22/* \" */: return '\\x22'\n    case 0x2F/* / */: return '/'\n    case 0x5C/* \\ */: return '\\x5C'\n    case 0x4E/* N */: return '\\x85'\n    case 0x5F/* _ */: return '\\xA0'\n    case 0x4C/* L */: return '\\u2028'\n    case 0x50/* P */: return '\\u2029'\n    default: return ''\n  }\n}\n\nconst simpleEscapeCheck = new Array(256)\nconst simpleEscapeMap = new Array(256)\nfor (let i = 0; i < 256; i++) {\n  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0\n  simpleEscapeMap[i] = simpleEscapeSequence(i)\n}\n\nfunction charFromCodepoint (c: number) {\n  if (c <= 0xFFFF) {\n    return String.fromCharCode(c)\n  }\n  return String.fromCharCode(\n    ((c - 0x010000) >> 10) + 0xD800,\n    ((c - 0x010000) & 0x03FF) + 0xDC00\n  )\n}\n\nfunction fromHexCode (c: number) {\n  if (c >= 0x30/* 0 */ && c <= 0x39/* 9 */) return c - 0x30\n  const lc = c | 0x20\n  // Double-quoted scalar ranges are validated by parser.ts before cooking.\n  return lc - 0x61 + 10\n}\n\nfunction escapedHexLen (c: number) {\n  if (c === 0x78/* x */) return 2\n  if (c === 0x75/* u */) return 4\n  // Double-quoted scalar ranges are validated by parser.ts before cooking.\n  return 8\n}\n\n// --- line folding helpers ---\n\n// Skip a run of line breaks plus the leading whitespace of the following\n// lines, returning the number of line breaks consumed and the new position.\nfunction skipFoldedBreaks (input: string, position: number, end: number) {\n  let breaks = 0\n\n  while (position < end) {\n    const ch = input.charCodeAt(position)\n\n    if (ch === 0x0A/* LF */) {\n      breaks++\n      position++\n    } else if (ch === 0x0D/* CR */) {\n      breaks++\n      position++\n      if (input.charCodeAt(position) === 0x0A/* LF */) position++\n    } else if (ch === 0x20/* Space */ || ch === 0x09/* Tab */) {\n      position++\n    } else {\n      break\n    }\n  }\n\n  return { position, breaks }\n}\n\n// Folding of line breaks between content chunks: a single break becomes a\n// space, several breaks become (count - 1) newlines.\nfunction foldedBreaks (count: number) {\n  if (count === 1) return ' '\n  // Called only after skipFoldedBreaks() consumed at least one line break.\n  return '\\n'.repeat(count - 1)\n}\n\n// --- per-style extractors ---\n\nfunction getPlainValue (input: string, start: number, end: number) {\n  let result = ''\n  let position = start\n  let captureStart = start\n  let captureEnd = start\n\n  while (position < end) {\n    const ch = input.charCodeAt(position)\n\n    if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n      result += input.slice(captureStart, captureEnd)\n      const fold = skipFoldedBreaks(input, position, end)\n      result += foldedBreaks(fold.breaks)\n      position = captureStart = captureEnd = fold.position\n    } else {\n      position++\n      if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n    }\n  }\n\n  return result + input.slice(captureStart, captureEnd)\n}\n\nfunction getSingleQuotedValue (input: string, start: number, end: number) {\n  let result = ''\n  let position = start\n  let captureStart = start\n  let captureEnd = start\n\n  while (position < end) {\n    const ch = input.charCodeAt(position)\n\n    if (ch === 0x27/* ' */) {\n      // Within the stored range every quote is part of an escaped '' pair.\n      result += input.slice(captureStart, position) + \"'\"\n      position += 2\n      captureStart = captureEnd = position\n    } else if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n      result += input.slice(captureStart, captureEnd)\n      const fold = skipFoldedBreaks(input, position, end)\n      result += foldedBreaks(fold.breaks)\n      position = captureStart = captureEnd = fold.position\n    } else {\n      position++\n      if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n    }\n  }\n\n  // Whitespace right before the closing quote is significant (it is only\n  // stripped when followed by a line break).\n  return result + input.slice(captureStart, end)\n}\n\nfunction getDoubleQuotedValue (input: string, start: number, end: number) {\n  let result = ''\n  let position = start\n  let captureStart = start\n  let captureEnd = start\n\n  while (position < end) {\n    const ch = input.charCodeAt(position)\n\n    if (ch === 0x5C/* \\ */) {\n      result += input.slice(captureStart, position)\n      position++\n      const escaped = input.charCodeAt(position)\n\n      if (escaped === 0x0A/* LF */ || escaped === 0x0D/* CR */) {\n        // Escaped line break: a line continuation that joins with nothing.\n        position = skipFoldedBreaks(input, position, end).position\n      } else if (escaped < 256 && simpleEscapeCheck[escaped]) {\n        result += simpleEscapeMap[escaped]\n        position++\n      } else {\n        // parser.ts has already rejected unknown escapes and invalid hex digits.\n        let hexLength = escapedHexLen(escaped)\n        let hexResult = 0\n\n        for (; hexLength > 0; hexLength--) {\n          position++\n          const digit = fromHexCode(input.charCodeAt(position))\n          hexResult = (hexResult << 4) + digit\n        }\n\n        result += charFromCodepoint(hexResult)\n        position++\n      }\n\n      captureStart = captureEnd = position\n    } else if (ch === 0x0A/* LF */ || ch === 0x0D/* CR */) {\n      result += input.slice(captureStart, captureEnd)\n      const fold = skipFoldedBreaks(input, position, end)\n      result += foldedBreaks(fold.breaks)\n      position = captureStart = captureEnd = fold.position\n    } else {\n      position++\n      if (ch !== 0x20/* Space */ && ch !== 0x09/* Tab */) captureEnd = position\n    }\n  }\n\n  return result + input.slice(captureStart, end)\n}\n\nfunction getBlockValue (\n  input: string,\n  start: number,\n  end: number,\n  indent: number,\n  chomping: number,\n  folded: boolean\n) {\n  const textIndent = indent < 0 ? 0 : indent\n  // The range starts at column 0 of the first line and includes every line\n  // break, including those of trailing blank lines.\n  const region = input.slice(start, end).replace(/\\r\\n?/g, '\\n')\n  // An empty range is a block with no lines at all (e.g. an empty `|+`) and\n  // must stay empty; a naive split would invent a phantom blank line. Otherwise\n  // a trailing line break leaves a trailing '' from split() that is not a real\n  // line (just the terminator of the last one), so drop it. Interior blank\n  // lines are kept.\n  const lines = region === ''\n    ? []\n    : (region.endsWith('\\n') ? region.slice(0, -1) : region).split('\\n')\n\n  let result = ''\n  let didReadContent = false\n  let emptyLines = 0\n  let atMoreIndented = false\n\n  for (const line of lines) {\n    // Whitespace beyond the content indentation is part of the content, so the\n    // indentation scan stops at textIndent. A line is empty only when nothing\n    // remains after the (capped) indentation.\n    // indent < 0 means no content line was detected (a wholly blank block), so\n    // every line is an empty line.\n    let column = 0\n    while (column < textIndent && line.charCodeAt(column) === 0x20/* Space */) column++\n\n    if (indent < 0 || column >= line.length) {\n      emptyLines++\n      continue\n    }\n\n    const content = line.slice(textIndent)\n    const first = content.charCodeAt(0)\n\n    if (folded) {\n      if (first === 0x20/* Space */ || first === 0x09/* Tab */) {\n        // More-indented lines are not folded.\n        atMoreIndented = true\n        result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n      } else if (atMoreIndented) {\n        atMoreIndented = false\n        result += '\\n'.repeat(emptyLines + 1)\n      } else if (emptyLines === 0) {\n        if (didReadContent) result += ' '\n      } else {\n        result += '\\n'.repeat(emptyLines)\n      }\n    } else {\n      result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n    }\n\n    result += content\n    didReadContent = true\n    emptyLines = 0\n  }\n\n  if (chomping === CHOMPING_KEEP) {\n    result += '\\n'.repeat(didReadContent ? 1 + emptyLines : emptyLines)\n  } else if (chomping !== CHOMPING_STRIP) {\n    if (didReadContent) result += '\\n'\n  }\n\n  return result\n}\n\nfunction getScalarValue (input: string, scalar: ScalarEvent): string {\n  if (scalar.valueStart === NO_RANGE) return ''\n\n  const { valueStart, valueEnd } = scalar\n\n  // Fast path: the parser marked this scalar as a verbatim slice of the input\n  // (single-line plain / quoted with no escapes or folded breaks), so the\n  // per-style char loop below would just reproduce the slice.\n  if (scalar.fast) return input.slice(valueStart, valueEnd)\n\n  switch (scalar.style) {\n    case SCALAR_STYLE_SINGLE_QUOTED:\n      return getSingleQuotedValue(input, valueStart, valueEnd)\n    case SCALAR_STYLE_DOUBLE_QUOTED:\n      return getDoubleQuotedValue(input, valueStart, valueEnd)\n    case SCALAR_STYLE_LITERAL_BLOCK:\n      return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false)\n    case SCALAR_STYLE_FOLDED_BLOCK:\n      return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true)\n    default:\n      return getPlainValue(input, valueStart, valueEnd)\n  }\n}\n\nexport {\n  getScalarValue\n}\n","const DEFAULT_TAG_HANDLERS: Readonly<Record<string, string>> = {\n  '!': '!',\n  '!!': 'tag:yaml.org,2002:'\n}\n\nfunction tagPercentEncode (source: string) {\n  return encodeURI(source).replace(/!/g, '%21')\n}\n\nfunction tagNameFull (rawTag: string, tagHandlers?: Readonly<Record<string, string>>) {\n  if (rawTag.startsWith('!<') && rawTag.endsWith('>')) {\n    return decodeURIComponent(rawTag.slice(2, -1))\n  }\n\n  const handleEnd = rawTag.indexOf('!', 1)\n  const handle = handleEnd === -1 ? '!' : rawTag.slice(0, handleEnd + 1)\n  const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle\n\n  return decodeURIComponent(prefix) + decodeURIComponent(rawTag.slice(handle.length))\n}\n\nfunction tagNameShort (fullTag: string) {\n  let tag = fullTag\n\n  if (tag.charCodeAt(0) === 0x21) {\n    tag = tag.slice(1)\n    return `!${tagPercentEncode(tag)}`\n  }\n\n  if (tag.slice(0, 18) === 'tag:yaml.org,2002:') {\n    return `!!${tagPercentEncode(tag.slice(18))}`\n  }\n\n  return `!<${tagPercentEncode(tag)}>`\n}\n\nexport {\n  tagNameFull,\n  tagNameShort\n}\n","import {\n  EVENT_ALIAS,\n  EVENT_DOCUMENT,\n  EVENT_MAPPING,\n  EVENT_POP,\n  EVENT_SCALAR,\n  EVENT_SEQUENCE,\n  SCALAR_STYLE_PLAIN,\n  type Event,\n  type TagHandlers,\n  type MappingEvent,\n  type ScalarEvent,\n  type SequenceEvent\n} from './events.ts'\nimport { getScalarValue } from './parser_scalar.ts'\nimport { CORE_SCHEMA, type Schema } from '../schema.ts'\nimport {\n  MERGE_KEY,\n  NOT_RESOLVED,\n  type MappingTagDefinition,\n  type ScalarTagDefinition,\n  type SequenceTagDefinition\n} from '../tag.ts'\nimport { YAMLException, throwErrorAt } from '../common/exception.ts'\nimport { tagNameFull } from '../common/tagname.ts'\n\nconst NO_RANGE = -1\n\ninterface DocumentFrame {\n  kind: 'document'\n  position: number\n  value: unknown\n  hasValue: boolean\n}\n\ninterface SequenceFrame {\n  kind: 'sequence'\n  position: number\n  value: any\n  tag: SequenceTagDefinition<any, any>\n  anchor: Anchor | null\n  index: number\n  // True when this sequence is the source list of a `<<` merge (`<<: [...]`).\n  // Each element is validated as a mapping on arrival; the materialized list is\n  // then delivered to the target mapping, which folds the elements in.\n  merge: boolean\n}\n\ninterface MappingFrame {\n  kind: 'mapping'\n  position: number\n  value: any\n  tag: MappingTagDefinition<any, any>\n  anchor: Anchor | null\n  key: unknown\n  keyPosition: number\n  hasKey: boolean\n  // Keys brought in by a merge that an explicit pair is still allowed to\n  // override. Lazily allocated: stays null for mappings without `<<`.\n  overridable: Set<unknown> | null\n}\n\ntype Frame = DocumentFrame | SequenceFrame | MappingFrame\n\ntype AnyTag = ScalarTagDefinition | SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>\n\ninterface ValueAndTag {\n  value: unknown\n  tag: AnyTag\n}\n\ninterface Anchor {\n  value: unknown\n  tag: AnyTag\n  isValueFinal: boolean\n}\n\ninterface ConstructorOptions {\n  source: string\n  filename?: string\n  schema?: Schema\n  json?: boolean\n  maxTotalMergeKeys?: number\n  maxAliases?: number\n}\n\n// `source` is input data, not config — so it has no default here.\nconst DEFAULT_CONSTRUCTOR_OPTIONS: Required<Omit<ConstructorOptions, 'source'>> = {\n  filename: '',\n  schema: CORE_SCHEMA,\n  json: false,\n  maxTotalMergeKeys: 10000,\n  maxAliases: -1\n}\n\ninterface ConstructorState extends Required<ConstructorOptions> {\n  events: Event[]\n  documents: unknown[]\n  eventIndex: number\n  position: number\n  frames: Frame[]\n  anchors: Map<string, Anchor>\n  tagHandlers: TagHandlers\n  totalMergeKeys: number\n  aliasCount: number\n}\n\nfunction eventPosition (event: Event) {\n  if ('tagStart' in event && event.tagStart !== NO_RANGE) return event.tagStart\n  if ('anchorStart' in event && event.anchorStart !== NO_RANGE) return event.anchorStart\n  if ('valueStart' in event && event.valueStart !== NO_RANGE) return event.valueStart\n  if ('start' in event) return event.start\n  return 0\n}\n\nfunction throwError (state: ConstructorState, message: string): never {\n  throwErrorAt(state.source, state.position, message, state.filename)\n}\n\nfunction finalizeCollection (\n  state: ConstructorState,\n  position: number,\n  tag: SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>,\n  carrier: unknown\n) {\n  try {\n    return tag.finalize(carrier)\n  } catch (error) {\n    if (error instanceof YAMLException) throw error\n    throwErrorAt(\n      state.source,\n      position,\n      error instanceof Error ? error.message : String(error),\n      state.filename\n    )\n  }\n}\n\nfunction lookupTag<T extends ScalarTagDefinition | SequenceTagDefinition | MappingTagDefinition> (\n  exact: Record<string, T>,\n  prefix: readonly T[],\n  tagName: string\n): T | undefined {\n  const exactTag = exact[tagName]\n  if (exactTag) return exactTag\n\n  for (const tag of prefix) {\n    if (tagName.startsWith(tag.tagName)) return tag\n  }\n\n  return undefined\n}\n\nfunction findExplicitTag<T extends ScalarTagDefinition | SequenceTagDefinition | MappingTagDefinition> (\n  state: ConstructorState,\n  exact: Record<string, T>,\n  prefix: readonly T[],\n  tagName: string,\n  nodeKind: T['nodeKind']\n) {\n  const tag = lookupTag(exact, prefix, tagName)\n  if (tag) return tag\n\n  throwError(state, `unknown ${nodeKind} tag !<${tagName}>`)\n}\n\nfunction constructScalar (\n  state: ConstructorState,\n  event: ScalarEvent\n): ValueAndTag {\n  const source = getScalarValue(state.source, event)\n  const rawTag = event.tagStart === NO_RANGE\n    ? ''\n    : state.source.slice(event.tagStart, event.tagEnd)\n  const strTag = state.schema.defaultScalarTag\n\n  if (rawTag !== '') {\n    if (rawTag === '!') return { value: source, tag: strTag }\n\n    const tagName = tagNameFull(rawTag, state.tagHandlers)\n    const scalarTag = lookupTag(state.schema.exact.scalar, state.schema.prefix.scalar, tagName)\n\n    if (scalarTag) {\n      const result = scalarTag.resolve(source, true, tagName)\n\n      if (result === NOT_RESOLVED) {\n        throwError(state, `cannot resolve a node with !<${tagName}> explicit tag`)\n      }\n\n      return { value: result, tag: scalarTag }\n    }\n\n    // An empty node carrying a collection tag (e.g. `!!map`, `!!seq`) is emitted\n    // by the parser as a scalar event, since there is no collection syntax to key\n    // off. Resolve it here by the explicit tag's kind into an empty collection.\n    const collectionTagDef =\n      lookupTag(state.schema.exact.mapping, state.schema.prefix.mapping, tagName) ??\n      lookupTag(state.schema.exact.sequence, state.schema.prefix.sequence, tagName)\n\n    if (collectionTagDef) {\n      if (source !== '') {\n        throwError(state, `cannot resolve a node with !<${tagName}> explicit tag`)\n      }\n\n      const carrier = collectionTagDef.create(tagName)\n      const value = collectionTagDef.carrierIsResult\n        ? carrier\n        : finalizeCollection(state, state.position, collectionTagDef, carrier)\n      return { value, tag: collectionTagDef }\n    }\n\n    throwError(state, `unknown scalar tag !<${tagName}>`)\n  }\n\n  if (event.style === SCALAR_STYLE_PLAIN) {\n    // charAt(0) (not source[0]) yields '' for an empty source, which is the key\n    // the null tag declares; source[0] would be undefined and miss that bucket.\n    const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ??\n      state.schema.implicitScalarAnyFirstChar\n    for (const tag of candidates) {\n      const result = tag.resolve(source, false, tag.tagName)\n      if (result !== NOT_RESOLVED) return { value: result, tag }\n    }\n  }\n\n  return { value: strTag.resolve(source, false, strTag.tagName), tag: strTag }\n}\n\nfunction collectionTag<Tag extends SequenceTagDefinition | MappingTagDefinition> (\n  state: ConstructorState,\n  event: SequenceEvent | MappingEvent,\n  exact: Record<string, Tag>,\n  prefix: readonly Tag[],\n  defaultTagName: string,\n  nodeKind: Tag['nodeKind']\n) {\n  const rawTag = event.tagStart === NO_RANGE\n    ? ''\n    : state.source.slice(event.tagStart, event.tagEnd)\n  const tagName = rawTag === '' || rawTag === '!'\n    ? defaultTagName\n    : tagNameFull(rawTag, state.tagHandlers)\n\n  return {\n    tagName,\n    tag: findExplicitTag(state, exact, prefix, tagName, nodeKind)\n  }\n}\n\n// A merge source must be a mapping; every mapping tag exposes the read side.\nfunction isMappingTag (tag: AnyTag): tag is MappingTagDefinition<any, any> {\n  return tag.nodeKind === 'mapping'\n}\n\n// Fold the keys of one mapping source into the target frame, honoring merge\n// precedence: an already-present key (explicit or from an earlier source) wins.\nfunction mergeKeys (state: ConstructorState, frame: MappingFrame, source: unknown, sourceTag: MappingTagDefinition<any, any>) {\n  for (const sourceKey of sourceTag.keys(source)) {\n    if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {\n      throwError(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`)\n    }\n\n    if (frame.tag.has(frame.value, sourceKey)) continue\n\n    const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey))\n    if (err) throwError(state, err)\n    ;(frame.overridable ??= new Set()).add(sourceKey)\n  }\n}\n\n// The value of a `<<` key: either a mapping (fold its keys) or a sequence of\n// mappings (fold each). A merge sequence has already had every element validated\n// as a mapping on arrival (see addValue), and its elements were built by the\n// target's own mapping tag, so they are read back with it.\nfunction mergeSource (state: ConstructorState, frame: MappingFrame, source: unknown, sourceTag: AnyTag) {\n  state.position = frame.keyPosition\n\n  if (isMappingTag(sourceTag)) {\n    mergeKeys(state, frame, source, sourceTag)\n  } else if (sourceTag.nodeKind === 'sequence' && Array.isArray(source)) {\n    for (const element of source) {\n      mergeKeys(state, frame, element, frame.tag)\n    }\n  } else {\n    throwError(state, 'cannot merge mappings; the provided source object is unacceptable')\n  }\n}\n\nfunction addMappingValue (state: ConstructorState, frame: MappingFrame, key: unknown, value: unknown, tag: AnyTag) {\n  state.position = frame.keyPosition\n\n  // `<<` is intercepted before dedup, so a repeated merge key is allowed.\n  if (key === MERGE_KEY) {\n    mergeSource(state, frame, value, tag)\n    return\n  }\n\n  if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) {\n    throwError(state, 'duplicated mapping key')\n  }\n\n  const err = frame.tag.addPair(frame.value, key, value)\n  if (err) throwError(state, err)\n  frame.overridable?.delete(key)\n}\n\nfunction addValue (state: ConstructorState, value: unknown, tag: AnyTag) {\n  const frame = state.frames[state.frames.length - 1]!\n\n  if (frame.kind === 'document') {\n    frame.value = value\n    frame.hasValue = true\n  } else if (frame.kind === 'sequence') {\n    if (frame.merge) {\n      // Element of a `<<: [...]` list: validate it is a mapping, then collect\n      // it like any other item for the target to fold in.\n      if (!isMappingTag(tag)) {\n        throwError(state, 'cannot merge mappings; the provided source object is unacceptable')\n      }\n    }\n    const err = frame.tag.addItem(frame.value, value, frame.index++)\n    if (err) throwError(state, err)\n  } else if (frame.hasKey) {\n    const key = frame.key\n    frame.key = undefined\n    frame.hasKey = false\n    addMappingValue(state, frame, key, value, tag)\n  } else {\n    frame.key = value\n    frame.keyPosition = state.position\n    frame.hasKey = true\n  }\n}\n\nfunction storeAnchor (\n  state: ConstructorState,\n  event: ScalarEvent | SequenceEvent | MappingEvent,\n  value: unknown,\n  tag: AnyTag,\n  isValueFinal: boolean\n): Anchor | null {\n  if (event.anchorStart !== NO_RANGE) {\n    const anchor = {\n      value,\n      tag,\n      isValueFinal\n    }\n    state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor)\n    return anchor\n  }\n\n  return null\n}\n\nfunction constructFromEvents (events: Event[], options: ConstructorOptions): unknown[] {\n  const state: ConstructorState = {\n    ...DEFAULT_CONSTRUCTOR_OPTIONS,\n    ...options,\n    events,\n    documents: [],\n    eventIndex: 0,\n    position: 0,\n    frames: [],\n    anchors: new Map(),\n    tagHandlers: Object.create(null),\n    totalMergeKeys: 0,\n    aliasCount: 0\n  }\n\n  while (state.eventIndex < state.events.length) {\n    const event = state.events[state.eventIndex++]\n    state.position = eventPosition(event)\n\n    switch (event.type) {\n      case EVENT_DOCUMENT:\n        state.anchors = new Map()\n        state.aliasCount = 0\n        state.tagHandlers = Object.create(null)\n        for (const directive of event.directives) {\n          if (directive.kind === 'tag') state.tagHandlers[directive.handle] = directive.prefix\n        }\n        state.frames.push({ kind: 'document', position: state.position, value: undefined, hasValue: false })\n        break\n\n      case EVENT_SCALAR: {\n        const { value, tag } = constructScalar(state, event)\n        storeAnchor(state, event, value, tag, true)\n        addValue(state, value, tag)\n        break\n      }\n\n      case EVENT_SEQUENCE: {\n        const definition = collectionTag(\n          state,\n          event,\n          state.schema.exact.sequence,\n          state.schema.prefix.sequence,\n          'tag:yaml.org,2002:seq',\n          'sequence'\n        )\n        const value = definition.tag.create(definition.tagName)\n        const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult)\n\n        // `<<: [...]` — the parent mapping is waiting on a merge key, so this\n        // sequence is a list of merge sources: its elements must be mappings.\n        // It is still built and delivered as a normal value; the target folds it.\n        const parent = state.frames[state.frames.length - 1]\n        const merge = parent !== undefined && parent.kind === 'mapping' &&\n          parent.hasKey && parent.key === MERGE_KEY\n\n        state.frames.push({\n          kind: 'sequence', position: state.position, value, tag: definition.tag, anchor, index: 0, merge\n        })\n        break\n      }\n\n      case EVENT_MAPPING: {\n        const definition = collectionTag(\n          state,\n          event,\n          state.schema.exact.mapping,\n          state.schema.prefix.mapping,\n          'tag:yaml.org,2002:map',\n          'mapping'\n        )\n        const value = definition.tag.create(definition.tagName)\n        const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult)\n        state.frames.push({\n          kind: 'mapping',\n          position: state.position,\n          value,\n          tag: definition.tag,\n          anchor,\n          key: undefined,\n          keyPosition: state.position,\n          hasKey: false,\n          overridable: null\n        })\n        break\n      }\n\n      case EVENT_ALIAS: {\n        if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) {\n          throwError(state, `aliases exceeded maxAliases (${state.maxAliases})`)\n        }\n\n        const name = state.source.slice(event.anchorStart, event.anchorEnd)\n        const anchor = state.anchors.get(name)\n        if (!anchor) {\n          throwError(state, `unidentified alias \"${name}\"`)\n        }\n        if (!anchor.isValueFinal) {\n          throwError(state, `recursive alias \"${name}\" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`)\n        }\n        addValue(state, anchor.value, anchor.tag)\n        break\n      }\n\n      case EVENT_POP: {\n        const frame = state.frames.pop()!\n\n        if (frame.kind === 'document') {\n          state.documents.push(frame.value)\n        } else {\n          const value = frame.tag.carrierIsResult\n            ? frame.value\n            : finalizeCollection(state, frame.position, frame.tag, frame.value)\n          if (frame.anchor) {\n            frame.anchor.value = value\n            frame.anchor.isValueFinal = true\n          }\n          addValue(state, value, frame.tag)\n        }\n        break\n      }\n    }\n  }\n\n  return state.documents\n}\n\nexport {\n  constructFromEvents,\n  DEFAULT_CONSTRUCTOR_OPTIONS,\n  type ConstructorOptions\n}\n","import {\n  EVENT_DOCUMENT,\n  EVENT_SEQUENCE,\n  EVENT_MAPPING,\n  EVENT_SCALAR,\n  EVENT_ALIAS,\n  EVENT_POP,\n  SCALAR_STYLE_PLAIN,\n  SCALAR_STYLE_SINGLE_QUOTED,\n  SCALAR_STYLE_DOUBLE_QUOTED,\n  SCALAR_STYLE_LITERAL_BLOCK,\n  SCALAR_STYLE_FOLDED_BLOCK,\n  COLLECTION_STYLE_BLOCK,\n  COLLECTION_STYLE_FLOW,\n  CHOMPING_CLIP,\n  CHOMPING_STRIP,\n  CHOMPING_KEEP,\n  type Event,\n  type ScalarStyle,\n  type CollectionStyle,\n  type Chomping,\n  type DocumentDirective,\n  type TagHandlers\n} from './events.ts'\nimport { throwErrorAt } from '../common/exception.ts'\n\nconst NO_RANGE = -1\nconst HAS_OWN = Object.prototype.hasOwnProperty\n\nconst CONTEXT_FLOW_IN = 1\nconst CONTEXT_FLOW_OUT = 2\nconst CONTEXT_BLOCK_IN = 3\nconst CONTEXT_BLOCK_OUT = 4\n\n// eslint-disable-next-line no-control-regex\nconst PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_FLOW_INDICATORS = /[,\\[\\]{}]/\n// YAML 1.2.2, [91] c-tag-handle.\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/\n// YAML 1.2.2, [39] ns-uri-char.\n// eslint-disable-next-line no-useless-escape\nconst NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$,_.!~*'()\\[\\]])`\n// YAML 1.2.2, [40] ns-tag-char = ns-uri-char - \"!\" - c-flow-indicator.\n// eslint-disable-next-line no-useless-escape\nconst NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$.~*'()_])`\nconst PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`)\n// YAML 1.2.2, [99] c-ns-shorthand-tag suffix part.\nconst PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`)\n// YAML 1.2.2, [93] ns-tag-prefix.\nconst PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`)\n\ntype NodeContext =\n  typeof CONTEXT_FLOW_IN | typeof CONTEXT_FLOW_OUT |\n  typeof CONTEXT_BLOCK_IN | typeof CONTEXT_BLOCK_OUT\n\ninterface NodeProperties {\n  anchorStart: number\n  anchorEnd: number\n  tagStart: number\n  tagEnd: number\n}\n\ninterface ParserSnapshot {\n  position: number\n  line: number\n  lineStart: number\n  lineIndent: number\n  firstTabInLine: number\n  eventsLength: number\n}\n\ninterface ParserOptions {\n  filename?: string\n  maxDepth?: number\n}\n\nconst DEFAULT_PARSER_OPTIONS: Required<ParserOptions> = {\n  filename: '',\n  maxDepth: 100\n}\n\ninterface ParserState extends Required<ParserOptions> {\n  input: string\n  length: number\n  position: number\n  line: number\n  lineStart: number\n  lineIndent: number\n  firstTabInLine: number\n  depth: number\n  directives: DocumentDirective[]\n  tagHandlers: TagHandlers\n  events: Event[]\n}\n\nfunction addDocumentEvent (\n  state: ParserState,\n  explicitStart: boolean,\n  explicitEnd: boolean\n) {\n  state.events.push({\n    type: EVENT_DOCUMENT,\n    explicitStart,\n    explicitEnd,\n    directives: state.directives\n  })\n}\n\nfunction addSequenceEvent (\n  state: ParserState,\n  start: number,\n  anchorStart: number,\n  anchorEnd: number,\n  tagStart: number,\n  tagEnd: number,\n  style: CollectionStyle\n) {\n  state.events.push({\n    type: EVENT_SEQUENCE,\n    start,\n    anchorStart,\n    anchorEnd,\n    tagStart,\n    tagEnd,\n    style\n  })\n}\n\nfunction addMappingEvent (\n  state: ParserState,\n  start: number,\n  anchorStart: number,\n  anchorEnd: number,\n  tagStart: number,\n  tagEnd: number,\n  style: CollectionStyle\n) {\n  state.events.push({\n    type: EVENT_MAPPING,\n    start,\n    anchorStart,\n    anchorEnd,\n    tagStart,\n    tagEnd,\n    style\n  })\n}\n\nfunction addScalarEvent (\n  state: ParserState,\n  valueStart: number,\n  valueEnd: number,\n  anchorStart: number,\n  anchorEnd: number,\n  tagStart: number,\n  tagEnd: number,\n  style: ScalarStyle,\n  chomping: Chomping = CHOMPING_CLIP,\n  indent = -1,\n  fast = false\n) {\n  state.events.push({\n    type: EVENT_SCALAR,\n    valueStart,\n    valueEnd,\n    anchorStart,\n    anchorEnd,\n    tagStart,\n    tagEnd,\n    style,\n    chomping,\n    indent,\n    fast\n  })\n}\n\nfunction addAliasEvent (\n  state: ParserState,\n  anchorStart: number,\n  anchorEnd: number\n) {\n  state.events.push({\n    type: EVENT_ALIAS,\n    anchorStart,\n    anchorEnd\n  })\n}\n\nfunction addPopEvent (state: ParserState) {\n  state.events.push({ type: EVENT_POP })\n}\n\nfunction addEmptyScalarEvent (state: ParserState) {\n  addScalarEvent(\n    state,\n    NO_RANGE,\n    NO_RANGE,\n    NO_RANGE,\n    NO_RANGE,\n    NO_RANGE,\n    NO_RANGE,\n    SCALAR_STYLE_PLAIN\n  )\n}\n\nfunction emptyProperties (): NodeProperties {\n  return {\n    anchorStart: NO_RANGE,\n    anchorEnd: NO_RANGE,\n    tagStart: NO_RANGE,\n    tagEnd: NO_RANGE\n  }\n}\n\nfunction snapshotState (state: ParserState): ParserSnapshot {\n  return {\n    position: state.position,\n    line: state.line,\n    lineStart: state.lineStart,\n    lineIndent: state.lineIndent,\n    firstTabInLine: state.firstTabInLine,\n    eventsLength: state.events.length\n  }\n}\n\nfunction restoreState (state: ParserState, snapshot: ParserSnapshot) {\n  state.position = snapshot.position\n  state.line = snapshot.line\n  state.lineStart = snapshot.lineStart\n  state.lineIndent = snapshot.lineIndent\n  state.firstTabInLine = snapshot.firstTabInLine\n  state.events.length = snapshot.eventsLength\n}\n\nfunction throwError (state: ParserState, message: string): never {\n  throwErrorAt(state.input.slice(0, state.length), state.position, message, state.filename)\n}\n\nfunction isEol (c: number) {\n  return c === 0x0A/* LF */ || c === 0x0D/* CR */\n}\n\nfunction isWhiteSpace (c: number) {\n  return c === 0x09/* Tab */ || c === 0x20/* Space */\n}\n\nfunction isWsOrEol (c: number) {\n  return isWhiteSpace(c) || isEol(c)\n}\n\nfunction isWsOrEolOrEnd (c: number) {\n  return c === 0 || isWsOrEol(c)\n}\n\nfunction isFlowIndicator (c: number) {\n  return c === 0x2C/* , */ ||\n         c === 0x5B/* [ */ ||\n         c === 0x5D/* ] */ ||\n         c === 0x7B/* { */ ||\n         c === 0x7D/* } */\n}\n\nfunction fromDecimalCode (c: number) {\n  return c >= 0x30/* 0 */ && c <= 0x39/* 9 */ ? c - 0x30 : -1\n}\n\nfunction fromHexCode (c: number) {\n  if (c >= 0x30/* 0 */ && c <= 0x39/* 9 */) return c - 0x30\n  const lc = c | 0x20\n  if (lc >= 0x61/* a */ && lc <= 0x66/* f */) return lc - 0x61 + 10\n  return -1\n}\n\nfunction escapedHexLen (c: number) {\n  if (c === 0x78/* x */) return 2\n  if (c === 0x75/* u */) return 4\n  if (c === 0x55/* U */) return 8\n  return 0\n}\n\nfunction isSimpleEscape (c: number) {\n  return c === 0x30/* 0 */ ||\n         c === 0x61/* a */ ||\n         c === 0x62/* b */ ||\n         c === 0x74/* t */ ||\n         c === 0x09/* Tab */ ||\n         c === 0x6E/* n */ ||\n         c === 0x76/* v */ ||\n         c === 0x66/* f */ ||\n         c === 0x72/* r */ ||\n         c === 0x65/* e */ ||\n         c === 0x20/* Space */ ||\n         c === 0x22/* \" */ ||\n         c === 0x2F/* / */ ||\n         c === 0x5C/* \\ */ ||\n         c === 0x4E/* N */ ||\n         c === 0x5F/* _ */ ||\n         c === 0x4C/* L */ ||\n         c === 0x50/* P */\n}\n\n// Precondition: state.position points at LF or CR.\nfunction consumeLineBreak (state: ParserState) {\n  const ch = state.input.charCodeAt(state.position)\n\n  if (ch === 0x0A/* LF */) {\n    state.position++\n  } else {\n    state.position++\n    if (state.input.charCodeAt(state.position) === 0x0A/* LF */) state.position++\n  }\n\n  state.line++\n  state.lineStart = state.position\n  state.lineIndent = 0\n  state.firstTabInLine = -1\n}\n\nfunction skipSeparationSpace (state: ParserState, allowComments: boolean) {\n  let lineBreaks = 0\n  let ch = state.input.charCodeAt(state.position)\n  let hasSeparation = state.position === state.lineStart ||\n    isWsOrEol(state.input.charCodeAt(state.position - 1))\n\n  while (ch !== 0) {\n    while (isWhiteSpace(ch)) {\n      hasSeparation = true\n      if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\n        state.firstTabInLine = state.position\n      }\n      ch = state.input.charCodeAt(++state.position)\n    }\n\n    if (allowComments && hasSeparation && ch === 0x23/* # */) {\n      do { ch = state.input.charCodeAt(++state.position) }\n      while (!isEol(ch) && ch !== 0)\n    }\n\n    if (!isEol(ch)) break\n\n    consumeLineBreak(state)\n    lineBreaks++\n    hasSeparation = true\n    ch = state.input.charCodeAt(state.position)\n\n    while (ch === 0x20/* Space */) {\n      state.lineIndent++\n      ch = state.input.charCodeAt(++state.position)\n    }\n  }\n\n  return lineBreaks\n}\n\nfunction testDocumentSeparator (state: ParserState, position = state.position) {\n  const ch = state.input.charCodeAt(position)\n\n  if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n      ch === state.input.charCodeAt(position + 1) &&\n      ch === state.input.charCodeAt(position + 2)) {\n    const following = state.input.charCodeAt(position + 3)\n    return following === 0 || isWsOrEol(following)\n  }\n\n  return false\n}\n\nfunction skipUntilLineEnd (state: ParserState) {\n  let ch = state.input.charCodeAt(state.position)\n\n  while (ch !== 0 && !isEol(ch)) {\n    ch = state.input.charCodeAt(++state.position)\n  }\n}\n\nfunction checkPrintable (state: ParserState, start: number, end: number) {\n  if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) {\n    throwError(state, 'the stream contains non-printable characters')\n  }\n}\n\nfunction readTagProperty (state: ParserState, props: NodeProperties, inFlow: boolean) {\n  if (state.input.charCodeAt(state.position) !== 0x21/* ! */) return false\n  if (props.tagStart !== NO_RANGE) throwError(state, 'duplication of a tag property')\n\n  const start = state.position\n  let isVerbatim = false\n  let isNamed = false\n  let tagHandle = '!'\n  let ch = state.input.charCodeAt(++state.position)\n\n  if (ch === 0x3C/* < */) {\n    isVerbatim = true\n    ch = state.input.charCodeAt(++state.position)\n  } else if (ch === 0x21/* ! */) {\n    isNamed = true\n    tagHandle = '!!'\n    ch = state.input.charCodeAt(++state.position)\n  }\n\n  let suffixStart = state.position\n  let tagName\n\n  if (isVerbatim) {\n    while (ch !== 0 && ch !== 0x3E/* > */) ch = state.input.charCodeAt(++state.position)\n    if (ch !== 0x3E/* > */) throwError(state, 'unexpected end of the stream within a verbatim tag')\n    tagName = state.input.slice(suffixStart, state.position)\n    state.position++\n  } else {\n    while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {\n      if (ch === 0x21/* ! */) {\n        if (!isNamed) {\n          tagHandle = state.input.slice(suffixStart - 1, state.position + 1)\n          if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, 'named tag handle cannot contain such characters')\n          isNamed = true\n          suffixStart = state.position + 1\n        } else {\n          throwError(state, 'tag suffix cannot contain exclamation marks')\n        }\n      }\n\n      ch = state.input.charCodeAt(++state.position)\n    }\n\n    tagName = state.input.slice(suffixStart, state.position)\n    if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, 'tag suffix cannot contain flow indicator characters')\n  }\n\n  if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) {\n    throwError(state, `tag name cannot contain such characters: ${tagName}`)\n  }\n  try {\n    decodeURIComponent(tagName)\n  } catch {\n    throwError(state, `tag name is malformed: ${tagName}`)\n  }\n\n  if (!isVerbatim && tagHandle !== '!' && tagHandle !== '!!' && !HAS_OWN.call(state.tagHandlers, tagHandle)) {\n    throwError(state, `undeclared tag handle \"${tagHandle}\"`)\n  }\n\n  props.tagStart = start\n  props.tagEnd = state.position\n  return true\n}\n\nfunction readAnchorProperty (state: ParserState, props: NodeProperties) {\n  if (state.input.charCodeAt(state.position) !== 0x26/* & */) return false\n  if (props.anchorStart !== NO_RANGE) throwError(state, 'duplication of an anchor property')\n\n  state.position++\n  const start = state.position\n\n  while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) {\n    state.position++\n  }\n\n  if (state.position === start) throwError(state, 'name of an anchor node must contain at least one character')\n\n  props.anchorStart = start\n  props.anchorEnd = state.position\n  return true\n}\n\nfunction readAlias (state: ParserState, props: NodeProperties) {\n  if (state.input.charCodeAt(state.position) !== 0x2A/* * */) return false\n  if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n    throwError(state, 'alias node should not have any properties')\n  }\n\n  state.position++\n  const start = state.position\n\n  while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) {\n    state.position++\n  }\n\n  if (state.position === start) throwError(state, 'name of an alias node must contain at least one character')\n\n  addAliasEvent(state, start, state.position)\n  return true\n}\n\nfunction readFlowScalarBreak (state: ParserState, nodeIndent: number) {\n  skipSeparationSpace(state, false)\n\n  if (state.lineIndent < nodeIndent) {\n    throwError(state, 'deficient indentation')\n  }\n}\n\nfunction readSingleQuotedScalar (state: ParserState, nodeIndent: number, props: NodeProperties) {\n  if (state.input.charCodeAt(state.position) !== 0x27/* ' */) return false\n\n  state.position++\n  const start = state.position\n  // A single-quoted scalar is sliceable verbatim when it has no '' escape pairs\n  // and no folded line breaks (see getScalarValue fast path).\n  let simple = true\n\n  while (state.input.charCodeAt(state.position) !== 0) {\n    const ch = state.input.charCodeAt(state.position)\n\n    if (ch === 0x27/* ' */) {\n      if (state.input.charCodeAt(state.position + 1) === 0x27/* ' */) {\n        simple = false\n        state.position += 2\n        continue\n      }\n\n      const end = state.position\n      state.position++\n      addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE_SINGLE_QUOTED, CHOMPING_CLIP, -1, simple)\n      return true\n    }\n\n    if (isEol(ch)) {\n      simple = false\n      readFlowScalarBreak(state, nodeIndent)\n    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n      throwError(state, 'unexpected end of the document within a single quoted scalar')\n    } else if (ch !== 0x09/* Tab */ && ch < 0x20) {\n      throwError(state, 'expected valid JSON character')\n    } else {\n      state.position++\n    }\n  }\n\n  throwError(state, 'unexpected end of the stream within a single quoted scalar')\n}\n\nfunction readDoubleQuotedScalar (state: ParserState, nodeIndent: number, props: NodeProperties) {\n  if (state.input.charCodeAt(state.position) !== 0x22/* \" */) return false\n\n  state.position++\n  const start = state.position\n  // A double-quoted scalar is sliceable verbatim when it has no \\ escapes and\n  // no folded line breaks (see getScalarValue fast path).\n  let simple = true\n\n  while (state.input.charCodeAt(state.position) !== 0) {\n    const ch = state.input.charCodeAt(state.position)\n\n    if (ch === 0x22/* \" */) {\n      const end = state.position\n      state.position++\n      addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE_DOUBLE_QUOTED, CHOMPING_CLIP, -1, simple)\n      return true\n    }\n\n    if (ch === 0x5C/* \\ */) {\n      simple = false\n      const escaped = state.input.charCodeAt(++state.position)\n\n      if (isEol(escaped)) {\n        readFlowScalarBreak(state, nodeIndent)\n      } else if (isSimpleEscape(escaped)) {\n        state.position++\n      } else {\n        let hexLength = escapedHexLen(escaped)\n\n        if (hexLength === 0) throwError(state, 'unknown escape sequence')\n\n        while (hexLength-- > 0) {\n          state.position++\n          if (fromHexCode(state.input.charCodeAt(state.position)) < 0) {\n            throwError(state, 'expected hexadecimal character')\n          }\n        }\n        state.position++\n      }\n    } else if (isEol(ch)) {\n      simple = false\n      readFlowScalarBreak(state, nodeIndent)\n    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n      throwError(state, 'unexpected end of the document within a double quoted scalar')\n    } else if (ch !== 0x09/* Tab */ && ch < 0x20) {\n      throwError(state, 'expected valid JSON character')\n    } else {\n      state.position++\n    }\n  }\n\n  throwError(state, 'unexpected end of the stream within a double quoted scalar')\n}\n\nfunction readBlockScalar (state: ParserState, parentIndent: number, props: NodeProperties) {\n  const ch = state.input.charCodeAt(state.position)\n  let chomping: Chomping = CHOMPING_CLIP\n  let indent = -1\n  let detectedIndent = false\n\n  if (ch !== 0x7C/* | */ && ch !== 0x3E/* > */) return false\n\n  const style = ch === 0x7C/* | */ ? SCALAR_STYLE_LITERAL_BLOCK : SCALAR_STYLE_FOLDED_BLOCK\n  state.position++\n\n  while (state.input.charCodeAt(state.position) !== 0) {\n    const current = state.input.charCodeAt(state.position)\n    const digit = fromDecimalCode(current)\n\n    if (current === 0x2B/* + */ || current === 0x2D/* - */) {\n      if (chomping !== CHOMPING_CLIP) throwError(state, 'repeat of a chomping mode identifier')\n      chomping = current === 0x2B/* + */ ? CHOMPING_KEEP : CHOMPING_STRIP\n      state.position++\n    } else if (digit >= 0) {\n      if (digit === 0) {\n        throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one')\n      }\n      if (detectedIndent) throwError(state, 'repeat of an indentation width identifier')\n      indent = parentIndent + digit - 1\n      detectedIndent = true\n      state.position++\n    } else {\n      break\n    }\n  }\n\n  let hadWhitespace = false\n  while (isWhiteSpace(state.input.charCodeAt(state.position))) {\n    hadWhitespace = true\n    state.position++\n  }\n  if (hadWhitespace && state.input.charCodeAt(state.position) === 0x23/* # */) skipUntilLineEnd(state)\n\n  if (isEol(state.input.charCodeAt(state.position))) {\n    consumeLineBreak(state)\n  } else if (state.input.charCodeAt(state.position) !== 0) {\n    throwError(state, 'a line break is expected')\n  }\n\n  let contentIndent = detectedIndent ? indent : -1\n  let maxLeadingIndent = 0\n  const valueStart = state.position\n  let valueEnd = state.position\n\n  while (state.input.charCodeAt(state.position) !== 0) {\n    const linePosition = state.position\n    let column = 0\n\n    while (state.input.charCodeAt(linePosition + column) === 0x20/* Space */) column++\n\n    const first = state.input.charCodeAt(linePosition + column)\n    if (first === 0) {\n      // End of input acts as a line terminator, but there is no line break to\n      // include here. A final all-spaces line still counts: when the block has a\n      // content indent, the spaces beyond it are real content; in a wholly blank\n      // block (contentIndent < 0) the spaces form a blank line that chomping must\n      // see, exactly as it would if the line ended with a break. Capture the line\n      // in both cases; otherwise the block ends at the start of this empty line.\n      if (contentIndent >= 0) {\n        if (column > contentIndent) valueEnd = linePosition + column\n      } else if (column > 0) {\n        valueEnd = linePosition + column\n      }\n      break\n    }\n    if (linePosition === state.lineStart && testDocumentSeparator(state, linePosition)) break\n\n    if (!detectedIndent && contentIndent === -1 && isEol(first)) {\n      maxLeadingIndent = Math.max(maxLeadingIndent, column)\n    }\n\n    if (!detectedIndent && contentIndent === -1 && !isEol(first)) {\n      if (first === 0x09/* Tab */ && column < parentIndent) {\n        state.position = linePosition + column\n        throwError(state, 'tab characters must not be used in indentation')\n      }\n      if (column < maxLeadingIndent) {\n        state.position = linePosition + column\n        throwError(state, 'bad indentation of a mapping entry')\n      }\n    }\n\n    if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {\n      state.lineIndent = column\n      state.position = linePosition + column\n      break\n    }\n\n    if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) {\n      contentIndent = column\n    }\n\n    const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent\n    if (first !== 0 && !isEol(first) && column < requiredIndent) {\n      state.lineIndent = column\n      state.position = linePosition + column\n      break\n    }\n\n    skipUntilLineEnd(state)\n    valueEnd = state.position\n    if (isEol(state.input.charCodeAt(state.position))) {\n      consumeLineBreak(state)\n      // Include the line break in the range so trailing blank lines are\n      // preserved. This is what lets cook tell apart an empty `|+` (range \"\",\n      // value \"\") from a `|+` with one blank line (range \"\\n\", value \"\\n\").\n      // De-indent and chomping are applied later in getScalarValue.\n      valueEnd = state.position\n    }\n  }\n\n  checkPrintable(state, valueStart, valueEnd)\n  addScalarEvent(\n    state,\n    valueStart,\n    valueEnd,\n    props.anchorStart,\n    props.anchorEnd,\n    props.tagStart,\n    props.tagEnd,\n    style,\n    chomping,\n    contentIndent\n  )\n  return true\n}\n\nfunction canStartPlainScalar (state: ParserState, nodeContext: NodeContext) {\n  const ch = state.input.charCodeAt(state.position)\n  const inFlow = nodeContext === CONTEXT_FLOW_IN\n\n  if (ch === 0 ||\n      isWsOrEol(ch) ||\n      ch === 0x23/* # */ ||\n      ch === 0x26/* & */ ||\n      ch === 0x2A/* * */ ||\n      ch === 0x21/* ! */ ||\n      ch === 0x7C/* | */ ||\n      ch === 0x3E/* > */ ||\n      ch === 0x27/* ' */ ||\n      ch === 0x22/* \" */ ||\n      ch === 0x25/* % */ ||\n      ch === 0x40/* @ */ ||\n      ch === 0x60/* ` */ ||\n      (inFlow && isFlowIndicator(ch))) {\n    return false\n  }\n\n  if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n    const following = state.input.charCodeAt(state.position + 1)\n    if (isWsOrEolOrEnd(following) || (inFlow && isFlowIndicator(following))) return false\n  }\n\n  return true\n}\n\nfunction readPlainScalar (state: ParserState, nodeIndent: number, nodeContext: NodeContext, props: NodeProperties) {\n  if (!canStartPlainScalar(state, nodeContext)) return false\n\n  const start = state.position\n  let end = state.position\n  let ch = state.input.charCodeAt(state.position)\n  const inFlow = nodeContext === CONTEXT_FLOW_IN\n  // A single-line plain scalar is sliceable verbatim: the parser already trims\n  // trailing whitespace from the range, so no folding is needed (see\n  // getScalarValue fast path). Folded line breaks make it non-simple.\n  let multiline = false\n\n  while (ch !== 0) {\n    if (state.position === state.lineStart && testDocumentSeparator(state)) break\n\n    if (ch === 0x3A/* : */) {\n      const following = state.input.charCodeAt(state.position + 1)\n      if (isWsOrEolOrEnd(following) || (inFlow && isFlowIndicator(following))) break\n    } else if (ch === 0x23/* # */) {\n      const preceding = state.input.charCodeAt(state.position - 1)\n      if (isWsOrEol(preceding)) break\n    } else if (inFlow && isFlowIndicator(ch)) {\n      break\n    } else if (isEol(ch)) {\n      const savedPosition = state.position\n      const savedLine = state.line\n      const savedLineStart = state.lineStart\n      const savedLineIndent = state.lineIndent\n\n      skipSeparationSpace(state, false)\n\n      if (state.lineIndent >= nodeIndent) {\n        multiline = true\n        ch = state.input.charCodeAt(state.position)\n        continue\n      }\n\n      state.position = savedPosition\n      state.line = savedLine\n      state.lineStart = savedLineStart\n      state.lineIndent = savedLineIndent\n      break\n    }\n\n    if (!isWhiteSpace(ch)) end = state.position + 1\n    ch = state.input.charCodeAt(++state.position)\n  }\n\n  if (end === start) return false\n\n  checkPrintable(state, start, end)\n  addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE_PLAIN, CHOMPING_CLIP, -1, !multiline)\n  return true\n}\n\nfunction findBlockMappingColon (state: ParserState) {\n  let position = state.position\n  let flowLevel = 0\n\n  while (position < state.length) {\n    const ch = state.input.charCodeAt(position)\n\n    if (isEol(ch)) return -1\n    if (ch === 0x23/* # */ && isWsOrEol(state.input.charCodeAt(position - 1))) return -1\n\n    if ((ch === 0x2A/* * */ || ch === 0x26/* & */) && position === state.position) {\n      do { position++ }\n      while (state.input.charCodeAt(position) !== 0 &&\n             !isWsOrEol(state.input.charCodeAt(position)) &&\n             !isFlowIndicator(state.input.charCodeAt(position)))\n      continue\n    }\n\n    if (ch === 0x5B/* [ */ || ch === 0x7B/* { */) {\n      flowLevel++\n    } else if (ch === 0x5D/* ] */ || ch === 0x7D/* } */) {\n      if (flowLevel > 0) flowLevel--\n    } else if (flowLevel === 0 && ch === 0x3A/* : */ && isWsOrEol(state.input.charCodeAt(position + 1))) {\n      return position\n    }\n\n    if ((flowLevel > 0 || position === state.position) &&\n        (ch === 0x27/* ' */ || ch === 0x22/* \" */)) {\n      const quote = ch\n      position++\n\n      while (position < state.length && state.input.charCodeAt(position) !== quote) {\n        if (state.input.charCodeAt(position) === 0x5C/* \\ */ && quote === 0x22/* \" */) position++\n        position++\n      }\n    }\n\n    position++\n  }\n\n  return -1\n}\n\nfunction skipFlowSeparationSpace (state: ParserState, nodeIndent: number) {\n  const startLine = state.line\n  skipSeparationSpace(state, true)\n\n  if ((state.line > startLine && state.lineIndent < nodeIndent) ||\n      (state.firstTabInLine !== -1 && state.lineIndent < nodeIndent)) {\n    throwError(state, 'deficient indentation')\n  }\n}\n\nfunction readFlowCollection (state: ParserState, nodeIndent: number, props: NodeProperties) {\n  const ch = state.input.charCodeAt(state.position)\n  const isMapping = ch === 0x7B/* { */\n  const start = state.position\n  let readNext = true\n\n  if (ch !== 0x5B/* [ */ && ch !== 0x7B/* { */) return false\n\n  const terminator = isMapping ? 0x7D/* } */ : 0x5D/* ] */\n\n  if (isMapping) {\n    addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE_FLOW)\n  } else {\n    addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE_FLOW)\n  }\n\n  state.position++\n\n  while (state.input.charCodeAt(state.position) !== 0) {\n    skipFlowSeparationSpace(state, nodeIndent)\n\n    let ch = state.input.charCodeAt(state.position)\n\n    if (ch === terminator) {\n      state.position++\n      addPopEvent(state)\n      return true\n    } else if (!readNext) {\n      throwError(state, 'missed comma between flow collection entries')\n    } else if (ch === 0x2C/* , */) {\n      throwError(state, \"expected the node content, but found ','\")\n    }\n\n    let isPair = false\n    let isExplicitPair = false\n\n    if (ch === 0x3F/* ? */ && isWsOrEol(state.input.charCodeAt(state.position + 1))) {\n      isPair = isExplicitPair = true\n      state.position += 1\n      skipFlowSeparationSpace(state, nodeIndent)\n    }\n\n    const entryLine = state.line\n    const entryStart = snapshotState(state)\n\n    const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)\n    skipFlowSeparationSpace(state, nodeIndent)\n\n    ch = state.input.charCodeAt(state.position)\n\n    if ((isMapping || isExplicitPair || state.line === entryLine) && ch === 0x3A/* : */) {\n      isPair = true\n      state.position++\n      skipFlowSeparationSpace(state, nodeIndent)\n      if (!isMapping) {\n        restoreState(state, entryStart)\n        addMappingEvent(state, entryStart.position, NO_RANGE, NO_RANGE, NO_RANGE, NO_RANGE, COLLECTION_STYLE_FLOW)\n        if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) {\n          addEmptyScalarEvent(state)\n        }\n        skipFlowSeparationSpace(state, nodeIndent)\n        state.position++\n        skipFlowSeparationSpace(state, nodeIndent)\n      } else if (!keyWasRead) {\n        addEmptyScalarEvent(state)\n      }\n      if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) {\n        addEmptyScalarEvent(state)\n      }\n      skipFlowSeparationSpace(state, nodeIndent)\n      if (!isMapping) addPopEvent(state)\n    } else if (isMapping && isPair) {\n      if (!keyWasRead) addEmptyScalarEvent(state)\n      addEmptyScalarEvent(state)\n    } else if (isMapping) {\n      addEmptyScalarEvent(state)\n    } else if (isPair) {\n      restoreState(state, entryStart)\n      addMappingEvent(state, entryStart.position, NO_RANGE, NO_RANGE, NO_RANGE, NO_RANGE, COLLECTION_STYLE_FLOW)\n      parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)\n      addEmptyScalarEvent(state)\n      addPopEvent(state)\n    }\n\n    ch = state.input.charCodeAt(state.position)\n\n    if (ch === 0x2C/* , */) {\n      readNext = true\n      state.position++\n    } else {\n      readNext = false\n    }\n  }\n\n  throwError(state, 'unexpected end of the stream within a flow collection')\n}\n\nfunction readBlockSequence (state: ParserState, nodeIndent: number, props: NodeProperties) {\n  if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 0x2D/* - */ || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n    return false\n  }\n\n  addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE_BLOCK)\n\n  while (state.input.charCodeAt(state.position) === 0x2D/* - */ && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n    if (state.firstTabInLine !== -1) {\n      state.position = state.firstTabInLine\n      throwError(state, 'tab characters must not be used in indentation')\n    }\n\n    const entryLine = state.line\n    state.position++\n\n    const hadBreak = skipSeparationSpace(state, true) > 0\n    if (state.firstTabInLine !== -1 &&\n        state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n        isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n      throwError(state, 'bad indentation of a sequence entry')\n    }\n\n    if (hadBreak && state.lineIndent <= nodeIndent) {\n      addEmptyScalarEvent(state)\n    } else {\n      parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true)\n    }\n\n    skipSeparationSpace(state, true)\n\n    if (state.lineIndent < nodeIndent || state.position >= state.length) break\n    if (state.lineIndent > nodeIndent) throwError(state, 'bad indentation of a sequence entry')\n    if (state.line === entryLine &&\n        state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n        isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {\n      throwError(state, 'bad indentation of a sequence entry')\n    }\n  }\n\n  addPopEvent(state)\n  return true\n}\n\nfunction readBlockMapping (state: ParserState, nodeIndent: number, flowIndent: number, props: NodeProperties) {\n  let atExplicitKey = false\n  let detected = false\n  let mappingOpened = false\n  let pendingExplicitKey = false\n\n  if (state.firstTabInLine !== -1) return false\n\n  let ch = state.input.charCodeAt(state.position)\n\n  while (ch !== 0) {\n    if (!atExplicitKey && state.firstTabInLine !== -1) {\n      state.position = state.firstTabInLine\n      throwError(state, 'tab characters must not be used in indentation')\n    }\n\n    const following = state.input.charCodeAt(state.position + 1)\n    const entryLine = state.line\n\n    if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && isWsOrEolOrEnd(following)) {\n      if (!mappingOpened) {\n        addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE_BLOCK)\n        mappingOpened = true\n      }\n\n      if (ch === 0x3F/* ? */) {\n        if (atExplicitKey) addEmptyScalarEvent(state)\n        detected = true\n        atExplicitKey = true\n      } else if (atExplicitKey) {\n        atExplicitKey = false\n      } else {\n        addEmptyScalarEvent(state)\n        detected = true\n        atExplicitKey = false\n      }\n\n      state.position += 1\n      pendingExplicitKey = true\n    } else {\n      // An explicit key awaiting its value, followed by an implicit key, means\n      // the explicit key's value is empty. Emit it now (append-only) so it is\n      // ordered before the implicit key node read just below.\n      if (atExplicitKey) {\n        addEmptyScalarEvent(state)\n        atExplicitKey = false\n      }\n\n      const beforeKey = snapshotState(state)\n\n      if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n        break\n      }\n\n      if (state.line === entryLine) {\n        ch = state.input.charCodeAt(state.position)\n\n        while (isWhiteSpace(ch)) {\n          ch = state.input.charCodeAt(++state.position)\n        }\n\n        if (ch === 0x3A/* : */) {\n          ch = state.input.charCodeAt(++state.position)\n\n          if (!isWsOrEolOrEnd(ch)) {\n            throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping')\n          }\n\n          if (!mappingOpened) {\n            restoreState(state, beforeKey)\n            addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE_BLOCK)\n            mappingOpened = true\n            // The key, the `:` and the space after it were already validated\n            // above, before the rollback. Re-reading the same input cannot\n            // fail, so just consume it again without error checks.\n            parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)\n\n            ch = state.input.charCodeAt(state.position)\n            while (isWhiteSpace(ch)) {\n              ch = state.input.charCodeAt(++state.position)\n            }\n\n            state.position++\n          }\n\n          detected = true\n          atExplicitKey = false\n          pendingExplicitKey = false\n        } else if (detected) {\n          throwError(state, \"expected ':' after a mapping key\")\n        } else {\n          // Not a mapping. If outer properties are pending, roll back so the\n          // caller re-reads this node with them attached (events are append-only).\n          if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n            restoreState(state, beforeKey)\n            return false\n          }\n          return true\n        }\n      } else if (detected) {\n        throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key')\n      } else {\n        if (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE) {\n          restoreState(state, beforeKey)\n          return false\n        }\n        return true\n      }\n    }\n\n    if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) {\n      pendingExplicitKey = false\n    }\n\n    if (!atExplicitKey) {\n      if (pendingExplicitKey) {\n        addEmptyScalarEvent(state)\n        pendingExplicitKey = false\n      }\n    }\n\n    skipSeparationSpace(state, true)\n    ch = state.input.charCodeAt(state.position)\n\n    if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) {\n      throwError(state, 'bad indentation of a mapping entry')\n    } else if (state.lineIndent < nodeIndent) {\n      break\n    }\n  }\n\n  if (!detected) return false\n  if (atExplicitKey) addEmptyScalarEvent(state)\n  if (mappingOpened) addPopEvent(state)\n  return true\n}\n\nfunction parseNode (\n  state: ParserState,\n  parentIndent: number,\n  nodeContext: NodeContext,\n  allowToSeek: boolean,\n  allowCompact: boolean,\n  allowPropertyMapping = true\n): boolean {\n  if (state.depth >= state.maxDepth) {\n    throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`)\n  }\n\n  state.depth++\n\n  let indentStatus = 1\n  let atNewLine = false\n  let hasContent = false\n  let propertyStart: ParserSnapshot | null = null\n  const props = emptyProperties()\n\n  let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN\n  let allowBlockCollections = allowBlockScalars\n  const allowBlockStyles = allowBlockScalars\n\n  if (allowToSeek && skipSeparationSpace(state, true)) {\n    atNewLine = true\n\n    if (state.lineIndent > parentIndent) {\n      indentStatus = 1\n    } else if (state.lineIndent === parentIndent) {\n      indentStatus = 0\n    } else {\n      indentStatus = -1\n    }\n  }\n\n  if (state.position === state.lineStart && testDocumentSeparator(state)) {\n    state.depth--\n    return false\n  }\n\n  if (indentStatus === 1) {\n    while (true) {\n      const ch = state.input.charCodeAt(state.position)\n      const propertyState = snapshotState(state)\n\n      if (atNewLine &&\n          indentStatus !== 1 &&\n          (ch === 0x21/* ! */ || ch === 0x26/* & */)) {\n        break\n      }\n\n      if (atNewLine &&\n          allowBlockStyles &&\n          (props.tagStart !== NO_RANGE || props.anchorStart !== NO_RANGE) &&\n          (ch === 0x21/* ! */ || ch === 0x26/* & */)) {\n        const fallbackState = snapshotState(state)\n        const flowIndent = parentIndent + 1\n        const mappingIndent = state.position - state.lineStart\n\n        if (readBlockMapping(state, mappingIndent, flowIndent, props) &&\n            state.events[fallbackState.eventsLength]?.type === EVENT_MAPPING) {\n          state.depth--\n          return true\n        }\n\n        restoreState(state, fallbackState)\n      }\n\n      if (atNewLine &&\n          ((ch === 0x21/* ! */ && props.tagStart !== NO_RANGE) ||\n           (ch === 0x26/* & */ && props.anchorStart !== NO_RANGE))) {\n        break\n      }\n\n      if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) {\n        break\n      }\n\n      if (propertyStart === null) propertyStart = propertyState\n\n      if (skipSeparationSpace(state, true)) {\n        atNewLine = true\n        allowBlockCollections = allowBlockStyles\n\n        if (state.lineIndent > parentIndent) {\n          indentStatus = 1\n        } else if (state.lineIndent === parentIndent) {\n          indentStatus = 0\n        } else {\n          indentStatus = -1\n        }\n      } else {\n        allowBlockCollections = false\n      }\n    }\n  }\n\n  if (allowBlockCollections) {\n    allowBlockCollections = atNewLine || allowCompact\n  }\n\n  if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {\n    const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT\n      ? parentIndent\n      : parentIndent + 1\n    const blockIndent = state.position - state.lineStart\n\n    if (indentStatus === 1) {\n      if ((allowBlockCollections &&\n          (readBlockSequence(state, blockIndent, props) ||\n           readBlockMapping(state, blockIndent, flowIndent, props))) ||\n          readFlowCollection(state, flowIndent, props)) {\n        hasContent = true\n      } else {\n        const ch = state.input.charCodeAt(state.position)\n\n        if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections &&\n            ch !== 0x7C/* | */ && ch !== 0x3E/* > */) {\n          const fallbackState = snapshotState(state)\n          const propertyIndent = propertyStart.position - propertyStart.lineStart\n\n          restoreState(state, propertyStart)\n\n          if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) &&\n              state.events[fallbackState.eventsLength]?.type === EVENT_MAPPING) {\n            hasContent = true\n          } else {\n            restoreState(state, fallbackState)\n          }\n        }\n\n        if (!hasContent &&\n            ((allowBlockScalars && readBlockScalar(state, flowIndent, props)) ||\n             readSingleQuotedScalar(state, flowIndent, props) ||\n             readDoubleQuotedScalar(state, flowIndent, props) ||\n             readAlias(state, props) ||\n             readPlainScalar(state, flowIndent, nodeContext, props))) {\n          hasContent = true\n        }\n      }\n    } else if (indentStatus === 0) {\n      hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props)\n    }\n  }\n\n  allowBlockScalars = allowBlockScalars && !hasContent\n\n  if (!hasContent && (props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE || allowBlockScalars)) {\n    addScalarEvent(\n      state,\n      NO_RANGE,\n      NO_RANGE,\n      props.anchorStart,\n      props.anchorEnd,\n      props.tagStart,\n      props.tagEnd,\n      SCALAR_STYLE_PLAIN\n    )\n    hasContent = true\n  }\n\n  state.depth--\n  return hasContent || props.anchorStart !== NO_RANGE || props.tagStart !== NO_RANGE\n}\n\nfunction readDirective (state: ParserState) {\n  if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 0x25/* % */) return false\n\n  state.position++\n  const nameStart = state.position\n\n  while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++\n\n  const name = state.input.slice(nameStart, state.position)\n  const args: string[] = []\n\n  if (name.length === 0) throwError(state, 'directive name must not be less than one character in length')\n\n  while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {\n    while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++\n    if (state.input.charCodeAt(state.position) === 0x23/* # */ || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break\n\n    const start = state.position\n    while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++\n    args.push(state.input.slice(start, state.position))\n  }\n\n  if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state)\n\n  if (name === 'YAML') {\n    if (state.directives.some(directive => directive.kind === 'yaml')) throwError(state, 'duplication of %YAML directive')\n    if (args.length !== 1) throwError(state, 'YAML directive accepts exactly one argument')\n\n    const match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0])\n    if (match === null) throwError(state, 'ill-formed argument of the YAML directive')\n    if (parseInt(match[1], 10) !== 1) throwError(state, 'unacceptable YAML version of the document')\n\n    state.directives.push({ kind: 'yaml', version: args[0] })\n  } else if (name === 'TAG') {\n    if (args.length !== 2) throwError(state, 'TAG directive accepts exactly two arguments')\n\n    const [handle, prefix] = args\n    if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, 'ill-formed tag handle (first argument) of the TAG directive')\n    if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for \"${handle}\" tag handle`)\n    if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive')\n    try {\n      decodeURIComponent(prefix)\n    } catch {\n      throwError(state, `tag prefix is malformed: ${prefix}`)\n    }\n\n    state.tagHandlers[handle] = prefix\n    state.directives.push({ kind: 'tag', handle, prefix })\n  }\n\n  return true\n}\n\nfunction readDocument (state: ParserState) {\n  state.directives = []\n  state.tagHandlers = Object.create(null)\n  let hasDirectives = false\n\n  skipSeparationSpace(state, true)\n\n  while (readDirective(state)) {\n    hasDirectives = true\n    skipSeparationSpace(state, true)\n  }\n\n  let explicitStart = false\n  let explicitEnd = false\n  let allowCompact = true\n\n  if (state.lineIndent === 0 &&\n      state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n      state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\n      state.input.charCodeAt(state.position + 2) === 0x2D/* - */ &&\n      isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {\n    explicitStart = true\n    const markerLine = state.line\n    state.position += 3\n    skipSeparationSpace(state, true)\n    allowCompact = state.line > markerLine\n  } else if (hasDirectives) {\n    throwError(state, 'directives end mark is expected')\n  }\n\n  const documentEventIndex = state.events.length\n  if (!explicitStart &&\n      state.position === state.lineStart &&\n      state.input.charCodeAt(state.position) === 0x2E/* . */ &&\n      testDocumentSeparator(state)) {\n    state.position += 3\n    skipSeparationSpace(state, true)\n    return\n  }\n\n  addDocumentEvent(state, explicitStart, false)\n  if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) {\n    addEmptyScalarEvent(state)\n  }\n  skipSeparationSpace(state, true)\n\n  if (state.position === state.lineStart && testDocumentSeparator(state)) {\n    explicitEnd = state.input.charCodeAt(state.position) === 0x2E/* . */\n    if (explicitEnd) {\n      const markerLine = state.line\n      state.position += 3\n      skipSeparationSpace(state, true)\n      if (state.line === markerLine && state.position < state.length) {\n        throwError(state, 'end of the stream or a document separator is expected')\n      }\n    }\n  }\n\n  const documentEvent = state.events[documentEventIndex]\n  if (documentEvent?.type === EVENT_DOCUMENT) documentEvent.explicitEnd = explicitEnd\n\n  addPopEvent(state)\n\n  if (!explicitEnd &&\n      state.position < state.length &&\n      !(state.position === state.lineStart && testDocumentSeparator(state))) {\n    throwError(state, 'end of the stream or a document separator is expected')\n  }\n}\n\nfunction parseEvents (input: string, options: ParserOptions): Event[] {\n  const length = input.length\n  const state: ParserState = {\n    ...DEFAULT_PARSER_OPTIONS,\n    ...options,\n    input: `${input}\\0`,\n    length,\n    position: 0,\n    line: 0,\n    lineStart: 0,\n    lineIndent: 0,\n    firstTabInLine: -1,\n    depth: 0,\n    directives: [],\n    tagHandlers: Object.create(null),\n    events: []\n  }\n\n  const nullpos = input.indexOf('\\0')\n  if (nullpos !== -1) throwErrorAt(input, nullpos, 'null byte is not allowed in input', state.filename)\n\n  if (state.input.charCodeAt(state.position) === 0xFEFF) state.position++\n\n  while (state.position < state.length) {\n    skipSeparationSpace(state, true)\n    if (state.position >= state.length) break\n    const documentStart = state.position\n    readDocument(state)\n    if (state.position === documentStart) {\n      // Internal progress guard: if readDocument() ever returns without\n      // consuming input, stop here instead of looping forever.\n      /* c8 ignore next */\n      throwError(state, 'can not read a document')\n    }\n  }\n\n  return state.events\n}\n\nexport {\n  parseEvents,\n  DEFAULT_PARSER_OPTIONS,\n  type ParserOptions\n}\n","import { YAMLException } from './common/exception.ts'\nimport { pick } from './common/object.ts'\nimport {\n  constructFromEvents,\n  DEFAULT_CONSTRUCTOR_OPTIONS,\n  type ConstructorOptions\n} from './parser/constructor.ts'\nimport {\n  parseEvents,\n  DEFAULT_PARSER_OPTIONS,\n  type ParserOptions\n} from './parser/parser.ts'\n\n// `source` is supplied by `loadDocuments` itself, not by the public caller.\ninterface LoadOptions extends ParserOptions, Omit<ConstructorOptions, 'source'> {}\n\ntype LoadAllIterator = (document: unknown) => void\n\nconst DEFAULT_LOAD_OPTIONS: Required<LoadOptions> = {\n  ...DEFAULT_PARSER_OPTIONS,\n  ...DEFAULT_CONSTRUCTOR_OPTIONS\n}\n\nfunction loadDocuments (input: string, options: LoadOptions = {}) {\n  const opts = { ...DEFAULT_LOAD_OPTIONS, ...options }\n  const source = String(input)\n\n  const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS) as\n    (keyof typeof DEFAULT_PARSER_OPTIONS)[]\n  const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS) as\n    (keyof typeof DEFAULT_CONSTRUCTOR_OPTIONS)[]\n\n  const events = parseEvents(source, pick(opts, PARSER_OPT_KEYS))\n  return constructFromEvents(events, { ...pick(opts, CONSTRUCTOR_OPT_KEYS), source })\n}\n\n// Signatures with iterator are deprecated. Will be removed in the next versions.\nfunction loadAll (input: string, options?: LoadOptions): unknown[]\nfunction loadAll (input: string, iterator: null, options?: LoadOptions): unknown[]\nfunction loadAll (input: string, iterator: LoadAllIterator, options?: LoadOptions): void\nfunction loadAll (\n  input: string,\n  iteratorOrOptions?: LoadAllIterator | LoadOptions | null,\n  options?: LoadOptions\n) {\n  let iterator: LoadAllIterator | null = null\n\n  if (typeof iteratorOrOptions === 'function') {\n    iterator = iteratorOrOptions\n  } else if (iteratorOrOptions !== null && typeof iteratorOrOptions === 'object') {\n    options = iteratorOrOptions\n  }\n\n  const documents = loadDocuments(input, options)\n\n  if (iterator === null) return documents\n  for (const document of documents) iterator(document)\n}\n\nfunction load (input: string, options?: LoadOptions) {\n  const documents = loadDocuments(input, options)\n\n  if (documents.length === 0) throw new YAMLException('expected a document, but the input is empty')\n  if (documents.length === 1) return documents[0]\n\n  throw new YAMLException('expected a single document in the stream, but found more')\n}\n\nexport {\n  load,\n  loadAll,\n  type LoadOptions\n}\n","// Plain-object discriminated union shared by the dumper (built by `jsToAst`,\n// rendered by the presenter) and, later, by load. Behaviour lives in the walkers,\n// not on the nodes.\n\nimport { type DocumentDirective } from '../parser/events.ts'\n\nclass Style {\n  tagged = false\n  flow = false\n  singleQuoted = false\n  doubleQuoted = false\n  literal = false\n  folded = false\n}\n\ninterface NodeBase {\n  // YAML tag. Untagged nodes carry the semantic resolved tag; tagged nodes carry\n  // the printable/verbatim tag spelling.\n  tag: string\n  style: Style\n  anchor?: string\n\n  // Reserved for the formatting layer; not populated by the dumper yet.\n  commentBefore?: string\n  comment?: string\n  commentAfter?: string\n  blankBefore?: number\n}\n\ninterface ScalarNode extends NodeBase {\n  kind: 'scalar'\n  value: string\n}\n\ninterface SequenceNode extends NodeBase {\n  kind: 'sequence'\n  items: Node[]\n}\n\ninterface MappingNode extends NodeBase {\n  kind: 'mapping'\n  items: Array<{ key: Node, value: Node }>\n}\n\ninterface AliasNode extends NodeBase {\n  kind: 'alias'\n  // The anchor name this alias points at (`*name`).\n  anchor: string\n}\n\ntype Node = ScalarNode | SequenceNode | MappingNode | AliasNode\n\n// The layer above `Node`: each document wraps one content node plus its own\n// markers/directives. Not a member of `Node` — the fields differ. Document\n// directives are ordered presentation data.\ninterface Document {\n  contents: Node | null            // null = empty document\n  explicitStart?: boolean          // print '---'\n  explicitEnd?: boolean            // print '...'\n  directives: DocumentDirective[]\n}\n\nexport {\n  Style,\n\n  type Node,\n  type Document,\n  type NodeBase,\n  type ScalarNode,\n  type SequenceNode,\n  type MappingNode,\n  type AliasNode\n}\n","// JS value graph → AST. Knows tags (`identify` / `represent`). A single\n// identity-`Map` walk handles dedup: a repeat occurrence of an object (including\n// a cycle) becomes an `alias`, and the first occurrence gets an `anchor`.\n\nimport { YAMLException } from '../common/exception.ts'\nimport { type Schema } from '../schema.ts'\nimport { type TagDefinition } from '../tag.ts'\nimport { tagNameShort } from '../common/tagname.ts'\nimport {\n  Style,\n  type Document,\n  type Node,\n  type ScalarNode,\n  type SequenceNode,\n  type MappingNode\n} from './nodes.ts'\n\ninterface FromJsOptions {\n  noRefs?: boolean\n  skipInvalid?: boolean\n}\n\n// A match candidate. `implicitTag` means the tag is not printed (implicit\n// scalars and the default str/seq/map tags).\ninterface RepresentType {\n  tag: TagDefinition\n  implicitTag: boolean\n}\n\n// Returned by `build` when no tag matched.\nconst INVALID = Symbol('INVALID')\n\ninterface FromJsState {\n  representTypes: RepresentType[]\n  noRefs: boolean\n  skipInvalid: boolean\n\n  // Already-built collection values → their node, for anchor/alias dedup.\n  refs: Map<unknown, Node>\n  refCounter: number\n}\n\nfunction buildRepresentTypes (schema: Schema): RepresentType[] {\n  const defaultTags = new Set<TagDefinition>([\n    schema.defaultScalarTag,\n    schema.defaultSequenceTag,\n    schema.defaultMappingTag\n  ].filter((t): t is TagDefinition => t !== undefined))\n\n  // Default container/str tags go last so a more specific tag identifying the\n  // same JS value (e.g. a custom tag on a plain object) wins.\n  const implicitScalars = schema.implicitScalarTags\n  const explicitTags = schema.tags.filter(t =>\n    !(t.nodeKind === 'scalar' && t.implicit) && !defaultTags.has(t))\n  const defaultTagsLast = schema.tags.filter(t => defaultTags.has(t))\n\n  return [\n    ...implicitScalars.map(tag => ({ tag, implicitTag: true })),\n    ...explicitTags.map(tag => ({ tag, implicitTag: false })),\n    ...defaultTagsLast.map(tag => ({ tag, implicitTag: true }))\n  ]\n}\n\n// First tag whose `identify` accepts `object`.\nfunction matchTag (state: FromJsState, object: unknown): { tag: TagDefinition, tagName: string, implicitTag: boolean } | null {\n  for (let index = 0, length = state.representTypes.length; index < length; index += 1) {\n    const { tag, implicitTag } = state.representTypes[index]\n\n    if (tag.identify && tag.identify(object)) {\n      let tagName: string\n      if (tag.matchByTagPrefix && tag.representTagName) {\n        tagName = tag.representTagName(object)\n      } else {\n        tagName = tag.tagName\n      }\n      return { tag, tagName, implicitTag }\n    }\n  }\n\n  return null\n}\n\n// Build a node for `object`, or INVALID when no tag matches. `undefined` never\n// throws (caller decides: null in a sequence, skip in a mapping, '' at root);\n// any other unrepresentable value throws unless `skipInvalid`.\nfunction build (state: FromJsState, object: unknown): Node | typeof INVALID {\n  if (!state.noRefs && object !== null && typeof object === 'object') {\n    const existing = state.refs.get(object)\n    if (existing) {\n      if (existing.anchor === undefined) existing.anchor = `ref_${state.refCounter++}`\n      return { kind: 'alias', tag: '', style: new Style(), anchor: existing.anchor }\n    }\n  }\n\n  const matched = matchTag(state, object)\n\n  if (!matched) {\n    if (object === undefined) return INVALID\n    if (state.skipInvalid) return INVALID\n    throw new YAMLException(`unacceptable kind of an object to dump ${Object.prototype.toString.call(object)}`)\n  }\n\n  const { tag, tagName, implicitTag } = matched\n  const nodeTagName = implicitTag ? tagName : tagNameShort(tagName)\n\n  if (tag.nodeKind === 'scalar') {\n    const style = new Style()\n    style.tagged = !implicitTag\n    const node: ScalarNode = {\n      kind: 'scalar',\n      tag: nodeTagName,\n      style,\n      value: tag.represent(object)\n    }\n    return node\n  }\n\n  if (tag.nodeKind === 'sequence') {\n    const container = tag.represent(object)\n    const style = new Style()\n    style.tagged = !implicitTag\n    const node: SequenceNode = { kind: 'sequence', tag: nodeTagName, style, items: [] }\n    if (!state.noRefs) state.refs.set(object, node)\n\n    for (let index = 0, length = container.length; index < length; index += 1) {\n      let item = build(state, container[index])\n      // An invalid element becomes null; a still-invalid null then skips/throws.\n      if (item === INVALID && container[index] === undefined) item = build(state, null)\n      if (item === INVALID) continue\n      node.items.push(item)\n    }\n    return node\n  }\n\n  // mapping — the canonical form is always a `Map`.\n  const map = tag.represent(object)\n  const style = new Style()\n  style.tagged = !implicitTag\n  const node: MappingNode = { kind: 'mapping', tag: nodeTagName, style, items: [] }\n  if (!state.noRefs) state.refs.set(object, node)\n\n  for (const [objectKey, objectValue] of map) {\n    const key = build(state, objectKey)\n    if (key === INVALID) continue // invalid key skips the pair\n    const value = build(state, objectValue)\n    if (value === INVALID) continue // invalid value skips the pair\n    node.items.push({ key, value })\n  }\n  return node\n}\n\n// A JS value is one YAML document. An unrepresentable root becomes an empty\n// document, which the presenter renders as an empty string.\nfunction jsToAst (input: unknown, schema: Schema, options: FromJsOptions = {}): Document[] {\n  const state: FromJsState = {\n    representTypes: buildRepresentTypes(schema),\n    noRefs: options.noRefs ?? false,\n    skipInvalid: options.skipInvalid ?? false,\n    refs: new Map(),\n    refCounter: 0\n  }\n\n  const root = build(state, input)\n  return [{ contents: root === INVALID ? null : root, directives: [] }]\n}\n\nexport {\n  jsToAst,\n  type FromJsOptions\n}\n","// Depth-first AST traversal. Mirrors the `kind` walk of the presenter and the\n// `from_*` builders, but stays read-oriented: nodes are plain objects, so a\n// visitor mutates them in place. Control signals let it prune or stop the walk.\n\nimport {\n  type Node,\n  type Document\n} from './nodes.ts'\n\n// Returned by a visitor to control the walk; anything else (incl. `undefined`)\n// descends as usual.\nconst VISIT_BREAK = Symbol('visit:break') // stop the whole traversal\nconst VISIT_SKIP = Symbol('visit:skip')   // don't descend into this node's children\n\ntype VisitControl = typeof VISIT_BREAK | typeof VISIT_SKIP | undefined | void\n\n// Traversal-derived position of the current node. Kept off the node itself: a\n// node may sit in several places (alias/dedup reuse), so depth/role belong to\n// the walk, not the node. `parent.kind` + `isKey` pin the exact slot.\ninterface VisitContext {\n  depth: number        // 0 = document content root\n  parent: Node | null  // enclosing sequence/mapping, null at the root\n  isKey: boolean       // node sits in a mapping key position\n}\n\ntype Visitor = (node: Node, ctx: VisitContext) => VisitControl\n\n// Returns `true` once `VISIT_BREAK` was seen, so callers can unwind the walk.\nfunction visitNode (node: Node, visitor: Visitor, ctx: VisitContext): boolean {\n  const control = visitor(node, ctx)\n  if (control === VISIT_BREAK) return true\n  if (control === VISIT_SKIP) return false\n\n  const depth = ctx.depth + 1\n\n  switch (node.kind) {\n    case 'sequence':\n      for (const item of node.items) {\n        if (visitNode(item, visitor, { depth, parent: node, isKey: false })) return true\n      }\n      break\n    case 'mapping':\n      for (const { key, value } of node.items) {\n        if (visitNode(key, visitor, { depth, parent: node, isKey: true })) return true\n        if (visitNode(value, visitor, { depth, parent: node, isKey: false })) return true\n      }\n      break\n  }\n\n  return false\n}\n\n// Walk every node in the documents, calling `visitor` once per node (pre-order).\nfunction visit (documents: Document[], visitor: Visitor): void {\n  for (const doc of documents) {\n    if (doc.contents && visitNode(doc.contents, visitor, { depth: 0, parent: null, isKey: false })) return\n  }\n}\n\nexport {\n  visit,\n  VISIT_BREAK,\n  VISIT_SKIP,\n  type Visitor,\n  type VisitContext\n}\n","// AST → text. Walks the node `kind`; the scalar machinery (style selection,\n// quoting, folding) is driven by node text, not by sniffing a JS value.\n\nimport { YAMLException } from '../common/exception.ts'\nimport { tagNameShort } from '../common/tagname.ts'\nimport { type Schema } from '../schema.ts'\nimport { NOT_RESOLVED, type ScalarTagDefinition } from '../tag.ts'\nimport {\n  type Node,\n  type Document,\n  type ScalarNode,\n  type SequenceNode,\n  type MappingNode\n} from './nodes.ts'\n\nconst CHAR_BOM = 0xFEFF\nconst CHAR_TAB = 0x09 /* Tab */\nconst CHAR_LINE_FEED = 0x0A /* LF */\nconst CHAR_CARRIAGE_RETURN = 0x0D /* CR */\nconst CHAR_SPACE = 0x20 /* Space */\nconst CHAR_EXCLAMATION = 0x21 /* ! */\nconst CHAR_DOUBLE_QUOTE = 0x22 /* \" */\nconst CHAR_SHARP = 0x23 /* # */\nconst CHAR_PERCENT = 0x25 /* % */\nconst CHAR_AMPERSAND = 0x26 /* & */\nconst CHAR_SINGLE_QUOTE = 0x27 /* ' */\nconst CHAR_ASTERISK = 0x2A /* * */\nconst CHAR_COMMA = 0x2C /* , */\nconst CHAR_MINUS = 0x2D /* - */\nconst CHAR_COLON = 0x3A /* : */\nconst CHAR_EQUALS = 0x3D /* = */\nconst CHAR_GREATER_THAN = 0x3E /* > */\nconst CHAR_QUESTION = 0x3F /* ? */\nconst CHAR_COMMERCIAL_AT = 0x40 /* @ */\nconst CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */\nconst CHAR_RIGHT_SQUARE_BRACKET = 0x5D /* ] */\nconst CHAR_GRAVE_ACCENT = 0x60 /* ` */\nconst CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */\nconst CHAR_VERTICAL_LINE = 0x7C /* | */\nconst CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */\n\nconst ESCAPE_SEQUENCES: Record<number, string> = {}\n\nESCAPE_SEQUENCES[0x00] = '\\\\0'\nESCAPE_SEQUENCES[0x07] = '\\\\a'\nESCAPE_SEQUENCES[0x08] = '\\\\b'\nESCAPE_SEQUENCES[0x09] = '\\\\t'\nESCAPE_SEQUENCES[0x0A] = '\\\\n'\nESCAPE_SEQUENCES[0x0B] = '\\\\v'\nESCAPE_SEQUENCES[0x0C] = '\\\\f'\nESCAPE_SEQUENCES[0x0D] = '\\\\r'\nESCAPE_SEQUENCES[0x1B] = '\\\\e'\nESCAPE_SEQUENCES[0x22] = '\\\\\"'\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\'\nESCAPE_SEQUENCES[0x85] = '\\\\N'\nESCAPE_SEQUENCES[0xA0] = '\\\\_'\nESCAPE_SEQUENCES[0x2028] = '\\\\L'\nESCAPE_SEQUENCES[0x2029] = '\\\\P'\n\ninterface PresenterOptions {\n  schema: Schema\n  indent?: number\n  seqNoIndent?: boolean\n  seqInlineFirst?: boolean\n  sortKeys?: boolean | ((a: any, b: any) => number)\n  lineWidth?: number\n  flowBracketPadding?: boolean\n  flowSkipCommaSpace?: boolean\n  flowSkipColonSpace?: boolean\n  quoteFlowKeys?: boolean\n  quoteStyle?: 'single' | 'double'\n  forceQuotes?: boolean\n  tagBeforeAnchor?: boolean\n}\n\nconst DEFAULT_PRESENTER_OPTIONS: Required<Omit<PresenterOptions, 'schema'>> = {\n  indent: 2,\n  seqNoIndent: false,\n  seqInlineFirst: true,\n  sortKeys: false,\n  lineWidth: 80,\n  flowBracketPadding: false,\n  flowSkipCommaSpace: false,\n  flowSkipColonSpace: false,\n  quoteFlowKeys: false,\n  quoteStyle: 'single',\n  forceQuotes: false,\n  tagBeforeAnchor: false\n}\n\ninterface PresenterState extends Required<PresenterOptions> {\n  defaultScalarTagName: string\n  implicitResolvers: readonly ScalarTagDefinition[]\n}\n\nfunction nodeTagShort (node: Node) {\n  return node.style.tagged ? node.tag : tagNameShort(node.tag)\n}\n\nfunction createPresenterState (options: PresenterOptions): PresenterState {\n  const opts = {\n    ...DEFAULT_PRESENTER_OPTIONS,\n    ...options\n  }\n\n  return {\n    ...opts,\n    defaultScalarTagName: opts.schema.defaultScalarTag.tagName,\n    implicitResolvers: opts.schema.implicitScalarTags\n  }\n}\n\nfunction encodeNonPrintable (character: number) {\n  // YAML non-printable code points are all in BMP (max FFFF);\n  // astral code points are printable and can't come here.\n  const string = character.toString(16).toUpperCase()\n  const handle = character <= 0xFF ? 'x' : 'u'\n  const length = character <= 0xFF ? 2 : 4\n\n  return `\\\\${handle}${'0'.repeat(length - string.length)}${string}`\n}\n\n// Indents every line in a string. Empty lines (\\n only) are not indented.\nfunction indentString (string: string, spaces: number) {\n  const ind = ' '.repeat(spaces)\n  let position = 0\n  let result = ''\n  const length = string.length\n\n  while (position < length) {\n    let line\n    const next = string.indexOf('\\n', position)\n    if (next === -1) {\n      line = string.slice(position)\n      position = length\n    } else {\n      line = string.slice(position, next + 1)\n      position = next + 1\n    }\n\n    if (line.length && line !== '\\n') result += ind\n\n    result += line\n  }\n\n  return result\n}\n\nfunction generateNextLine (state: PresenterState, level: number) {\n  return `\\n${' '.repeat(state.indent * level)}`\n}\n\n// Indentation/width numbers that govern how a scalar lays out at `level`.\n// Scalar-only: collections compute their own indent via `generateNextLine`.\n//   indent      - spaces prepended to the scalar's content (block styles)\n//   blockIndent - the block indentation indicator digit (`|2` / `>2`); at the\n//                 document root (level 0) it is one greater than the spaces we\n//                 actually prepend (reader applies it relative to parent n = -1)\n//   lineWidth   - fold width at this depth, shrinking monotonically toward\n//                 min(state.lineWidth, 40) as indentation deepens; -1 = no limit\nfunction scalarLayout (state: PresenterState, level: number) {\n  const indent = state.indent * Math.max(1, level) // no 0-indent scalars\n  const blockIndent = level === 0 ? state.indent + 1 : state.indent\n  const lineWidth = (state.lineWidth === -1)\n    ? -1\n    : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent)\n\n  return { indent, blockIndent, lineWidth }\n}\n\nfunction resolveImplicitTag (state: PresenterState, str: string) {\n  for (let index = 0, length = state.implicitResolvers.length; index < length; index += 1) {\n    const tagDefinition = state.implicitResolvers[index]\n\n    if (tagDefinition.resolve(str, false, tagDefinition.tagName) !== NOT_RESOLVED) {\n      return tagDefinition.tagName\n    }\n  }\n\n  return state.defaultScalarTagName\n}\n\n// [33] s-white ::= s-space | s-tab\nfunction isWhitespace (c: number) {\n  return c === CHAR_SPACE || c === CHAR_TAB\n}\n\n// Mirrors parser.testDocumentSeparator(): `---` and `...` are document\n// markers when followed by separation whitespace, a line break, or EOF.\nfunction startsWithDocumentSeparator (string: string) {\n  const marker = string.charCodeAt(0)\n\n  if ((marker !== CHAR_MINUS && marker !== 0x2E/* . */) ||\n      string.charCodeAt(1) !== marker || string.charCodeAt(2) !== marker) return false\n\n  if (string.length === 3) return true\n\n  const following = string.charCodeAt(3)\n  return isWhitespace(following) ||\n    following === CHAR_CARRIAGE_RETURN || following === CHAR_LINE_FEED\n}\n\n// Returns true if the character can be printed without escaping.\n// From YAML 1.2: \"any allowed characters known to be non-printable\n// should also be escaped. [However,] This isn’t mandatory\"\n// Derived from nb-char - \\t - #x85 - #xA0 - #x2028 - #x2029.\nfunction isPrintable (c: number) {\n  return (c >= 0x00020 && c <= 0x00007E) ||\n    ((c >= 0x000A1 && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) ||\n    ((c >= 0x0E000 && c <= 0x00FFFD) && c !== CHAR_BOM) ||\n    (c >= 0x10000 && c <= 0x10FFFF)\n}\n\n// [34] ns-char ::= nb-char - s-white\n// [27] nb-char ::= c-printable - b-char - c-byte-order-mark\n// [26] b-char  ::= b-line-feed | b-carriage-return\n// Including s-white (for some reason, examples doesn't match specs in this aspect)\n// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark\nfunction isNsCharOrWhitespace (c: number) {\n  return isPrintable(c) &&\n    c !== CHAR_BOM &&\n    // - b-char\n    c !== CHAR_CARRIAGE_RETURN &&\n    c !== CHAR_LINE_FEED\n}\n\n// [127]  ns-plain-safe(c) ::= c = flow-out  ⇒ ns-plain-safe-out\n//                             c = flow-in   ⇒ ns-plain-safe-in\n//                             c = block-key ⇒ ns-plain-safe-out\n//                             c = flow-key  ⇒ ns-plain-safe-in\n// [128] ns-plain-safe-out ::= ns-char\n// [129]  ns-plain-safe-in ::= ns-char - c-flow-indicator\n// [130]  ns-plain-char(c) ::=  ( ns-plain-safe(c) - “:” - “#” )\n//                            | ( /* An ns-char preceding */ “#” )\n//                            | ( “:” /* Followed by an ns-plain-safe(c) */ )\n// `prev` is the previous code point, or -1 when `c` is the first character\n// (no preceding character). -1 is not a valid code point, so it can never\n// collide with a real one and safely disables the prev-dependent cases below.\nfunction isPlainSafe (c: number, prev: number, inblock: boolean) {\n  const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c)\n  const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c)\n  return (\n    (\n      // ns-plain-safe\n      inblock // c = flow-in\n        ? cIsNsCharOrWhitespace\n        : cIsNsCharOrWhitespace &&\n          // - c-flow-indicator\n          c !== CHAR_COMMA &&\n          c !== CHAR_LEFT_SQUARE_BRACKET &&\n          c !== CHAR_RIGHT_SQUARE_BRACKET &&\n          c !== CHAR_LEFT_CURLY_BRACKET &&\n          c !== CHAR_RIGHT_CURLY_BRACKET\n    ) &&\n    // ns-plain-char\n    c !== CHAR_SHARP && // false on '#'\n    !(prev === CHAR_COLON && !cIsNsChar)\n  ) || // false on ': '\n  (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) || // change to true on '[^ ]#'\n  (prev === CHAR_COLON && cIsNsChar) // change to true on ':[^ ]'\n}\n\n// Simplified test for values allowed as the first character in plain style.\nfunction isPlainSafeFirst (c: number) {\n  // Uses a subset of ns-char - c-indicator\n  // where ns-char = nb-char - s-white.\n  // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part\n  return isPrintable(c) &&\n    c !== CHAR_BOM &&\n    !isWhitespace(c) && // - s-white\n    // - (c-indicator ::=\n    // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”\n    c !== CHAR_MINUS &&\n    c !== CHAR_QUESTION &&\n    c !== CHAR_COLON &&\n    c !== CHAR_COMMA &&\n    c !== CHAR_LEFT_SQUARE_BRACKET &&\n    c !== CHAR_RIGHT_SQUARE_BRACKET &&\n    c !== CHAR_LEFT_CURLY_BRACKET &&\n    c !== CHAR_RIGHT_CURLY_BRACKET &&\n    // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “\"”\n    c !== CHAR_SHARP &&\n    c !== CHAR_AMPERSAND &&\n    c !== CHAR_ASTERISK &&\n    c !== CHAR_EXCLAMATION &&\n    c !== CHAR_VERTICAL_LINE &&\n    c !== CHAR_EQUALS &&\n    c !== CHAR_GREATER_THAN &&\n    c !== CHAR_SINGLE_QUOTE &&\n    c !== CHAR_DOUBLE_QUOTE &&\n    // | “%” | “@” | “`”)\n    c !== CHAR_PERCENT &&\n    c !== CHAR_COMMERCIAL_AT &&\n    c !== CHAR_GRAVE_ACCENT\n}\n\nfunction isPlainSafeAtStart (string: string, inblock: boolean) {\n  const first = codePointAt(string, 0)\n\n  if (isPlainSafeFirst(first)) return true\n\n  if (\n    string.length > 1 &&\n    (first === CHAR_MINUS || first === CHAR_QUESTION || first === CHAR_COLON)\n  ) {\n    const second = codePointAt(string, 1)\n\n    // The relaxed isPlainSafe() accepts whitespace inside a scalar, but the\n    // indicator exception in ns-plain-first requires an ns-plain-safe\n    // *non-space* character. Otherwise `- value` and `? value` start block\n    // collections instead of plain scalars.\n    return !isWhitespace(second) && isPlainSafe(second, first, inblock)\n  }\n\n  return false\n}\n\n// Simplified test for values allowed as the last character in plain style.\nfunction isPlainSafeLast (c: number) {\n  // just not whitespace or colon, it will be checked to be plain character later\n  return !isWhitespace(c) && c !== CHAR_COLON\n}\n\n// Same as 'string'.codePointAt(pos), but works in older browsers.\nfunction codePointAt (string: string, pos: number) {\n  const first = string.charCodeAt(pos)\n  let second\n\n  if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {\n    second = string.charCodeAt(pos + 1)\n    if (second >= 0xDC00 && second <= 0xDFFF) {\n      // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n      return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000\n    }\n  }\n  return first\n}\n\nfunction needIndentIndicator (string: string) {\n  const leadingSpaceRe = /^\\n* /\n  return leadingSpaceRe.test(string)\n}\n\nconst STYLE_PLAIN = 1\nconst STYLE_SINGLE = 2\nconst STYLE_LITERAL = 3\nconst STYLE_FOLDED = 4\nconst STYLE_DOUBLE = 5\n\ntype ScalarStyleId =\n  typeof STYLE_PLAIN |\n  typeof STYLE_SINGLE |\n  typeof STYLE_LITERAL |\n  typeof STYLE_FOLDED |\n  typeof STYLE_DOUBLE\n\n// Determines which scalar styles are possible and returns the preferred style.\n// lineWidth = -1 => no limit.\n// Pre-conditions: str.length > 0.\n// Post-conditions:\n//    STYLE_PLAIN or STYLE_SINGLE => no \\n are in the string.\n//    STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).\n//    STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).\nfunction chooseScalarStyle (state: PresenterState, string: string, layout: ReturnType<typeof scalarLayout>,\n  singleLineOnly: boolean, forceQuote: boolean, inblock: boolean): ScalarStyleId {\n  const { blockIndent, lineWidth } = layout\n  let i\n  let char = 0\n  let prevChar = -1 // -1 = no previous character yet (see isPlainSafe)\n  let hasLineBreak = false\n  let hasFoldableLine = false // only checked if shouldTrackWidth\n  const shouldTrackWidth = lineWidth !== -1\n  let previousLineBreak = -1 // count the first line correctly\n  // Document markers are recognized as whole tokens at the start of a line,\n  // so character-level plain-scalar checks alone cannot reject them.\n  let plain = !startsWithDocumentSeparator(string) &&\n    isPlainSafeAtStart(string, inblock) &&\n    isPlainSafeLast(codePointAt(string, string.length - 1))\n\n  if (singleLineOnly || forceQuote) {\n    // Case: no block styles.\n    // Check for disallowed characters to rule out plain and single.\n    for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n      char = codePointAt(string, i)\n      if (!isPrintable(char)) {\n        return STYLE_DOUBLE\n      }\n      plain = plain && isPlainSafe(char, prevChar, inblock)\n      prevChar = char\n    }\n  } else {\n    // Case: block styles permitted.\n    for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n      char = codePointAt(string, i)\n      if (char === CHAR_LINE_FEED) {\n        hasLineBreak = true\n        // Check if any line can be folded.\n        if (shouldTrackWidth) {\n          hasFoldableLine = hasFoldableLine ||\n            // Foldable line = too long, and not more-indented.\n            (i - previousLineBreak - 1 > lineWidth &&\n             string[previousLineBreak + 1] !== ' ')\n          previousLineBreak = i\n        }\n      } else if (!isPrintable(char)) {\n        return STYLE_DOUBLE\n      }\n      plain = plain && isPlainSafe(char, prevChar, inblock)\n      prevChar = char\n    }\n    // in case the end is missing a \\n\n    hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&\n      (i - previousLineBreak - 1 > lineWidth &&\n       string[previousLineBreak + 1] !== ' '))\n  }\n  // Although every style can represent \\n without escaping, prefer block styles\n  // for multiline, since they're more readable and they don't add empty lines.\n  // Also prefer folding a super-long line.\n  if (!hasLineBreak && !hasFoldableLine) {\n    // Syntactic verdict only: whether the bare text round-trips to the node's\n    // tag is a semantic check the caller applies (see resolveScalarStyle).\n    if (plain && !forceQuote) return STYLE_PLAIN\n    return state.quoteStyle === 'double' ? STYLE_DOUBLE : STYLE_SINGLE\n  }\n  // Edge case: block indentation indicator can only have one digit.\n  if (blockIndent > 9 && needIndentIndicator(string)) {\n    return STYLE_DOUBLE\n  }\n  // At this point we know block styles are valid.\n  // Prefer literal style unless we want to fold.\n  return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL\n}\n\n// Renders `string` in the given numeric style with the given layout.\n// NB. We drop the last trailing newline (if any) of a returned block scalar\n//  since the dumper adds its own newline. This always works:\n//    • No ending newline => unaffected; already using strip \"-\" chomping.\n//    • Ending newline    => removed then restored.\n//  Importantly, this keeps the \"+\" chomp indicator from gaining an extra line.\nfunction renderScalarStyle (string: string, style: ScalarStyleId, layout: ReturnType<typeof scalarLayout>) {\n  const { indent, blockIndent, lineWidth } = layout\n\n  switch (style) {\n    case STYLE_PLAIN:\n      return encodeFlowBreaks(string, indent)\n    case STYLE_SINGLE:\n      return `'${encodeFlowBreaks(string, indent).replace(/'/g, \"''\")}'`\n    case STYLE_LITERAL:\n      return '|' + blockHeader(string, blockIndent) +\n        dropEndingNewline(indentString(string, indent))\n    case STYLE_FOLDED:\n      return '>' + blockHeader(string, blockIndent) +\n        dropEndingNewline(indentString(foldBlockScalar(string, lineWidth), indent))\n    case STYLE_DOUBLE:\n      return `\"${escapeString(string)}\"`\n  }\n}\n\n// Picks the scalar style for `node`: a style hint carried on the node wins,\n// otherwise the style chosen by the machinery. Returns a numeric STYLE_*.\nfunction resolveScalarStyle (state: PresenterState, node: ScalarNode,\n  layout: ReturnType<typeof scalarLayout>, iskey: boolean, inblock: boolean): ScalarStyleId {\n  // Without knowing if keys are implicit/explicit, assume implicit for safety.\n  const singleLineOnly = iskey || !inblock\n\n  // Style hints carried on the node take precedence. They were valid in their\n  // original context; only a parent change can break them, and only block\n  // styles in a single-line context — quoted styles survive any context. A\n  // rejected block hint falls through to selection by content below.\n  if (node.style.singleQuoted) return STYLE_SINGLE\n  if (node.style.doubleQuoted) return STYLE_DOUBLE\n  if (!singleLineOnly) {\n    if (node.style.literal) return STYLE_LITERAL\n    if (node.style.folded) return STYLE_FOLDED\n  }\n\n  const string = node.value\n\n  if (string.length === 0) {\n    // An empty scalar is safe when its tag is explicit or resolves back to the\n    // node tag (notably, the default null representation). A real empty string\n    // does neither and therefore remains quoted.\n    if (node.style.tagged || resolveImplicitTag(state, string) === node.tag) return STYLE_PLAIN\n    return state.quoteStyle === 'double' ? STYLE_DOUBLE : STYLE_SINGLE\n  }\n\n  // v4's forceQuotes deliberately excluded keys. Keys are still quoted when\n  // syntax or tag resolution requires it, using quoteStyle as the preference.\n  const style = chooseScalarStyle(\n    state, string, layout, singleLineOnly, state.forceQuotes && !iskey, inblock)\n\n  // Plain writes no tag, so it round-trips only if the bare text resolves back\n  // to the node's tag (or the tag gets printed explicitly). Else downgrade.\n  // Downgrade to the preferred quote style here.\n  if (style === STYLE_PLAIN && !node.style.tagged && resolveImplicitTag(state, string) !== node.tag) {\n    return state.quoteStyle === 'double' ? STYLE_DOUBLE : STYLE_SINGLE\n  }\n  return style\n}\n\n// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.\nfunction blockHeader (string: string, indentPerLevel: number) {\n  const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''\n\n  // note the special case: the string '\\n' counts as a \"trailing\" empty line.\n  const clip = string[string.length - 1] === '\\n'\n  const keep = clip && (string[string.length - 2] === '\\n' || string === '\\n')\n  const chomp = keep ? '+' : (clip ? '' : '-')\n\n  return `${indentIndicator}${chomp}\\n`\n}\n\n// Flow scalars (plain, single-quoted) fold line breaks: a run of k source line\n// breaks reparses to k-1 literal `\\n`. So a single break is just line-wrapping\n// (folds back to a space), while a literal `\\n` in the value must be emitted as\n// a blank line (two breaks). Encode each run of p literal `\\n` as p+1 breaks and\n// indent the following content line so the continuation isn't read as a new node\n// (a bare break would yield invalid \"deficient indentation\" output).\n// `foldBlockScalar` can't be reused here: it treats a leading space as a\n// \"more-indented\" line and suppresses the doubling, which a flow scalar must not.\nfunction encodeFlowBreaks (string: string, indent: number) {\n  let nextLF = string.indexOf('\\n')\n  if (nextLF === -1) return string\n\n  const pad = ' '.repeat(indent)\n  let result = string.slice(0, nextLF) // first line follows the quote, no indent\n\n  const lineRe = /(\\n+)([^\\n]*)/g\n  lineRe.lastIndex = nextLF\n  let match\n  while ((match = lineRe.exec(string))) {\n    const breaks = match[1].length\n    const line = match[2]\n    // line === '' only at the end (the greedy \\n+ leaves no empty line mid-string);\n    // pad it so the closing quote carries indent instead of sitting at column 0.\n    result += '\\n'.repeat(breaks + 1) + pad + line\n  }\n\n  return result\n}\n\n// Strips one trailing newline from a block scalar: the dumper adds its own,\n// so without this a \"+\" (keep) chomp would gain an extra blank line.\nfunction dropEndingNewline (string: string) {\n  return string[string.length - 1] === '\\n' ? string.slice(0, -1) : string\n}\n\n// Note: a long line without a suitable break point will exceed the width limit.\n// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.\nfunction foldBlockScalar (string: string, width: number) {\n  // In folded style, $k$ consecutive newlines output as $k+1$ newlines—\n  // unless they're before or after a more-indented line, or at the very\n  // beginning or end, in which case $k$ maps to $k$.\n  // Therefore, parse each chunk as newline(s) followed by a content line.\n  const lineRe = /(\\n+)([^\\n]*)/g\n\n  // first line (possibly an empty line)\n  let nextLF = string.indexOf('\\n')\n  if (nextLF === -1) nextLF = string.length\n  lineRe.lastIndex = nextLF\n  let result = foldLine(string.slice(0, nextLF), width)\n  // If we haven't reached the first content line yet, don't add an extra \\n.\n  let prevMoreIndented = string[0] === '\\n' || string[0] === ' '\n  let moreIndented\n\n  // rest of the lines\n  let match\n  while ((match = lineRe.exec(string))) {\n    const prefix = match[1]\n    const line = match[2]\n\n    moreIndented = (line[0] === ' ')\n    result += prefix +\n      ((!prevMoreIndented && !moreIndented && line !== '') ? '\\n' : '') +\n      foldLine(line, width)\n    prevMoreIndented = moreIndented\n  }\n\n  return result\n}\n\n// Greedy line breaking.\n// Picks the longest line under the limit each time,\n// otherwise settles for the shortest line over the limit.\n// NB. More-indented lines *cannot* be folded, as that would add an extra \\n.\nfunction foldLine (line: string, width: number) {\n  if (line === '' || line[0] === ' ') return line\n\n  // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n  const breakRe = / [^ ]/g // note: the match index will always be <= length-2.\n  let match\n  // start is an inclusive index. end, curr, and next are exclusive.\n  let start = 0\n  let end\n  let curr = 0\n  let next = 0\n  let result = ''\n\n  // Invariants: 0 <= start <= length-1.\n  //   0 <= curr <= next <= max(0, length-2). curr - start <= width.\n  // Inside the loop:\n  //   A match implies length >= 2, so curr and next are <= length-2.\n  while ((match = breakRe.exec(line))) {\n    next = match.index\n    // maintain invariant: curr - start <= width\n    if (next - start > width) {\n      end = (curr > start) ? curr : next // derive end <= length-2\n      result += `\\n${line.slice(start, end)}`\n      // skip the space that was output as \\n\n      start = end + 1                    // derive start <= length-1\n    }\n    curr = next\n  }\n\n  // By the invariants, start <= length-1, so there is something left over.\n  // It is either the whole string or a part starting from non-whitespace.\n  result += '\\n'\n  // Insert a break if the remainder is too long and there is a break available.\n  if (line.length - start > width && curr > start) {\n    result += `${line.slice(start, curr)}\\n${line.slice(curr + 1)}`\n  } else {\n    result += line.slice(start)\n  }\n\n  return result.slice(1) // drop extra \\n joiner\n}\n\nfunction escapeString (string: string) {\n  let result = ''\n  let char = 0\n\n  for (let i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n    char = codePointAt(string, i)\n    const escapeSeq = ESCAPE_SEQUENCES[char]\n\n    if (escapeSeq) {\n      result += escapeSeq\n      continue\n    }\n\n    if (isPrintable(char)) {\n      result += string[i]\n      if (char >= 0x10000) result += string[i + 1]\n      continue\n    }\n\n    result += encodeNonPrintable(char)\n  }\n\n  return result\n}\n\nfunction writeFlowSequence (state: PresenterState, level: number, node: SequenceNode) {\n  let result = ''\n\n  for (let index = 0, length = node.items.length; index < length; index += 1) {\n    const item = writeNode(state, level, node.items[index], {})\n    if (result !== '') result += `,${!state.flowSkipCommaSpace ? ' ' : ''}`\n    result += item\n  }\n\n  const pad = state.flowBracketPadding && result !== '' ? ' ' : ''\n  return `[${pad}${result}${pad}]`\n}\n\nfunction writeBlockSequence (state: PresenterState, level: number, node: SequenceNode, compact: boolean) {\n  let result = ''\n\n  for (let index = 0, length = node.items.length; index < length; index += 1) {\n    const item = writeNode(state, level + 1, node.items[index],\n      { block: true, compact: state.seqInlineFirst, isblockseq: true })\n\n    if (!compact || result !== '') {\n      result += generateNextLine(state, level)\n    }\n\n    // No trailing space when the value renders empty (e.g. null → '').\n    if (item === '' || CHAR_LINE_FEED === item.charCodeAt(0)) {\n      result += '-'\n    } else {\n      result += '- '\n    }\n\n    result += item\n  }\n\n  return result\n}\n\nfunction writeFlowMapping (state: PresenterState, level: number, node: MappingNode) {\n  let result = ''\n  const items = sortMappingItems(state, node.items)\n\n  for (const { key, value } of items) {\n    let pairBuffer = ''\n    if (result !== '') pairBuffer += `,${!state.flowSkipCommaSpace ? ' ' : ''}`\n\n    const keyText = writeNode(state, level, key, { iskey: true })\n    const explicitPair = keyText.length > 1024\n\n    if (explicitPair) {\n      pairBuffer += '? '\n    } else if (state.quoteFlowKeys) {\n      pairBuffer += '\"'\n    }\n\n    const valueText = writeNode(state, level, value, {})\n    // No separating space when the value renders empty (e.g. null → '').\n    const sep = state.flowSkipColonSpace || valueText === '' ? '' : ' '\n\n    pairBuffer += `${keyText}${state.quoteFlowKeys && !explicitPair ? '\"' : ''}:${sep}${valueText}`\n\n    result += pairBuffer\n  }\n\n  const pad = state.flowBracketPadding && result !== '' ? ' ' : ''\n  return `{${pad}${result}${pad}}`\n}\n\n// A scalar key sorts by its text; the default sort and a custom comparator both\n// see that, matching the original keys-array sort.\nfunction sortKeyValue (key: Node): any {\n  return key.kind === 'scalar' ? key.value : key\n}\n\nfunction sortMappingItems (state: PresenterState, items: MappingNode['items']) {\n  if (!state.sortKeys) return items\n\n  const copy = items.slice()\n\n  if (state.sortKeys === true) {\n    copy.sort((a, b) => {\n      const x = sortKeyValue(a.key)\n      const y = sortKeyValue(b.key)\n      if (x < y) return -1\n      if (x > y) return 1\n      return 0\n    })\n  } else {\n    const fn = state.sortKeys\n    copy.sort((a, b) => fn(sortKeyValue(a.key), sortKeyValue(b.key)))\n  }\n\n  return copy\n}\n\nfunction writeBlockMapping (state: PresenterState, level: number, node: MappingNode, compact: boolean) {\n  let result = ''\n  const items = sortMappingItems(state, node.items)\n\n  for (let index = 0, length = items.length; index < length; index += 1) {\n    let pairBuffer = ''\n\n    if (!compact || result !== '') {\n      pairBuffer += generateNextLine(state, level)\n    }\n\n    const { key, value } = items[index]\n\n    // A block key — a block collection (mapping/sequence) or a block scalar\n    // (literal/folded) — can't sit on a `key:` line, so it's written with block\n    // context and the pair takes the explicit `? key / : value` form. A simple\n    // scalar key stays inline (flow-vs-block is invisible there).\n    const keyIsBlock =\n      ((key.kind === 'mapping' || key.kind === 'sequence') &&\n        !key.style.flow && key.items.length !== 0) ||\n      (key.kind === 'scalar' && (key.style.literal || key.style.folded))\n\n    // The `?`/`:` indicators shift content right like a `-`, so a block key or\n    // value that stays on the indicator line keeps its indentation under\n    // seqNoIndent (`isblockseq`). One that drops to its own line (tag/anchor)\n    // collapses to the parent indent, so leave the flag off there.\n    const keyText = keyIsBlock\n      ? writeNode(state, level + 1, key,\n        { block: true, compact: true, isblockseq: !cannotBeCompact(state, key, level + 1) })\n      : writeNode(state, level + 1, key, { block: true, compact: true, iskey: true })\n\n    // Block key, over-long key, or multiline scalar key forces explicit form.\n    // Multiline isn't a spec requirement — just matches pyyaml's simple-key rule.\n    const keyHasLineBreak = key.kind === 'scalar' && key.value.indexOf('\\n') !== -1\n    const explicitPair = keyIsBlock || keyHasLineBreak || keyText.length > 1024\n\n    if (explicitPair) {\n      if (keyText && CHAR_LINE_FEED === keyText.charCodeAt(0)) {\n        pairBuffer += '?'\n      } else {\n        pairBuffer += '? '\n      }\n    }\n\n    pairBuffer += keyText\n\n    if (explicitPair) {\n      pairBuffer += generateNextLine(state, level)\n    }\n\n    const valueText = writeNode(state, level + 1, value,\n      { block: true, compact: explicitPair, isblockseq: explicitPair && !cannotBeCompact(state, value, level + 1) })\n\n    // Keep a space before the colon when the key text ends in a leading\n    // property rather than scalar content, so the colon can't be read as part\n    // of it. Two cases: an inline alias key (`*b : v`), and an empty scalar key\n    // whose whole text is its anchor/tag (`&a :`, `!!str :`) — without the\n    // space `&a:` reparses as an anchored value, dropping the null key.\n    const keyIsBareProps = key.kind === 'scalar' && key.value === '' &&\n      keyText !== '' &&\n      keyText.charCodeAt(keyText.length - 1) !== CHAR_SINGLE_QUOTE &&\n      keyText.charCodeAt(keyText.length - 1) !== CHAR_DOUBLE_QUOTE\n    const keyColonSep = !explicitPair && (key.kind === 'alias' || keyIsBareProps) ? ' ' : ''\n\n    // No trailing space when the value renders empty (e.g. null → '').\n    if (valueText === '' || CHAR_LINE_FEED === valueText.charCodeAt(0)) {\n      pairBuffer += `${keyColonSep}:`\n    } else {\n      pairBuffer += `${keyColonSep}: `\n    }\n\n    pairBuffer += valueText\n\n    result += pairBuffer\n  }\n\n  return result\n}\n\n// Where a node sits relative to its parent — drives layout/style decisions.\n// All flags default to false (the flow-context, non-key, non-compact case).\ninterface NodeContext {\n  block?: boolean      // block context (vs flow); propagates downward\n  compact?: boolean    // may start on the current line (no leading newline)\n  iskey?: boolean      // node is a mapping key\n  isblockseq?: boolean // content follows an indicator (`-`, or `?`/`:` in an\n                       // explicit pair) that already shifted it right; keeps\n                       // its indentation under seqNoIndent\n}\n\n// A node can't sit compact on its parent's indicator (`-`/`?`/`:`) line when it\n// carries leading props (tag/anchor) that would collide with the indicator, or\n// when the indent step is too narrow for the 2-char indicator. Such a node drops\n// to its own line; a block collection that does so also collapses its seqNoIndent\n// indentation back to the parent.\nfunction cannotBeCompact (state: PresenterState, node: Node, level: number) {\n  return node.style.tagged || node.anchor !== undefined || (state.indent < 2 && level > 0)\n}\n\nfunction writeNode (state: PresenterState, level: number, node: Node, ctx: NodeContext): string {\n  if (node.kind === 'alias') return `*${node.anchor}`\n\n  const { block = false, iskey = false, isblockseq = false } = ctx\n  let compact = ctx.compact ?? false\n\n  const hasAnchor = node.anchor !== undefined\n\n  if (cannotBeCompact(state, node, level)) {\n    compact = false\n  }\n\n  let body: string\n  let shouldPrintTag = node.style.tagged\n  const useBlockCollection = block &&\n    (node.kind === 'mapping' || node.kind === 'sequence') &&\n    !node.style.flow && node.items.length !== 0\n\n  if (node.kind === 'mapping') {\n    if (useBlockCollection) {\n      body = writeBlockMapping(state, level, node, compact)\n    } else {\n      body = writeFlowMapping(state, level, node)\n    }\n  } else if (node.kind === 'sequence') {\n    if (useBlockCollection) {\n      if (state.seqNoIndent && !isblockseq && level > 0) {\n        body = writeBlockSequence(state, level - 1, node, compact)\n      } else {\n        body = writeBlockSequence(state, level, node, compact)\n      }\n    } else {\n      body = writeFlowSequence(state, level, node)\n    }\n  } else {\n    const layout = scalarLayout(state, level)\n    const style = resolveScalarStyle(state, node, layout, iskey, block)\n    body = renderScalarStyle(node.value, style, layout)\n    shouldPrintTag = node.style.tagged || (style !== STYLE_PLAIN && node.tag !== state.defaultScalarTagName)\n  }\n\n  // An indicator plus its mandatory separator occupies 2 columns. For wider\n  // indentation, pad a compact block collection so its first item starts at\n  // the same column as the following items.\n  if (useBlockCollection && compact && level > 0 && state.indent > 2) {\n    body = `${' '.repeat(state.indent - 2)}${body}`\n  }\n\n  if (shouldPrintTag || hasAnchor) {\n    const props: string[] = []\n    const tag = shouldPrintTag ? nodeTagShort(node) : null\n    const anchor = hasAnchor ? `&${node.anchor}` : null\n\n    if (state.tagBeforeAnchor) {\n      if (tag !== null) props.push(tag)\n      if (anchor !== null) props.push(anchor)\n    } else {\n      if (anchor !== null) props.push(anchor)\n      if (tag !== null) props.push(tag)\n    }\n\n    // No separator when the body is empty (e.g. `&anchor` on a null node) or\n    // already starts on its own line.\n    const sep = body === '' || body.charCodeAt(0) === CHAR_LINE_FEED ? '' : ' '\n    body = `${props.join(' ')}${sep}${body}`\n  }\n\n  return body\n}\n\n// A bare (untagged, unanchored) non-empty block collection: writeNode renders it\n// in compact form with its first item on the opening line. That works mid-stream,\n// but right after a `---` the first item must drop to the next line. A tag/anchor\n// already forces the body onto its own line, so those stay on the `---` line.\nfunction rootStartsOwnLine (node: Node) {\n  return (node.kind === 'sequence' || node.kind === 'mapping') &&\n    !node.style.flow &&\n    node.items.length !== 0 &&\n    !node.style.tagged &&\n    node.anchor === undefined\n}\n\n// A document whose serialization ends with a keep-chomped (`+`) block scalar is\n// open-ended: the trailing blank line(s) would otherwise be ambiguous, so it\n// needs a `...` terminator. Mirrors the keep test in `blockHeader`.\nfunction isOpenEnded (node: Node) {\n  // Descend to the last leaf, always taking the last item of a block collection\n  // (a flow collection renders on one line, so it ends the document itself).\n  let leaf = node\n  while ((leaf.kind === 'sequence' || leaf.kind === 'mapping') &&\n    !leaf.style.flow && leaf.items.length !== 0) {\n    leaf = leaf.kind === 'sequence'\n      ? leaf.items[leaf.items.length - 1]\n      : leaf.items[leaf.items.length - 1].value\n  }\n\n  if (leaf.kind !== 'scalar' || !(leaf.style.literal || leaf.style.folded)) return false\n  const { value } = leaf\n  // Keep chomping: ends in a blank line (`\\n\\n`) or is a lone `\\n`.\n  return value.endsWith('\\n\\n') || value === '\\n'\n}\n\nfunction writeDocumentDirectives (doc: Document) {\n  let result = ''\n\n  for (const directive of doc.directives) {\n    if (directive.kind === 'yaml') {\n      result += `%YAML ${directive.version}\\n`\n      continue\n    }\n\n    const { handle, prefix } = directive\n    result += `%TAG ${handle} ${prefix}\\n`\n  }\n\n  return result\n}\n\n// Documents → text, including the trailing newline.\nfunction present (documents: Document[], options: PresenterOptions): string {\n  const state = createPresenterState(options)\n  let result = ''\n  let previousEnded = false\n\n  for (let index = 0; index < documents.length; index += 1) {\n    const doc = documents[index]\n    const directives = writeDocumentDirectives(doc)\n    const hasDirectives = directives !== ''\n    const marker = doc.explicitStart || hasDirectives || (index > 0 && !previousEnded)\n\n    result += directives\n\n    if (doc.contents === null) {\n      if (marker) result += '---\\n'\n    } else if (marker) {\n      const body = writeNode(state, 0, doc.contents, { block: true, compact: true })\n      // Content shares the `---` line, except: an empty render (no separator at\n      // all), a bare block collection (wraps to the next line), or directives\n      // forcing `---` onto its own line.\n      const sep = body === '' ? '' : (hasDirectives || rootStartsOwnLine(doc.contents) ? '\\n' : ' ')\n      result += `---${sep}${body}\\n`\n    } else {\n      result += writeNode(state, 0, doc.contents, { block: true, compact: true }) + '\\n'\n    }\n\n    previousEnded = doc.explicitEnd || (doc.contents !== null && isOpenEnded(doc.contents))\n    if (previousEnded) {\n      result += '...\\n'\n    }\n  }\n\n  return result\n}\n\nexport {\n  DEFAULT_PRESENTER_OPTIONS,\n  present,\n  type PresenterOptions\n}\n","import { YAML11_SCHEMA, type Schema } from './schema.ts'\nimport { jsToAst } from './ast/from_js.ts'\nimport { visit, VISIT_SKIP } from './ast/visit.ts'\nimport { type Document } from './ast/nodes.ts'\nimport {\n  DEFAULT_PRESENTER_OPTIONS,\n  present,\n  type PresenterOptions\n} from './ast/presenter.ts'\nimport { pick } from './common/object.ts'\nimport { NOT_RESOLVED } from './tag.ts'\nimport { intCoreTag } from './tag/scalar/int_core.ts'\nimport { intYaml11Tag } from './tag/scalar/int_yaml11.ts'\nimport { floatCoreTag } from './tag/scalar/float_core.ts'\nimport { floatYaml11Tag } from './tag/scalar/float_yaml11.ts'\n\ninterface DumpOptions extends Omit<PresenterOptions, 'schema'> {\n  schema?: Schema\n  skipInvalid?: boolean\n  noRefs?: boolean\n  flowLevel?: number\n  transform?: (documents: Document[]) => void\n}\n\n// YAML 1.1 misses YAML 1.2 `0o...` ints and exponent-only floats.\n// Combine resolvers so all possible collisions are quoted.\nconst DEFAULT_DUMP_SCHEMA = YAML11_SCHEMA.withTags(\n  {\n    ...intYaml11Tag,\n    resolve: (source, isExplicit, tagName) => {\n      const result = intYaml11Tag.resolve(source, isExplicit, tagName)\n      return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result\n    }\n  },\n  {\n    ...floatYaml11Tag,\n    resolve: (source, isExplicit, tagName) => {\n      const result = floatYaml11Tag.resolve(source, isExplicit, tagName)\n      return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result\n    }\n  }\n)\n\nconst DEFAULT_DUMP_OPTIONS: Required<DumpOptions> = {\n  ...DEFAULT_PRESENTER_OPTIONS,\n  schema: DEFAULT_DUMP_SCHEMA,\n  skipInvalid: false,\n  noRefs: false,\n  flowLevel: -1,\n  transform: () => {}\n}\n\n// Options that need the JS value (tags, format, dedup) go to `jsToAst`; purely\n// presentational ones go to `present`.\nfunction dump (input: any, options: DumpOptions = {}) {\n  const opts = { ...DEFAULT_DUMP_OPTIONS, ...options }\n\n  const documents = jsToAst(input, opts.schema, {\n    noRefs: opts.noRefs,\n    skipInvalid: opts.skipInvalid\n  })\n\n  // flowLevel: every node at this depth switches to flow; the presenter forces\n  // everything below into flow too, so the walk stops there.\n  if (opts.flowLevel >= 0) {\n    visit(documents, (node, ctx) => {\n      if (ctx.depth < opts.flowLevel) return\n      node.style.flow = true\n      return VISIT_SKIP\n    })\n  }\n\n  opts.transform(documents)\n\n  const PRESENTER_OPT_KEYS = Object.keys(DEFAULT_PRESENTER_OPTIONS) as\n    (keyof typeof DEFAULT_PRESENTER_OPTIONS)[]\n\n  return present(documents, { ...pick(opts, PRESENTER_OPT_KEYS), schema: opts.schema })\n}\n\nexport {\n  dump,\n\n  type DumpOptions\n}\n","// Parser events → AST. The second entry into the AST world (the first being\n// `jsToAst`): instead of building JS values like the constructor, it mirrors the\n// same document/sequence/mapping frame walk and emits `Node`s that keep the\n// original styles, tags and anchors, so parsed YAML can be re-dumped faithfully.\n\nimport {\n  EVENT_ALIAS,\n  EVENT_DOCUMENT,\n  EVENT_MAPPING,\n  EVENT_POP,\n  EVENT_SCALAR,\n  EVENT_SEQUENCE,\n  SCALAR_STYLE_PLAIN,\n  SCALAR_STYLE_SINGLE_QUOTED,\n  SCALAR_STYLE_DOUBLE_QUOTED,\n  SCALAR_STYLE_LITERAL_BLOCK,\n  SCALAR_STYLE_FOLDED_BLOCK,\n  COLLECTION_STYLE_FLOW,\n  type Event,\n  type MappingEvent,\n  type ScalarEvent,\n  type SequenceEvent\n} from '../parser/events.ts'\nimport { getScalarValue } from '../parser/parser_scalar.ts'\nimport { type Schema } from '../schema.ts'\nimport { NOT_RESOLVED } from '../tag.ts'\nimport {\n  Style,\n  type Node,\n  type Document,\n  type ScalarNode,\n  type SequenceNode,\n  type MappingNode,\n  type AliasNode\n} from './nodes.ts'\n\nconst NO_RANGE = -1\n\ninterface DocumentFrame {\n  kind: 'document'\n  doc: Document\n}\n\ninterface SequenceFrame {\n  kind: 'sequence'\n  node: SequenceNode\n}\n\ninterface MappingFrame {\n  kind: 'mapping'\n  node: MappingNode\n  key: Node | null\n}\n\ntype Frame = DocumentFrame | SequenceFrame | MappingFrame\n\ninterface FromEventsOptions {\n  source: string\n  schema: Schema\n}\n\ninterface FromEventsState {\n  source: string\n  schema: Schema\n  eventIndex: number\n  position: number\n  frames: Frame[]\n  documents: Document[]\n}\n\nfunction eventPosition (event: Event) {\n  if ('tagStart' in event && event.tagStart !== NO_RANGE) return event.tagStart\n  if ('anchorStart' in event && event.anchorStart !== NO_RANGE) return event.anchorStart\n  if ('valueStart' in event && event.valueStart !== NO_RANGE) return event.valueStart\n  if ('start' in event) return event.start\n  return 0\n}\n\nfunction rawTag (state: FromEventsState, event: ScalarEvent | SequenceEvent | MappingEvent) {\n  return event.tagStart === NO_RANGE\n    ? ''\n    : state.source.slice(event.tagStart, event.tagEnd)\n}\n\nfunction anchorName (state: FromEventsState, event: ScalarEvent | SequenceEvent | MappingEvent) {\n  return event.anchorStart === NO_RANGE\n    ? undefined\n    : state.source.slice(event.anchorStart, event.anchorEnd)\n}\n\n// Tag name carried by an empty/plain scalar with no explicit tag: the first\n// implicit scalar resolver that accepts the text, falling back to str. Mirrors\n// the implicit branch of `constructScalar`, but we only want the tag name.\nfunction implicitScalarTagName (state: FromEventsState, source: string) {\n  const { schema } = state\n  const candidates = schema.implicitScalarByFirstChar.get(source.charAt(0)) ??\n    schema.implicitScalarAnyFirstChar\n  for (const tag of candidates) {\n    if (tag.resolve(source, false, tag.tagName) !== NOT_RESOLVED) return tag.tagName\n  }\n  return schema.defaultScalarTag.tagName\n}\n\nfunction buildScalar (state: FromEventsState, event: ScalarEvent): ScalarNode {\n  const value = getScalarValue(state.source, event)\n  const raw = rawTag(state, event)\n  const style = new Style()\n\n  switch (event.style) {\n    case SCALAR_STYLE_SINGLE_QUOTED: style.singleQuoted = true; break\n    case SCALAR_STYLE_DOUBLE_QUOTED: style.doubleQuoted = true; break\n    case SCALAR_STYLE_LITERAL_BLOCK: style.literal = true; break\n    case SCALAR_STYLE_FOLDED_BLOCK: style.folded = true; break\n  }\n\n  let tag: string\n  if (raw !== '') {\n    style.tagged = true\n    tag = raw\n  } else if (event.style === SCALAR_STYLE_PLAIN) {\n    tag = implicitScalarTagName(state, value)\n  } else {\n    tag = state.schema.defaultScalarTag.tagName\n  }\n\n  return { kind: 'scalar', tag, style, anchor: anchorName(state, event), value }\n}\n\nfunction buildCollection (\n  state: FromEventsState,\n  event: SequenceEvent | MappingEvent,\n  defaultTagName: string\n): { tag: string, style: Style, anchor?: string } {\n  const raw = rawTag(state, event)\n  const style = new Style()\n  if (event.style === COLLECTION_STYLE_FLOW) style.flow = true\n\n  let tag: string\n  if (raw === '') {\n    tag = defaultTagName\n  } else {\n    tag = raw\n    style.tagged = true\n  }\n\n  return { tag, style, anchor: anchorName(state, event) }\n}\n\nfunction addNode (state: FromEventsState, node: Node) {\n  const frame = state.frames[state.frames.length - 1]\n\n  if (frame.kind === 'document') {\n    frame.doc.contents = node\n  } else if (frame.kind === 'sequence') {\n    frame.node.items.push(node)\n  } else if (frame.key) {\n    frame.node.items.push({ key: frame.key, value: node })\n    frame.key = null\n  } else {\n    frame.key = node\n  }\n}\n\nfunction eventsToAst (events: Event[], options: FromEventsOptions): Document[] {\n  const state: FromEventsState = {\n    source: options.source,\n    schema: options.schema,\n    eventIndex: 0,\n    position: 0,\n    frames: [],\n    documents: []\n  }\n\n  while (state.eventIndex < events.length) {\n    const event = events[state.eventIndex++]\n    state.position = eventPosition(event)\n\n    switch (event.type) {\n      case EVENT_DOCUMENT: {\n        const doc: Document = {\n          contents: null,\n          explicitStart: event.explicitStart,\n          explicitEnd: event.explicitEnd,\n          directives: event.directives\n        }\n        state.frames.push({ kind: 'document', doc })\n        break\n      }\n\n      case EVENT_SCALAR:\n        addNode(state, buildScalar(state, event))\n        break\n\n      case EVENT_SEQUENCE: {\n        const { tag, style, anchor } = buildCollection(state, event, 'tag:yaml.org,2002:seq')\n        const node: SequenceNode = { kind: 'sequence', tag, style, anchor, items: [] }\n        state.frames.push({ kind: 'sequence', node })\n        break\n      }\n\n      case EVENT_MAPPING: {\n        const { tag, style, anchor } = buildCollection(state, event, 'tag:yaml.org,2002:map')\n        const node: MappingNode = { kind: 'mapping', tag, style, anchor, items: [] }\n        state.frames.push({ kind: 'mapping', node, key: null })\n        break\n      }\n\n      case EVENT_ALIAS: {\n        const name = state.source.slice(event.anchorStart, event.anchorEnd)\n        const node: AliasNode = { kind: 'alias', tag: '', style: new Style(), anchor: name }\n        addNode(state, node)\n        break\n      }\n\n      case EVENT_POP: {\n        const frame = state.frames.pop()!\n        if (frame.kind === 'document') {\n          state.documents.push(frame.doc)\n        } else {\n          addNode(state, frame.node)\n        }\n        break\n      }\n    }\n  }\n\n  return state.documents\n}\n\nexport {\n  eventsToAst,\n  type FromEventsOptions\n}\n"],"mappings":";;AAAA,IAAM,IAA8B,OAAO,cAAc,GACnD,IAA2B,OAAO,WAAW;AAoHnD,SAAS,EAAyB,GAAiB,GAAgE;;CACjH,OAAO;EACL;EACA,UAAU;EACV,WAAA,IAAU,EAAQ,aAAA,OAAY,KAAZ;EAClB,mBAAA,IAAkB,EAAQ,qBAAA,OAAoB,KAApB;EAC1B,qBAAA,IAAoB,EAAQ,uBAAA,OAAsB,OAAtB;EAC5B,SAAS,EAAQ;EACjB,WAAA,IAAU,EAAQ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O,WAAW,GAAY,KAAK,GAAY,KAAK,GAAY,KAAK,GA2B9F,KAAkD;CACtD,UAAU;CACV,UAAU;AACZ;AAgBA,SAAS,GACP,GACA,GACA,GACA;CACA,EAAM,OAAO,KAAK;EAChB,MAAA;EACA;EACA;EACA,YAAY,EAAM;CACpB,CAAC;AACH;AAEA,SAAS,GACP,GACA,GACA,GACA,GACA,GACA,GACA,GACA;CACA,EAAM,OAAO,KAAK;EAChB,MAAA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH;AAEA,SAAS,EACP,GACA,GACA,GACA,GACA,GACA,GACA,GACA;CACA,EAAM,OAAO,KAAK;EAChB,MAAA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH;AAEA,SAAS,EACP,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IAAA,GACA,IAAS,IACT,IAAO,IACP;CACA,EAAM,OAAO,KAAK;EAChB,MAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH;AAEA,SAAS,GACP,GACA,GACA,GACA;CACA,EAAM,OAAO,KAAK;EAChB,MAAA;EACA;EACA;CACF,CAAC;AACH;AAEA,SAAS,EAAa,GAAoB;CACxC,EAAM,OAAO,KAAK,EAAE,MAAA,EAAgB,CAAC;AACvC;AAEA,SAAS,EAAqB,GAAoB;CAChD,EACE,GACA,GACA,GACA,GACA,GACA,GACA,GAAA,CAEF;AACF;AAEA,SAAS,KAAmC;CAC1C,OAAO;EACL,aAAa;EACb,WAAW;EACX,UAAU;EACV,QAAQ;CACV;AACF;AAEA,SAAS,EAAe,GAAoC;CAC1D,OAAO;EACL,UAAU,EAAM;EAChB,MAAM,EAAM;EACZ,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,gBAAgB,EAAM;EACtB,cAAc,EAAM,OAAO;CAC7B;AACF;AAEA,SAAS,EAAc,GAAoB,GAA0B;CAMnE,AALA,EAAM,WAAW,EAAS,UAC1B,EAAM,OA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