@aiquants/markdown 6.2.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +61 -3
  2. package/dist/{abnfDiagram-VRR7QNED-DX6eyf4O.cjs → abnfDiagram-VRR7QNED-B4qwBPG8.cjs} +1 -1
  3. package/dist/{abnfDiagram-VRR7QNED-Csrzuwyl.js → abnfDiagram-VRR7QNED-DJQK-fno.js} +3 -3
  4. package/dist/{arc-Gw7Urszo.js → arc-B5-ynLRd.js} +1 -1
  5. package/dist/{arc-ZAQ3z7kr.cjs → arc-CXmyMsv9.cjs} +1 -1
  6. package/dist/{architectureDiagram-ZJ3FMSHR-Coy6_Fcg.js → architectureDiagram-ZJ3FMSHR-C_JEocx6.js} +2 -2
  7. package/dist/{architectureDiagram-ZJ3FMSHR-DxzMbkp1.cjs → architectureDiagram-ZJ3FMSHR-DyhTbYvV.cjs} +1 -1
  8. package/dist/{blockDiagram-677ZJIJ3-THmR4OyE.cjs → blockDiagram-677ZJIJ3-BsWnBpmo.cjs} +1 -1
  9. package/dist/{blockDiagram-677ZJIJ3-CbR-wn2x.js → blockDiagram-677ZJIJ3-COWsJwrz.js} +3 -3
  10. package/dist/{c4Diagram-LMCZKHZV-DHMqNO9p.js → c4Diagram-LMCZKHZV-BJGPyybb.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-BcJpuXK1.cjs → c4Diagram-LMCZKHZV-C8SAoymj.cjs} +1 -1
  12. package/dist/{channel-Cryph4zI.cjs → channel-Catm-7_m.cjs} +1 -1
  13. package/dist/{channel-CfC4eqki.js → channel-gEEzHgMK.js} +1 -1
  14. package/dist/{chunk-2Q5K7J3B-C3BIc3MH.js → chunk-2Q5K7J3B-BrZPj48S.js} +1 -1
  15. package/dist/{chunk-2Q5K7J3B-CxWyY331.cjs → chunk-2Q5K7J3B-D2pUNN7e.cjs} +1 -1
  16. package/dist/{chunk-32BRIVSS-C3w_aYfI.cjs → chunk-32BRIVSS-BHwCDqTA.cjs} +1 -1
  17. package/dist/{chunk-32BRIVSS-C37ccuiX.js → chunk-32BRIVSS-Qjp2CRZG.js} +1 -1
  18. package/dist/{chunk-5VM5RSS4-Cbt79-V5.cjs → chunk-5VM5RSS4-C-2Xl1mK.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-DVLmkcyq.js → chunk-5VM5RSS4-Cz-1oXF8.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-BZOxrSRn.cjs → chunk-EX3LRPZG-CcWHrBHu.cjs} +1 -1
  21. package/dist/{chunk-EX3LRPZG-Co0Bql0-.js → chunk-EX3LRPZG-DOly63cQ.js} +4 -4
  22. package/dist/{chunk-JWPE2WC7-DUndc3Wb.js → chunk-JWPE2WC7-D8oKuUKk.js} +1 -1
  23. package/dist/{chunk-JWPE2WC7-Cvt_ToFU.cjs → chunk-JWPE2WC7-uLMzLWor.cjs} +1 -1
  24. package/dist/{chunk-MOJQB5TN-AAMW2q8N.cjs → chunk-MOJQB5TN-CFHULd2m.cjs} +1 -1
  25. package/dist/{chunk-MOJQB5TN-aTSDPliR.js → chunk-MOJQB5TN-DFfn4gwS.js} +1 -1
  26. package/dist/{chunk-PUDLZKDR-Q5QzbDtY.js → chunk-PUDLZKDR-BSXgzvcs.js} +6 -6
  27. package/dist/{chunk-PUDLZKDR-CzCdcyAN.cjs → chunk-PUDLZKDR-CdXVWW4P.cjs} +1 -1
  28. package/dist/{chunk-RYQCIY6F-DbjhsOnH.cjs → chunk-RYQCIY6F-CVamSMzr.cjs} +1 -1
  29. package/dist/{chunk-RYQCIY6F-O6wbIIFF.js → chunk-RYQCIY6F-D7rBCtF6.js} +1 -1
  30. package/dist/{chunk-V7JOEXUC-OTS1fN7j.js → chunk-V7JOEXUC-BEGUrMN0.js} +5 -5
  31. package/dist/{chunk-V7JOEXUC-B6Qc5ABc.cjs → chunk-V7JOEXUC-DJuvtTef.cjs} +1 -1
  32. package/dist/{chunk-VR4S4FIN-D4tY80kq.js → chunk-VR4S4FIN-DbzCqIxB.js} +1 -1
  33. package/dist/{chunk-VR4S4FIN-DlneMFEg.cjs → chunk-VR4S4FIN-Okfemb3d.cjs} +1 -1
  34. package/dist/{chunk-XXDRQBXY-CvhBfnFQ.cjs → chunk-XXDRQBXY-DQBgFSg2.cjs} +1 -1
  35. package/dist/{chunk-XXDRQBXY-58rTAwvh.js → chunk-XXDRQBXY-DzmhMVRC.js} +1 -1
  36. package/dist/{classDiagram-v2-EOCWNBFH-hcuKRiyp.js → classDiagram-OUVF2IWQ-BGn-HjT8.js} +2 -2
  37. package/dist/{classDiagram-OUVF2IWQ-C0S2HAJU.cjs → classDiagram-OUVF2IWQ-DR8DD7tr.cjs} +1 -1
  38. package/dist/{classDiagram-OUVF2IWQ-hcuKRiyp.js → classDiagram-v2-EOCWNBFH-BGn-HjT8.js} +2 -2
  39. package/dist/{classDiagram-v2-EOCWNBFH-C0S2HAJU.cjs → classDiagram-v2-EOCWNBFH-DR8DD7tr.cjs} +1 -1
  40. package/dist/components/MermaidDiagram.d.ts +1 -0
  41. package/dist/components/mathRendering.d.ts +1 -0
  42. package/dist/components/mdastNodes/CodeNode.d.ts +2 -1
  43. package/dist/conversion.d.ts +26 -0
  44. package/dist/converter/NOTICES.md +178 -0
  45. package/dist/converter/createMarkdownConverter.d.ts +12 -0
  46. package/dist/converter/protocol.d.ts +58 -0
  47. package/dist/converter/serve.d.ts +12 -0
  48. package/dist/converter/worker.d.ts +1 -0
  49. package/dist/converter/worker.js +76 -0
  50. package/dist/converter.cjs +1 -0
  51. package/dist/converter.d.ts +4 -0
  52. package/dist/converter.js +109 -0
  53. package/dist/converter.wasm +0 -0
  54. package/dist/{cose-bilkent-JH36ORCC-BwltbHKG.js → cose-bilkent-JH36ORCC-CXaSZTQh.js} +1 -1
  55. package/dist/{cose-bilkent-JH36ORCC-DVZVn03H.cjs → cose-bilkent-JH36ORCC-DKpnPAKO.cjs} +1 -1
  56. package/dist/{cynefinDiagram-TSTJHNR4-ogTeIoNY.js → cynefinDiagram-TSTJHNR4-BQSdT_2p.js} +2 -2
  57. package/dist/{cynefinDiagram-TSTJHNR4-DYCBxaEi.cjs → cynefinDiagram-TSTJHNR4-WzHtBOXU.cjs} +1 -1
  58. package/dist/{dagre-VKFMJZFB-DJW9o9XX.cjs → dagre-VKFMJZFB-BOlxvZO9.cjs} +1 -1
  59. package/dist/{dagre-VKFMJZFB-BfNdgMHQ.js → dagre-VKFMJZFB-DQ5e1PJD.js} +2 -2
  60. package/dist/{diagram-FQU43EPY-BRpNVpgn.cjs → diagram-FQU43EPY-DdDxGx-M.cjs} +1 -1
  61. package/dist/{diagram-FQU43EPY-CJf3yD8h.js → diagram-FQU43EPY-DlCF28sn.js} +2 -2
  62. package/dist/{diagram-G47NLZAW-5rZfUeWV.cjs → diagram-G47NLZAW-Cvts7_pn.cjs} +1 -1
  63. package/dist/{diagram-G47NLZAW-D0-6oupP.js → diagram-G47NLZAW-DVdw7HhH.js} +3 -3
  64. package/dist/{diagram-NH7WQ7WH-BwrWWWZJ.js → diagram-NH7WQ7WH-BkU3b82h.js} +2 -2
  65. package/dist/{diagram-NH7WQ7WH-g7m8p5fK.cjs → diagram-NH7WQ7WH-Cs_Dyb0p.cjs} +1 -1
  66. package/dist/{diagram-OA4YK3LP-BBqA1m8s.js → diagram-OA4YK3LP-D39RUkK3.js} +3 -3
  67. package/dist/{diagram-OA4YK3LP-BxP8KUna.cjs → diagram-OA4YK3LP-ONhluSWR.cjs} +1 -1
  68. package/dist/{diagram-WEI45ONY-CMexm2GN.js → diagram-WEI45ONY-CMD5pSfn.js} +2 -2
  69. package/dist/{diagram-WEI45ONY-DgJyq1w0.cjs → diagram-WEI45ONY-DyEvKt6H.cjs} +1 -1
  70. package/dist/{ebnfDiagram-CCIWWBDH-sfiWOXCW.cjs → ebnfDiagram-CCIWWBDH-Bi-wg1C0.cjs} +1 -1
  71. package/dist/{ebnfDiagram-CCIWWBDH-DvLr_8nV.js → ebnfDiagram-CCIWWBDH-Z3TtxdlL.js} +3 -3
  72. package/dist/{erDiagram-Q63AITRT-D6U6Ng3Y.js → erDiagram-Q63AITRT-C-O8hBWj.js} +4 -4
  73. package/dist/{erDiagram-Q63AITRT-B11THykZ.cjs → erDiagram-Q63AITRT-DQO3kH0H.cjs} +1 -1
  74. package/dist/errors-BW5JXRoX.cjs +1 -0
  75. package/dist/errors-Blk_XJ9C.js +55 -0
  76. package/dist/errors.d.ts +12 -0
  77. package/dist/extractHeadings-DSlyjlEb.cjs +311 -0
  78. package/dist/{extractHeadings-CdLPwHlC.js → extractHeadings-DkKFCMIW.js} +5195 -5149
  79. package/dist/flowDiagram-23GEKE2U-BHV7jjdl.js +7 -0
  80. package/dist/flowDiagram-23GEKE2U-Bn8nX3mJ.cjs +1 -0
  81. package/dist/{ganttDiagram-NO4QXBWP-CGCdgj0K.js → ganttDiagram-NO4QXBWP-BgxDDjW1.js} +2 -2
  82. package/dist/{ganttDiagram-NO4QXBWP-BLlXK3zo.cjs → ganttDiagram-NO4QXBWP-C6v1dyOv.cjs} +1 -1
  83. package/dist/gen/markdown/v1/markdown_pb.d.ts +1 -0
  84. package/dist/{gitGraphDiagram-IHSO6WYX-Bib3c0C6.js → gitGraphDiagram-IHSO6WYX-BSIaczat.js} +3 -3
  85. package/dist/{gitGraphDiagram-IHSO6WYX-BHOyibqH.cjs → gitGraphDiagram-IHSO6WYX-Dly6wuUW.cjs} +1 -1
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.client.cjs +1 -1
  88. package/dist/index.client.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.server.cjs +1 -1
  91. package/dist/index.server.d.ts +3 -1
  92. package/dist/index.server.js +185 -178
  93. package/dist/{infoDiagram-FWYZ7A6U-BUqDBIaP.js → infoDiagram-FWYZ7A6U-BJpiPMD3.js} +1 -1
  94. package/dist/{infoDiagram-FWYZ7A6U-BcDp6g1Y.cjs → infoDiagram-FWYZ7A6U-CRxeian2.cjs} +1 -1
  95. package/dist/{ishikawaDiagram-FXEZZL3T-CcPh4nuP.js → ishikawaDiagram-FXEZZL3T-B3tCfTEo.js} +1 -1
  96. package/dist/{ishikawaDiagram-FXEZZL3T-C3QHQ1ia.cjs → ishikawaDiagram-FXEZZL3T-jEnTu6LN.cjs} +1 -1
  97. package/dist/{journeyDiagram-5HDEW3XC-B17v98Wb.cjs → journeyDiagram-5HDEW3XC-BXFW-Svx.cjs} +1 -1
  98. package/dist/{journeyDiagram-5HDEW3XC-MdxndgF1.js → journeyDiagram-5HDEW3XC-D7U-NNAM.js} +4 -4
  99. package/dist/{kanban-definition-HUTT4EX6-JhfZ6Qik.js → kanban-definition-HUTT4EX6-B14iIRCh.js} +2 -2
  100. package/dist/{kanban-definition-HUTT4EX6-BApVXeVQ.cjs → kanban-definition-HUTT4EX6-DSprt7D2.cjs} +1 -1
  101. package/dist/{linear-CIVwb13z.cjs → linear-B-_z7_Qw.cjs} +1 -1
  102. package/dist/{linear-dbOUbGpD.js → linear-DZOg62FH.js} +1 -1
  103. package/dist/{mindmap-definition-LN4V7U3C-BUbo0u-Y.cjs → mindmap-definition-LN4V7U3C-Bs_ccQ71.cjs} +1 -1
  104. package/dist/{mindmap-definition-LN4V7U3C-gNTBga2z.js → mindmap-definition-LN4V7U3C-Dh-Z6t4L.js} +3 -3
  105. package/dist/{pegDiagram-2B236MQR-BqjpbNkG.js → pegDiagram-2B236MQR-6OQwK0r-.js} +3 -3
  106. package/dist/{pegDiagram-2B236MQR-DZiQVxu1.cjs → pegDiagram-2B236MQR-BunF191h.cjs} +1 -1
  107. package/dist/{pieDiagram-ENE6RG2P-D2nxDVFV.cjs → pieDiagram-ENE6RG2P-BUdykoZb.cjs} +1 -1
  108. package/dist/{pieDiagram-ENE6RG2P-C1Gr48CK.js → pieDiagram-ENE6RG2P-DjvAa5zD.js} +3 -3
  109. package/dist/{quadrantDiagram-ABIIQ3AL-DuD9ZdUQ.js → quadrantDiagram-ABIIQ3AL-DfiOa0GN.js} +2 -2
  110. package/dist/{quadrantDiagram-ABIIQ3AL-C855tL3K.cjs → quadrantDiagram-ABIIQ3AL-ksoulitn.cjs} +1 -1
  111. package/dist/{railroadDiagram-RFXS5EU6-BZsnhaQd.cjs → railroadDiagram-RFXS5EU6-BWupYLwR.cjs} +1 -1
  112. package/dist/{railroadDiagram-RFXS5EU6-xx1d3Md8.js → railroadDiagram-RFXS5EU6-DxJ3t05t.js} +3 -3
  113. package/dist/remarkProcessor.server.d.ts +1 -27
  114. package/dist/{requirementDiagram-TGXJPOKE-CCu1UYFH.js → requirementDiagram-TGXJPOKE-CxplHHB8.js} +3 -3
  115. package/dist/{requirementDiagram-TGXJPOKE-D_NbFRkb.cjs → requirementDiagram-TGXJPOKE-D17FjoFO.cjs} +1 -1
  116. package/dist/{sankeyDiagram-HTMAVEWB-Dn2Ta-XX.cjs → sankeyDiagram-HTMAVEWB-CDXvEE-n.cjs} +1 -1
  117. package/dist/{sankeyDiagram-HTMAVEWB-QGzXzczJ.js → sankeyDiagram-HTMAVEWB-DFOQ2fD-.js} +1 -1
  118. package/dist/{sequenceDiagram-DBY2YBRQ-BA3Oc4pz.cjs → sequenceDiagram-DBY2YBRQ-D-aVI5Yt.cjs} +1 -1
  119. package/dist/{sequenceDiagram-DBY2YBRQ-CjnUnaw9.js → sequenceDiagram-DBY2YBRQ-Gf5VRPPO.js} +3 -3
  120. package/dist/{sizeCapture-X5ZJPWSS-BPQhVBe0.cjs → sizeCapture-X5ZJPWSS-BAB3SekL.cjs} +1 -1
  121. package/dist/{sizeCapture-X5ZJPWSS-nb9uU-BE.js → sizeCapture-X5ZJPWSS-DyErW1EK.js} +1 -1
  122. package/dist/source-lines.cjs +1 -0
  123. package/dist/source-lines.d.ts +6 -0
  124. package/dist/source-lines.js +11 -0
  125. package/dist/{stateDiagram-2N3HPSRC-DSqLqSY5.cjs → stateDiagram-2N3HPSRC-BrUDPgXu.cjs} +1 -1
  126. package/dist/{stateDiagram-2N3HPSRC-Byg3E1AA.js → stateDiagram-2N3HPSRC-lxQmuBDw.js} +2 -2
  127. package/dist/{stateDiagram-v2-6OUMAXLB-VRhXyf-C.cjs → stateDiagram-v2-6OUMAXLB-B67PZ7bz.cjs} +1 -1
  128. package/dist/{stateDiagram-v2-6OUMAXLB-hKcuYy9t.js → stateDiagram-v2-6OUMAXLB-l5VmN12f.js} +2 -2
  129. package/dist/{swimlanes-5IMT3BWC-DyIDdThc.js → swimlanes-5IMT3BWC-CMkiOd-R.js} +3 -3
  130. package/dist/{swimlanes-5IMT3BWC-CVnOKNcb.cjs → swimlanes-5IMT3BWC-DW61y4w7.cjs} +1 -1
  131. package/dist/{swimlanesDiagram-G3AALYLV-BF1ofRjP.js → swimlanesDiagram-G3AALYLV-CaDY11RK.js} +2 -2
  132. package/dist/{swimlanesDiagram-G3AALYLV-C3U5wLlX.cjs → swimlanesDiagram-G3AALYLV-DN1x1exB.cjs} +1 -1
  133. package/dist/{timeline-definition-FHXFAJF6-KUETCXLT.cjs → timeline-definition-FHXFAJF6-DCW8SrSN.cjs} +1 -1
  134. package/dist/{timeline-definition-FHXFAJF6-DBmE_qU3.js → timeline-definition-FHXFAJF6-GIvmYQNR.js} +2 -2
  135. package/dist/{vennDiagram-L72KCM5P-C6j4k5X-.js → vennDiagram-L72KCM5P-DtN1NFNM.js} +1 -1
  136. package/dist/{vennDiagram-L72KCM5P-DkSV3dIE.cjs → vennDiagram-L72KCM5P-wENEw3FH.cjs} +1 -1
  137. package/dist/{wardleyDiagram-EHGQE667-BaG6Cf_u.js → wardleyDiagram-EHGQE667-CPYTbfuJ.js} +2 -2
  138. package/dist/{wardleyDiagram-EHGQE667-uWMTMxL-.cjs → wardleyDiagram-EHGQE667-Daugt2NV.cjs} +1 -1
  139. package/dist/{xychartDiagram-FW5EYKEG-QAFE-xqg.cjs → xychartDiagram-FW5EYKEG-B3D8pi1c.cjs} +1 -1
  140. package/dist/{xychartDiagram-FW5EYKEG-BPl5BnMB.js → xychartDiagram-FW5EYKEG-C-NgU5xv.js} +2 -2
  141. package/package.json +23 -8
  142. package/dist/extractHeadings-DRUBnhbi.cjs +0 -311
  143. package/dist/flowDiagram-23GEKE2U-CDscoQ9F.cjs +0 -1
  144. package/dist/flowDiagram-23GEKE2U-CLibi_u4.js +0 -7
