{"version":3,"sources":["../src/index.ts","../src/document.ts","../src/errors.ts","../src/parsed.ts","../node_modules/.pnpm/github-slugger@2.0.0/node_modules/github-slugger/regex.js","../node_modules/.pnpm/github-slugger@2.0.0/node_modules/github-slugger/index.js","../src/text.ts","../src/render.ts","../src/serialized.ts"],"sourcesContent":["import { normalizeParsed } from \"./parsed.js\";\nimport { renderDocument, type ConvertOptions } from \"./render.js\";\nimport { parseSerialized } from \"./serialized.js\";\n\nexport { JsonToMarkdownError } from \"./errors.js\";\nexport type { JsonToMarkdownErrorCode, SourceLocation } from \"./errors.js\";\nexport type { ConvertOptions } from \"./render.js\";\n\nexport type JsonObject = { readonly [key: string]: JsonValue };\nexport type JsonArray = readonly JsonValue[];\nexport type JsonValue = null | boolean | number | string | JsonObject | JsonArray;\n\n/**\n * Convert caller-trusted parsed JSON data into a deterministic GFM Output Document.\n * Validates the value at runtime and throws {@link JsonToMarkdownError} on invalid input.\n */\nexport function convertJsonValue(value: unknown, options: ConvertOptions = {}): string {\n  return renderDocument(normalizeParsed(value), options);\n}\n\n/**\n * Convert untrusted Serialized JSON Text into a deterministic GFM Output Document.\n * Parses without executing caller code, preserves numeric lexemes losslessly, and\n * throws {@link JsonToMarkdownError} on invalid input.\n */\nexport function convertJsonText(source: string, options: ConvertOptions = {}): string {\n  return renderDocument(parseSerialized(source), options);\n}\n","/**\n * Internal representation shared by both entry points.\n *\n * Both `convertJsonValue` and `convertJsonText` normalise their input into this\n * form so that a single renderer produces the Output Document. A number keeps\n * its Numeric Lexeme as text: the serialized path stores the original token, the\n * parsed path stores the caller's value formatted by the host.\n */\nexport type DocNode =\n  | { readonly kind: \"null\" }\n  | { readonly kind: \"boolean\"; readonly value: boolean }\n  | { readonly kind: \"number\"; readonly lexeme: string }\n  | { readonly kind: \"string\"; readonly value: string }\n  | { readonly kind: \"array\"; readonly items: readonly DocNode[] }\n  | { readonly kind: \"object\"; readonly entries: readonly (readonly [string, DocNode])[] };\n\nexport const NULL_NODE: DocNode = { kind: \"null\" };\nexport const TRUE_NODE: DocNode = { kind: \"boolean\", value: true };\nexport const FALSE_NODE: DocNode = { kind: \"boolean\", value: false };\n\nexport function isContainer(node: DocNode): boolean {\n  return node.kind === \"array\" || node.kind === \"object\";\n}\n\nexport function isEmptyContainer(node: DocNode): boolean {\n  return (\n    (node.kind === \"array\" && node.items.length === 0) ||\n    (node.kind === \"object\" && node.entries.length === 0)\n  );\n}\n\n/** A value shown inline (as a paragraph or list-item scalar) rather than as its own structure. */\nexport function rendersInline(node: DocNode): boolean {\n  return !isContainer(node) || isEmptyContainer(node);\n}\n\n/** Zero-padded four-digit hex for a `\\uXXXX` escape. */\nexport function hex4(code: number): string {\n  return code.toString(16).padStart(4, \"0\");\n}\n\n/** RFC 6901 pointer segment escaping. */\nexport function pointerSegment(name: string): string {\n  return name.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n\nexport function childPointer(pointer: string, name: string): string {\n  return `${pointer}/${pointerSegment(name)}`;\n}\n","export type JsonToMarkdownErrorCode =\n  | \"INVALID_JSON_SYNTAX\"\n  | \"DUPLICATE_MEMBER_NAME\"\n  | \"INVALID_PARSED_VALUE\"\n  | \"CYCLIC_REFERENCE\"\n  | \"SPARSE_ARRAY\"\n  | \"INVALID_OPTION\";\n\nexport interface SourceLocation {\n  /** Zero-based UTF-16 code-unit index. */\n  readonly offset: number;\n  /** One-based line number. */\n  readonly line: number;\n  /** One-based UTF-16 code-unit position within the line. */\n  readonly column: number;\n}\n\nexport interface JsonToMarkdownErrorDetails {\n  readonly pointer?: string;\n  readonly location?: SourceLocation;\n  /** First occurrence of a member name reported as DUPLICATE_MEMBER_NAME. */\n  readonly firstLocation?: SourceLocation;\n}\n\nexport class JsonToMarkdownError extends Error {\n  readonly code: JsonToMarkdownErrorCode;\n  readonly pointer: string | undefined;\n  readonly location: SourceLocation | undefined;\n  readonly firstLocation: SourceLocation | undefined;\n\n  constructor(\n    code: JsonToMarkdownErrorCode,\n    message: string,\n    details: JsonToMarkdownErrorDetails = {},\n  ) {\n    super(message);\n    this.name = \"JsonToMarkdownError\";\n    this.code = code;\n    this.pointer = details.pointer;\n    this.location = details.location;\n    this.firstLocation = details.firstLocation;\n    // Keep `instanceof` working when compiled down and when subclassed.\n    Object.setPrototypeOf(this, new.target.prototype);\n  }\n}\n","import { childPointer, FALSE_NODE, NULL_NODE, TRUE_NODE, type DocNode } from \"./document.js\";\nimport { JsonToMarkdownError } from \"./errors.js\";\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nfunction invalid(pointer: string, what: string): never {\n  throw new JsonToMarkdownError(\n    \"INVALID_PARSED_VALUE\",\n    `Value at ${pointer || \"the root\"} is not JSON-compatible: ${what}.`,\n    { pointer },\n  );\n}\n\n/** Classify a value. Returns a DocNode for scalars, or null when it is a container to descend. */\nfunction tryScalar(value: unknown, pointer: string): DocNode | null {\n  if (value === null) return NULL_NODE;\n  switch (typeof value) {\n    case \"boolean\":\n      return value ? TRUE_NODE : FALSE_NODE;\n    case \"string\":\n      return { kind: \"string\", value };\n    case \"number\":\n      if (!Number.isFinite(value)) invalid(pointer, `the number ${String(value)}`);\n      return { kind: \"number\", lexeme: String(value) };\n    case \"object\":\n      return null;\n    case \"undefined\":\n      invalid(pointer, \"undefined\");\n    // eslint-disable-next-line no-fallthrough\n    case \"bigint\":\n      invalid(pointer, \"a BigInt\");\n    // eslint-disable-next-line no-fallthrough\n    case \"function\":\n      invalid(pointer, \"a function\");\n    // eslint-disable-next-line no-fallthrough\n    case \"symbol\":\n      invalid(pointer, \"a symbol\");\n    // eslint-disable-next-line no-fallthrough\n    default:\n      invalid(pointer, `a ${typeof value}`);\n  }\n}\n\n/** Read an own property through its descriptor so getters are never invoked. */\nfunction readOwn(source: object, key: PropertyKey, pointer: string): unknown {\n  const d = Object.getOwnPropertyDescriptor(source, key);\n  if (d === undefined || !(\"value\" in d)) {\n    invalid(pointer, \"an accessor property\");\n  }\n  return d.value;\n}\n\nfunction validateArrayShape(source: readonly unknown[], pointer: string): number {\n  const length = source.length;\n  for (let i = 0; i < length; i++) {\n    if (!hasOwn.call(source, i)) {\n      const at = childPointer(pointer, String(i));\n      throw new JsonToMarkdownError(\"SPARSE_ARRAY\", `Array at ${pointer || \"the root\"} has a hole at index ${i}.`, {\n        pointer: at,\n      });\n    }\n  }\n  for (const key of Object.keys(source)) {\n    const idx = Number(key);\n    if (!Number.isInteger(idx) || idx < 0 || idx >= length || String(idx) !== key) {\n      invalid(pointer, `an array with an extra enumerable property \"${key}\"`);\n    }\n  }\n  return length;\n}\n\nfunction validateObjectShape(source: object, pointer: string): string[] {\n  const proto = Object.getPrototypeOf(source);\n  if (proto !== Object.prototype && proto !== null) {\n    invalid(pointer, \"an object with a non-plain prototype\");\n  }\n  return Object.keys(source);\n}\n\ninterface Frame {\n  source: object;\n  pointer: string;\n  isArray: boolean;\n  keyForParent: string | null;\n  index: number;\n  length: number;\n  keys: readonly string[] | null;\n  results: DocNode[];\n  entries: [string, DocNode][];\n}\n\nfunction makeFrame(value: object, pointer: string, keyForParent: string | null): Frame {\n  if (Array.isArray(value)) {\n    const length = validateArrayShape(value, pointer);\n    return { source: value, pointer, isArray: true, keyForParent, index: 0, length, keys: null, results: [], entries: [] };\n  }\n  const keys = validateObjectShape(value, pointer);\n  return { source: value, pointer, isArray: false, keyForParent, index: 0, length: keys.length, keys, results: [], entries: [] };\n}\n\n/**\n * Validate caller-trusted parsed data and normalise it into a DocNode.\n * Iterative to satisfy the no-nesting-limit ADR: never relies on the call stack.\n */\nexport function normalizeParsed(root: unknown): DocNode {\n  const rootScalar = tryScalar(root, \"\");\n  if (rootScalar !== null) return rootScalar;\n\n  const onPath = new Set<object>();\n  onPath.add(root as object);\n  const stack: Frame[] = [makeFrame(root as object, \"\", null)];\n  let finished: DocNode | null = null;\n\n  while (stack.length > 0) {\n    const frame = stack[stack.length - 1]!;\n\n    if (frame.index >= frame.length) {\n      const node: DocNode = frame.isArray\n        ? { kind: \"array\", items: frame.results }\n        : { kind: \"object\", entries: frame.entries };\n      onPath.delete(frame.source);\n      stack.pop();\n      const parent = stack[stack.length - 1];\n      if (parent === undefined) {\n        finished = node;\n      } else if (parent.isArray) {\n        parent.results.push(node);\n      } else {\n        parent.entries.push([frame.keyForParent!, node]);\n      }\n      continue;\n    }\n\n    const i = frame.index++;\n    const key = frame.isArray ? String(i) : frame.keys![i]!;\n    const childPtr = childPointer(frame.pointer, key);\n    const childValue = readOwn(frame.source, frame.isArray ? i : key, childPtr);\n\n    const scalar = tryScalar(childValue, childPtr);\n    if (scalar !== null) {\n      if (frame.isArray) frame.results.push(scalar);\n      else frame.entries.push([key, scalar]);\n      continue;\n    }\n\n    const childObj = childValue as object;\n    if (onPath.has(childObj)) {\n      throw new JsonToMarkdownError(\"CYCLIC_REFERENCE\", `Cyclic reference at ${childPtr}.`, { pointer: childPtr });\n    }\n    onPath.add(childObj);\n    stack.push(makeFrame(childObj, childPtr, frame.isArray ? null : key));\n  }\n\n  return finished!;\n}\n","// This module is generated by `script/`.\n/* eslint-disable no-control-regex, no-misleading-character-class, no-useless-escape */\nexport const regex = /[\\0-\\x1F!-,\\.\\/:-@\\[-\\^`\\{-\\xA9\\xAB-\\xB4\\xB6-\\xB9\\xBB-\\xBF\\xD7\\xF7\\u02C2-\\u02C5\\u02D2-\\u02DF\\u02E5-\\u02EB\\u02ED\\u02EF-\\u02FF\\u0375\\u0378\\u0379\\u037E\\u0380-\\u0385\\u0387\\u038B\\u038D\\u03A2\\u03F6\\u0482\\u0530\\u0557\\u0558\\u055A-\\u055F\\u0589-\\u0590\\u05BE\\u05C0\\u05C3\\u05C6\\u05C8-\\u05CF\\u05EB-\\u05EE\\u05F3-\\u060F\\u061B-\\u061F\\u066A-\\u066D\\u06D4\\u06DD\\u06DE\\u06E9\\u06FD\\u06FE\\u0700-\\u070F\\u074B\\u074C\\u07B2-\\u07BF\\u07F6-\\u07F9\\u07FB\\u07FC\\u07FE\\u07FF\\u082E-\\u083F\\u085C-\\u085F\\u086B-\\u089F\\u08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CD4\\u0CD7-\\u0CDD\\u0CDF\\u0CE4\\u0CE5\\u0CF0\\u0CF3-\\u0CFF\\u0D0D\\u0D11\\u0D45\\u0D49\\u0D4F-\\u0D53\\u0D58-\\u0D5E\\u0D64\\u0D65\\u0D70-\\u0D79\\u0D80\\u0D84\\u0D97-\\u0D99\\u0DB2\\u0DBC\\u0DBE\\u0DBF\\u0DC7-\\u0DC9\\u0DCB-\\u0DCE\\u0DD5\\u0DD7\\u0DE0-\\u0DE5\\u0DF0\\u0DF1\\u0DF4-\\u0E00\\u0E3B-\\u0E3F\\u0E4F\\u0E5A-\\u0E80\\u0E83\\u0E85\\u0E8B\\u0EA4\\u0EA6\\u0EBE\\u0EBF\\u0EC5\\u0EC7\\u0ECE\\u0ECF\\u0EDA\\u0EDB\\u0EE0-\\u0EFF\\u0F01-\\u0F17\\u0F1A-\\u0F1F\\u0F2A-\\u0F34\\u0F36\\u0F38\\u0F3A-\\u0F3D\\u0F48\\u0F6D-\\u0F70\\u0F85\\u0F98\\u0FBD-\\u0FC5\\u0FC7-\\u0FFF\\u104A-\\u104F\\u109E\\u109F\\u10C6\\u10C8-\\u10CC\\u10CE\\u10CF\\u10FB\\u1249\\u124E\\u124F\\u1257\\u1259\\u125E\\u125F\\u1289\\u128E\\u128F\\u12B1\\u12B6\\u12B7\\u12BF\\u12C1\\u12C6\\u12C7\\u12D7\\u1311\\u1316\\u1317\\u135B\\u135C\\u1360-\\u137F\\u1390-\\u139F\\u13F6\\u13F7\\u13FE-\\u1400\\u166D\\u166E\\u1680\\u169B-\\u169F\\u16EB-\\u16ED\\u16F9-\\u16FF\\u170D\\u1715-\\u171F\\u1735-\\u173F\\u1754-\\u175F\\u176D\\u1771\\u1774-\\u177F\\u17D4-\\u17D6\\u17D8-\\u17DB\\u17DE\\u17DF\\u17EA-\\u180A\\u180E\\u180F\\u181A-\\u181F\\u1879-\\u187F\\u18AB-\\u18AF\\u18F6-\\u18FF\\u191F\\u192C-\\u192F\\u193C-\\u1945\\u196E\\u196F\\u1975-\\u197F\\u19AC-\\u19AF\\u19CA-\\u19CF\\u19DA-\\u19FF\\u1A1C-\\u1A1F\\u1A5F\\u1A7D\\u1A7E\\u1A8A-\\u1A8F\\u1A9A-\\u1AA6\\u1AA8-\\u1AAF\\u1AC1-\\u1AFF\\u1B4C-\\u1B4F\\u1B5A-\\u1B6A\\u1B74-\\u1B7F\\u1BF4-\\u1BFF\\u1C38-\\u1C3F\\u1C4A-\\u1C4C\\u1C7E\\u1C7F\\u1C89-\\u1C8F\\u1CBB\\u1CBC\\u1CC0-\\u1CCF\\u1CD3\\u1CFB-\\u1CFF\\u1DFA\\u1F16\\u1F17\\u1F1E\\u1F1F\\u1F46\\u1F47\\u1F4E\\u1F4F\\u1F58\\u1F5A\\u1F5C\\u1F5E\\u1F7E\\u1F7F\\u1FB5\\u1FBD\\u1FBF-\\u1FC1\\u1FC5\\u1FCD-\\u1FCF\\u1FD4\\u1FD5\\u1FDC-\\u1FDF\\u1FED-\\u1FF1\\u1FF5\\u1FFD-\\u203E\\u2041-\\u2053\\u2055-\\u2070\\u2072-\\u207E\\u2080-\\u208F\\u209D-\\u20CF\\u20F1-\\u2101\\u2103-\\u2106\\u2108\\u2109\\u2114\\u2116-\\u2118\\u211E-\\u2123\\u2125\\u2127\\u2129\\u212E\\u213A\\u213B\\u2140-\\u2144\\u214A-\\u214D\\u214F-\\u215F\\u2189-\\u24B5\\u24EA-\\u2BFF\\u2C2F\\u2C5F\\u2CE5-\\u2CEA\\u2CF4-\\u2CFF\\u2D26\\u2D28-\\u2D2C\\u2D2E\\u2D2F\\u2D68-\\u2D6E\\u2D70-\\u2D7E\\u2D97-\\u2D9F\\u2DA7\\u2DAF\\u2DB7\\u2DBF\\u2DC7\\u2DCF\\u2DD7\\u2DDF\\u2E00-\\u2E2E\\u2E30-\\u3004\\u3008-\\u3020\\u3030\\u3036\\u3037\\u303D-\\u3040\\u3097\\u3098\\u309B\\u309C\\u30A0\\u30FB\\u3100-\\u3104\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\nconst own = Object.hasOwnProperty\n\n/**\n * Slugger.\n */\nexport default class BananaSlug {\n  /**\n   * Create a new slug class.\n   */\n  constructor () {\n    /** @type {Record<string, number>} */\n    // eslint-disable-next-line no-unused-expressions\n    this.occurrences\n\n    this.reset()\n  }\n\n  /**\n   * Generate a unique slug.\n  *\n  * Tracks previously generated slugs: repeated calls with the same value\n  * will result in different slugs.\n  * Use the `slug` function to get same slugs.\n   *\n   * @param  {string} value\n   *   String of text to slugify\n   * @param  {boolean} [maintainCase=false]\n   *   Keep the current case, otherwise make all lowercase\n   * @return {string}\n   *   A unique slug string\n   */\n  slug (value, maintainCase) {\n    const self = this\n    let result = slug(value, maintainCase === true)\n    const originalSlug = result\n\n    while (own.call(self.occurrences, result)) {\n      self.occurrences[originalSlug]++\n      result = originalSlug + '-' + self.occurrences[originalSlug]\n    }\n\n    self.occurrences[result] = 0\n\n    return result\n  }\n\n  /**\n   * Reset - Forget all previous slugs\n   *\n   * @return void\n   */\n  reset () {\n    this.occurrences = Object.create(null)\n  }\n}\n\n/**\n * Generate a slug.\n *\n * Does not track previously generated slugs: repeated calls with the same value\n * will result in the exact same slug.\n * Use the `GithubSlugger` class to get unique slugs.\n *\n * @param  {string} value\n *   String of text to slugify\n * @param  {boolean} [maintainCase=false]\n *   Keep the current case, otherwise make all lowercase\n * @return {string}\n *   A unique slug string\n */\nexport function slug (value, maintainCase) {\n  if (typeof value !== 'string') return ''\n  if (!maintainCase) value = value.toLowerCase()\n  return value.replace(regex, '').replace(/ /g, '-')\n}\n","import { hex4, type DocNode } from \"./document.js\";\n\nconst EMPTY_STRING = '`\"\"`';\n\n/**\n * Escape the character at `i` for inline, one-line display: control characters\n * become visible JSON-style escapes, valid surrogate pairs pass through, lone\n * surrogates become visible, and Markdown/HTML metacharacters are neutralised.\n * Spaces and newlines are handled by callers (space-run and line logic), so a\n * literal space returns unchanged. Returns the escaped text and code units read.\n */\nfunction escapeInlineChar(str: string, i: number): [string, number] {\n  const code = str.charCodeAt(i);\n  switch (code) {\n    case 0x09:\n      return [\"\\\\t\", 1];\n    case 0x08:\n      return [\"\\\\b\", 1];\n    case 0x0c:\n      return [\"\\\\f\", 1];\n    case 0x0a:\n      return [\"\\\\n\", 1];\n    case 0x0d:\n      return [\"\\\\r\", 1];\n  }\n  if (code < 0x20 || (code >= 0x7f && code <= 0x9f)) return [\"\\\\u\" + hex4(code), 1];\n\n  if (code >= 0xd800 && code <= 0xdbff) {\n    const next = i + 1 < str.length ? str.charCodeAt(i + 1) : 0;\n    if (next >= 0xdc00 && next <= 0xdfff) return [str[i]! + str[i + 1]!, 2];\n    return [\"\\\\u\" + hex4(code), 1];\n  }\n  if (code >= 0xdc00 && code <= 0xdfff) return [\"\\\\u\" + hex4(code), 1];\n\n  switch (str[i]) {\n    case \"\\\\\":\n      return [\"\\\\\\\\\", 1];\n    case \"`\":\n      return [\"\\\\`\", 1];\n    case \"*\":\n      return [\"\\\\*\", 1];\n    case \"_\":\n      return [\"\\\\_\", 1];\n    case \"[\":\n      return [\"\\\\[\", 1];\n    case \"]\":\n      return [\"\\\\]\", 1];\n    case \"|\":\n      return [\"\\\\|\", 1];\n    case \"~\":\n      return [\"\\\\~\", 1];\n    case \"&\":\n      return [\"&amp;\", 1];\n    case \"<\":\n      return [\"&lt;\", 1];\n    case \">\":\n      return [\"&gt;\", 1];\n    default:\n      return [str[i]!, 1];\n  }\n}\n\n/**\n * Escape one line segment of a Literal String. Newlines are handled by the\n * caller; this sees text with no `\\n`/`\\r`.\n */\nfunction renderSegment(seg: string): string {\n  let out = \"\";\n  const n = seg.length;\n  let i = 0;\n  let atStart = true;\n\n  while (i < n) {\n    const code = seg.charCodeAt(i);\n\n    // Space runs: keep a single interior space, protect everything Markdown\n    // would collapse (leading, trailing, additional repeats) with `&nbsp;`.\n    if (code === 0x20) {\n      let j = i;\n      while (j < n && seg.charCodeAt(j) === 0x20) j++;\n      const runLen = j - i;\n      const interior = i > 0 && j < n;\n      out += interior ? \" \" + \"&nbsp;\".repeat(runLen - 1) : \"&nbsp;\".repeat(runLen);\n      i = j;\n      atStart = false;\n      continue;\n    }\n\n    // Block markers only bite at the very start of a segment.\n    if (atStart) {\n      if (code >= 0x30 && code <= 0x39) {\n        let j = i;\n        while (j < n) {\n          const c = seg.charCodeAt(j);\n          if (c >= 0x30 && c <= 0x39) j++;\n          else break;\n        }\n        const punct = seg[j];\n        if (j < n && (punct === \".\" || punct === \")\")) {\n          out += seg.slice(i, j) + \"\\\\\" + punct;\n          i = j + 1;\n          atStart = false;\n          continue;\n        }\n      } else if (code === 0x23 /* # */ || code === 0x2d /* - */ || code === 0x2b /* + */) {\n        out += \"\\\\\" + seg[i];\n        i++;\n        atStart = false;\n        continue;\n      }\n    }\n\n    const [text, consumed] = escapeInlineChar(seg, i);\n    out += text;\n    i += consumed;\n    atStart = false;\n  }\n\n  return out;\n}\n\n/**\n * Escape a string for one-line inline display (a Key Label or a JSON Pointer):\n * the same space-run and metacharacter handling as a Literal String segment, but\n * newlines stay as `\\n`/`\\r` (via `escapeInlineChar`) so the text never leaves its\n * line, and no block-start markers are escaped. Converting boundary and collapsible\n * spaces to `&nbsp;` keeps headings free of trailing spaces and keeps a heading's\n * slug stable (a GFM renderer trims trailing spaces but preserves entities).\n */\nexport function escapeInline(str: string): string {\n  let out = \"\";\n  const n = str.length;\n  let i = 0;\n  while (i < n) {\n    if (str.charCodeAt(i) === 0x20) {\n      let j = i;\n      while (j < n && str.charCodeAt(j) === 0x20) j++;\n      const runLen = j - i;\n      const interior = i > 0 && j < n;\n      out += interior ? \" \" + \"&nbsp;\".repeat(runLen - 1) : \"&nbsp;\".repeat(runLen);\n      i = j;\n      continue;\n    }\n    const [text, consumed] = escapeInlineChar(str, i);\n    out += text;\n    i += consumed;\n  }\n  return out;\n}\n\n/** Render an untrusted string as visible Literal String text (newlines become `<br>`). */\nexport function escapeText(value: string): string {\n  const normalized = value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n  const segments = normalized.split(\"\\n\");\n  let out = \"\";\n  for (let s = 0; s < segments.length; s++) {\n    if (s > 0) out += \"<br>\";\n    out += renderSegment(segments[s]!);\n  }\n  return out;\n}\n\n/** A string is a URL String only if its whole, unmodified content is one absolute http(s) URL. */\nexport function isUrlString(value: string): boolean {\n  if (/\\s/.test(value)) return false;\n  if (!/^https?:\\/\\//i.test(value)) return false;\n  try {\n    const url = new URL(value);\n    if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false;\n    return url.host.length > 0;\n  } catch {\n    return false;\n  }\n}\n\n/** Escape a link destination so it survives a table cell. */\nfunction escapeDestination(url: string): string {\n  return url.replace(/[\\\\()|]/g, (c) => \"\\\\\" + c);\n}\n\n/**\n * The literal, escaped display of an object member name. Unlike a Literal String,\n * a Key Label keeps control characters as visible JSON-style escapes (`\\n`, `\\t`,\n * `\u0000`) so the label stays on one line inside a heading or table header.\n */\nexport function keyLabel(name: string): string {\n  if (name === \"\") return EMPTY_STRING;\n  return escapeInline(name);\n}\n\nexport type AnnotationType = \"string\" | \"integer\" | \"number\" | \"boolean\";\n\n/** The Type Annotation token appended after a value or a Uniform Column header. */\nexport function annotationSuffix(type: AnnotationType): string {\n  return ` *(${type})*`;\n}\n\n/**\n * The Annotation Type of a value, or null for Self-Describing Values (null,\n * `[]`, `{}`) which never carry a Type Annotation. A number is an integer when\n * its Numeric Lexeme has no fraction or exponent part (`1.00` and `1e3` are\n * numbers).\n */\nexport function annotationType(node: DocNode): AnnotationType | null {\n  switch (node.kind) {\n    case \"string\":\n      return \"string\";\n    case \"boolean\":\n      return \"boolean\";\n    case \"number\":\n      return /[.eE]/.test(node.lexeme) ? \"number\" : \"integer\";\n    default:\n      return null;\n  }\n}\n\n/**\n * The inline representation of a Scalar Value, or of an empty container shown\n * inline as `` `[]` `` / `` `{}` ``. Same rendering in every context; table\n * cells rely on the same escaping.\n */\nexport function scalarText(node: DocNode): string {\n  switch (node.kind) {\n    case \"null\":\n      return \"`null`\";\n    case \"boolean\":\n      return node.value ? \"true\" : \"false\";\n    case \"number\":\n      return node.lexeme;\n    case \"string\": {\n      if (node.value === \"\") return EMPTY_STRING;\n      if (isUrlString(node.value)) {\n        return `[${escapeText(node.value)}](${escapeDestination(node.value)})`;\n      }\n      return escapeText(node.value);\n    }\n    case \"array\":\n      return \"`[]`\";\n    case \"object\":\n      return \"`{}`\";\n  }\n}\n","import GithubSlugger from \"github-slugger\";\nimport { childPointer, isEmptyContainer, rendersInline, type DocNode } from \"./document.js\";\nimport { JsonToMarkdownError } from \"./errors.js\";\nimport { annotationSuffix, annotationType, escapeInline, keyLabel, scalarText, type AnnotationType } from \"./text.js\";\n\nconst MAX_HEADING_LEVEL = 6;\n\nexport interface ConvertOptions {\n  /**\n   * Document Heading text. A string replaces the default `\"Results\"` (rendered\n   * as plain text, never raw Markdown); `null` omits the H1 entirely without\n   * shifting body heading levels. An empty string is INVALID_OPTION.\n   */\n  readonly heading?: string | null;\n  /** Emit Type Annotations (` *(integer)*` …) after annotatable values. Default false. */\n  readonly showTypes?: boolean;\n}\n\ninterface ResolvedOptions {\n  readonly heading: string | null;\n  readonly showTypes: boolean;\n}\n\nfunction resolveOptions(options: ConvertOptions): ResolvedOptions {\n  const heading = options.heading === undefined ? \"Results\" : options.heading;\n  if (heading !== null && typeof heading !== \"string\") {\n    throw new JsonToMarkdownError(\"INVALID_OPTION\", \"heading must be a string or null\");\n  }\n  if (heading === \"\") {\n    throw new JsonToMarkdownError(\"INVALID_OPTION\", \"heading must not be empty; pass null to omit it\");\n  }\n  const showTypes = options.showTypes === undefined ? false : options.showTypes;\n  if (typeof showTypes !== \"boolean\") {\n    throw new JsonToMarkdownError(\"INVALID_OPTION\", \"showTypes must be a boolean\");\n  }\n  return { heading, showTypes };\n}\n\n/**\n * The inline text of a value plus its Type Annotation. The `*(type)*` token is\n * unforgeable: a literal `*` in user data is always escaped, so italics here can\n * only come from the renderer.\n */\nfunction annotatedText(node: DocNode, showTypes: boolean): string {\n  const text = scalarText(node);\n  if (!showTypes) return text;\n  const type = annotationType(node);\n  return type === null ? text : text + annotationSuffix(type);\n}\n\n/** Push tasks so they run in given order under a LIFO stack. */\nfunction pushReversed(stack: Task[], tasks: readonly Task[]): void {\n  for (let i = tasks.length - 1; i >= 0; i--) stack.push(tasks[i]!);\n}\n\ntype ScalarCell = { readonly t: \"scalar\"; readonly text: string };\ntype LinkCell = { readonly t: \"link\"; readonly pointer: string; readonly label: string };\ntype Cell = ScalarCell | LinkCell;\n\ntype TableData = { readonly headers: readonly string[]; readonly rows: readonly (readonly Cell[])[] };\n\n// A list block is a run of lines that may embed indented tables (a Tabular Array\n// nested inside a list still renders as a table, per ADR-0003).\ntype ListPart =\n  | { readonly kind: \"line\"; readonly text: string }\n  | { readonly kind: \"table\"; readonly indent: number; readonly table: TableData };\n\ntype Block =\n  | { kind: \"heading\"; level: number; text: string; detailPointer?: string; fragment?: string }\n  | { kind: \"text\"; text: string }\n  | { kind: \"hr\" }\n  | { kind: \"table\"; table: TableData }\n  | { kind: \"list\"; parts: readonly ListPart[] };\n\ntype Task =\n  | { t: \"value\"; node: DocNode; pointer: string; level: number }\n  | { t: \"emit\"; block: Block };\n\nfunction isObjectNode(node: DocNode): node is Extract<DocNode, { kind: \"object\" }> {\n  return node.kind === \"object\";\n}\n\n/** Detect a Tabular Array: non-empty, every item an object, union of keys is non-empty. */\nfunction tableColumns(items: readonly DocNode[]): string[] | null {\n  if (items.length === 0) return null;\n  const columns: string[] = [];\n  const seen = new Set<string>();\n  for (const item of items) {\n    if (!isObjectNode(item)) return null;\n    for (const [key] of item.entries) {\n      if (!seen.has(key)) {\n        seen.add(key);\n        columns.push(key);\n      }\n    }\n  }\n  return columns.length > 0 ? columns : null;\n}\n\n/** Build a table's rows plus the Detail-cell tasks it spawns, in row-major order. */\nfunction buildTableData(\n  items: readonly DocNode[],\n  columns: readonly string[],\n  pointer: string,\n  detailLevel: number,\n  detailSubLevel: number,\n  showTypes: boolean,\n): { table: TableData; details: Task[] } {\n  const rows: Cell[][] = [];\n  const details: Task[] = [];\n  // Per column: undefined = no present cell seen yet, \"bare\" = not a Uniform\n  // Column (mixed types, or a link / Self-Describing cell), else its one type.\n  const colTypes: (AnnotationType | \"bare\" | undefined)[] = columns.map(() => undefined);\n\n  for (let r = 0; r < items.length; r++) {\n    const item = items[r]! as Extract<DocNode, { kind: \"object\" }>;\n    const rowPointer = childPointer(pointer, String(r));\n    const byKey = new Map<string, DocNode>(item.entries);\n    const row: Cell[] = [];\n    for (let c = 0; c < columns.length; c++) {\n      const col = columns[c]!;\n      const value = byKey.get(col);\n      if (value === undefined) {\n        row.push({ t: \"scalar\", text: \"\" }); // Missing Property: empty cell.\n        continue;\n      }\n      const type = annotationType(value);\n      if (colTypes[c] !== \"bare\") {\n        if (type === null) colTypes[c] = \"bare\";\n        else if (colTypes[c] === undefined) colTypes[c] = type;\n        else if (colTypes[c] !== type) colTypes[c] = \"bare\";\n      }\n      if (value.kind === \"object\" || value.kind === \"array\") {\n        if (isEmptyContainer(value)) {\n          row.push({ t: \"scalar\", text: scalarText(value) });\n        } else {\n          const cellPointer = childPointer(rowPointer, col);\n          // The link label and the Detail Heading text must stay byte-identical.\n          const label = escapeInline(cellPointer);\n          row.push({ t: \"link\", pointer: cellPointer, label });\n          // A thematic break precedes every Detail Heading (and appears nowhere else).\n          details.push({ t: \"emit\", block: { kind: \"hr\" } });\n          details.push({\n            t: \"emit\",\n            block: {\n              kind: \"heading\",\n              level: detailLevel,\n              text: label,\n              detailPointer: cellPointer,\n            },\n          });\n          details.push({ t: \"value\", node: value, pointer: cellPointer, level: detailSubLevel });\n        }\n      } else {\n        row.push({ t: \"scalar\", text: scalarText(value) });\n      }\n    }\n    rows.push(row);\n  }\n\n  const headers = columns.map((col, c) => {\n    const type = colTypes[c];\n    const label = keyLabel(col);\n    return showTypes && type !== undefined && type !== \"bare\" ? label + annotationSuffix(type) : label;\n  });\n\n  return { table: { headers, rows }, details };\n}\n\n/**\n * Build the list block for a non-empty container in list position. A child that is\n * a Tabular Array is rendered as an indented table (ADR-0003) and its Detail Sections\n * are returned to be emitted at block level after the list. Iterative: an explicit\n * heap stack keeps arbitrarily deep nesting off the call stack.\n */\nfunction buildListBlock(\n  root: DocNode,\n  rootPointer: string,\n  blockLevel: number,\n  showTypes: boolean,\n): { parts: ListPart[]; details: Task[] } {\n  const detailLevel = Math.min(blockLevel, MAX_HEADING_LEVEL);\n  const detailSubLevel = Math.min(detailLevel + 1, MAX_HEADING_LEVEL);\n  const parts: ListPart[] = [];\n  const details: Task[] = [];\n\n  interface ListFrame {\n    node: DocNode;\n    pointer: string;\n    indent: number;\n    index: number;\n  }\n  const stack: ListFrame[] = [{ node: root, pointer: rootPointer, indent: 0, index: 0 }];\n\n  // Emit a non-inline container child: an indented table if Tabular, else a nested list.\n  const handleContainer = (child: DocNode, childPtr: string, indent: number, lead: string): void => {\n    if (child.kind === \"array\") {\n      const columns = tableColumns(child.items);\n      if (columns !== null) {\n        parts.push({ kind: \"line\", text: lead });\n        const built = buildTableData(child.items, columns, childPtr, detailLevel, detailSubLevel, showTypes);\n        parts.push({ kind: \"table\", indent, table: built.table });\n        for (const task of built.details) details.push(task);\n        return;\n      }\n    }\n    parts.push({ kind: \"line\", text: lead });\n    stack.push({ node: child, pointer: childPtr, indent, index: 0 });\n  };\n\n  while (stack.length > 0) {\n    const frame = stack[stack.length - 1]!;\n    const node = frame.node;\n    const pad = \"  \".repeat(frame.indent);\n\n    if (node.kind === \"object\") {\n      if (frame.index >= node.entries.length) {\n        stack.pop();\n        continue;\n      }\n      const [key, child] = node.entries[frame.index++]!;\n      const label = keyLabel(key);\n      const childPtr = childPointer(frame.pointer, key);\n      if (rendersInline(child)) {\n        parts.push({ kind: \"line\", text: `${pad}- **${label}:** ${annotatedText(child, showTypes)}` });\n      } else {\n        handleContainer(child, childPtr, frame.indent + 1, `${pad}- **${label}**`);\n      }\n    } else if (node.kind === \"array\") {\n      if (frame.index >= node.items.length) {\n        stack.pop();\n        continue;\n      }\n      const i = frame.index++;\n      const child = node.items[i]!;\n      const childPtr = childPointer(frame.pointer, String(i));\n      if (rendersInline(child)) {\n        parts.push({ kind: \"line\", text: `${pad}- ${annotatedText(child, showTypes)}` });\n      } else {\n        handleContainer(child, childPtr, frame.indent + 1, `${pad}-`);\n      }\n    } else {\n      // A scalar can only appear as the root of a list when misused; guard anyway.\n      parts.push({ kind: \"line\", text: `${pad}- ${annotatedText(node, showTypes)}` });\n      stack.pop();\n    }\n  }\n\n  return { parts, details };\n}\n\n/** Walk the document (iteratively) into an ordered list of blocks. */\nfunction layout(root: DocNode, opts: ResolvedOptions): Block[] {\n  const blocks: Block[] = [];\n  if (opts.heading !== null) {\n    blocks.push({ kind: \"heading\", level: 1, text: escapeInline(opts.heading) });\n  }\n  const stack: Task[] = [{ t: \"value\", node: root, pointer: \"\", level: 2 }];\n\n  while (stack.length > 0) {\n    const task = stack.pop()!;\n\n    if (task.t === \"emit\") {\n      blocks.push(task.block);\n      continue;\n    }\n\n    const { node, pointer, level } = task;\n\n    if (rendersInline(node)) {\n      blocks.push({ kind: \"text\", text: annotatedText(node, opts.showTypes) });\n      continue;\n    }\n\n    if (node.kind === \"object\") {\n      if (level > MAX_HEADING_LEVEL) {\n        const { parts, details } = buildListBlock(node, pointer, level, opts.showTypes);\n        blocks.push({ kind: \"list\", parts });\n        pushReversed(stack, details);\n        continue;\n      }\n      // Expand members: heading then value, in order.\n      const expansion: Task[] = [];\n      for (const [key, child] of node.entries) {\n        expansion.push({ t: \"emit\", block: { kind: \"heading\", level, text: keyLabel(key) } });\n        expansion.push({ t: \"value\", node: child, pointer: childPointer(pointer, key), level: level + 1 });\n      }\n      pushReversed(stack, expansion);\n      continue;\n    }\n\n    // Array (rendersInline already excluded scalars and empty containers).\n    if (node.kind !== \"array\") continue;\n    const columns = tableColumns(node.items);\n    if (columns === null) {\n      const { parts, details } = buildListBlock(node, pointer, level, opts.showTypes);\n      blocks.push({ kind: \"list\", parts });\n      pushReversed(stack, details);\n      continue;\n    }\n    const detailLevel = Math.min(level, MAX_HEADING_LEVEL);\n    const detailSubLevel = Math.min(detailLevel + 1, MAX_HEADING_LEVEL);\n    const { table, details } = buildTableData(node.items, columns, pointer, detailLevel, detailSubLevel, opts.showTypes);\n    pushReversed(stack, [{ t: \"emit\", block: { kind: \"table\", table } }, ...details]);\n  }\n\n  return blocks;\n}\n\n/** Render a table cell. Scalar text is already table-safe (`scalarText` escapes pipes). */\nfunction tableCell(cell: Cell, fragments: Map<string, string>): string {\n  if (cell.t === \"scalar\") return cell.text;\n  const fragment = fragments.get(cell.pointer) ?? \"\";\n  return `[${cell.label}](#${fragment})`;\n}\n\nfunction serializeTable(table: TableData, indent: number, fragments: Map<string, string>): string {\n  const pad = \"  \".repeat(indent);\n  const header = `${pad}| ${table.headers.join(\" | \")} |`;\n  const delimiter = `${pad}| ${table.headers.map(() => \"---\").join(\" | \")} |`;\n  const rows = table.rows.map((row) => `${pad}| ${row.map((c) => tableCell(c, fragments)).join(\" | \")} |`);\n  return [header, delimiter, ...rows].join(\"\\n\");\n}\n\nfunction serializeList(parts: readonly ListPart[], fragments: Map<string, string>): string {\n  return parts.map((p) => (p.kind === \"line\" ? p.text : serializeTable(p.table, p.indent, fragments))).join(\"\\n\");\n}\n\nexport function renderDocument(root: DocNode, options: ConvertOptions = {}): string {\n  const blocks = layout(root, resolveOptions(options));\n\n  // Allocate heading fragments in final document order; map detail pointers to them.\n  const slugger = new GithubSlugger();\n  const fragments = new Map<string, string>();\n  for (const block of blocks) {\n    if (block.kind === \"heading\") {\n      block.fragment = slugger.slug(block.text);\n      if (block.detailPointer !== undefined) fragments.set(block.detailPointer, block.fragment);\n    }\n  }\n\n  const rendered: string[] = [];\n  for (const block of blocks) {\n    if (block.kind === \"heading\") {\n      rendered.push(`${\"#\".repeat(block.level)} ${block.text}`);\n    } else if (block.kind === \"text\") {\n      rendered.push(block.text);\n    } else if (block.kind === \"hr\") {\n      rendered.push(\"---\");\n    } else if (block.kind === \"table\") {\n      rendered.push(serializeTable(block.table, 0, fragments));\n    } else {\n      rendered.push(serializeList(block.parts, fragments));\n    }\n  }\n\n  return rendered.join(\"\\n\\n\") + \"\\n\";\n}\n","import { FALSE_NODE, NULL_NODE, TRUE_NODE, type DocNode } from \"./document.js\";\nimport { JsonToMarkdownError, type SourceLocation } from \"./errors.js\";\n\nfunction locationAt(src: string, offset: number): SourceLocation {\n  let line = 1;\n  let column = 1;\n  const end = Math.min(offset, src.length);\n  for (let i = 0; i < end; i++) {\n    if (src.charCodeAt(i) === 0x0a) {\n      line++;\n      column = 1;\n    } else {\n      column++;\n    }\n  }\n  return { offset, line, column };\n}\n\nfunction syntaxError(src: string, message: string, offset: number): never {\n  throw new JsonToMarkdownError(\"INVALID_JSON_SYNTAX\", message, { location: locationAt(src, offset) });\n}\n\nfunction isWs(code: number): boolean {\n  return code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0d;\n}\n\nfunction skipWs(src: string, pos: number): number {\n  const n = src.length;\n  while (pos < n && isWs(src.charCodeAt(pos))) pos++;\n  return pos;\n}\n\nfunction isDigit(code: number): boolean {\n  return code >= 0x30 && code <= 0x39;\n}\n\ninterface Scanned {\n  readonly node: DocNode;\n  readonly end: number;\n}\n\nfunction parseString(src: string, pos: number): { value: string; end: number } {\n  const n = src.length;\n  let i = pos + 1;\n  let start = i;\n  let out = \"\";\n\n  while (i < n) {\n    const c = src.charCodeAt(i);\n    if (c === 0x22 /* \" */) {\n      return { value: out + src.slice(start, i), end: i + 1 };\n    }\n    if (c === 0x5c /* \\ */) {\n      out += src.slice(start, i);\n      i++;\n      const e = src[i];\n      switch (e) {\n        case '\"':\n          out += '\"';\n          break;\n        case \"\\\\\":\n          out += \"\\\\\";\n          break;\n        case \"/\":\n          out += \"/\";\n          break;\n        case \"b\":\n          out += \"\\b\";\n          break;\n        case \"f\":\n          out += \"\\f\";\n          break;\n        case \"n\":\n          out += \"\\n\";\n          break;\n        case \"r\":\n          out += \"\\r\";\n          break;\n        case \"t\":\n          out += \"\\t\";\n          break;\n        case \"u\": {\n          const hex = src.slice(i + 1, i + 5);\n          if (hex.length < 4 || !/^[0-9a-fA-F]{4}$/.test(hex)) {\n            syntaxError(src, \"Invalid \\\\u escape in string\", i - 1);\n          }\n          out += String.fromCharCode(parseInt(hex, 16));\n          i += 4;\n          break;\n        }\n        default:\n          syntaxError(src, \"Invalid escape sequence in string\", i - 1);\n      }\n      i++;\n      start = i;\n      continue;\n    }\n    if (c < 0x20) {\n      syntaxError(src, \"Unescaped control character in string\", i);\n    }\n    i++;\n  }\n  return syntaxError(src, \"Unterminated string\", pos);\n}\n\nfunction parseNumber(src: string, pos: number): Scanned {\n  const n = src.length;\n  let i = pos;\n  if (src.charCodeAt(i) === 0x2d /* - */) i++;\n\n  const first = src.charCodeAt(i);\n  if (first === 0x30 /* 0 */) {\n    i++;\n  } else if (first >= 0x31 && first <= 0x39) {\n    i++;\n    while (i < n && isDigit(src.charCodeAt(i))) i++;\n  } else {\n    syntaxError(src, \"Invalid number\", pos);\n  }\n\n  if (i < n && src.charCodeAt(i) === 0x2e /* . */) {\n    i++;\n    if (!(i < n && isDigit(src.charCodeAt(i)))) syntaxError(src, \"Invalid number: missing fraction digits\", i);\n    while (i < n && isDigit(src.charCodeAt(i))) i++;\n  }\n\n  const exp = i < n ? src.charCodeAt(i) : 0;\n  if (exp === 0x65 || exp === 0x45 /* e E */) {\n    i++;\n    const sign = i < n ? src.charCodeAt(i) : 0;\n    if (sign === 0x2b || sign === 0x2d) i++;\n    if (!(i < n && isDigit(src.charCodeAt(i)))) syntaxError(src, \"Invalid number: missing exponent digits\", i);\n    while (i < n && isDigit(src.charCodeAt(i))) i++;\n  }\n\n  return { node: { kind: \"number\", lexeme: src.slice(pos, i) }, end: i };\n}\n\nfunction parseScalar(src: string, pos: number): Scanned {\n  const c = src.charCodeAt(pos);\n  if (c === 0x22) {\n    const s = parseString(src, pos);\n    return { node: { kind: \"string\", value: s.value }, end: s.end };\n  }\n  if (c === 0x2d || isDigit(c)) return parseNumber(src, pos);\n  if (src.startsWith(\"true\", pos)) return { node: TRUE_NODE, end: pos + 4 };\n  if (src.startsWith(\"false\", pos)) return { node: FALSE_NODE, end: pos + 5 };\n  if (src.startsWith(\"null\", pos)) return { node: NULL_NODE, end: pos + 4 };\n  return syntaxError(src, \"Unexpected token; expected a JSON value\", pos);\n}\n\ntype ObjFrame = {\n  readonly type: \"obj\";\n  readonly entries: [string, DocNode][];\n  readonly seen: Map<string, number>;\n  state: \"start\" | \"value\" | \"comma\";\n  key: string;\n};\ntype ArrFrame = {\n  readonly type: \"arr\";\n  readonly items: DocNode[];\n  state: \"start\" | \"value\";\n};\ntype Frame = ObjFrame | ArrFrame;\n\n/**\n * Parse exactly one JSON document into a DocNode without executing caller code.\n * Iterative to satisfy the no-nesting-limit ADR; preserves numeric lexemes,\n * member encounter order, and rejects duplicate member names.\n */\nexport function parseSerialized(source: string): DocNode {\n  const n = source.length;\n  const stack: Frame[] = [];\n  let pending: DocNode | null = null;\n  let hasPending = false;\n  let pos = skipWs(source, 0);\n\n  if (pos >= n) syntaxError(source, \"Unexpected end of input; expected a JSON value\", pos);\n\n  // Read the leading value (opens a frame or produces a pending scalar).\n  pos = startValue();\n\n  for (;;) {\n    const frame = stack[stack.length - 1];\n\n    if (frame === undefined) {\n      // Root value complete.\n      pos = skipWs(source, pos);\n      if (pos !== n) syntaxError(source, \"Unexpected trailing content after JSON value\", pos);\n      return pending!;\n    }\n\n    if (frame.type === \"arr\") {\n      if (hasPending) {\n        frame.items.push(pending!);\n        hasPending = false;\n        pending = null;\n        frame.state = \"value\";\n        continue;\n      }\n      pos = skipWs(source, pos);\n      const c = source.charCodeAt(pos);\n      if (frame.state === \"start\") {\n        if (c === 0x5d /* ] */) {\n          pos++;\n          closeFrame();\n          continue;\n        }\n        pos = startValue();\n        continue;\n      }\n      // state === \"value\"\n      if (c === 0x2c /* , */) {\n        pos = startValue(pos + 1);\n        continue;\n      }\n      if (c === 0x5d) {\n        pos++;\n        closeFrame();\n        continue;\n      }\n      syntaxError(source, \"Expected ',' or ']' in array\", pos);\n    } else {\n      if (hasPending) {\n        frame.entries.push([frame.key, pending!]);\n        hasPending = false;\n        pending = null;\n        frame.state = \"value\";\n        continue;\n      }\n      pos = skipWs(source, pos);\n      const c = source.charCodeAt(pos);\n      if (frame.state === \"start\") {\n        if (c === 0x7d /* } */) {\n          pos++;\n          closeFrame();\n          continue;\n        }\n        pos = readMember(frame);\n        continue;\n      }\n      if (frame.state === \"value\") {\n        if (c === 0x2c /* , */) {\n          frame.state = \"comma\";\n          pos++;\n          continue;\n        }\n        if (c === 0x7d) {\n          pos++;\n          closeFrame();\n          continue;\n        }\n        syntaxError(source, \"Expected ',' or '}' in object\", pos);\n      }\n      // state === \"comma\": expect the next member key.\n      pos = readMember(frame);\n    }\n  }\n\n  function startValue(from = pos): number {\n    let p = skipWs(source, from);\n    if (p >= n) syntaxError(source, \"Unexpected end of input; expected a JSON value\", p);\n    const c = source.charCodeAt(p);\n    if (c === 0x7b /* { */) {\n      stack.push({ type: \"obj\", entries: [], seen: new Map(), state: \"start\", key: \"\" });\n      return p + 1;\n    }\n    if (c === 0x5b /* [ */) {\n      stack.push({ type: \"arr\", items: [], state: \"start\" });\n      return p + 1;\n    }\n    const scanned = parseScalar(source, p);\n    pending = scanned.node;\n    hasPending = true;\n    return scanned.end;\n  }\n\n  function closeFrame(): void {\n    const frame = stack.pop()!;\n    pending = frame.type === \"arr\" ? { kind: \"array\", items: frame.items } : { kind: \"object\", entries: frame.entries };\n    hasPending = true;\n  }\n\n  function readMember(frame: ObjFrame): number {\n    let p = skipWs(source, pos);\n    if (source.charCodeAt(p) !== 0x22 /* \" */) syntaxError(source, \"Expected a string object key\", p);\n    const keyStart = p;\n    const key = parseString(source, p);\n    const prev = frame.seen.get(key.value);\n    if (prev !== undefined) {\n      throw new JsonToMarkdownError(\"DUPLICATE_MEMBER_NAME\", `Duplicate object member name ${JSON.stringify(key.value)}.`, {\n        location: locationAt(source, keyStart),\n        firstLocation: locationAt(source, prev),\n      });\n    }\n    frame.seen.set(key.value, keyStart);\n    frame.key = key.value;\n    p = skipWs(source, key.end);\n    if (source.charCodeAt(p) !== 0x3a /* : */) syntaxError(source, \"Expected ':' after object key\", p);\n    return startValue(p + 1);\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,IAAM,YAAqB,EAAE,MAAM,OAAO;AAC1C,IAAM,YAAqB,EAAE,MAAM,WAAW,OAAO,KAAK;AAC1D,IAAM,aAAsB,EAAE,MAAM,WAAW,OAAO,MAAM;AAE5D,SAAS,YAAY,MAAwB;AAClD,SAAO,KAAK,SAAS,WAAW,KAAK,SAAS;AAChD;AAEO,SAAS,iBAAiB,MAAwB;AACvD,SACG,KAAK,SAAS,WAAW,KAAK,MAAM,WAAW,KAC/C,KAAK,SAAS,YAAY,KAAK,QAAQ,WAAW;AAEvD;AAGO,SAAS,cAAc,MAAwB;AACpD,SAAO,CAAC,YAAY,IAAI,KAAK,iBAAiB,IAAI;AACpD;AAGO,SAAS,KAAK,MAAsB;AACzC,SAAO,KAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC1C;AAGO,SAAS,eAAe,MAAsB;AACnD,SAAO,KAAK,QAAQ,MAAM,IAAI,EAAE,QAAQ,OAAO,IAAI;AACrD;AAEO,SAAS,aAAa,SAAiB,MAAsB;AAClE,SAAO,GAAG,OAAO,IAAI,eAAe,IAAI,CAAC;AAC3C;;;ACxBO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAM7C,YACE,MACA,SACA,UAAsC,CAAC,GACvC;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,UAAU,QAAQ;AACvB,SAAK,WAAW,QAAQ;AACxB,SAAK,gBAAgB,QAAQ;AAE7B,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;;;ACzCA,IAAM,SAAS,OAAO,UAA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