{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/index.cjs","../src/engine/pipeline.ts","../src/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACdA,SAAS,WAAA,CAAY,IAAA,EAA8B;AACjD,EAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAA,GAAa,KAAA,IAAS,MAAA,EAAQ,OAAO,MAAA;AAClD,EAAA,GAAA,CAAI,KAAA,IAAS,OAAA,GAAU,KAAA,IAAS,WAAA,GAAc,KAAA,IAAS,MAAA,EAAQ,OAAO,IAAA;AACtE,EAAA,MAAM,IAAI,oCAAA;AAAA,IACR,uBAAA;AAAA,IACA,CAAA,cAAA,EAAiB,MAAA,CAAO,IAAI,CAAC,CAAA,iDAAA;AAAA,EAC/B,CAAA;AACF;AASO,SAAS,WAAA,CAAY,KAAA,EAAe,OAAA,EAA0B;AAInE,EAAA,MAAM,MAAA,mBAA0B,OAAA,UAAW,CAAC,GAAA;AAC5C,EAAA,MAAM,KAAA,EAAO,WAAA,CAAY,KAAA,CAAM,IAAI,CAAA;AACnC,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACxD,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACxD,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,+CAAA,KAAgB,EAAO,KAAK,CAAA;AACxD,EAAA,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AACzC;AAOO,SAAS,UAAA,CAAW,KAAA,EAAe,OAAA,EAA4B;AACpE,EAAA,MAAM,MAAA,mBAA0B,OAAA,UAAW,CAAC,GAAA;AAC5C,EAAA,MAAM,KAAA,EAAO,WAAA,CAAY,KAAA,CAAM,IAAI,CAAA;AACnC,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AAC5D,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AAC5D,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ,OAAO,mDAAA,KAAoB,EAAO,KAAK,CAAA;AAC5D,EAAA,OAAO,uDAAA,KAAwB,EAAO,KAAK,CAAA;AAC7C;ADDA;AACA;AE9CO,SAAS,SAAA,CAAU,KAAA,EAAe,OAAA,EAA0B;AACjE,EAAA,OAAO,WAAA,CAAY,KAAA,EAAO,OAAO,CAAA;AACnC;AAYO,SAAS,OAAA,CAAQ,KAAA,EAAe,OAAA,EAA4B;AACjE,EAAA,OAAO,UAAA,CAAW,KAAA,EAAO,OAAO,CAAA;AAClC;AFqCA;AACE;AACA;AACA;AACA;AACF,iLAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/index.cjs","sourcesContent":[null,"import { PolytypoError } from \"../errors.js\";\nimport type { Mode, Options } from \"../types.js\";\nimport { analyzeHtmlPipeline, runHtmlPipeline } from \"./html-pipeline.js\";\nimport { analyzeMarkdownPipeline, runMarkdownPipeline } from \"./markdown-pipeline.js\";\nimport { analyzeTextPipeline, runTextPipeline } from \"./text-pipeline.js\";\nimport { analyzeYamlPipeline, runYamlPipeline } from \"./yaml-pipeline.js\";\nimport type { Change } from \"./origin.js\";\n\nexport { planRules } from \"./rule-runner.js\";\n\nfunction resolveMode(mode: Mode | undefined): Mode {\n  if (mode === undefined || mode === \"text\") return \"text\";\n  if (mode === \"html\" || mode === \"markdown\" || mode === \"yaml\") return mode;\n  throw new PolytypoError(\n    \"POLYTYPO_INVALID_MODE\",\n    `Unknown mode \"${String(mode)}\". Expected \"text\", \"html\", \"markdown\" or \"yaml\".`,\n  );\n}\n\n/**\n * The aggregate entry's dispatcher: every mode is reachable, so it is the only pipeline module\n * that imports all four mode-specific ones (and therefore the only one whose module graph\n * includes both `parse5` and the Micromark/MDX stack). `polytypo/text`, `polytypo/html` and\n * `polytypo/markdown` each call their own mode-specific pipeline directly and never import this\n * module (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1).\n */\nexport function runPipeline(input: string, options: Options): string {\n  // A plain-JS caller can omit the options object entirely. Reading through a null here would\n  // raise a native TypeError, which is outside the error taxonomy; an absent `locale` is an\n  // unknown locale and must say so with a code (locale-resolution.md 3.1).\n  const given: Partial<Options> = options ?? {};\n  const mode = resolveMode(given.mode);\n  if (mode === \"text\") return runTextPipeline(input, given);\n  if (mode === \"html\") return runHtmlPipeline(input, given);\n  if (mode === \"yaml\") return runYamlPipeline(input, given);\n  return runMarkdownPipeline(input, given);\n}\n\n/**\n * The dispatcher for `analyze` (analyze.md §1). Mode resolution, and therefore\n * POLYTYPO_INVALID_MODE, is shared with `runPipeline` rather than duplicated: A1 requires the\n * two entry points to accept and reject exactly the same arguments.\n */\nexport function runAnalyze(input: string, options: Options): Change[] {\n  const given: Partial<Options> = options ?? {};\n  const mode = resolveMode(given.mode);\n  if (mode === \"text\") return analyzeTextPipeline(input, given);\n  if (mode === \"html\") return analyzeHtmlPipeline(input, given);\n  if (mode === \"yaml\") return analyzeYamlPipeline(input, given);\n  return analyzeMarkdownPipeline(input, given);\n}\n","import { runAnalyze, runPipeline } from \"./engine/pipeline.js\";\nimport type { Change } from \"./engine/origin.js\";\nimport type { Options } from \"./types.js\";\n\nexport function transform(input: string, options: Options): string {\n  return runPipeline(input, options);\n}\n\n/**\n * The same pipeline as `transform`, reporting what it would do instead of doing it\n * (spec/rules/analyze.md). Offsets are code-point offsets into `input` in every mode.\n *\n * What it guarantees: the list is empty exactly when `transform` would return the input\n * unchanged, every `ruleId` was enabled for the call, and every offset is inside the input.\n * What it does not: the list is a report, not a patch — two rules may touch the same original\n * range, so replaying it is not guaranteed to reproduce `transform`'s output. Call `transform`\n * for the text (analyze.md §4, §5).\n */\nexport function analyze(input: string, options: Options): Change[] {\n  return runAnalyze(input, options);\n}\n\nexport { SKIPPED_ELEMENTS } from \"./modes/html.js\";\nexport { PolytypoError } from \"./errors.js\";\nexport type { PolytypoErrorCode } from \"./errors.js\";\nexport type { Change } from \"./engine/origin.js\";\nexport type {\n  Dialect,\n  Edit,\n  LocaleData,\n  LocaleSource,\n  Mode,\n  NarrowNbsp,\n  Options,\n  ProtectRange,\n  QuotePair,\n  Rule,\n  RuleContext,\n  RuleId,\n} from \"./types.js\";\n"]}