package/README.md CHANGED
@@ -6,6 +6,7 @@ Advanced Markdown renderer for React with support for various extensions and cus
6
6
 
7
7
  - **Rich Markdown Support**: Full support for CommonMark, GitHub Flavored Markdown (GFM), and LaTeX Math expressions.
8
8
  - **Offloaded Parser**: CPU-heavy Markdown parsing and AST transformation are offloaded to a high-performance Go API server running `goldmark` and `ConnectRPC`.
9
+ - **Browser Converter**: the same Go converter, compiled to WebAssembly and run in a worker, converts in the browser exactly as the service does, byte for byte, without a round trip (`@aiquants/markdown/converter`).
9
10
  - **Custom Extensions & Plugins**: GitHub alerts, Zenn-style directives (`:::message` / `:::details`), single-line display math, and pluggable subscript, superscript, mark highlights, table cell merges, and opt-in embeds: posts and videos of ten SNS and video providers as script-free cross-origin frames, and link cards from the host's metadata endpoint.
10
11
  - **Dynamic Configuration**: Easily enable or disable custom extensions dynamically using parse options.
11
12
  - **Syntax Highlighting**: Code blocks with Shiki syntax highlighting.
@@ -131,6 +132,7 @@ const parseResult = await parseMarkdown(
131
132
  maxHtmlBytes: 4 * 1024 * 1024, // required; the largest HTML in bytes
132
133
  resolveImports: false, // expand <!-- @import "path" --> (default false)
133
134
  validateExistence: true, // probe local images and doc links (data-asset-exists / data-doc-exists; default true)
135
+ includeSourceLines: false, // annotate each block with data-source-lines="<first>-<last>" (default false)
134
136
  signal: controller.signal, // cancels the conversion in the service too
135
137
  timeoutMs: 10_000, // the conversion's deadline
136
138
  enableSubscript: false, // Disable subscript (leaves ~2~ as plain text)
@@ -149,6 +151,7 @@ const parseResult = await parseMarkdown(
149
151
  | `maxHtmlBytes` | ✅ | The largest HTML in bytes, a positive integer up to `MAX_HTML_BYTES_LIMIT`. The service stops while it renders and the call rejects with `MarkdownResourceExhaustedError`; the response the call accepts is bounded by twice this plus 64 KiB. |
150
152
  | `resolveImports` | | Expand `<!-- @import "path" -->` directives (default `false`: a directive stays an HTML comment and nothing is read). Only Markdown (`.md`) targets the deny rules admit are read, nested imports included; a refused target rejects the call with `permission_denied`. |
151
153
  | `validateExistence` | | Probe local targets (default `true`): a local storage image also gets `data-asset-exists` (`"true"` or `"false"`) and a local doc link `data-doc-exists` (`"true"` or `"false"`). Cloud targets are never probed, and `data-asset-src` is written for every admitted storage image either way. |
154
+ | `includeSourceLines` | | Annotate every rendered block with `data-source-lines="<first>-<last>"`, the 1-based lines of `markdownText` it came from, both inclusive (default `false`; see "Source lines" below). |
152
155
  | `signal` | | Cancels the call; the service stops converting. |
153
156
  | `timeoutMs` | | The conversion's deadline in milliseconds (a positive integer); the service stops at it or at `MARKDOWN_CONVERT_TIMEOUT`, whichever comes first. |
154
157
  | `enable*` | | Switch the syntax extensions and HTML plugins (each enabled unless `false`). The text plugins leave `summary` text (a `:::details` title included) as written. |
@@ -169,8 +172,58 @@ An image destination is a URL decoded once: `![](a%2541.png)` names the file `a%
169
172
 
170
173
  `MarkdownRenderer` shows an image without a `src` (or with `data-asset-exists="false"`) as a placeholder naming its `data-asset-src`, so HTML rendered before the host wrote the URLs shows which files are missing instead of blank space.
171
174
 
175
+ ### Source lines
176
+
177
+ With `includeSourceLines`, every rendered block carries `data-source-lines="<first>-<last>"`: the 1-based lines of `markdownText` it came from, both inclusive, so an editor can open the source at the block a reader points at. With `resolveImports`, the lines count the text with every import expanded.
178
+
179
+ - A leaf block counts its own lines (a fenced code block from its opening fence, which holds the info string); a container (a list, an item, a blockquote, a table, an alert, a Zenn container, a definition list, the footnotes) spans its blocks. A setext heading counts its text, not its underline; an alert, its blocks, not the `[!NOTE]` line.
180
+ - A thematic break and a raw HTML block carry none (the converter never wraps an author's HTML).
181
+ - The HTML with source lines is the HTML without them plus the attribute alone.
182
+ - The attribute comes only from the converter: a `data-source-lines` written in raw HTML or a heading's `{…}` attributes is removed whether or not the option is on.
183
+ - The viewer keeps the attribute only in the converter's shape, and moves the attribute of a `pre` it replaces (a highlighted code block, a Mermaid diagram) onto the replacement's root.
184
+
185
+ `@aiquants/markdown/source-lines` holds the contract without React or any package, for host sanitizers and editors: `SOURCE_LINES_ATTRIBUTE` (`"data-source-lines"`), the type `SourceLines` (`{ first, last }`) and `parseSourceLines(value)`, which returns `null` for any value the converter could not have written.
186
+
187
+ ```ts
188
+ import { parseSourceLines, SOURCE_LINES_ATTRIBUTE } from "@aiquants/markdown/source-lines"
189
+
190
+ const block = target.closest(`[${SOURCE_LINES_ATTRIBUTE}]`)
191
+ const lines = parseSourceLines(block?.getAttribute(SOURCE_LINES_ATTRIBUTE))
192
+ ```
193
+
194
+ ### Browser converter
195
+
196
+ `@aiquants/markdown/converter` runs the service's Go converter, compiled to WebAssembly, in a worker, so a browser converts a document exactly as the service does, without a round trip: with existence validation off and `@import` directives left as written, the HTML and the headings are the service's byte for byte (the package's end-to-end tests compare both on the same documents). A host serves two assets and passes their URLs, here with Vite:
197
+
198
+ ```ts
199
+ import { createMarkdownConverter } from "@aiquants/markdown/converter"
200
+ import converterWorkerUrl from "@aiquants/markdown/converter/worker?worker&url"
201
+ import converterWasmUrl from "@aiquants/markdown/converter.wasm?url"
202
+
203
+ const converter = createMarkdownConverter({ workerUrl: converterWorkerUrl, wasmUrl: converterWasmUrl, timeoutMs: 10_000 })
204
+ const { htmlContent, headings } = await converter.convert(
205
+ {
206
+ markdownText,
207
+ filePath: "notes/my-file.md", // the document's path under workspaceRoot, or its gcs:// / gdrive:// URI
208
+ workspaceRoot: "/workspace", // any absolute path: the browser has no workspace
209
+ options: { deniedPathSegments: hostDenyRules, maxHtmlBytes: 4 * 1024 * 1024, includeSourceLines: true },
210
+ },
211
+ controller.signal,
212
+ )
213
+ ```
214
+
215
+ - **Options** are `BrowserParseOptions`: `ParseOptions` without `resolveImports`, `validateExistence` (the browser has no storage), `signal` and `timeoutMs` (the call has its own). They are validated as `parseMarkdown` validates them.
216
+ - **Paths**: `filePath` is read as the service reads it. Give a local document's path relative to any absolute `workspaceRoot`: the converter writes workspace-relative document paths (`data-asset-src`, `data-doc-path`), the same as the service with the real root. The deny rules apply as written; symbolic links are not resolved, since there is no file system, so the service stays the authority when the host serves a target.
217
+ - **One conversion at a time**, in call order. One aborted before it starts never runs; one aborted while it runs rejects at once with the signal's reason and its answer is dropped, since a WebAssembly call cannot be interrupted. `timeoutMs` counts from the moment the converter is loaded; past it the converter stops its worker, rejects with `MarkdownConversionTimeoutError` and starts a new worker for the next conversion.
218
+ - **Errors**: `MarkdownResourceExhaustedError` past a size limit (the same class `./server` exports; the browser applies the service's default limits, an 8 MiB source and a 32 MiB HTML, lowered by `maxHtmlBytes`), `MarkdownConversionTimeoutError`, and `MarkdownConversionError` with `code`: `invalid_argument` for a refused request, `internal` when the converter failed on the document, `unavailable` when the converter could not load or was disposed (every later call fails the same way; create a new converter to retry). `dispose()` stops the worker.
219
+ - **Assets**: `converter.wasm` is about 9.1 MiB (gzip 2.0 MiB, brotli 1.6 MiB); serve it as `application/wasm`, so it compiles while it downloads, and compressed. The first conversion starts the worker, compiles the module and starts Go (about 0.4 s in Chromium); a 700-line document then converts in about 35 ms, the worker's round trip included. The worker is one self-contained script that starts with the `wasm_exec.js` of the Go toolchain that built the module, under its BSD license; `dist/converter/NOTICES.md` lists the licenses of everything linked into the module.
220
+ - **Content Security Policy**: a page that sets `script-src` needs `'wasm-unsafe-eval'` in it, and `worker-src 'self'` (or a `script-src` that covers the worker) for the same-origin worker.
221
+ - **Building from source** needs the Go toolchain on PATH: `pnpm run build` compiles `cmd/markdown-wasm` of `packages/go/markdown-api` and bundles the worker with the same toolchain's `wasm_exec.js` (`pnpm run build:converter` alone).
222
+
172
223
  ## Viewer, embeds and links
173
224
 
225
+ `MarkdownRenderer` keys every top-level block by its content: a fingerprint of the block's HTML without `data-source-lines`, and its occurrence among equal blocks. When the document around a block changes (a paragraph added above, the lines it came from moved), the block keeps its components, so a highlighted code block, a Mermaid diagram or an embedded frame is not built again; only a block whose content changed is.
226
+
174
227
  ### Stylesheets
175
228
 
176
229
  | Import | Content |
@@ -432,9 +485,14 @@ Given the prop, the viewer renders
432
485
 
433
486
  The function receives the scroll container, `[data-aqmd-scroll-container]`, the same element with the same hooks and classes as without the prop. It is called on every render once the container is mounted, before the first paint. The bar reads and writes the container's scroll position itself (`scrollTop`, `scrollHeight`, `clientHeight`, `scroll` events).
434
487
 
435
- Only the native vertical scrollbar is hidden, in every engine: the scroll container always reserves it (`overflow-y: scroll`, so its thickness is constant), its border box (`box-sizing: border-box`, whatever the host's default) is widened by the measured thickness (`width: calc(100% + <thickness>px)`), and the clipping cell cuts that strip off. The native horizontal scrollbar keeps its native look, spans exactly the visible width and stays usable, as do the wheel, the keyboard and touch in both directions. No `::-webkit-scrollbar` or `scrollbar-width` rule is involved, so a host's `scrollbar-color` or `scrollbar-width` neither breaks the hiding nor is overridden. The cell uses `overflow: clip` rather than `hidden`, so nothing can scroll the cell itself, and it creates no containing block, so the fixed toolbar is neither moved nor clipped by it. Coverage: classic (space-taking) scrollbars are hidden in every browser that supports `overflow: clip` (Chromium 90, Firefox 81, Safari 16). An overlay scrollbar (macOS by default, mobile browsers, Firefox and GTK overlay modes) takes no space, measures 0 px and is drawn over the content while scrolling, so it stays visible there; the right-to-left inline end is handled the same way.
488
+ Only the native vertical scrollbar is hidden, in every engine: the scroll container always reserves it (`overflow-y: scroll`, so its thickness is constant), its border box (`box-sizing: border-box`, whatever the host's default) is widened by the measured thickness (`width: calc(100% + <thickness>px)`), and the clipping cell cuts that strip off.
489
+ The native horizontal scrollbar keeps its native look, spans exactly the visible width and stays usable, as do the wheel, the keyboard and touch in both directions. No `::-webkit-scrollbar` or `scrollbar-width` rule is involved, so a host's `scrollbar-color` or `scrollbar-width` neither breaks the hiding nor is overridden. The cell uses `overflow: clip` rather than `hidden`, so nothing can scroll the cell itself, and it creates no containing block, so the fixed toolbar is neither moved nor clipped by it.
490
+ Coverage: classic (space-taking) scrollbars are hidden in every browser that supports `overflow: clip` (Chromium 90, Firefox 81, Safari 16). An overlay scrollbar (macOS by default, mobile browsers, Firefox and GTK overlay modes) takes no space, measures 0 px and is drawn over the content while scrolling, so it stays visible there; the right-to-left inline end is handled the same way.
436
491
 
437
- The thickness and the slot's width are measured in the scroll container's own CSS px, which a CSS `zoom` or a transform above it makes differ from the viewport's: a native scrollbar keeps its size on screen, so under `zoom: 1.1` its 15 px are 13.64 of the container's px. The container is positioned (`position: relative`) and holds an invisible, zero-tall box stretched across its padding box, `[data-aqmd-scroll-bar-probe]` (`aria-hidden`, out of flow); the thickness is the container's rect width less that box's, converted by the ratio of the container's rect width to its computed width, less its side borders. It is rounded up to a whole px, because the clip must never leave any of the native bar showing: the price is less than 1 px of the container's own px cut off its inline-end padding and the end of the native horizontal scrollbar (0.36 px at `zoom: 1.1`, none where the thickness is whole). Both are measured before the first paint and again whenever the container or the slot resizes and the window resizes (a page zoom changes a scrollbar's thickness in CSS px). The floating toolbar keeps the slot's measured width from the inline end instead of a native scrollbar's 24 px, and each popover's maximum width uses the same clearance.
492
+ The thickness and the slot's width are measured in the scroll container's own CSS px, which a CSS `zoom` or a transform above it makes differ from the viewport's: a native scrollbar keeps its size on screen, so under `zoom: 1.1` its 15 px are 13.64 of the container's px.
493
+ The container is positioned (`position: relative`) and holds an invisible, zero-tall box stretched across its padding box, `[data-aqmd-scroll-bar-probe]` (`aria-hidden`, out of flow); the thickness is the container's rect width less that box's, converted by the ratio of the container's rect width to its computed width, less its side borders.
494
+ It is rounded up to a whole px, because the clip must never leave any of the native bar showing: the price is less than 1 px of the container's own px cut off its inline-end padding and the end of the native horizontal scrollbar (0.36 px at `zoom: 1.1`, none where the thickness is whole).
495
+ Both are measured before the first paint and again whenever the container or the slot resizes and the window resizes (a page zoom changes a scrollbar's thickness in CSS px). The floating toolbar keeps the slot's measured width from the inline end instead of a native scrollbar's 24 px, and each popover's maximum width uses the same clearance.
438
496
 
439
497
  Everything else keeps using the native scroller: fragment and table-of-contents scrolling with `scroll-padding-block-start`, the scroll position kept across a display-style change, link-card visibility observation, embed minimum widths measured from the content column, and the browser's scroll anchoring. Without the prop, the scroll container is the viewer's root element with its native scrollbars, and no row, cell or slot is rendered. Switching between given and omitted moves the scroll container onto another element, which starts at the top.
440
498
 
@@ -556,7 +614,7 @@ e^{i\theta} = \cos\theta + i\sin\theta
556
614
  $$
557
615
  ```
558
616
 
559
- Every renderer (`MarkdownRenderer`, `MarkdownViewer`, `NodesRenderer`) renders a formula with the same KaTeX options: `throwOnError: false` (an invalid formula shows its source in red) and display math in display mode.
617
+ Every renderer (`MarkdownRenderer`, `MarkdownViewer`, `NodesRenderer`) renders a formula with the same KaTeX options: `throwOnError: false` (an invalid formula shows its source in red) and display math in display mode. The 610 most recently used renderings are kept, reports included, so a document re-rendered while it is edited renders only its new formulas.
560
618
  Nothing KaTeX says about a formula reaches the console, in the browser or on the server: its reports about LaTeX-incompatible input that still renders (a text-mode accent such as `\r` in math mode, an unknown symbol, `\\` in display math), its warning about a character its fonts have no metrics for (※, ①, ★, €, an emoji: code `noCharacterMetrics`), and the TeX console commands `\message`, `\errmessage` and `\show`, which render nothing (code `consoleCommand`).
561
619
  `MarkdownRenderer` and `MarkdownViewer` hand them to `onMathDiagnostics` as `MarkdownMathDiagnostic` objects (`{ code, message, formula, displayMode }`): after the commit, once per document, and only when there is one; the viewer's function may change on any render without the document being parsed again.
562
620
  Japanese or other non-Latin letters inside a formula (`\frac{売上}{原価}`) are not reported, since KaTeX renders them as written; `\text{…}` is the LaTeX way to write words inside a formula.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-AAMW2q8N.cjs"),u=require("./chunk-JWPE2WC7-Cvt_ToFU.cjs"),n=require("./extractHeadings-DRUBnhbi.cjs"),i=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var p=i.createRailroadAbnfServices().RailroadAbnf.parser.LangiumParser,o=n.__name(e=>{const r=e.alternatives.map(c);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),c=n.__name(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),f=n.__name(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),d=n.__name(e=>{const r=b(e.primary);if(!e.repeat)return r;const{min:t,max:s}=f(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),b=n.__name(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return o(e.element);case"AbnfOptionalGroup":return{type:"optional",element:o(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),g=n.__name(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),v=n.__name(e=>{u.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(g(r)))},"populateDb"),y={parse:n.__name(e=>{a.db.clear(),n.log.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.MermaidParseError(r);const t=r.value;n.log.debug("[ABNF Parser] Parsed rules:",t.rules.length),v(t),n.log.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a.db}},_={parser:y,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-CFHULd2m.cjs"),u=require("./chunk-JWPE2WC7-uLMzLWor.cjs"),n=require("./extractHeadings-DSlyjlEb.cjs"),i=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var p=i.createRailroadAbnfServices().RailroadAbnf.parser.LangiumParser,o=n.__name(e=>{const r=e.alternatives.map(c);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),c=n.__name(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),f=n.__name(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),d=n.__name(e=>{const r=b(e.primary);if(!e.repeat)return r;const{min:t,max:s}=f(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),b=n.__name(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return o(e.element);case"AbnfOptionalGroup":return{type:"optional",element:o(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),g=n.__name(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),v=n.__name(e=>{u.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(g(r)))},"populateDb"),y={parse:n.__name(e=>{a.db.clear(),n.log.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.MermaidParseError(r);const t=r.value;n.log.debug("[ABNF Parser] Parsed rules:",t.rules.length),v(t),n.log.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a.db}},_={parser:y,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=_;
@@ -1,6 +1,6 @@
1
- import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-aTSDPliR.js";
2
- import { p as f } from "./chunk-JWPE2WC7-DUndc3Wb.js";
3
- import { _ as n, Q as o } from "./extractHeadings-CdLPwHlC.js";
1
+ import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-DFfn4gwS.js";
2
+ import { p as f } from "./chunk-JWPE2WC7-D8oKuUKk.js";
3
+ import { _ as n, Q as o } from "./extractHeadings-DkKFCMIW.js";
4
4
  import { M as c, b as d } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
5
5
  var v = d().RailroadAbnf.parser.LangiumParser, i = /* @__PURE__ */ n((e) => {
6
6
  const r = e.alternatives.map(g);
@@ -1,4 +1,4 @@
1
- import { aD as ln, aE as an, aF as y, aG as tn, aH as N, aI as D, aJ as _, aK as un, aL as rn, aM as j, aN as o, aO as J, aP as sn, aQ as on, aR as fn } from "./extractHeadings-CdLPwHlC.js";
1
+ import { aD as ln, aE as an, aF as y, aG as tn, aH as N, aI as D, aJ as _, aK as un, aL as rn, aM as j, aN as o, aO as J, aP as sn, aQ as on, aR as fn } from "./extractHeadings-DkKFCMIW.js";
2
2
  function cn(l) {
3
3
  return l.innerRadius;
4
4
  }
@@ -1 +1 @@
1
- "use strict";const n=require("./extractHeadings-DRUBnhbi.cjs");function $(o){return o.innerRadius}function b(o){return o.outerRadius}function k(o){return o.startAngle}function _(o){return o.endAngle}function nn(o){return o&&o.padAngle}function en(o,x,D,P,h,v,S,s){var E=D-o,r=P-x,e=S-h,p=s-v,i=p*E-e*r;if(!(i*i<n.epsilon))return i=(e*(x-v)-p*(o-h))/i,[o+i*E,x+i*r]}function M(o,x,D,P,h,v,S){var s=o-D,E=x-P,r=(S?v:-v)/n.sqrt(s*s+E*E),e=r*E,p=-r*s,i=o+e,u=x+p,c=D+e,f=P+p,j=(i+c)/2,l=(u+f)/2,y=c-i,g=f-u,A=y*y+g*g,R=h-v,T=i*f-c*u,H=(g<0?-1:1)*n.sqrt(n.max(0,R*R*A-T*T)),I=(T*g-y*H)/A,O=(-T*y-g*H)/A,q=(T*g+y*H)/A,d=(-T*y+g*H)/A,m=I-j,a=O-l,t=q-j,z=d-l;return m*m+a*a>t*t+z*z&&(I=q,O=d),{cx:I,cy:O,x01:-e,y01:-p,x11:I*(h/R-1),y11:O*(h/R-1)}}function an(){var o=$,x=b,D=n.constant(0),P=null,h=k,v=_,S=nn,s=null,E=n.withPath(r);function r(){var e,p,i=+o.apply(this,arguments),u=+x.apply(this,arguments),c=h.apply(this,arguments)-n.halfPi,f=v.apply(this,arguments)-n.halfPi,j=n.abs(f-c),l=f>c;if(s||(s=e=E()),u<i&&(p=u,u=i,i=p),!(u>n.epsilon))s.moveTo(0,0);else if(j>n.tau-n.epsilon)s.moveTo(u*n.cos(c),u*n.sin(c)),s.arc(0,0,u,c,f,!l),i>n.epsilon&&(s.moveTo(i*n.cos(f),i*n.sin(f)),s.arc(0,0,i,f,c,l));else{var y=c,g=f,A=c,R=f,T=j,H=j,I=S.apply(this,arguments)/2,O=I>n.epsilon&&(P?+P.apply(this,arguments):n.sqrt(i*i+u*u)),q=n.min(n.abs(u-i)/2,+D.apply(this,arguments)),d=q,m=q,a,t;if(O>n.epsilon){var z=n.asin(O/i*n.sin(I)),F=n.asin(O/u*n.sin(I));(T-=z*2)>n.epsilon?(z*=l?1:-1,A+=z,R-=z):(T=0,A=R=(c+f)/2),(H-=F*2)>n.epsilon?(F*=l?1:-1,y+=F,g-=F):(H=0,y=g=(c+f)/2)}var B=u*n.cos(y),C=u*n.sin(y),G=i*n.cos(R),J=i*n.sin(R);if(q>n.epsilon){var K=u*n.cos(g),L=u*n.sin(g),N=i*n.cos(A),Q=i*n.sin(A),w;if(j<n.pi)if(w=en(B,C,N,Q,K,L,G,J)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/n.sin(n.acos((U*W+V*X)/(n.sqrt(U*U+V*V)*n.sqrt(W*W+X*X)))/2),Z=n.sqrt(w[0]*w[0]+w[1]*w[1]);d=n.min(q,(i-Z)/(Y-1)),m=n.min(q,(u-Z)/(Y+1))}else d=m=0}H>n.epsilon?m>n.epsilon?(a=M(N,Q,B,C,u,m,l),t=M(K,L,G,J,u,m,l),s.moveTo(a.cx+a.x01,a.cy+a.y01),m<q?s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,u,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),!l),s.arc(t.cx,t.cy,m,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):(s.moveTo(B,C),s.arc(0,0,u,y,g,!l)):s.moveTo(B,C),!(i>n.epsilon)||!(T>n.epsilon)?s.lineTo(G,J):d>n.epsilon?(a=M(G,J,K,L,i,-d,l),t=M(B,C,N,Q,i,-d,l),s.lineTo(a.cx+a.x01,a.cy+a.y01),d<q?s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,i,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),l),s.arc(t.cx,t.cy,d,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):s.arc(0,0,i,R,A,l)}if(s.closePath(),e)return s=null,e+""||null}return r.centroid=function(){var e=(+o.apply(this,arguments)+ +x.apply(this,arguments))/2,p=(+h.apply(this,arguments)+ +v.apply(this,arguments))/2-n.pi/2;return[n.cos(p)*e,n.sin(p)*e]},r.innerRadius=function(e){return arguments.length?(o=typeof e=="function"?e:n.constant(+e),r):o},r.outerRadius=function(e){return arguments.length?(x=typeof e=="function"?e:n.constant(+e),r):x},r.cornerRadius=function(e){return arguments.length?(D=typeof e=="function"?e:n.constant(+e),r):D},r.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:n.constant(+e),r):P},r.startAngle=function(e){return arguments.length?(h=typeof e=="function"?e:n.constant(+e),r):h},r.endAngle=function(e){return arguments.length?(v=typeof e=="function"?e:n.constant(+e),r):v},r.padAngle=function(e){return arguments.length?(S=typeof e=="function"?e:n.constant(+e),r):S},r.context=function(e){return arguments.length?(s=e??null,r):s},r}exports.d3arc=an;
1
+ "use strict";const n=require("./extractHeadings-DSlyjlEb.cjs");function $(o){return o.innerRadius}function b(o){return o.outerRadius}function k(o){return o.startAngle}function _(o){return o.endAngle}function nn(o){return o&&o.padAngle}function en(o,x,D,P,h,v,S,s){var E=D-o,r=P-x,e=S-h,p=s-v,i=p*E-e*r;if(!(i*i<n.epsilon))return i=(e*(x-v)-p*(o-h))/i,[o+i*E,x+i*r]}function M(o,x,D,P,h,v,S){var s=o-D,E=x-P,r=(S?v:-v)/n.sqrt(s*s+E*E),e=r*E,p=-r*s,i=o+e,u=x+p,c=D+e,f=P+p,j=(i+c)/2,l=(u+f)/2,y=c-i,g=f-u,A=y*y+g*g,R=h-v,T=i*f-c*u,H=(g<0?-1:1)*n.sqrt(n.max(0,R*R*A-T*T)),I=(T*g-y*H)/A,O=(-T*y-g*H)/A,q=(T*g+y*H)/A,d=(-T*y+g*H)/A,m=I-j,a=O-l,t=q-j,z=d-l;return m*m+a*a>t*t+z*z&&(I=q,O=d),{cx:I,cy:O,x01:-e,y01:-p,x11:I*(h/R-1),y11:O*(h/R-1)}}function an(){var o=$,x=b,D=n.constant(0),P=null,h=k,v=_,S=nn,s=null,E=n.withPath(r);function r(){var e,p,i=+o.apply(this,arguments),u=+x.apply(this,arguments),c=h.apply(this,arguments)-n.halfPi,f=v.apply(this,arguments)-n.halfPi,j=n.abs(f-c),l=f>c;if(s||(s=e=E()),u<i&&(p=u,u=i,i=p),!(u>n.epsilon))s.moveTo(0,0);else if(j>n.tau-n.epsilon)s.moveTo(u*n.cos(c),u*n.sin(c)),s.arc(0,0,u,c,f,!l),i>n.epsilon&&(s.moveTo(i*n.cos(f),i*n.sin(f)),s.arc(0,0,i,f,c,l));else{var y=c,g=f,A=c,R=f,T=j,H=j,I=S.apply(this,arguments)/2,O=I>n.epsilon&&(P?+P.apply(this,arguments):n.sqrt(i*i+u*u)),q=n.min(n.abs(u-i)/2,+D.apply(this,arguments)),d=q,m=q,a,t;if(O>n.epsilon){var z=n.asin(O/i*n.sin(I)),F=n.asin(O/u*n.sin(I));(T-=z*2)>n.epsilon?(z*=l?1:-1,A+=z,R-=z):(T=0,A=R=(c+f)/2),(H-=F*2)>n.epsilon?(F*=l?1:-1,y+=F,g-=F):(H=0,y=g=(c+f)/2)}var B=u*n.cos(y),C=u*n.sin(y),G=i*n.cos(R),J=i*n.sin(R);if(q>n.epsilon){var K=u*n.cos(g),L=u*n.sin(g),N=i*n.cos(A),Q=i*n.sin(A),w;if(j<n.pi)if(w=en(B,C,N,Q,K,L,G,J)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/n.sin(n.acos((U*W+V*X)/(n.sqrt(U*U+V*V)*n.sqrt(W*W+X*X)))/2),Z=n.sqrt(w[0]*w[0]+w[1]*w[1]);d=n.min(q,(i-Z)/(Y-1)),m=n.min(q,(u-Z)/(Y+1))}else d=m=0}H>n.epsilon?m>n.epsilon?(a=M(N,Q,B,C,u,m,l),t=M(K,L,G,J,u,m,l),s.moveTo(a.cx+a.x01,a.cy+a.y01),m<q?s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,u,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),!l),s.arc(t.cx,t.cy,m,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):(s.moveTo(B,C),s.arc(0,0,u,y,g,!l)):s.moveTo(B,C),!(i>n.epsilon)||!(T>n.epsilon)?s.lineTo(G,J):d>n.epsilon?(a=M(G,J,K,L,i,-d,l),t=M(B,C,N,Q,i,-d,l),s.lineTo(a.cx+a.x01,a.cy+a.y01),d<q?s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,i,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),l),s.arc(t.cx,t.cy,d,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):s.arc(0,0,i,R,A,l)}if(s.closePath(),e)return s=null,e+""||null}return r.centroid=function(){var e=(+o.apply(this,arguments)+ +x.apply(this,arguments))/2,p=(+h.apply(this,arguments)+ +v.apply(this,arguments))/2-n.pi/2;return[n.cos(p)*e,n.sin(p)*e]},r.innerRadius=function(e){return arguments.length?(o=typeof e=="function"?e:n.constant(+e),r):o},r.outerRadius=function(e){return arguments.length?(x=typeof e=="function"?e:n.constant(+e),r):x},r.cornerRadius=function(e){return arguments.length?(D=typeof e=="function"?e:n.constant(+e),r):D},r.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:n.constant(+e),r):P},r.startAngle=function(e){return arguments.length?(h=typeof e=="function"?e:n.constant(+e),r):h},r.endAngle=function(e){return arguments.length?(v=typeof e=="function"?e:n.constant(+e),r):v},r.padAngle=function(e){return arguments.length?(S=typeof e=="function"?e:n.constant(+e),r):S},r.context=function(e){return arguments.length?(s=e??null,r):s},r}exports.d3arc=an;
@@ -1,5 +1,5 @@
1
- import { p as Ze } from "./chunk-JWPE2WC7-DUndc3Wb.js";
2
- import { bL as qe, _ as gt, al as Qe, aB as Je, Q as Fe, J as Ke, G as je, a6 as _e, a7 as tr, A as er, z as rr, ac as ir, ai as ar, ag as nr, aj as or, K as Ee, bE as Te, aX as pe, W as sr, O as hr, ab as lr, aY as fr, bM as cr } from "./extractHeadings-CdLPwHlC.js";
1
+ import { p as Ze } from "./chunk-JWPE2WC7-D8oKuUKk.js";
2
+ import { bL as qe, _ as gt, al as Qe, aB as Je, Q as Fe, J as Ke, G as je, a6 as _e, a7 as tr, A as er, z as rr, ac as ir, ai as ar, ag as nr, aj as or, K as Ee, bE as Te, aX as pe, W as sr, O as hr, ab as lr, aY as fr, bM as cr } from "./extractHeadings-DkKFCMIW.js";
3
3
  import { p as gr } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
4
4
  import { c as be } from "./cytoscape.esm-kVAWcYoG.js";
5
5
  var he = { exports: {} }, le = { exports: {} }, fe = { exports: {} }, ur = fe.exports, Oe;