agentic-mermaid 0.4.1 → 0.5.3

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 (253) hide show
  1. package/AGENT_NATIVE.md +94 -627
  2. package/CHANGELOG.md +651 -0
  3. package/Instructions_for_agents.md +44 -23
  4. package/LICENSES/Khroma-MIT.txt +21 -0
  5. package/LICENSES/Mermaid-MIT.txt +21 -0
  6. package/LICENSES/es-toolkit-MIT.txt +21 -0
  7. package/LICENSES/pele-MIT.txt +40 -0
  8. package/LICENSES/zenuml-core-MIT.txt +21 -0
  9. package/README.md +93 -50
  10. package/SECURITY.md +28 -12
  11. package/THIRD_PARTY_NOTICES.md +60 -0
  12. package/assets/hero.png +0 -0
  13. package/dist/agent-core.d.ts +478 -210
  14. package/dist/agent-core.js +1 -396
  15. package/dist/agent.d.ts +17 -8
  16. package/dist/agent.js +1 -408
  17. package/dist/agentic-mermaid-mcp.js +1 -11
  18. package/dist/am.js +1 -34562
  19. package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
  20. package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
  21. package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
  22. package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
  23. package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
  24. package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
  25. package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
  26. package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
  27. package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
  28. package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
  29. package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
  30. package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
  31. package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
  32. package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
  33. package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
  34. package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
  35. package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
  36. package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
  37. package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
  38. package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
  39. package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
  40. package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
  41. package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
  42. package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
  43. package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
  44. package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
  45. package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
  46. package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
  47. package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
  48. package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
  49. package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
  50. package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
  51. package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
  52. package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
  53. package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
  54. package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
  55. package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
  56. package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
  57. package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
  58. package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
  59. package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
  60. package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
  61. package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
  62. package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
  63. package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
  64. package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
  65. package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
  66. package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
  67. package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
  68. package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
  69. package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
  70. package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
  71. package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
  72. package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
  73. package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
  74. package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
  75. package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
  76. package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
  77. package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
  78. package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
  79. package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
  80. package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
  81. package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
  82. package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
  83. package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
  84. package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
  85. package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
  86. package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
  87. package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
  88. package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
  89. package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
  90. package/dist/browser-lazy/index.d.ts +544 -275
  91. package/dist/browser-lazy/index.js +1 -1
  92. package/dist/browser.global.js +802 -565
  93. package/dist/chunk-3LGLPG33.js +2 -0
  94. package/dist/chunk-7CRDX2QR.js +2 -0
  95. package/dist/chunk-7PPW2BMO.js +2 -0
  96. package/dist/chunk-DQDKA5ND.js +2 -0
  97. package/dist/chunk-EHCMJUMD.js +52 -0
  98. package/dist/chunk-GVCHLSHH.js +4 -0
  99. package/dist/chunk-H3NCS2XZ.js +19 -0
  100. package/dist/chunk-JZOJ4YGS.js +201 -0
  101. package/dist/chunk-MKE7GNYU.js +146 -0
  102. package/dist/chunk-NKNFOREZ.js +2 -0
  103. package/dist/chunk-O7H2UX5K.js +2 -0
  104. package/dist/chunk-OMY6NRQD.js +58 -0
  105. package/dist/chunk-UA234O4M.js +4 -0
  106. package/dist/chunk-VUFVLGTH.js +2 -0
  107. package/dist/chunk-XU5LPD2D.js +2 -0
  108. package/dist/cli-YGGTJZH7.js +226 -0
  109. package/dist/elk-constructor.js +2 -0
  110. package/dist/elk-constructor.node.js +11 -0
  111. package/dist/index-EeXqJXr5.d.ts +1223 -0
  112. package/dist/index.d.ts +4 -1
  113. package/dist/index.js +1 -334
  114. package/dist/jsonl-RPJY6YWO.js +2 -0
  115. package/dist/mcp-cli-63DYXTVD.js +2 -0
  116. package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
  117. package/dist/server-5NEOHOFS.js +524 -0
  118. package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
  119. package/dist/svg-styles.d.ts +1 -0
  120. package/dist/svg-styles.js +2 -0
  121. package/dist/svg.d.ts +13 -0
  122. package/dist/svg.js +2 -0
  123. package/dist/types-BcS52Mjt.d.ts +1360 -0
  124. package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
  125. package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
  126. package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
  127. package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
  128. package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
  129. package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
  130. package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
  131. package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
  132. package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
  133. package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
  134. package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
  135. package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
  136. package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
  137. package/dist/zenuml-frame.global.js +3626 -0
  138. package/dist/zenuml.d.ts +83 -0
  139. package/dist/zenuml.js +1 -0
  140. package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
  141. package/docs/README.md +59 -103
  142. package/docs/agent-api-cookbook.md +26 -16
  143. package/docs/agent-mutation-policy.md +86 -15
  144. package/docs/agent-workflow-examples.md +1 -1
  145. package/docs/api-advanced.md +385 -0
  146. package/docs/api.md +320 -366
  147. package/docs/ascii.md +40 -4
  148. package/docs/browser.md +46 -7
  149. package/docs/choosing-a-diagram.md +148 -0
  150. package/docs/code-mode-impact.md +1 -0
  151. package/docs/comparison.md +244 -28
  152. package/docs/computational-aesthetics-prototype-plan.md +10 -10
  153. package/docs/config.md +60 -2
  154. package/docs/custom-fonts.md +78 -21
  155. package/docs/diagram-families.md +160 -10
  156. package/docs/eventmodeling-and-zenuml.md +165 -0
  157. package/docs/features.md +21 -19
  158. package/docs/fork-differences.md +105 -32
  159. package/docs/getting-started.md +56 -51
  160. package/docs/layout-certification.md +126 -0
  161. package/docs/mcp-code-mode-rationale.md +20 -12
  162. package/docs/mcp-http-transport.md +14 -8
  163. package/docs/quality.md +145 -15
  164. package/docs/react.md +76 -31
  165. package/docs/style-authoring.md +23 -11
  166. package/docs/svg-semantic-contract.md +104 -4
  167. package/docs/testing-strategy.md +684 -126
  168. package/docs/theming.md +27 -8
  169. package/examples/styles/readme-hero.md +25 -0
  170. package/examples/styles/readme-hero.mmd +13 -0
  171. package/examples/styles/readme-hero.style.json +7 -0
  172. package/package.json +114 -57
  173. package/server.json +2 -2
  174. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
  175. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
  176. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
  177. package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
  178. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
  179. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
  180. package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
  181. package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
  182. package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
  183. package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
  184. package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
  185. package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
  186. package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
  187. package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
  188. package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
  189. package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
  190. package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
  191. package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
  192. package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
  193. package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
  194. package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
  195. package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
  196. package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
  197. package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
  198. package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
  199. package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
  200. package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
  201. package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
  202. package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
  203. package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
  204. package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
  205. package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
  206. package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
  207. package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
  208. package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
  209. package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
  210. package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
  211. package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
  212. package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
  213. package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
  214. package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
  215. package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
  216. package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
  217. package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
  218. package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
  219. package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
  220. package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
  221. package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
  222. package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
  223. package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
  224. package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
  225. package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
  226. package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
  227. package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
  228. package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
  229. package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
  230. package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
  231. package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
  232. package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
  233. package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
  234. package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
  235. package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
  236. package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
  237. package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
  238. package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
  239. package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
  240. package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
  241. package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
  242. package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
  243. package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
  244. package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
  245. package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
  246. package/dist/chunk-GGXCNCNA.js +0 -4118
  247. package/dist/chunk-IVD4NXNE.js +0 -615
  248. package/dist/chunk-JDMRPUAG.js +0 -37
  249. package/dist/chunk-JWAAW3FH.js +0 -149
  250. package/dist/chunk-LCGBT32P.js +0 -62036
  251. package/dist/chunk-RWMZRUIC.js +0 -4715
  252. package/dist/mcp-cli-4MLKC3ZH.js +0 -17
  253. package/docs/mutation-testing.md +0 -285
@@ -0,0 +1,12 @@
1
+ import{h as e}from"./chunk-J7FFAFQF.js";import{a as t,c as i}from"./chunk-NMQQMRIR.js";import{b as n,c as a}from"./chunk-2SH76OTH.js";import{d as r}from"./chunk-AMJLVPUB.js";import{t as o}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{c as l}from"./chunk-CN7WTBWB.js";import{D as s,a as d,b as c,c as h,d as p,e as m,g as f,i as u}from"./chunk-HLWUNUCM.js";import{C as g,c as y,n as b,o as x,q as w,x as v,y as $}from"./chunk-X2UYKWKM.js";import{i as k,j as M,k as _,l as S,q as I}from"./chunk-TYZOZXUJ.js";import{h as N,l as W,n as z,o as F}from"./chunk-NO7ZIVRU.js";import{H as j,N as D,O as E,S as T,T as A,Z as C,ca as B,na as L,ra as U,wa as O}from"./chunk-Z3FDIVLN.js";import{C as P,D as q}from"./chunk-N5ELX7LR.js";import"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var R=Object.freeze({id:"mindmap",upstreamId:"mindmap",maturity:"stable",label:"Mindmap",headers:["mindmap"],aliases:[],config:{section:"mindmap",keys:["padding","maxNodeWidth","layoutAlgorithm","colorBy"],noopKeys:["colorBy","layoutAlgorithm"]},identity:{id:"family:mindmap",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["importance","category"],semanticRoles:["prelude","title","chrome","edge","node","icon","label"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"edge",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"node",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`mindmap
2
+ root((Product))
3
+ Research
4
+ Interviews
5
+ Evidence
6
+ Delivery
7
+ Launch`,detect:P,detectLoose:q}),H={padding:a,maxNodeWidth:n},Q=class extends Error{constructor(e,t){super(e),this.line=t,this.name="MindmapParseError"}line},V=class extends Q{constructor(e,t){super(`Duplicate mindmap node identity '${e}' on line ${t}; every node identity must be unique.`,t),this.id=e}id;code="MINDMAP_DUPLICATE_ID"};function Z(e){let t=e.map((e,t)=>t);try{for(let{start:i,end:n}of G(e,0))t[i]=n}catch{}return t}function*G(e,t){let i,n;for(let a=t;a<e.length;a++){let t=a,r=e[a];if(r.includes('["`')&&!r.includes('`"]')){let t=[r],i=!1;for(;++a<e.length;)if(t.push(e[a]),e[a].includes('`"]')){i=!0;break}if(!i)throw new Q("Unclosed mindmap Markdown String",a+1);r=t.join(`
8
+ `)}if("open"===K(r.trimStart())){let t=e=>/^\s*%%/.test(e);i??=e.map(e=>t(e)?"":e).join(`
9
+ `);let o=(n??=e.reduce((i,n,a)=>(i.push(0===a?0:i[a-1]+(t(e[a-1])?0:e[a-1].length)+1),i),[]))[a]+r.length-r.trimStart().length,l=K(i.slice(o));if(l&&"open"!==l){let n=a+i.slice(o,o+l.end).split(`
10
+ `).length-1;r=[e[a].trimEnd(),...e.slice(a+1,n+1).filter(e=>!t(e)).map(e=>e.trim())].join(`
11
+ `),a=n}}yield{raw:X(r),start:t,end:a}}}function J(e){let t=K(e);return"open"===t?null:t}function K(e){let t=e.match(/^([^()[{}]*?)(\(\(|\{\{|\[|\)\)|\)|\()/);if(!t)return null;let i=t[2],n=t[0].length,a=n;if(e.startsWith('"`',n)){let t=e.indexOf('`"',n+2);if(t<0)return"open";a=t+2}else if('"'===e[n]){for(a=n+1;a<e.length;){if("\\"===e[a]){a+=2;continue}if('"'===e[a++])break}if('"'!==e[a-1]||a===n+1)return"open"}else for(;a<e.length&&!/[)\](}]/.test(e[a]);)a++;let r=e.slice(n,a),o='"'===e[n];for(;a<e.length&&(o?/[ \t]/:/\s/).test(e[a]);)a++;if(a===e.length)return o?null:"open";let l=["))","}}","((","(-","-)",")","]","("].find(t=>e.startsWith(t,a));if(!l)return null;let s="["===i?"rect":"{{"===i?"hexagon":"(("===i?"circle":"))"===i?"bang":")"===i||")"!==l?"cloud":"rounded";return{id:t[1].trim(),label:r,shape:s,end:a+l.length}}function X(e,t=!0){if(e.trimStart().startsWith(":::"))return e;let i=v([e],0)?.form==="inline",n=e.trimStart(),a=t&&!n.startsWith("::")?J(n):null;if(a){let t=e.indexOf("%%",e.length-n.length+a.end);return t<0?e:e.slice(0,t)}let r=!1,o=!1;for(let t=0;t<e.length-1;t++){let n=e[t];if(o){o=!1;continue}if("\\"===n){o=!0;continue}if('"'===n){r=!r;continue}if(r||"%"!==n||"%"!==e[t+1])continue;let a=e.slice(0,t).trim();if(!a||i||/^::icon\([^)]*\)$/.test(a))return e.slice(0,t);let l=ee(a);if(l&&"default"!==l.shape)return e.slice(0,t)}return e}var Y=/^(?!mindmap\b)[^([\r\n){}]*$/i;function ee(e){return function(e){let t=J(e);if(t&&!e.slice(t.end).trim()){let e=ei(t.id,t.label,t.shape);return e&&{node:e}}for(let{regex:t,shape:i}of et){let n=e.match(t);if(!n)continue;let a=n[2],r=!a.includes('"')&&function(e){let t=[];for(let i of e){let e="("===i?")":"["===i?"]":"{"===i?"}":void 0;if(e)t.push(e);else if((")"===i||"]"===i||"}"===i)&&t.pop()!==i)return!1}return 0===t.length}(a)?ei(n[1].trim(),a,i):null;return r&&{node:r,nested:!0}}if(!Y.test(e))return null;let i=en(e),n=ea(i.label);return n?{node:{id:n,label:i.label,shape:"default",...i.markdown?{markdown:!0}:{}}}:null}(e)?.node??null}var et=[{regex:/^(.*?)\(\((.*)\)\)$/,shape:"circle"},{regex:/^(.*?)\{\{(.*)\}\}$/,shape:"hexagon"},{regex:/^(.*?)\[([\s\S]*)\]$/,shape:"rect"},{regex:/^(.*?)\)\)(.*)\(\($/,shape:"bang"},{regex:/^(.*?)\)(.*)\($/,shape:"cloud"},{regex:/^(.*?)\((.*)\)$/,shape:"rounded"}];function ei(e,t,i){if(!Y.test(e))return null;let n=en(t),a=e||ea(n.label);return a&&n.label?{id:a,label:n.label,shape:i,...n.markdown?{markdown:!0}:{}}:null}function en(e){let t=e.trim(),i=t.startsWith('"`')&&t.endsWith('`"');return i?t=b(t.slice(2,-2)).replace(/\*\*([\s\S]+?)\*\*/g,"<b>$1</b>").replace(/\*([\s\S]+?)\*/g,"<i>$1</i>"):(t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1)),t=(t=b(t)).replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1")),{label:x(j(t),"*()[]").trim(),markdown:i}}function ea(e){return e.replace(/<\/?(?:b|i)>/gi,"").trim()}function er(e,t){let i=e.width*("bang"===e.shape?.38:.5);return e.x+e.width/2+("right"===t?i:-i)}function eo(e,t){let i=Math.min(...Array.from(e.values(),e=>e.y));if(i<t)for(let n of e.values())n.y+=t-i}function el(e,t,i){let n=Array.from(t.values()).flatMap(e=>{if(!e.parentId)return[];let i=t.get(e.parentId),n="left"===e.side,a={x:er(i,n?"left":"right"),y:i.y+i.height/2},r={x:er(e,n?"right":"left"),y:e.y+e.height/2},o=.42*Math.abs(r.x-a.x),l={x:a.x+(n?-o:o),y:a.y},s={x:r.x+(n?o:-o),y:r.y};return[{from:i.id,to:e.id,points:[a,l,s,r],d:`M ${ed(a.x)} ${ed(a.y)} C ${ed(l.x)} ${ed(l.y)} ${ed(s.x)} ${ed(s.y)} ${ed(r.x)} ${ed(r.y)}`}]}),a=Math.min(...Array.from(t.values(),e=>e.x));if(a<i){let e=i-a;for(let i of t.values())i.x+=e;for(let t of n){t.points.forEach(t=>{t.x+=e});let[i,n,a,r]=t.points;t.d=`M ${ed(i.x)} ${ed(i.y)} C ${ed(n.x)} ${ed(n.y)} ${ed(a.x)} ${ed(a.y)} ${ed(r.x)} ${ed(r.y)}`}}return{width:Math.max(...Array.from(t.values(),e=>e.x+e.width))+i,height:Math.max(...Array.from(t.values(),e=>e.y+e.height))+i,accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,nodes:[...t.values()],edges:n}}function es(e,t){return"number"==typeof e&&Number.isFinite(e)&&e>=0?e:t}function ed(e){return Math.round(1e3*e)/1e3}function ec(e,t){let i={layout:"tidy-tree"===t?"tidy-tree":"radial"};return!e||"object"!=typeof e||Array.isArray(e)||("number"==typeof e.padding&&Number.isFinite(e.padding)&&e.padding>=0&&(i.padding=e.padding),"number"==typeof e.maxNodeWidth&&Number.isFinite(e.maxNodeWidth)&&e.maxNodeWidth>0&&(i.maxNodeWidth=e.maxNodeWidth)),i}function eh(e){return Math.round(1e3*e)/1e3}var ep=y(function(n,a){let{positioned:r,colors:o,resolved:l}=a,s=l.renderOptions,d=o.font??"Inter",c=s.transparent??!1,h="mindmap-title",p="mindmap-desc",m=I(r.accessibilityTitle??r.nodes[0]?.label,r.accessibilityDescription,h,p,"mindmap"),f=[_(r.width,r.height,o,c,{attrs:m}),M(d,!1,o.shadow,o.embedFontImport)],u=k(o);u&&f.push(`<defs>${u}</defs>`);let g=function(e){let t=new Map,i=e.nodes.find(e=>0===e.depth);if(!i)return t;let n=0;for(let a of[...e.nodes].sort((e,t)=>e.depth-t.depth))0!==a.depth&&(a.parentId===i.id?t.set(a.id,n++):a.parentId&&t.has(a.parentId)&&t.set(a.id,t.get(a.parentId)));return t}(r),y=new Set(g.values()).size,b=O(o.accent??"")?o.accent:"#3b82f6",x=O(o.bg)?o.bg:"#ffffff",w=e(y,y<=6?{accent:b,bg:x}:{accent:o.accent??b,bg:o.bg}),v=e=>w[g.get(e)??0]??b,$=[n.documentOpen({id:"prelude",width:r.width,height:r.height,colors:o,transparent:c,font:d,hasMonoFont:!1},f.join(`
12
+ `))],W=r.accessibilityTitle??r.nodes[0]?.label;for(let e of(W&&$.push(n.documentText({id:"acc-title",element:"title",domId:h,text:W})),r.accessibilityDescription&&$.push(n.documentText({id:"acc-desc",element:"description",domId:p,text:r.accessibilityDescription})),r.title&&$.push(n.text(F(r.title,N(s,void 0,l.styleFace)))),r.edges)){let t=v(e.to),[i,a,r,o]=e.points;if(!i||!a||!r||!o)throw Error(`Mindmap edge "${e.from}" -> "${e.to}" requires four cubic control points`);let l=B(e.d,i,[{kind:"cubic",control1:a,control2:r,end:o}]);$.push(n.connector({id:T(e.from,e.to),role:"edge",geometry:l.geometry,lineStyle:"solid",paint:{fill:"none",stroke:t,strokeWidth:"2.5"},endpoints:{from:e.from,to:e.to},relationship:{kind:"mindmap-branch",direction:"forward"},route:{ownership:"layout",contours:l.contours},stroke:{lineCap:"round"},channels:{importance:1,category:String(g.get(e.to)??0)},attributes:{className:"mindmap-edge",data:{"branch-index":String(g.get(e.to)??0)}}}))}for(let e of r.nodes)$.push(function(e,n,a,r,o){let l=O(a.bg)&&O(a.fg)&&(void 0===a.accent||O(a.accent)),s=l?S(a).arrow:"var(--_arrow)",d=l?L(o,a.bg,1===n.depth?30:2===n.depth?20:13):"var(--_node-fill)",c=0===n.depth?s:d,h=0===n.depth?s:o,p=0===n.depth?l?U(a.bg,s,4.5,a.fg):"var(--bg)":l?U(a.fg,d,4.5):"var(--_text)",m=function(e){let{x:t,y:i,width:n,height:a}=e,r=(e,t)=>({x:eh(e),y:eh(t)});if("circle"===e.shape)return{kind:"circle",cx:eh(t+n/2),cy:eh(i+a/2),r:eh(Math.min(n,a)/2)};if("cloud"===e.shape)return{kind:"ellipse",cx:eh(t+n/2),cy:eh(i+a/2),rx:eh(n/2),ry:eh(a/2)};if("hexagon"===e.shape)return{kind:"polygon",points:[r(t+12,i),r(t+n-12,i),r(t+n,i+a/2),r(t+n-12,i+a),r(t+12,i+a),r(t,i+a/2)]};if("bang"===e.shape){let e=[];for(let o=0;o<12;o++){let l=-Math.PI/2+o*Math.PI/6,s=o%2==0?n/2:.38*n,d=o%2==0?a/2:.38*a;e.push(r(t+n/2+Math.cos(l)*s,i+a/2+Math.sin(l)*d))}return{kind:"polygon",points:e}}return{kind:"rect",x:eh(t),y:eh(i),width:eh(n),height:eh(a),rx:"rect"===e.shape?0:"rounded"===e.shape?10:16,ry:"rect"===e.shape?0:"rounded"===e.shape?10:16}}(n),f=[{node:e.shape({id:A(n.id,"shape"),role:"chrome",geometry:m,paint:{fill:c,stroke:h,strokeWidth:"1.5"}}),indent:2}];if(n.icon){let a=i(n.icon);if(a){let t=n.x+n.width/2-7,i=n.y+4,r=14/24;f.push({node:e.pathArtwork({id:A(n.id,"icon"),paths:a.paths,owner:{id:n.id,role:"node"},open:`<g class="mindmap-icon-glyph" data-icon="${D(n.icon)}" data-icon-source="${D(a.source)}" transform="translate(${eh(t)} ${eh(i)}) scale(${eh(r)})">`,transform:{kind:"matrix",a:eh(r),b:0,c:0,d:eh(r),e:eh(t),f:eh(i)},paint:{fill:p,stroke:p,strokeWidth:"0.8"}}),indent:2})}else{let i=t(n.icon);f.push({node:e.text({id:A(n.id,"icon"),role:"icon",owner:{id:n.id,role:"node"},text:i,block:n.iconFallbackBlock,x:eh(n.x+n.width/2),y:eh(n.y+12),fontSize:9,anchor:"middle",paint:{fill:p},baselineShift:0,attributes:{className:"mindmap-icon-fallback",data:{icon:n.icon}}}),indent:2})}}let u=n.y+n.height/2+5*!!n.icon,g=n.labelBlock?.fontSize??13,y=n.labelBlock?.fontWeight??500,b=n.labelBlock?.letterSpacing??0;f.push({node:e.text({id:A(n.id,"label"),role:"label",text:n.label,block:n.labelBlock,x:n.x+n.width/2,y:u,fontSize:g,fontWeight:y,letterSpacing:b,anchor:"middle",paint:{fill:p}}),indent:2});let x=n.className?` ${D(n.className)}`:"";return e.group({id:n.id,role:"node",channels:{importance:Math.max(1,5-n.depth),...void 0===r?{}:{category:String(r)}},open:`<g class="mindmap-node depth-${n.depth}${x}" data-id="${D(n.id)}" data-label="${E(n.label)}"${void 0===r?"":` data-branch-index="${r}"`}${n.parentId?` data-parent-id="${D(n.parentId)}"`:""}>`,close:"</g>",children:f})}(n,e,o,g.get(e.id),v(e.id)));return $.push(n.documentClose()),{family:"mindmap",width:r.width,height:r.height,colors:o,transparent:c,parts:$}}),em=p(R,{configDiagnostics:e=>{let t=r("mindmap",e,H),i=e.root,n=i&&"object"==typeof i&&!Array.isArray(i)?i:void 0;return n&&"layout"in n&&!["tidy-tree","cose-bilkent","radial"].includes(String(n.layout))&&t.push({code:"INEFFECTIVE_CONFIG",field:"layout",message:'layout must be "cose-bilkent", "radial", or "tidy-tree" for mindmap diagrams; the invalid value has no effect.'}),t},statementEnds:Z,normalizeRequest:e=>({familyConfig:{position:ec(e.source.config.mindmap,e.source.config.layout)}}),layout:e=>h(function(e,n,a={groupLetterSpacing:0}){return function(e,t,i,n={}){let a=W(t,i);if(!a)return e;let r=es(n.padding,32),o=a.height,l=e.nodes.map(e=>({...e,y:e.y+o})),s=e.edges.map(e=>{let t=e.points.map(e=>({x:e.x,y:e.y+o})),[i,n,a,r]=t;return{...e,points:t,d:`M ${ed(i.x)} ${ed(i.y)} C ${ed(n.x)} ${ed(n.y)} ${ed(a.x)} ${ed(a.y)} ${ed(r.x)} ${ed(r.y)}`}}),d=Math.max(e.width,a.width+2*r);return{...e,width:d,height:e.height+o,nodes:l,edges:s,title:z(a,d,r)}}(function(e,n={}){var a,r;let o,l,s,d,c,h,p,m,f,u,g,y,b,x,w,v,$,k,M,_,S=es(n.padding,32),I=es(n.maxNodeWidth,180),N=es(n.nodeGap,40),W=es(n.layerGap,20),z=(a=e.root,r=n.textStyle,o=new Map,(l=(e,n,a)=>{let s=C(e.label,{fontSize:r?.nodeLabelFontSize??13,fontWeight:r?.nodeLabelFontWeight??500,letterSpacing:r?.nodeLetterSpacing,transform:r?.nodeTextTransform,maxWidth:I}),d=s.text,c=Math.max(56,s.width+24),h=Math.max(34,s.height+18+14*!!e.icon);for(let r of("circle"===e.shape&&(c=h=Math.max(c,h,54)),("bang"===e.shape||"cloud"===e.shape)&&(c+=18,h+=10),o.set(e.id,{id:e.id,label:d,labelBlock:s,iconFallbackBlock:e.icon&&!i(e.icon)?C(t(e.icon),{fontSize:9,fontWeight:400}):void 0,shape:e.shape,markdown:e.markdown,icon:e.icon,className:e.className,...a?{parentId:a}:{},depth:n,side:0===n?"root":"right",x:0,y:0,width:c,height:h}),e.children))l(r,n+1,e.id)})(a,0),o);return"tidy-tree"===n.layout?function(e,t,i,n,a){let r=function(e){let t=new Map;for(let i of e.values())t.set(i.depth,Math.max(t.get(i.depth)??0,i.width));return t}(t),o=new Map([[0,i]]),l=Math.max(...Array.from(t.values(),e=>e.depth));for(let e=1;e<=l;e++)o.set(e,o.get(e-1)+(r.get(e-1)??0)+a);let s=i,d=e=>{let a=t.get(e.id);if(a.side=0===a.depth?"root":"right",a.x=o.get(a.depth),0===e.children.length)return a.y=s,s+=a.height+n,a.y+a.height/2;let r=e.children.map(d);return a.y=Math.max(i,(r[0]+r.at(-1))/2-a.height/2),a.y+a.height/2};return d(e.root),eo(t,i),el(e,t,i)}(e,z,S,N,W):(s=z.get(e.root.id),d=e=>{let t=z.get(e.id).height;return 0===e.children.length?t:Math.max(t,e.children.reduce((e,t)=>e+d(t),0)+N*(e.children.length-1))},c=[],h=[],p=0,m=0,e.root.children.forEach((e,t)=>{let i=d(e)+N;1===t||t>1&&p<m?(c.push(e),p+=i):(h.push(e),m+=i)}),f=(e,t)=>{z.get(e.id).side=t,e.children.forEach(e=>f(e,t))},c.forEach(e=>f(e,"left")),h.forEach(e=>f(e,"right")),g=(u=e=>{let t=new Map;for(let i of z.values())i.side===e&&t.set(i.depth,Math.max(t.get(i.depth)??0,i.width));return t})("left"),y=u("right"),s.x=S+[...g.values()].reduce((e,t)=>e+t+W,0),x=(b=(e,t)=>{let i=new Map,n="left"===e?s.x:s.x+s.width,a=Math.max(0,...t.keys());for(let r=1;r<=a;r++){let a=t.get(r)??0;"left"===e?(n-=W+a,i.set(r,n)):(n+=W,i.set(r,n),n+=a)}return i})("left",g),w=b("right",y),$=(v=(e,t)=>{let i=S,n="left"===t?g:y,a="left"===t?x:w,r=e=>{let o=z.get(e.id),l=a.get(o.depth);if(o.x="left"===t?l+(n.get(o.depth)-o.width):l,0===e.children.length)return o.y=i,i+=o.height+N,o.y+o.height/2;let s=e.children.map(r),d=(s[0]+s.at(-1))/2;return o.y=d-o.height/2,d};return e.forEach(r),{min:S,max:Math.max(S,i-N)}})(c,"left"),k=v(h,"right"),M=Math.max(s.height,$.max-$.min,k.max-k.min),s.y=S+Math.max(0,(M-s.height)/2),(_=(e,t)=>{if(0===e.length)return;let i=S+(M-(t.max-t.min))/2-t.min,n=e=>{z.get(e.id).y+=i,e.children.forEach(n)};e.forEach(n)})(c,$),_(h,k),eo(z,S),el(e,z,S))}(e,{...n,textStyle:a}),e.title,a,n)}(o(g(function(e){let t=e.replace(/^\uFEFF/,"").split(/\r?\n/).map(e=>v([e],0)?.form==="inline"?X(e,!1):e),i=$(t,Z(t));if(void 0!==i.unclosedIndex)throw new Q("Unclosed accDescr block",i.unclosedIndex+1);let n=w(i.accessibility),a=i.familyLines,r=a.findIndex(e=>/^\s*mindmap\s*$/i.test(e));if(r<0)throw new Q("Mindmap source must start with the mindmap header");m("mindmap")&&f("mindmap","header",a[r],{line:r+1,unit:"normalized"});let o=[],l=new Set,s,d,c=n.title,h=n.descr;for(let{raw:e,start:t,end:i}of(m("mindmap")&&u("mindmap","initialize",{accessibilityTitle:c,accessibilityDescription:h}),G(a,r+1))){let n=t+1,a=e.trim();if(!a||a.startsWith("%%"))continue;if(/^acc(?:Title|Descr)\b/i.test(a)){let e=/^accTitle\b/i.test(a)?"accTitle":"accDescr";throw new Q(`Mindmap ${e} must contain a non-empty value`,i+1)}if(/^::icon\b/i.test(a)){m("mindmap")&&f("mindmap","icon",a,{line:n,unit:"normalized"});let e=a.match(/^::icon\(([^)]*)\)$/i),t=e?.[1]?.trim();if(!e||!t)throw new Q("Mindmap icon decoration must contain a non-empty value without closing parentheses",i+1);if(!d)throw new Q("Mindmap icon decoration requires a preceding node",i+1);d.icon=t,m("mindmap")&&u("mindmap","setIcon",{id:d.id,icon:t},{line:n,unit:"normalized"});continue}if(a.startsWith(":::")){m("mindmap")&&f("mindmap","class",a,{line:n,unit:"normalized"});let e=a.match(/^:::\s*(.+)$/);if(!e)throw new Q("Mindmap class decoration must contain at least one class name",i+1);if(!d)throw new Q("Mindmap class decoration requires a preceding node",i+1);d.className=e[1].trim().replace(/\s+/g," "),m("mindmap")&&u("mindmap","setClass",{id:d.id,className:d.className},{line:n,unit:"normalized"});continue}let r=ee(a);if(m("mindmap")&&f("mindmap",r?"node":"invalid",a,{line:n,unit:"normalized"}),!r)throw new Q(`Invalid mindmap node syntax on line ${i+1}: ${a}`,i+1);if(l.has(r.id))throw new V(r.id,i+1);l.add(r.id);let c={...r,children:[]};m("mindmap")&&u("mindmap","createNode",c,{line:n,unit:"normalized"});let h=function(e){let t=0;for(let i of e)if(" "===i)t++;else if(" "===i)t+=4;else break;return t}(e);for(;o.length>0&&o[o.length-1].indent>=h;)o.pop();if(0===o.length){if(s)throw new Q(`There can be only one mindmap root; '${c.label}' has no parent on line ${i+1}.`,i+1);s=c,m("mindmap")&&u("mindmap","setRoot",{id:c.id},{line:n,unit:"normalized"})}else o[o.length-1].node.children.push(c),m("mindmap")&&u("mindmap","attachChild",{id:c.id,parentId:o[o.length-1].node.id},{line:n,unit:"normalized"});o.push({indent:h,node:c}),d=c}if(!s)throw new Q("Mindmap requires exactly one root node");return{root:s,...c?{accessibilityTitle:c}:{},...h?{accessibilityDescription:h}:{}}}(e.source.authoredFamilyBody??e.source.familyBody),e.source.accessibility),e.source.frontmatter),e.familyConfig?.position??ec(void 0,void 0),N(e.renderOptions,void 0,e.styleFace)),{injectAccessibility:!1}),projectPositioned:d(function({positioned:e}){return{version:1,nodes:e.nodes.map(e=>({id:e.id,x:l(e.x),y:l(e.y),w:l(e.width),h:l(e.height),shape:"circle"===e.shape?"ellipse":"rectangle",label:e.label,...s(e.labelBlock,e.x+e.width/2,e.y+e.height/2+5*!!e.icon,e)})),edges:e.edges.map((e,t)=>({id:`edge#${t}:${e.from}->${e.to}`,from:e.from,to:e.to,path:e.points.map(e=>[l(e.x),l(e.y)])})),groups:[],bounds:{w:l(e.width),h:l(e.height)}}}),lowerScene:c(ep)});export{em as default};
@@ -0,0 +1,7 @@
1
+ import{b as e}from"./chunk-2I4UPL7Q.js";import{a as t,b as i,c as a,e as o,j as n}from"./chunk-2SH76OTH.js";import{d as r}from"./chunk-AMJLVPUB.js";import{t as s,y as l}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{a as d}from"./chunk-2UIA2IME.js";import{a as c,c as p}from"./chunk-CN7WTBWB.js";import{D as h,a as f,b as b,c as m,d as g,e as u,g as x,i as y}from"./chunk-HLWUNUCM.js";import{M as k,c as w,pa as v,s as S,y as _}from"./chunk-X2UYKWKM.js";import"./chunk-TYZOZXUJ.js";import{h as W,l as $,n as z,o as M}from"./chunk-NO7ZIVRU.js";import{D as B,N as P,Z as j}from"./chunk-Z3FDIVLN.js";import{L as I}from"./chunk-N5ELX7LR.js";import"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var R=Object.freeze({id:"packet",upstreamId:"packet",maturity:"stable",label:"Packet",headers:["packet","packet-beta"],aliases:[],config:{section:"packet",keys:["bitsPerRow","bitOrder","showBits","rowHeight","bitWidth","paddingX","paddingY","useMaxWidth"],noopKeys:["useMaxWidth"]},identity:{id:"family:packet",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:[],semanticRoles:["prelude","chrome","title","node","label"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"node",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"node",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`packet
2
+ 0-15: "Source port"
3
+ 16-31: "Destination port"`,detect:I,detectLoose:I});function F(e={}){let t=l(e,["packet"])??{},i=(e,i)=>"number"==typeof t[e]&&Number.isFinite(t[e])&&t[e]>0?t[e]:i,a=e=>"number"==typeof t[e]&&Number.isFinite(t[e])&&t[e]>=0?t[e]:5;return{bitsPerRow:"number"==typeof t.bitsPerRow&&Number.isSafeInteger(t.bitsPerRow)&&t.bitsPerRow>0?t.bitsPerRow:32,bitOrder:"descending"===t.bitOrder?"descending":"ascending",showBits:!1!==t.showBits,rowHeight:i("rowHeight",32),bitWidth:i("bitWidth",32),paddingX:a("paddingX"),paddingY:a("paddingY")}}var L=w(function(e,{positioned:t,colors:i,resolved:a}){let o=W(a.renderOptions,void 0,a.styleFace),n=a.renderOptions.transparent??!1,r=[];t.title&&r.push(e.text(M(t.title,o)));let s=o.nodeFillColor??"var(--_node-fill)",l=o.nodeTextColor??v(void 0,i,s)("var(--_text)");for(let i of t.fields){let t=[e.shape({id:`${i.id}:box`,role:"node",identity:!1,owner:{id:i.id,role:"node"},geometry:{kind:"rect",x:i.x,y:i.y,width:i.width,height:i.height,rx:o.cornerRadius},paint:{fill:s,stroke:o.nodeBorderColor??"var(--_node-stroke)",strokeWidth:String(o.nodeLineWidth)}}),e.text({id:`${i.id}:label`,role:"label",owner:{id:i.id,role:"node"},text:i.labelBlock.text,block:i.labelBlock,x:i.x+i.width/2,y:i.y+i.height/2,fontSize:i.labelBlock.fontSize,fontWeight:i.labelBlock.fontWeight,letterSpacing:i.labelBlock.letterSpacing,anchor:"middle",paint:{fill:l}})];for(let[a,n]of i.bitLabels.entries())t.push(e.text({id:`${i.id}:bit-${a}`,role:"label",text:n.text,block:n.block,x:n.x,y:n.y,fontSize:n.block.fontSize,fontWeight:n.block.fontWeight,anchor:n.anchor,paint:{fill:o.edgeTextColor??"var(--_text-muted)"}}));r.push(e.group({id:i.id,role:"node",open:`<g data-id="${P(i.id)}" data-field-id="${P(i.fieldId)}" data-start="${i.start}" data-end="${i.end}" data-field-label="${P(B(i.labelBlock.prepared))}">`,close:"</g>",children:t.map(e=>({node:e,indent:2}))}))}return d(e,"packet",t,i,n,r)}),N=g(R,{configDiagnostics:e=>r("packet",e,{bitsPerRow:t("a positive safe integer",e=>Number.isSafeInteger(e)&&Number(e)>=1),bitOrder:n("ascending","descending"),showBits:o,rowHeight:i,bitWidth:i,paddingX:a,paddingY:a,useMaxWidth:o}),normalizeRequest:e=>({familyConfig:{visual:F(e.source.frontmatter)}}),layout:t=>m(function(e,t={},i=F(),a){let o=e.fields.length?Math.floor(e.fields.at(-1).end/i.bitsPerRow)+1:0;k("nodes",o+e.fields.length);let n=W(t,void 0,a),r=t.padding??24,s=$(e.title,n),l=a?.node?.paddingX,d=a?.node?.paddingY??8,c=Math.max(8,Math.min(11,n.edgeLabelFontSize)),p=i.showBits?1.5*c+4:0,h=[],f=Array.from({length:o},()=>i.rowHeight),b={display:"formatted",transform:n.nodeTextTransform,fontSize:n.nodeLabelFontSize,fontWeight:n.nodeLabelFontWeight,letterSpacing:n.nodeLetterSpacing,fontFamily:t.font};for(let t of e.fields){let e;for(let a=t.start;a<=t.end;){let o=Math.floor(a/i.bitsPerRow),n=o*i.bitsPerRow,s=Math.min(t.end,n+i.bitsPerRow-1),c=(s-a+1)*i.bitWidth,p=Math.min(i.paddingX,c-1),m=c-p;a===s&&(e??=j(t.label,b));let g=a===s&&1===e.lines.length&&e.text.length<=4,u=Math.max(1,m-(void 0===l?g?2:8:2*l)),x=g?Math.max(9,Math.min(b.fontSize,Math.floor(b.fontSize*u/Math.max(1,e.width)))):b.fontSize,y=j(t.label,{...b,fontSize:x,maxWidth:u}),w=r+("descending"===i.bitOrder?i.bitsPerRow-(s-n+1):a-n)*i.bitWidth+p/2;h.push({...t,id:`${t.id}:row-${o}`,fieldId:t.id,start:a,end:s,row:o,x:w,y:0,width:m,slotWidth:c,height:0,labelBlock:y,bitLabels:[]}),f[o]=Math.max(f[o],y.height+2*d),k("nodes",h.length),a=s+1}}let m=r+(s?.height??0),g=0;for(let e=0;e<o;e++){for(;g<h.length&&h[g].row===e;){let t=h[g++];if(t.y=m+p,t.height=f[e],i.showBits){let e=t.start===t.end,a="descending"===i.bitOrder?t.end:t.start,o="descending"===i.bitOrder?t.start:t.end,n=e?[{bit:t.start,x:t.x+t.width/2,anchor:"middle"}]:[{bit:a,x:t.x+2,anchor:"start"},{bit:o,x:t.x+t.width-2,anchor:"end"}];t.bitLabels=n.map(e=>({text:String(e.bit),x:e.x,y:m+p/2,anchor:e.anchor,block:j(String(e.bit),{display:"literal",fontSize:c,fontWeight:400})}))}}m+=p+f[e]+i.paddingY}let u=Math.max(2*r+i.bitsPerRow*i.bitWidth,(s?.width??0)+2*r);return{width:u,height:Math.max(2*r+(s?.height??0),m+r),rows:o,fields:h,visual:i,...s?{title:z(s,u,r)}:{},accessibility:{title:e.accessibilityTitle,descr:e.accessibilityDescription}}}(s(function(t,i={}){let a=_("string"==typeof t?t.split(/\r?\n/):[...t]),o=[...a.familyLines];for(;o.length&&(!o[0].trim()||o[0].trim().startsWith("%%"));)o.shift();let n=o.shift()??"";if(x("packet","header",n,{line:1,unit:"normalized"}),!/^packet(?:-beta)?\s*$/i.test(e(n).trim()))throw S({what:"Invalid packet header",expectedForm:"packet",example:`packet
4
+ +8: "Byte"`});let r={kind:"packet",fields:[],accessibilityTitle:i.title??a.accessibility.title,accessibilityDescription:i.descr??a.accessibility.descr},s=o.join(`
5
+ `),l=/(?:title(?:[ \t]+([^\n]*))?(?:\n|$)|(\+)?(0|[1-9]\d*)[ \t]*(?:-[ \t]*(0|[1-9]\d*))?[ \t]*:[ \t]*("(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*')[ \t]*(?:%%[^\n]*)?(?:\n|$))/gy,d=0,c=-1,p=0,h=2;for(;d<s.length;){let t=/^(?:\s+|%%[^\n]*(?:\n|$))/.exec(s.slice(d));if(t){d+=t[0].length;continue}l.lastIndex=d;let i=l.exec(s);if(!i){if(!s.slice(d).trim())break;throw S({what:`Invalid packet statement: ${s.slice(d).split(`
6
+ `)[0]}`,expectedForm:'start-end: "label" or +bits: "label"',example:'+16: "Source Port"'})}if(d=l.lastIndex,u("packet")){for(;p<i.index;p++)10===s.charCodeAt(p)&&h++;x("packet",void 0===i[2]&&void 0===i[3]?"title":"field",i[0],{line:h,offset:i.index,endOffset:l.lastIndex,unit:"normalized"})}if(void 0===i[2]&&void 0===i[3]){r.title=e(i[1]??"").trim(),y("packet","set-title",r.title);continue}let a=Number(i[3]),o="+"===i[2],n=o?c+1:a,f=o?n+a-1:void 0===i[4]?n:Number(i[4]);if(o&&void 0!==i[4]||!Number.isSafeInteger(n)||!Number.isSafeInteger(f)||n<0||f<n)throw S({what:`Invalid packet bit range ${n}-${f}`,expectedForm:"a positive bit count or increasing inclusive bit range",example:'+8: "Byte"'});if(n!==c+1)throw S({what:`Packet block ${n}-${f} is not contiguous; it must start from ${c+1}`,expectedForm:`a field starting at ${c+1}`,example:'+8: "Next byte"'});let b=i[5].slice(1,-1);b=b.replace(/\\([\s\S])/g,(e,t)=>({n:`
7
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"})[t]??t);let m={id:`field-${r.fields.length}`,start:n,end:f,label:b};r.fields.push(m),y("packet","add-field",m),k("nodes",r.fields.length),c=f}return r}(t.source.familyBody,t.source.accessibility),t.source.frontmatter),t.renderOptions,t.familyConfig?.visual??F(),t.styleFace)),projectPositioned:f(function({positioned:e}){return{version:1,nodes:e.fields.map(t=>({id:t.id,x:p(t.x),y:p(t.y),w:p(t.width),h:p(t.height),shape:"rectangle",label:t.label,...h(t.labelBlock,t.x+t.width/2,t.y+t.height/2,c(e),"middle")})),edges:[],groups:[],bounds:{w:p(e.width),h:p(e.height)}}}),lowerScene:b(L)});export{N as default};
@@ -0,0 +1,15 @@
1
+ import{a as e}from"./chunk-VQYYGAXP.js";import{a as t,b as i}from"./chunk-5X6MJX3H.js";import{a as l,b as o,c as a}from"./chunk-PQGPS2YV.js";import"./chunk-J7FFAFQF.js";import{c as r}from"./chunk-QA6GJQ4X.js";import{b as n,c as s,f as c}from"./chunk-2I4UPL7Q.js";import{j as d,l as p}from"./chunk-2SH76OTH.js";import{d as h}from"./chunk-AMJLVPUB.js";import{t as u,w as m,y as f}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{a as g,c as b,h as x}from"./chunk-CN7WTBWB.js";import{D as v,a as y,b as $,c as S,d as k,e as w,g as z,i as L}from"./chunk-HLWUNUCM.js";import{c as W,g as P,j as F,k as M,ma as T,s as _,y as C}from"./chunk-X2UYKWKM.js";import{e as j,i as A,j as D,k as N,m as E}from"./chunk-TYZOZXUJ.js";import{c as H,h as X}from"./chunk-NO7ZIVRU.js";import{M as O,Z as U,aa as Y,na as B,o as I,u as V,va as Q,wa as Z}from"./chunk-Z3FDIVLN.js";import{x as R}from"./chunk-N5ELX7LR.js";import{a as J}from"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var G=Object.freeze({id:"pie",upstreamId:"pie",maturity:"stable",label:"Pie",headers:["pie"],aliases:[],config:{section:"pie",keys:["textPosition","donutHole","legendPosition","highlightSlice","useMaxWidth","useWidth"],noopKeys:["useMaxWidth","useWidth"]},identity:{id:"family:pie",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["value","category","emphasis"],semanticRoles:["prelude","chrome","pie-slice","legend","title","label"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"pie-slice",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"pie-slice",primitive:"data-mark",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"legend",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"legend",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"legend",primitive:"data-mark",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`pie title Plans
2
+ "Free" : 60
3
+ "Pro" : 30
4
+ "Enterprise" : 10`,detect:R,detectLoose:R}),K={textPosition:p(0,1),donutHole:p(0,.9),legendPosition:d("top","bottom","left","right","center")},q={textPosition:.75,donutHole:0,legendPosition:"right",paletteOverrides:[]},ee=["top","bottom","left","right","center"];function et(e){if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;if("string"==typeof e){let t=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(?:px)?$/.exec(e.trim());if(t){let e=Number.parseFloat(t[1]);if(Number.isFinite(e)&&e>0)return e}}}function ei(e={}){let t=f(e,["pie"])??{},i=f(e,["themeVariables"])??{},l={...q,paletteOverrides:[]},o=t.textPosition;"number"==typeof o&&Number.isFinite(o)&&o>=0&&o<=1&&(l.textPosition=o);let a=t.donutHole;"number"==typeof a&&Number.isFinite(a)&&a>0&&a<=.9&&(l.donutHole=a);let r=t.legendPosition;"string"==typeof r&&ee.includes(r)&&(l.legendPosition=r,l.legendPositionExplicit=!0),"string"==typeof t.highlightSlice&&t.highlightSlice.trim()&&(l.highlightSlice=t.highlightSlice.trim());for(let e=0;e<12;e++){let t=j(i[`pie${e+1}`]);void 0!==t&&(l.paletteOverrides[e]=t)}l.paletteOverrides=Array.from(l.paletteOverrides,e=>e??null);let n=j(i.pieStrokeColor);void 0!==n&&(l.strokeColor=n);let s=et(i.pieStrokeWidth);void 0!==s&&(l.strokeWidth=s);let c=et(i.pieOuterStrokeWidth);void 0!==c&&(l.outerStrokeWidth=c);let d=j(i.pieOuterStrokeColor);void 0!==d&&(l.outerStrokeColor=d);let p=i.pieOpacity;"number"==typeof p&&Number.isFinite(p)&&p>=0&&p<=1&&(l.opacity=p);let h=et(i.pieSectionTextSize);void 0!==h&&(l.sectionTextSize=h);let u=j(i.pieSectionTextColor);void 0!==u&&(l.sectionTextColor=u);let m=et(i.pieTitleTextSize);void 0!==m&&(l.titleTextSize=m);let g=j(i.pieTitleTextColor);void 0!==g&&(l.titleTextColor=g);let b=et(i.pieLegendTextSize);void 0!==b&&(l.legendTextSize=b);let x=j(i.pieLegendTextColor);return void 0!==x&&(l.legendTextColor=x),l}var el={nodeLabelFontSize:13,edgeLabelFontSize:13,groupHeaderFontSize:18,nodeLabelFontWeight:500,edgeLabelFontWeight:500,groupHeaderFontWeight:600,nodePaddingX:0,nodePaddingY:0,nodeLineWidth:1.5,edgeLineWidth:H.connector,groupCornerRadius:0,groupPaddingX:0,groupPaddingY:0,groupLineWidth:H.outerBox};function eo(e){return e>0?`${Math.max(.1,Math.round(1e3*e)/10).toFixed(1)}%`:"0.0%"}function ea(e,t,i,l){return{x:e+i*Math.sin(l),y:t-i*Math.cos(l)}}function er(e){return Math.round(100*e)/100}function en(e,i,o,a,r){let n=X(i,el,a),s=function(e){let t=e.reduce((e,t)=>e+t.value,0);if(!Number.isFinite(t))throw Error("Pie total exceeds the finite numeric range; rescale the values");if(e.some(e=>e.value>0&&e.value/t==0))throw Error("Pie slice share underflows the finite numeric range; rescale the values");return t}(e.entries),c=o.donutHole>0?er(95*o.donutHole):0,d=void 0===r?void 0:Math.max(r,238),p=70+222*("left"===o.legendPosition||"right"===o.legendPosition),h=void 0===d||d<=p?void 0:d-p,u=o.titleTextSize??n.groupHeaderFontSize,m=o.legendTextSize??n.nodeLabelFontSize,f=e.title?U(e.displayTitle??e.title,{display:void 0===e.displayTitle?"formatted":"literal",transform:n.groupTextTransform,fontSize:u,fontWeight:n.groupHeaderFontWeight,letterSpacing:n.groupLetterSpacing,safeFont:!0,...void 0===d?{}:{maxWidth:d-48}}):void 0;f&&void 0!==d&&f.width>d-48+.01&&(f=U(f.prepared,f));let g=f?.text,b=f?f.height:0,x=f?b+20:0,v=f?.width??0,y="hover"===o.highlightSlice?void 0:o.highlightSlice,$=e.entries.map(i=>{let l=s>0?i.value/s:0,a=`${e.showData?` [${t(i.value)}]`:""} (${eo(l)})`,r=(i.displayLabel??i.label).split(`
5
+ `),c=y===i.label?700:n.nodeLabelFontWeight,d=r.map((e,t)=>t===r.length-1?`${e}${a}`:e).join(`
6
+ `),p=700===c?1.1:1,u="center"===o.legendPosition||void 0===h?void 0:h/p,f=U(d,{display:void 0===i.displayLabel?"formatted":"literal",transform:n.nodeTextTransform,fontSize:m,fontWeight:c,letterSpacing:n.nodeLetterSpacing,safeFont:!0,...void 0===u?{}:{maxWidth:u}});void 0!==u&&f.width>u+.01&&(f=U(f.prepared,f));let g=f.lines,b=f.width,x=700===c?1.1*b:b;return{block:f,lines:g,fraction:l,textWidth:x,reservedWidth:x}}),S={gap:8,minRowHeight:14,leadingWidth:22,columnGap:16,...void 0!==d&&("top"===o.legendPosition||"bottom"===o.legendPosition)?{maxWidth:d-48}:{}},k=Y($,S),w=k.width,z=k.height,L=24+x,W=o.legendPosition,P,F,M,T,_,C;if("left"===W||"right"===W){let e=Math.max(190,z);F=L+e/2,T=L+(e-z)/2,"right"===W?(P=119,_=(M=246)+w+24):(M=24,_=(P=24+w+32+95)+95+24),_=Math.max(_,v+48),C=L+e+24}else{let e=Math.max(190,w);if(M=(P=((_=Math.max(48+e,v+48))-e)/2+e/2)-w/2,"top"===W)T=L,C=(F=L+z+24+95)+95+24;else if("bottom"===W)F=L+95,C=(T=L+190+24)+z+24;else{let e=Math.max(190,z);T=(F=L+e/2)-z/2,C=L+e+24}}let j=[],A=0;for(let i of(e.entries.forEach(e=>{let t=s>0?e.value/s:0,i=A,l=s>0?A+t*Math.PI*2:A;A=l,j.push({label:e.label,...void 0===e.displayLabel?{}:{displayLabel:e.displayLabel},value:e.value,fraction:t,startAngle:i,endAngle:l,path:function(e,t,i,l,o,a=0){let r=o-l,n=a>0?Math.min(a,95):0;if(r>=2*Math.PI-1e-9){let i=er(e),l=er(t-95),o=er(t+95),a=`M ${i} ${l} A ${er(95)} ${er(95)} 0 1 1 ${i} ${o} A ${er(95)} ${er(95)} 0 1 1 ${i} ${l} Z`;if(n<=0)return a;let r=er(t-n),s=er(t+n),c=`M ${i} ${r} A ${er(n)} ${er(n)} 0 1 0 ${i} ${s} A ${er(n)} ${er(n)} 0 1 0 ${i} ${r} Z`;return`${a} ${c}`}let s=ea(e,t,95,l),c=ea(e,t,95,o),d=+(r>Math.PI);if(n<=0)return`M ${er(e)} ${er(t)} L ${er(s.x)} ${er(s.y)} A ${er(95)} ${er(95)} 0 ${d} 1 ${er(c.x)} ${er(c.y)} Z`;let p=ea(e,t,n,l),h=ea(e,t,n,o);return`M ${er(s.x)} ${er(s.y)} A ${er(95)} ${er(95)} 0 ${d} 1 ${er(c.x)} ${er(c.y)} L ${er(h.x)} ${er(h.y)} A ${er(n)} ${er(n)} 0 ${d} 0 ${er(p.x)} ${er(p.y)} Z`}(P,F,0,i,l,c)})}),j)){let e=(i.startAngle+i.endAngle)/2,a=95*o.textPosition,r=`${(i.displayLabel??i.label).replace(/\n/g," ")}: ${t(i.value)} (${eo(i.fraction)})`;i.tooltip=l(er(er(P)+a*Math.sin(e)),er(er(F)-a*Math.cos(e)),r)}for(let e of(function(e,t,i,l,o){let a=95*o.textPosition,r=o.sectionTextSize??12,n=1.1*r,s=[];for(let l=0;l<e.length;l++){var c;let o=e[l];if(o.fraction<.01)continue;let n=(c=o.fraction,`${(100*c).toFixed(0)}%`);if("0%"===n)continue;let d=o.endAngle-o.startAngle;if(!(d>0))continue;let p=V(n,r,500);if(p+4>2*a*Math.sin(Math.min(d,Math.PI)/2))continue;let h=(o.startAngle+o.endAngle)/2;s.push({index:l,fraction:o.fraction,halfWidth:p/2,label:{text:n,x:er(t+a*Math.sin(h)),y:er(i-a*Math.cos(h)),fontSize:r}})}s.sort((e,t)=>t.fraction-e.fraction||e.index-t.index);let d=[];for(let t of s){let i={x0:t.label.x-t.halfWidth,y0:t.label.y-n/2,x1:t.label.x+t.halfWidth,y1:t.label.y+n/2};d.some(e=>Math.min(i.x1,e.x1)-Math.max(i.x0,e.x0)>1&&Math.min(i.y1,e.y1)-Math.max(i.y0,e.y0)>1)||(d.push(i),e[t.index].pctLabel=t.label)}}(j,P,F,0,o),j))e.pctLabel&&(e.pctLabel.block=U(e.pctLabel.text,{display:"literal",fontSize:e.pctLabel.fontSize,fontWeight:500}));let D=Y($,{...S,top:T}).rows.map(({item:t,x:i=0,top:l,textY:o},a)=>{let r=e.entries[a];return{label:r.label,...void 0===r.displayLabel?{}:{literalText:!0},value:r.value,fraction:t.fraction,x:er(M+i),y:er(l),swatchSize:14,textX:er(M+i+14+8),textY:er(o),lines:t.lines,block:t.block,textWidth:er(t.textWidth)}});return{width:er(_),height:er(C),title:e.title?{text:g,block:f,x:er(_/2),y:24+b/2,...void 0===e.displayTitle?{}:{literalText:!0}}:void 0,cx:er(P),cy:er(F),radius:95,innerRadius:c,slices:j,legend:D,showData:e.showData,total:s,visual:o}}var es={wholeLine:e=>/^(?:pie(?:\s+showData)?\s+)?title(?:\s|$)/i.test(e)},ec=/^"((?:[^"\\]|\\.)*)"\s*:\s*(.+)$/,ed=/^\+?(?:\d+(?:\.\d+)?|\.\d+)$/,ep=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/;function eh(e){return s(e,es)}function eu(e){return/[<>*~]/.test(e)}function em(e){let t=r(M(F(e)),ef);if(ep.test(t))throw _({what:"Pie title display contains an XML-disallowed control character",expectedForm:"a title without XML-disallowed control characters",example:"title Safe chart"});return t}var ef={subject:"Pie entity",example:'"Alpha&#35;" : 10'};function eg(e){let t={n:`
7
+ `,t:" ",r:"\r",b:"\b",f:"\f",v:"\v",0:"\0"};return e.replace(/\\(.)/g,(e,i)=>t[i]??i)}function eb(e){return Math.max(e+1,2.5)}function ex(e,t){return e&&/[<>*~]/.test(t)?{data:{"literal-text":"true"}}:{}}function ev(e){return Math.round(100*e)/100}var ey=W(function(e,l){let r,n,{positioned:s,colors:c,resolved:d}=l,p=d.renderOptions,h=c.font??"Inter",u=p.transparent??!1,m=p.interactive??!1,f=X(p,el,d.styleFace),g=I(d.styleFace,"pie-slice",{},{includeFallback:!1}),b=s.visual,x=[],v=i(s.slices.length,{accent:c.accent,bg:c.bg,overrides:b.paletteOverrides}),y="hover"===b.highlightSlice,$=!y&&s.slices.some(e=>b.highlightSlice===e.label),S=[];S.push(N(s.width,s.height,c,u,{attrs:{role:"img","aria-roledescription":"pie chart"}})),S.push(D(h,!1,c.shadow,c.embedFontImport));let k=A(c);k&&S.push(`<defs>${k}</defs>`);let w=(r=eb(b.strokeWidth??g?.lineWidth??f.nodeLineWidth),n=m?a("pie",["pie-slice-group"]):"",`<style>
8
+ .pie-slice.highlighted-on-hover:hover${"hover"===b.highlightSlice?`,
9
+ .pie-slice-group:hover > .pie-slice-hover-target`:""} { stroke: var(--fg); stroke-width: ${r}; opacity: 1; }${n}
10
+ </style>`);if(S.push(w),x.push(e.documentOpen({id:"prelude",width:s.width,height:s.height,colors:c,transparent:u,font:h,hasMonoFont:!1,extraCss:w},S.join(`
11
+ `))),void 0!==b.outerStrokeWidth||void 0!==b.outerStrokeColor){let t=b.outerStrokeWidth??2,i=ev(s.radius+t/2);x.push(e.shape({id:"outer-circle",role:"chrome",geometry:{kind:"circle",cx:s.cx,cy:s.cy,r:i},paint:{fill:"none",stroke:b.outerStrokeColor??f.nodeBorderColor??"var(--_node-stroke)",strokeWidth:String(t)},attributes:{className:"pie-outer-circle"}}))}let z=new Map,L=[],W=(e,t)=>{let i=`${e}:${t}`,l=z.get(i)??0;return z.set(i,l+1),0===l?i:`${i}#${l}`},P=eb(b.strokeWidth??g?.lineWidth??f.nodeLineWidth);for(let t=0;t<s.slices.length;t++){let i=s.slices[t],l=eo(i.fraction),o={category:i.label,value:i.fraction},a=I(d.styleFace,"pie-slice",o,{includeFallback:!1}),r=b.paletteOverrides[t]??a?.fillColor??v[t];v[t]=r;let n=b.strokeColor??a?.strokeColor??a?.borderColor??f.nodeBorderColor??"var(--bg)",c=b.strokeWidth??a?.lineWidth??f.nodeLineWidth,p=a?.cue??"none",h="outline"===p?c+1:"double-line"===p?c+2:c,u="pattern"===p?"3 2":"double-line"===p?"8 2 2 2":void 0,m=eb(h),g=$&&b.highlightSlice===i.label,S=$&&!g,k=`pie-slice${g?" highlighted":""}${y?" highlighted-on-hover":""}${S?" pie-dim":""}`,w=g?1:S?ev((b.opacity??1)*.4):b.opacity,z=W("slice",i.label);L[t]=z,x.push(e.shape({id:z,role:"pie-slice",geometry:{kind:"path",d:i.path},paint:{fill:r,stroke:g?"var(--fg)":n,strokeWidth:String(g?m:h),...u?{strokeDasharray:u}:{},...void 0!==w?{opacity:String(w)}:{}},channels:{...o,...g?{emphasis:!0}:{}},attributes:{className:k,data:{label:i.label,value:String(i.value),percent:l,..."none"!==p?{"brand-cue":p}:{},...g?{highlighted:"true"}:{}}}}))}for(let t=0;t<s.slices.length;t++){let i=s.slices[t],l=i.pctLabel;if(!l)continue;let o=$&&b.highlightSlice!==i.label,a=$&&!o?1:o?(b.opacity??1)*.4:b.opacity??1,r=function(e,t,i){let l=E("var(--bg)",i);if(!(void 0===l||!Z(e)))return t>=1?e:B(e,l,100*t)}(v[t],a,c),n=f.nodeTextColor??c.fg,d=b.sectionTextColor??(void 0===r?o?n:T(v[t])??n:o?Q(E(n,c)??n,r):T(r)??n);x.push(e.text({id:W("slice-label",i.label),role:"label",text:l.text,x:l.x,y:l.y,fontSize:l.fontSize,fontWeight:500,block:l.block,anchor:"middle",dominantBaseline:"middle",paint:{fill:d},channels:{category:i.label,value:i.fraction},attributes:{className:"pie-slice-label"}}))}for(let t=0;t<s.legend.length;t++){let i=s.legend[t],l=v[t],o=$&&b.highlightSlice===i.label,a=$&&!o,r=o?700:f.nodeLabelFontWeight;x.push(e.shape({id:W("legend",i.label),role:"legend",geometry:{kind:"rect",x:i.x,y:i.y,width:i.swatchSize,height:i.swatchSize,rx:2,ry:2},paint:{fill:l,stroke:f.nodeBorderColor??"var(--_node-stroke)",strokeWidth:String(f.nodeBorderColor?Math.max(1,f.nodeLineWidth):1),...a?{opacity:String(.4)}:{}},channels:{category:i.label,value:i.fraction},attributes:{className:`pie-legend-swatch${a?" pie-dim":""}`}}));let n=i.lines.join(`
12
+ `);x.push(e.text({id:W("legend-label",i.label),role:"legend",text:n,x:i.textX,y:i.textY,fontSize:b.legendTextSize??f.nodeLabelFontSize,fontWeight:r,letterSpacing:f.nodeLetterSpacing,block:i.block,...!0===i.literalText?{display:"literal"}:{},anchor:"start",dominantBaseline:"middle",paint:{fill:b.legendTextColor??f.nodeTextColor??"var(--_text)"},channels:{category:i.label,value:i.fraction},attributes:{className:"pie-legend-text",...ex(!0===i.literalText,n)}}))}if(s.title){let t=s.title.text;x.push(e.text({id:"title",role:"title",text:t,x:s.title.x,y:s.title.y,fontSize:b.titleTextSize??f.groupHeaderFontSize,fontWeight:f.groupHeaderFontWeight,letterSpacing:f.groupLetterSpacing,block:s.title.block,...!0===s.title.literalText?{display:"literal"}:{},anchor:"middle",dominantBaseline:"middle",paint:{fill:b.titleTextColor??f.groupTextColor??f.nodeTextColor??"var(--_text)"},attributes:{className:"pie-title",...ex(!0===s.title.literalText,t)}}))}if(m||y)for(let[i,l]of s.slices.entries()){let a=`${(l.displayLabel??l.label).replace(/\n/g," ")}: ${t(l.value)} (${eo(l.fraction)})`,r=W("tooltip:slice",l.label),n={id:L[i],role:"pie-slice"};x.push(e.group({id:r,role:"chrome",owner:n,open:'<g class="pie-slice-group">',close:"</g>",join:"",children:[{indent:0,node:e.shape({id:`${r}:hit`,role:"chrome",owner:n,...y?{visibility:"conditional",conditionalPaint:{fill:"transparent",stroke:"var(--fg)",strokeWidth:String(P)}}:{},geometry:{kind:"path",d:l.path},paint:{fill:"transparent",...y?{stroke:"transparent",strokeWidth:String(P)}:{}},...y?{attributes:{className:"pie-slice-hover-target"}}:{}})},...m?[{indent:0,node:e.documentContent({id:`${r}:title`,role:"chrome",nonPaint:"interaction-metadata"},`<title>${O(a)}</title>`)},{indent:0,node:o(e,"pie",l.tooltip,`${r}:body`,n)}]:[]]}))}return x.push(e.documentClose()),{family:"pie",width:s.width,height:s.height,colors:c,transparent:u,parts:x}}),e$=k(G,{configDiagnostics:e=>h("pie",e,K),statementEnds:eh,normalizeRequest:e=>({familyConfig:{visual:ei(e.source.frontmatter)}}),layout:t=>S(function(t,i={},l=q,o){let a=en(t,i,l,o),r=i.pie?.maxWidth;return void 0===r?a:e(a,r,e=>{if(1!==e)return;let a=l.legendPositionExplicit||"right"!==l.legendPosition?l.legendPosition:"bottom";return en(t,i,{...l,legendPosition:a},o,r)})}(u(function(e){if(0===(e=c(C(e,eh(e)).familyLines,es).map(n)).length)throw Error("Pie chart is empty");let t=e[0].trim(),i=t.match(/^pie\b(.*)$/i);if(!i)throw Error(`Pie chart must start with "pie", got: "${t}"`);w("pie")&&z("pie","header",t,{line:1,unit:"normalized"});let l=!1,o,a,s=i[1].trim(),d=s.match(/^showData\b\s*(.*)$/i);d&&(l=!0,w("pie")&&L("pie","setShowData",l,{line:1,unit:"normalized"}),s=d[1].trim());let p=s.match(/^title\s+(.+)$/i);if(p){let e=p[1].trim();o=e,w("pie")&&L("pie","setTitle",o,{line:1,unit:"normalized"}),a=em(e),w("pie")&&L("pie","resolveTitleDisplay",a,{line:1,unit:"normalized"})}else if(s.length>0)throw Error(`Unexpected text after pie header: "${s}"`);let h=[],u=new Set,m=!1,f=!1;for(let t=1;t<e.length;t++){let i=e[t].trim();if(0===i.length||i.startsWith("%%"))continue;if(/^showData\s*$/i.test(i)){w("pie")&&z("pie","showData",i,{line:t+1,unit:"normalized"}),l=!0,w("pie")&&L("pie","setShowData",l,{line:t+1,unit:"normalized"});continue}let n=i.match(/^title\s+(.+)$/i);if(n){w("pie")&&z("pie","title",i,{line:t+1,unit:"normalized"});let e=n[1].trim();o=e,w("pie")&&L("pie","setTitle",o,{line:t+1,unit:"normalized"}),a=em(e),w("pie")&&L("pie","resolveTitleDisplay",a,{line:t+1,unit:"normalized"});continue}let s=i.match(ec);if(s){w("pie")&&z("pie","entry",i,{line:t+1,unit:"normalized"});let e=eg(s[1]);/[\u0000-\u001f]/.test(eg(s[1].replace(/\n/g,"")))&&(f=!0,w("pie")&&L("pie","setHasEscapedControlLabels",!0,{line:t+1,unit:"normalized"}));let l=s[2].trim();if(!ed.test(l))throw Error(`Pie slice "${e}" has invalid value "${l}". Values must be non-negative numbers.`);let o=Number.parseFloat(l);if(!Number.isFinite(o)||o<0)throw Error(`Pie slice "${e}" has invalid value "${l}". Values must be non-negative numbers.`);if(ep.test(e))throw _({what:"Pie slice label contains an XML-disallowed control character",expectedForm:"a label without XML-disallowed control characters",example:'"Alpha" : 10'});let a=F(i),n=eg(M(ec.exec(a)?.[1]??s[1])),c=r(n,ef);if(w("pie")&&L("pie","resolveEntryDisplay",{sourceKey:n,label:c},{line:t+1,unit:"normalized"}),function(e,t){if(!P.test(t))return!1;let i=new Uint32Array(160);for(let t of e){let e=t.charCodeAt(0);e<160&&P.test(t)&&(i[e]=i[e]+1)}for(let e of t){let t=e.charCodeAt(0);if(!(t>=160||!P.test(e))){if(0===i[t])return!0;i[t]=i[t]-1}}return!1}(e,c))throw _({what:"Pie entity projection creates a terminal control character after escape decoding",expectedForm:"an entity that displays printable text",example:'"Alpha&#35;" : 10'});if(ep.test(c))throw _({what:"Pie slice display label contains an XML-disallowed control character",expectedForm:"a label without XML-disallowed control characters",example:'"Alpha" : 10'});let d=function(e){if(!e.includes(`
13
+ `))return e;let t=[];for(let i of e.split(`
14
+ `)){let e=0,l=i.length;for(;e<l&&(" "===i[e]||" "===i[e]);)e++;for(;l>e&&(" "===i[l-1]||" "===i[l-1]);)l--;e<l&&t.push(i.slice(e,l))}return t.join(" ")}(c);u.has(n)?(m=!0,w("pie")&&L("pie","setHasDuplicateSourceLabels",!0,{line:t+1,unit:"normalized"})):(u.add(n),w("pie")&&L("pie","addSourceLabel",n,{line:t+1,unit:"normalized"}),h.push({label:e,value:o,...d===e&&!eu(e)?{}:{displayLabel:d}}),w("pie")&&L("pie","appendEntry",h[h.length-1],{line:t+1,unit:"normalized"}));continue}throw i.includes(":")?(w("pie")&&z("pie","invalidEntry",i,{line:t+1,unit:"normalized"}),Error(`Invalid pie entry: "${i}". Expected: "label" : positiveNumber`)):(w("pie")&&z("pie","unrecognized",i,{line:t+1,unit:"normalized"}),_({what:`Unrecognized pie chart line: "${i}"`,expectedForm:'a title, showData, or a slice ("Label" : number)',example:'"Free" : 60'}))}return{title:o,showData:l,entries:h,...a!==o||void 0!==o&&eu(o)?{displayTitle:a}:{},...m?{hasDuplicateSourceLabels:!0}:{},...f?{hasEscapedControlLabels:!0}:{}}}(function(e){if(!e.authoredFamilyLines)return e.familyLines;let t=/^\s*"(?:[^"\\]|\\.)*"/;return m(c(e.authoredFamilyLines,es).map((e,i)=>{let l=function(e,t){let i=J(e),l="header"===t?i.match(/^(\s*pie\b(?:\s+showData\b)?\s+title)(\s+)(.+)$/i):i.match(/^(\s*title)(\s+)(.+)$/i);if(!l)return null;let o=l[1].length,a=o+l[2].length,r=0,n=0,s=()=>{let t=e[n],i=1;if("&"===t){let l=e.slice(n).match(/^&(?:#(?:x[0-9a-f]+|\d+)|[a-z][a-z0-9]+);/i)?.[0];if(l){let e=J(l);e!==l&&(t=e,i=l.length)}}return{text:t,length:i,entity:i>1}};for(;r<o&&n<e.length;){let e=s();if(i.slice(r,r+e.text.length)!==e.text)return null;r+=e.text.length,n+=e.length}if(r!==o)return null;let c=!1;for(;r<a&&n<e.length;){let e=s();if(e.entity&&c)break;if(!/^\s+$/u.test(e.text))return null;r+=e.text.length,n+=e.length,c=!0}return c?{decodedPrefix:i.slice(0,r),authoredTitle:e.slice(n)}:null}(e,0===i?"header":"body");if(l)return l.decodedPrefix+l.authoredTitle;let o=t.exec(e)?.[0];return void 0===o?J(e):o+J(e.slice(o.length))}).join(`
15
+ `)).familyLines}(t.source)),t.source.frontmatter),t.renderOptions,t.familyConfig?.visual??ei(),t.styleFace)),projectPositioned:y(function({positioned:e,options:t}){let i={version:1,nodes:e.legend.map((t,i)=>{let l=`${t.label} (${eo(t.fraction)})`,o=Math.max(t.swatchSize,t.textX-t.x+t.textWidth);return{id:`slice#${i}:${t.label}`,x:b(t.x),y:b(t.y),w:b(o),h:b(t.swatchSize),shape:"rectangle",label:l,...v(t.block,t.textX,t.textY,g(e),"start")}}),edges:[],groups:[],bounds:{w:b(e.width),h:b(e.height)}};return t.debug&&(i.certificates=x("pie",i,"legend-contained")),i}),lowerScene:$(ey)});export{e$ as default};
@@ -0,0 +1,10 @@
1
+ import{a as e,b as t,c as i}from"./chunk-PQGPS2YV.js";import{b as a,c as r,d as n,e as o}from"./chunk-2I4UPL7Q.js";import{b as l,c as s,e as d}from"./chunk-2SH76OTH.js";import{d as c}from"./chunk-AMJLVPUB.js";import{t as u,y as h,z as x}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{a as p,b as m,c as y,h as f}from"./chunk-CN7WTBWB.js";import{a as b,b as g,c as v,d as k,e as q,g as S,i as $,j as z}from"./chunk-HLWUNUCM.js";import{A as w,D as L,c as M,s as W,y as F}from"./chunk-X2UYKWKM.js";import{c as P,i as _,j as C,k as A,q as N}from"./chunk-TYZOZXUJ.js";import{c as B,h as T}from"./chunk-NO7ZIVRU.js";import{H as I,M as j,Tb as H,Z as E,x as O}from"./chunk-Z3FDIVLN.js";import{y as D,z as Q}from"./chunk-N5ELX7LR.js";import"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var Y=Object.freeze({id:"quadrant",upstreamId:"quadrantChart",maturity:"stable",label:"Quadrant",headers:["quadrantChart"],aliases:["quadrant"],config:{section:"quadrantChart",keys:["chartWidth","chartHeight","titleFontSize","titlePadding","quadrantPadding","quadrantLabelFontSize","xAxisLabelFontSize","yAxisLabelFontSize","xAxisLabelPadding","yAxisLabelPadding","pointLabelFontSize","pointRadius","pointTextPadding","quadrantInternalBorderStrokeWidth","quadrantExternalBorderStrokeWidth","useMaxWidth","quadrantTextTopPadding","xAxisPosition","yAxisPosition","useWidth"],noopKeys:["quadrantTextTopPadding","xAxisPosition","yAxisPosition","useWidth"]},identity:{id:"family:quadrant",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["category"],semanticRoles:["prelude","chrome","plate","grid","point","axis","title","label"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"plate",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"grid",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"point",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"axis",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`quadrantChart
2
+ title Prioritize
3
+ x-axis Low Effort --> High Effort
4
+ y-axis Low Value --> High Value
5
+ Quick win: [0.2, 0.8]
6
+ Money pit: [0.8, 0.2]`,detect:D,detectLoose:Q}),U=Object.fromEntries([...["chartWidth","chartHeight","titleFontSize","quadrantLabelFontSize","xAxisLabelFontSize","yAxisLabelFontSize","pointLabelFontSize","pointRadius"].map(e=>[e,l]),...["titlePadding","quadrantPadding","xAxisLabelPadding","yAxisLabelPadding","pointTextPadding","quadrantInternalBorderStrokeWidth","quadrantExternalBorderStrokeWidth"].map(e=>[e,s]),["useMaxWidth",d]]),X=["chartWidth","chartHeight","titleFontSize","quadrantLabelFontSize","xAxisLabelFontSize","yAxisLabelFontSize","pointLabelFontSize","pointRadius"],R=["titlePadding","quadrantPadding","xAxisLabelPadding","yAxisLabelPadding","pointTextPadding","quadrantInternalBorderStrokeWidth","quadrantExternalBorderStrokeWidth"];function V(e={}){let t=h(e,["quadrantChart"])??{},i={};for(let e of X){let a=x(t,[e]);"number"==typeof a&&Number.isFinite(a)&&a>0&&(i[e]=a)}for(let e of R){let a=x(t,[e]);"number"==typeof a&&Number.isFinite(a)&&a>=0&&(i[e]=a)}let a=x(t,["useMaxWidth"]);return"boolean"==typeof a&&(i.useMaxWidth=a),i}var Z=class extends Error{code="INVALID_STYLE_COLOR";subject;property;value;constructor(e,t,i){let a=e.slice(0,128),r=i.slice(0,256);super(W({what:`${a}: ${t} ${JSON.stringify(r)} is not a CSS color`,expectedForm:"a drawable color name, hex color, rgb()/rgba(), hsl()/hsla(), transparent, currentColor, none, or var(--name)",example:`${t}: #f96`}).message),this.name="QuadrantStyleColorError",this.subject=a,this.property=t,this.value=r}},J=/^\d+(?:\.\d+)?$/,K=/^\d+(?:\.\d+)?(?:px)?$/,G=/^[#\w][\w#(),.%+\s/~-]*$/;function ee(e,t="quadrant point style"){let i=e.trim();if(0===i.length)return{ok:!0,style:void 0};let a={},r=!1,n=function(e){let t=[],i=0,a=0;for(let r=0;r<e.length;r++){let n=e[r];if("("===n)a++;else if(")"===n){if(--a<0)return null}else","===n&&0===a&&(t.push(e.slice(i,r)),i=r+1)}return 0!==a?null:(t.push(e.slice(i)),t)}(i);if(!n)return{ok:!1,error:"style functions have unbalanced parentheses"};for(let e of n){let i=e.trim();if(!i)continue;let n=i.match(/^([a-z][\w-]*)\s*:\s*(.+)$/i);if(!n)return{ok:!1,error:`malformed style entry "${i}" (expected key: value)`};let o=n[1].toLowerCase(),l=n[2].trim();switch(o){case"radius":if(!J.test(l))return{ok:!1,error:`radius must be a non-negative number, got "${l}"`};a.radius=Number.parseFloat(l);break;case"color":if(void 0===P(l,!0))throw new Z(t,"color",l);a.color=l;break;case"stroke-color":if(void 0===P(l,!0))throw new Z(t,"stroke-color",l);a.strokeColor=l;break;case"stroke-width":if(!K.test(l))return{ok:!1,error:`stroke-width must be a number with optional px suffix, got "${l}"`};a.strokeWidth=l;break;default:if(!G.test(l))return{ok:!1,error:`style property "${o}" has unsupported characters: "${l}"`};a.extra=a.extra??[],a.extra.push(`${o}: ${l}`)}r=!0}return{ok:!0,style:r?a:void 0}}var et=/\s*:::\s*([A-Za-z_][\w-]*)\s*$/;function ei(e={}){return{nodeLabelFontSize:e.pointLabelFontSize??12,edgeLabelFontSize:e.xAxisLabelFontSize??13,groupHeaderFontSize:e.quadrantLabelFontSize??15,nodeLabelFontWeight:500,edgeLabelFontWeight:500,groupHeaderFontWeight:600,nodePaddingX:0,nodePaddingY:0,nodeLineWidth:B.innerBox,edgeLineWidth:1,groupCornerRadius:0,groupPaddingX:0,groupPaddingY:0,groupLineWidth:2}}function ea(e){return Math.round(100*e)/100}function er(e,t,i,a,r,n){return E(e,{display:"formatted",transform:n,maxWidth:t,fontSize:i,fontWeight:a,letterSpacing:r})}var en=class{cells=new Map;values=[];wide=[];visited=[];query=0;cellsOf(e){let t=Math.floor(e.x0/64),i=Math.floor(e.x1/64),a=Math.floor(e.y0/64),r=Math.floor(e.y1/64);if(!(![t,i,a,r].every(Number.isSafeInteger)||i<t||r<a||(i-t+1)*(r-a+1)>256))return[t,i,a,r]}add(e,t){let i=this.values.length;this.values.push(t);let a=this.cellsOf(e);if(!a)return void this.wide.push(i);let[r,n,o,l]=a;for(let e=o;e<=l;e++)for(let t=r;t<=n;t++){let a=`${t},${e}`,r=this.cells.get(a);r?r.push(i):this.cells.set(a,[i])}}some(e,t){let i=this.cellsOf(e);if(!i)return this.values.some(t);let a=++this.query,r=e=>this.visited[e]!==a&&(this.visited[e]=a,t(this.values[e]));for(let e of this.wide)if(r(e))return!0;let[n,o,l,s]=i;for(let e=l;e<=s;e++)for(let t=n;t<=o;t++)for(let i of this.cells.get(`${t},${e}`)??[])if(r(i))return!0;return!1}},eo=(e,t)=>Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0)>.5&&Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)>.5,el=[0,Math.PI,-Math.PI/2,Math.PI/2,-Math.PI/4,Math.PI/4,-3*Math.PI/4,3*Math.PI/4,-Math.PI/8,Math.PI/8,-3*Math.PI/8,3*Math.PI/8,-5*Math.PI/8,5*Math.PI/8,-7*Math.PI/8,7*Math.PI/8].map(e=>{let t=Math.cos(e);return{cos:t,sin:Math.sin(e),anchor:t>.38?"start":t<-.38?"end":"middle"}});function es(e,t,i,a){let r=a.x-e,n=a.y-t,o=Math.hypot(r,n)||1,l="start"===a.anchor?a.box.x0-2:"end"===a.anchor?a.box.x1+2:a.x,s="middle"===a.anchor?a.y>t?a.box.y0-1:a.box.y1+1:a.y;return{x1:ea(e+r/o*i),y1:ea(t+n/o*i),x2:ea(l),y2:ea(s)}}function ed(e,t,i){let a=i.x2-i.x1,r=i.y2-i.y1,n=a*a+r*r,o=0===n?0:Math.max(0,Math.min(1,((e-i.x1)*a+(t-i.y1)*r)/n));return Math.hypot(e-(i.x1+o*a),t-(i.y1+o*r))}function ec(e,t){var i,a,r,n,o,l,s,d,c,u,h,x,p,m,y,f,b,g,v,k;if(.5>=Math.hypot(e.x1-t.x1,e.y1-t.y1))return!1;let q=(e,t,i)=>{var a,r;return .01>=Math.abs((a=e.x1,r=e.y1,(e.x2-a)*(i-r)-(e.y2-r)*(t-a)))&&t>=Math.min(e.x1,e.x2)-.01&&t<=Math.max(e.x1,e.x2)+.01&&i>=Math.min(e.y1,e.y2)-.01&&i<=Math.max(e.y1,e.y2)+.01},S=(i=e.x1,a=e.y1,r=e.x2,n=e.y2,o=t.x1,(r-i)*(t.y1-a)-(n-a)*(o-i)),$=(l=e.x1,s=e.y1,d=e.x2,c=e.y2,u=t.x2,(d-l)*(t.y2-s)-(c-s)*(u-l)),z=(h=t.x1,x=t.y1,p=t.x2,m=t.y2,y=e.x1,(p-h)*(e.y1-x)-(m-x)*(y-h)),w=(f=t.x1,b=t.y1,g=t.x2,v=t.y2,k=e.x2,(g-f)*(e.y2-b)-(v-b)*(k-f));return!!(S*$<-.01&&z*w<-.01||q(e,t.x1,t.y1)||q(e,t.x2,t.y2)||q(t,e.x1,e.y1)||q(t,e.x2,e.y2))||3>Math.min(ed(e.x1,e.y1,t),ed(e.x2,e.y2,t),ed(t.x1,t.y1,e),ed(t.x2,t.y2,e))}function eu(e,t){let i={x0:t.x0-2,y0:t.y0-2,x1:t.x1+2,y1:t.y1+2};if(Math.max(e.x1,e.x2)<i.x0||Math.min(e.x1,e.x2)>i.x1||Math.max(e.y1,e.y2)<i.y0||Math.min(e.y1,e.y2)>i.y1)return!1;let a=(e,t)=>e>=i.x0&&e<=i.x1&&t>=i.y0&&t<=i.y1;return!!(a(e.x1,e.y1)||a(e.x2,e.y2))||[{x1:i.x0,y1:i.y0,x2:i.x1,y2:i.y0},{x1:i.x1,y1:i.y0,x2:i.x1,y2:i.y1},{x1:i.x1,y1:i.y1,x2:i.x0,y2:i.y1},{x1:i.x0,y1:i.y1,x2:i.x0,y2:i.y0}].some(t=>ec(e,t))}var eh=/^title\s+(.+)$/i,ex=/^([xy])-axis\s+(.+)$/is,ep=/^quadrant-([1-4])\s+(.+)$/is,em=/^(.+?)\s*:\s*\[\s*([^,\]]+)\s*,\s*([^,\]]+)\s*\]\s*(.*)$/s,ey=/^classDef\s+(.+)$/i;function ef(e){if(!e.includes(";")||eh.test(e))return[e];let t=[],i=0,a=!1,r=0;for(let n=0;n<e.length;n++){let o=e[n];if('"'===o&&(a=!a),!a){if("%"===o&&"%"===e[n+1])break;if("("===o)r++;else if(")"===o)r--;else if(";"===o&&0===r&&(t.push(e.slice(i,n)),i=n+1,/^\s*title\s/i.test(e.slice(i))))break}}t.push(e.slice(i));let n=[],o=[];for(let e=0;e<t.length;e++){let i=t[e];if(!i.trim()&&0===o.length)continue;o.push(i);let a=t[e+1]?.trim()??"",r=em.test(i.trim())||ey.test(i.trim())||/^quadrant(?:Chart)?$/i.test(i.trim()),l=ex.test(o[0].trim())||ep.test(o[0].trim()),s=em.test(a)||ey.test(a)||eh.test(a)||ex.test(a)||ep.test(a);if(r||l&&s||e===t.length-1){let e=o.join(";").trim();e&&n.push(e),o=[]}}return n}var eb=/^[\d.,+\s-]*$/,eg=/^[\d.,+\s-]*\]/;function ev(e){let t=r(e,{escapes:!1,wholeLine:e=>eh.test(e)});for(let i=0;i<e.length;i=t[i]+1){let r=t[i],o=a(n(e,i,r).trim()).replace(/"[^"]*"/g,'""'),l=o.lastIndexOf("[");if(eh.test(o)||l<0||o.includes("]",l)||!o.slice(0,l).trimEnd().endsWith(":"))continue;let s=r+1;for(;s<e.length&&eb.test(e[s]);)s++;s<e.length&&eg.test(e[s].trim())&&(t[i]=s)}return t}var ek=/^"[^"]*"/,eq=/[<>()[\]{}|@^~:;"\n\r\x00-\x08\x0e-\x1f\x7f]/,eS=/(?<![A-Za-z])(?:[xy]-axis|quadrant-[1-4]|quadrantChart|(?:classDef|title)(?![A-Za-z0-9_]))/i;function e$(e,t,i){let a=function(e,t=!1){let i=t?e.replace(ek,""):e;return i.match(eq)?.[0]??i.match(eS)?.[0]??(e.startsWith("-")?"-":void 0)}(e,!0);void 0!==a&&i?.(`Quadrant ${t} ${JSON.stringify(e)} has ${JSON.stringify(a)} outside a quoted string`);let r=/^"([^"]*)"/.exec(e);return I(r?r[1]+e.slice(r[0].length):e)}function ez(e,t){if(!/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(t))throw Error(`Quadrant point "${e}" has non-numeric coordinate "${t}". Coordinates must be numbers in [0, 1].`);let i=Number.parseFloat(t);if(!Number.isFinite(i)||i<0||i>1)throw Error(`Quadrant point "${e}" coordinate "${t}" is out of range. Coordinates must be in [0, 1].`);return i}function ew(e,t){return t.groupFillColor?`color-mix(in srgb, ${t.groupFillColor} ${1===e||3===e?88:76}%, var(--bg))`:`color-mix(in srgb, var(--accent, var(--_arrow)) ${1===e||3===e?10:5}%, var(--bg))`}var eL=M(function(e,a){let r,{positioned:n,colors:o,resolved:l}=a,s=l.renderOptions,d=o.font??"Inter",c=s.transparent??!1,u=s.interactive??!1,h=T(s,ei(n.visual),l.styleFace),x=[],p={title:n.accessibility?.title??n.title?.text,description:n.accessibility?.description},m=`quadrant-${H(n.width,n.height,p.title??"",p.description??"",...n.points.flatMap(e=>[e.label,e.nx,e.ny]))}`,y=`${m}-title`,f=`${m}-desc`,b=u?`<style>${i("quadrant",["quadrant-point-group"])}
7
+ </style>`:void 0,g=[(r=n.visual.useMaxWidth?{width:"100%",height:"100%",style:`max-width:${n.width}px`}:{},A(n.width,n.height,o,c,{...r,attrs:{id:m,...N(p.title,p.description,y,f,"quadrant chart")}}))];p.title&&g.push(`<title id="${y}">${j(p.title)}</title>`),p.description&&g.push(`<desc id="${f}">${j(p.description)}</desc>`),g.push(C(d,!1,o.shadow,o.embedFontImport));let v=_(o);v&&g.push(`<defs>${v}</defs>`),b&&g.push(b),x.push(e.documentOpen({id:"prelude",width:n.width,height:n.height,colors:o,transparent:c,font:d,hasMonoFont:!1,...b?{extraCss:b}:{}},g.join(`
8
+ `)));let{plot:k}=n,q=k.size/2,S=n.visual.quadrantInternalBorderStrokeWidth??h.lineWidth,$=n.visual.quadrantExternalBorderStrokeWidth??h.groupLineWidth;for(let t of n.regions){let i=ew(t.number,h);x.push(e.shape({id:`plate:${t.number}`,role:"plate",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height},paint:{fill:i,stroke:"none"},channels:t.label?{category:t.label}:void 0,attributes:{className:"quadrant-region",data:{quadrant:String(t.number)}}}))}let z=k.x+q,w=k.y+q,L={stroke:h.edgeStrokeColor??"var(--_line)",strokeWidth:String(S)};for(let t of(x.push(e.shape({id:"divider:v",role:"grid",geometry:{kind:"line",x1:z,y1:k.y,x2:z,y2:k.y+k.size},paint:L,attributes:{className:"quadrant-divider"}})),x.push(e.shape({id:"divider:h",role:"grid",geometry:{kind:"line",x1:k.x,y1:w,x2:k.x+k.size,y2:w},paint:L,attributes:{className:"quadrant-divider"}})),x.push(e.shape({id:"border",role:"chrome",geometry:{kind:"rect",x:k.x,y:k.y,width:k.size,height:k.size},paint:{fill:"none",stroke:h.groupBorderColor??h.nodeBorderColor??"var(--_node-stroke)",strokeWidth:String($)},attributes:{className:"quadrant-border"}})),n.regions)){if(!t.label)continue;let i=t.labelBlock?.text??t.label;x.push(e.text({id:`quadrant-label:${t.number}`,role:"label",text:i,x:t.labelX,y:t.labelY,fontSize:h.groupHeaderFontSize,fontWeight:h.groupHeaderFontWeight,letterSpacing:h.groupLetterSpacing,block:t.labelBlock,anchor:"middle",dominantBaseline:"middle",paint:{fill:h.groupTextColor??"var(--_text-sec)"},channels:{category:t.label},attributes:{className:"quadrant-label"}}))}let M=[],W=new Map;for(let i of n.points){let a=W.get(i.label)??0;W.set(i.label,a+1);let r=0===a?`point:${i.label}`:`point:${i.label}#${a}`;if(i.leader){let t=i.leader;x.push(e.shape({id:`leader:${i.label}`,role:"chrome",geometry:{kind:"line",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},paint:{stroke:h.edgeStrokeColor??"var(--_line)",strokeWidth:"1"},attributes:{className:"quadrant-leader"}}))}let o=i.className?`quadrant-point ${i.className}`:"quadrant-point";if(x.push(e.shape({id:r,role:"point",geometry:{kind:"circle",cx:i.cx,cy:i.cy,r:i.radius},paint:{fill:i.fill??h.nodeFillColor??"var(--accent, var(--_arrow))",stroke:i.stroke??h.nodeBorderColor??"var(--bg)",strokeWidth:i.strokeWidth??String(Math.max(1,h.nodeLineWidth))},attributes:{className:o,data:{label:i.label,x:String(i.nx),y:String(i.ny)}}})),!i.labelHidden){let t=function(e,t,i){let a=e.labelBox,r=a?(a.x0+a.x1)/2:e.labelX,n=a?(a.y0+a.y1)/2:e.labelY,o=t.regions.find(e=>r>=e.x&&r<=e.x+e.width&&n>=e.y&&n<=e.y+e.height);return o?ew(o.number,i):"var(--bg)"}(i,n,h);x.push(e.text({id:`${r}:label`,role:"label",text:i.label,x:i.labelX,y:i.labelY,fontSize:h.nodeLabelFontSize,fontWeight:h.nodeLabelFontWeight,letterSpacing:h.nodeLetterSpacing,block:i.labelBlock,anchor:i.labelAnchor,dominantBaseline:"middle",paint:{fill:h.nodeTextColor??"var(--_text)",stroke:t,strokeWidth:String(3),strokeLinejoin:"round",paintOrder:"stroke"},attributes:{className:"quadrant-point-label"}}))}if(u){let a=`${i.label}: [${i.nx}, ${i.ny}]`,n={id:r,role:"point"};M.push(e.group({id:`tooltip:${r}`,role:"chrome",owner:n,open:'<g class="quadrant-point-group">',close:"</g>",join:"",children:[{indent:0,node:e.shape({id:`${r}:hit`,role:"chrome",owner:n,geometry:{kind:"circle",cx:i.cx,cy:i.cy,r:i.radius+6},paint:{fill:"transparent"}})},{indent:0,node:e.documentContent({id:`${r}:title`,role:"chrome",nonPaint:"interaction-metadata"},`<title>${j(a)}</title>`)},{indent:0,node:t(e,"quadrant",i.tooltip,`${r}:tooltip`,n)}]}))}}for(let t of(x.push(...M),n.axisLabels)){let i=t.text.split(`
9
+ `),a=i.join(`
10
+ `),r=t.x<k.x?{kind:"rotate",angle:-90,cx:t.x,cy:t.y}:void 0,n=t.block?.lineHeight??1.3*t.fontSize,o=t.y+(i.length-1)*n/2-.35*t.fontSize;x.push(e.text({id:`axis:${t.text}`,role:"axis",text:a,x:t.x,y:o,fontSize:t.fontSize,fontWeight:h.edgeLabelFontWeight,letterSpacing:h.edgeLetterSpacing,block:t.block,anchor:t.anchor,paint:{fill:h.edgeTextColor??"var(--_text-muted)"},transform:r,attributes:{className:"quadrant-axis-label"}}))}if(n.title){let t=n.title.text;x.push(e.text({id:"title",role:"title",text:t,x:n.title.x,y:n.title.y,fontSize:n.title.fontSize,fontWeight:Math.max(h.groupHeaderFontWeight,600),letterSpacing:h.groupLetterSpacing,block:n.title.block,anchor:"middle",dominantBaseline:"middle",paint:{fill:h.groupTextColor??h.nodeTextColor??"var(--_text)"},attributes:{className:"quadrant-title"}}))}return x.push(e.documentClose()),{family:"quadrant",width:n.width,height:n.height,colors:o,transparent:c,parts:x}}),eM=k(Y,{configDiagnostics:e=>c("quadrant",e,U),statementEnds:ev,normalizeRequest:e=>({familyConfig:{visual:V(e.source.frontmatter)}}),layout:t=>v(function(t,i={},a={},r){var n;let o=T(i,ei(a),r),l=a.quadrantPadding??24,s=a.quadrantPadding??24,d=a.titleFontSize??18,c=a.titlePadding??18,u=Math.max(o.groupHeaderFontWeight,600),h=t.title?E(t.title,{display:"formatted",transform:o.groupTextTransform,fontSize:d,fontWeight:u,letterSpacing:o.groupLetterSpacing}):void 0,x=h?.text,p=t.title?d+c:0,m=a.xAxisLabelFontSize??o.edgeLabelFontSize,y=a.yAxisLabelFontSize??o.edgeLabelFontSize,f=a.xAxisLabelPadding??4,b=a.yAxisLabelPadding??4,g=m+2*f+7,v=y+2*b+7,k=g,q=v,S=(n=t.points.length)<=8?380:Math.min(720,380+(n-8)*20),$,z;for(let e=0;e<2;e++){if(void 0!==a.chartWidth||void 0!==a.chartHeight){let e=2*l+q,t=2*s+p+k;S=Math.max(60,Math.min(void 0!==a.chartWidth?a.chartWidth-e:1/0,void 0!==a.chartHeight?a.chartHeight-t:1/0))}let e=Math.max(24,S/2-12);$=t.xAxis?{near:er(t.xAxis.near,e,m,o.edgeLabelFontWeight,o.edgeLetterSpacing,o.edgeTextTransform),...t.xAxis.far?{far:er(t.xAxis.far,e,m,o.edgeLabelFontWeight,o.edgeLetterSpacing,o.edgeTextTransform)}:{}}:void 0,z=t.yAxis?{near:er(t.yAxis.near,e,y,o.edgeLabelFontWeight,o.edgeLetterSpacing,o.edgeTextTransform),...t.yAxis.far?{far:er(t.yAxis.far,e,y,o.edgeLabelFontWeight,o.edgeLetterSpacing,o.edgeTextTransform)}:{}}:void 0,t.title&&(x=(h=E(t.title,{display:"formatted",transform:o.groupTextTransform,fontSize:d,fontWeight:u,letterSpacing:o.groupLetterSpacing,maxWidth:S})).text,p=h.height-(h.lineHeight-h.fontSize)+c);let i=Math.max(m*O,...[$?.near,$?.far].map(e=>e?.height??0)),r=Math.max(y*O,...[z?.near,z?.far].map(e=>e?.height??0));k=g+i-m*O,q=v+r-y*O}let w=l+q,L=s+p,M=S/2,W=w+S+l,F=L+S+k+s,P=[{number:2,col:0,row:0},{number:1,col:1,row:0},{number:3,col:0,row:1},{number:4,col:1,row:1}].map(({number:e,col:i,row:a})=>{let r=w+i*M,n=L+a*M;return{number:e,label:t.quadrants[e-1],labelBlock:void 0===t.quadrants[e-1]?void 0:E(t.quadrants[e-1],{display:"formatted",transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing}),x:ea(r),y:ea(n),width:ea(M),height:ea(M),labelX:ea(r+M/2),labelY:ea(n+M/2)}}),_=o.nodeLabelFontSize,C=o.nodeLabelFontWeight,A=a.pointTextPadding??4,N=P.filter(e=>e.label).map(e=>{let t=e.labelBlock.width;return{x0:e.labelX-t/2,y0:e.labelY-e.labelBlock.height/2,x1:e.labelX+t/2,y1:e.labelY+e.labelBlock.height/2}}),B=a.pointRadius??6,I=t.points.map(e=>{var i,a;let r,n,o,l,s;return i=t.classDefs,a={radius:B},r=e.className&&i&&Object.hasOwn(i,e.className)?i[e.className]:void 0,n={radius:e.style?.radius??r?.radius??a.radius},o=e.style?.color??r?.color,l=e.style?.strokeColor??r?.strokeColor,s=e.style?.strokeWidth??r?.strokeWidth,void 0!==o&&(n.fill=o),void 0!==l&&(n.stroke=l),void 0!==s&&(n.strokeWidth=s),n}),j=t.points.map((e,t)=>{let i=w+e.x*S,a=L+(1-e.y)*S,r=I[t].radius+1;return{x0:i-r,y0:a-r,x1:i+r,y1:a+r}}),H={x0:2,y0:2,x1:W-2,y1:F-2},D=[],Q=t.points.length>=128,Y=Q?new en:void 0,U=Q?new en:void 0,X=Q?new en:void 0;if(Y&&U){for(let e of N)Y.add(e,e);for(let e of j)U.add(e,e)}let R=t.points.map((t,i)=>{let a=I[i],r=ea(w+t.x*S),n=ea(L+(1-t.y)*S),l=E(t.label,{display:"formatted",transform:o.nodeTextTransform,fontSize:_,fontWeight:C,letterSpacing:o.nodeLetterSpacing}),s=l.text,d=l.width,c=l.height,u=a.radius+A,h=e=>{let t=e.box;if(!(t.x0>=H.x0&&t.y0>=H.y0&&t.x1<=H.x1&&t.y1<=H.y1)||(Y?Y.some(t,e=>eo(t,e)):N.some(e=>eo(t,e)))||(U?U.some(t,e=>eo(t,e)):j.some(e=>eo(t,e))))return!1;if(!e.far)return!0;let i=es(r,n,a.radius,e);if(!Y||!X)return!N.some(e=>eu(i,e))&&!D.some(e=>ec(i,e));let o={x0:Math.min(i.x1,i.x2),y0:Math.min(i.y1,i.y2),x1:Math.max(i.x1,i.x2),y1:Math.max(i.y1,i.y2)},l={x0:o.x0-2,y0:o.y0-2,x1:o.x1+2,y1:o.y1+2},s={x0:o.x0-3,y0:o.y0-3,x1:o.x1+3,y1:o.y1+3};return!Y.some(l,e=>eu(i,e))&&!X.some(s,e=>ec(i,e))},x,p;for(let e of function*(e,t,i,a,r){yield{x:e+i,y:t,anchor:"start",far:!1,box:{x0:e+i,y0:t-r/2,x1:e+i+a,y1:t+r/2}},yield{x:e-i,y:t,anchor:"end",far:!1,box:{x0:e-i-a,y0:t-r/2,x1:e-i,y1:t+r/2}},yield{x:e,y:t+i+r/2,anchor:"middle",far:!1,box:{x0:e-a/2,y0:t+i,x1:e+a/2,y1:t+i+r}},yield{x:e,y:t-i-r/2,anchor:"middle",far:!1,box:{x0:e-a/2,y0:t-i-r,x1:e+a/2,y1:t-i}};for(let n=1;n<=10;n++){let o=i+n*(r+6);for(let{cos:i,sin:n,anchor:l}of el){let s=e+i*o,d=t+n*o,c="start"===l?s:"end"===l?s-a:s-a/2;yield{x:s,y:d,anchor:l,far:!0,box:{x0:c,y0:d-r/2,x1:c+a,y1:d+r/2}}}}}(r,n,u,d,c))if(x??=e,h(e)){p=e;break}let m={label:s,labelBlock:l,nx:t.x,ny:t.y,cx:r,cy:n,radius:a.radius,labelX:ea((p??x).x),labelY:ea((p??x).y),labelAnchor:(p??x).anchor};if(m.tooltip=e(r,n-a.radius,`${s}: [${t.x}, ${t.y}]`),void 0!==a.fill&&(m.fill=a.fill),void 0!==a.stroke&&(m.stroke=a.stroke),void 0!==a.strokeWidth&&(m.strokeWidth=a.strokeWidth),void 0!==t.className&&(m.className=t.className),p){if(N.push(p.box),Y?.add(p.box,p.box),m.labelBox={x0:ea(p.box.x0),y0:ea(p.box.y0),x1:ea(p.box.x1),y1:ea(p.box.y1)},p.far){m.leader=es(r,n,a.radius,p),D.push(m.leader);let e=m.leader;X?.add({x0:Math.min(e.x1,e.x2),y0:Math.min(e.y1,e.y2),x1:Math.max(e.x1,e.x2),y1:Math.max(e.y1,e.y2)},e)}}else m.labelHidden=!0;return m}),V=[],Z=e=>L+S+Math.max(m,e.lineHeight/2)+f;if($&&(V.push({text:$.near.text,block:$.near,x:ea(w+4),y:ea(Z($.near)),anchor:"start",fontSize:m}),$.far&&V.push({text:$.far.text,block:$.far,x:ea(w+S-4),y:ea(Z($.far)),anchor:"end",fontSize:m})),z){let e=e=>l+Math.max(y,e.lineHeight/2);V.push({text:z.near.text,block:z.near,x:ea(e(z.near)),y:ea(L+S-4),anchor:"start",fontSize:y}),z.far&&V.push({text:z.far.text,block:z.far,x:ea(e(z.far)),y:ea(L+4),anchor:"end",fontSize:y})}return{width:ea(W),height:ea(F),title:void 0!==x?{text:x,block:h,x:ea(w+S/2),y:ea(s+(p-c)/2),fontSize:d}:void 0,accessibility:t.accessibility?{...t.accessibility}:void 0,plot:{x:ea(w),y:ea(L),size:ea(S)},regions:P,points:R,axisLabels:V,visual:a}}(u(L(function(e,t,i){let r;if(r)for(let t of e)r.push(r[r.length-1]+t.length+1);let n=F(e,ev(e));w(n);let l=n.familyLines;if(0===(e=o(l,ev(l))).length)throw Error("Quadrant chart is empty");let s=ef(e[0].trim()),d=a(s[0]??"");if(!/^quadrant(?:Chart)?\b\s*$/i.test(d))throw Error(`Quadrant chart must start with "quadrant" or "quadrantChart", got: "${d}"`);q("quadrant")&&S("quadrant","header",d,{line:1,unit:"normalized"});let c,u={...void 0!==n.accessibility.title?{title:I(n.accessibility.title)}:{},...void 0!==n.accessibility.descr?{description:I(n.accessibility.descr)}:{}},h,x,p=[void 0,void 0,void 0,void 0],m=[],y=Object.create(null),f=new Set;for(let t=0;t<e.length;t++)for(let i of(0===t&&(e[t].indexOf(s[0]),s[0].length),0===t?s.slice(1):ef(e[t].trim()))){let e,r=eh.test(i)?i:a(i);if(!(0===r.length||r.startsWith("%%"))){if(e=r.match(ey)){q("quadrant")&&S("quadrant","classDef",r,{line:t+1,unit:"normalized"});let i=function(e){let t=e.trim().match(/^([A-Za-z_][\w-]*)\s+(.+)$/);if(!t)return{ok:!1,error:`expected "classDef <name> <styles>", got "classDef ${e.trim()}"`};let i=t[1],a=ee(t[2],`quadrant classDef ${i}`);return a.ok?a.style?{ok:!0,name:i,style:a.style}:{ok:!1,error:`classDef ${i} has no style entries`}:{ok:!1,error:`classDef ${i}: ${a.error}`}}(e[1]);if(!i.ok)throw Error(`Invalid quadrant classDef: ${i.error}`);y[i.name]=i.style,q("quadrant")&&$("quadrant","setClassDef",{name:i.name,style:i.style},{line:t+1,unit:"normalized"});continue}if(e=r.match(eh)){q("quadrant")&&S("quadrant","title",r,{line:t+1,unit:"normalized"}),c=I(e[1].trim()),q("quadrant")&&$("quadrant","setTitle",c,{line:t+1,unit:"normalized"});continue}if(e=r.match(ex)){q("quadrant")&&S("quadrant","axis",r,{line:t+1,unit:"normalized"});let i=function(e,t,i){let a="x"===t?"left":"bottom",r=!1,n=-1,o=0;for(let t=0;t<e.length;t++){if('"'===e[t]&&(r=!r),r||"-"!==e[t])continue;let i=/^--+>/.exec(e.slice(t));if(i){n=t,o=i[0].length;break}}if(n>=0){let r=e$(e.slice(0,n).trim(),`${t}-axis text`,i),l=e.slice(n+o).trim();if(!r)throw Error(`Quadrant ${t}-axis is missing its ${a} label: "${e}"`);return l?{near:r,far:e$(l,`${t}-axis text`,i)}:{near:r+" ⟶ "}}let l=e$(e.trim(),`${t}-axis text`,i);if(!l)throw Error(`Quadrant ${t}-axis is missing its ${a} label`);return{near:l}}(e[2].trim(),e[1].toLowerCase(),void 0);"x"===e[1].toLowerCase()?h=i:x=i,q("quadrant")&&$("quadrant","setAxis",{axis:e[1].toLowerCase(),value:i},{line:t+1,unit:"normalized"});continue}if(e=r.match(ep)){q("quadrant")&&S("quadrant","quadrant",r,{line:t+1,unit:"normalized"});let i=Number.parseInt(e[1],10)-1;p[i]=e$(e[2].trim(),`quadrant-${e[1]} label`,void 0),q("quadrant")&&$("quadrant","setQuadrant",{quadrant:i+1,label:p[i]},{line:t+1,unit:"normalized"});continue}if(e=r.match(em)){q("quadrant")&&S("quadrant","point",r,{line:t+1,unit:"normalized"});let{label:i,className:a}=function(e){let t=e.match(et);return t?{label:e.slice(0,t.index).trim(),className:t[1]}:{label:e}}(e[1].trim()),n=e$(i,"point label",void 0),o=e[4].trim(),l=ee(o,`quadrant point ${n}`);if(!l.ok)throw Error(`Unsupported quadrant point style metadata: "${o}" \u2014 ${l.error}. Expected comma-separated radius/color/stroke-color/stroke-width entries.`);let s=ez(n,e[2].trim()),d=ez(n,e[3].trim());if(f.has(n))throw Error(`Duplicate quadrant point label: "${n}"`);f.add(n),q("quadrant")&&$("quadrant","addPointLabel",n,{line:t+1,unit:"normalized"});let c={label:n,x:s,y:d};q("quadrant")&&$("quadrant","createPoint",c,{line:t+1,unit:"normalized"}),void 0!==a&&(c.className=a,q("quadrant")&&$("quadrant","setPointClass",{label:n,className:a},{line:t+1,unit:"normalized"})),void 0!==l.style&&(c.style=l.style,q("quadrant")&&$("quadrant","setPointStyle",{label:n,style:l.style},{line:t+1,unit:"normalized"})),m.push(c),q("quadrant")&&$("quadrant","appendPoint",c,{line:t+1,unit:"normalized"});continue}throw r.includes(":")?(q("quadrant")&&S("quadrant","invalidPoint",r,{line:t+1,unit:"normalized"}),Error(`Invalid quadrant point: "${r}". Expected: Label: [x, y] with x,y in [0,1]`)):(q("quadrant")&&S("quadrant","unrecognized",r,{line:t+1,unit:"normalized"}),W({what:`Unrecognized quadrant chart line: "${r}"`,expectedForm:"a title, x-axis/y-axis, a quadrant-N label, a point (Label: [x, y]), or a classDef",example:"Quick win: [0.2, 0.8]"}))}}return{title:c,...u.title||u.description?{accessibility:u}:{},xAxis:h,yAxis:x,quadrants:p,points:m,classDefs:y}}(t.source.familyLines),t.source.accessibility),t.source.frontmatter),t.renderOptions,t.familyConfig?.visual??V(),t.styleFace)),projectPositioned:b(function({positioned:e,options:t}){let i={version:1,nodes:e.points.map((t,i)=>({id:`point#${i}:${t.label}`,x:y(t.cx-t.radius),y:y(t.cy-t.radius),w:y(2*t.radius),h:y(2*t.radius),shape:"circle",label:t.label,role:"labelled-mark",labelVisibility:t.labelHidden?"hidden":"visible",labelBounds:t.labelBox?{x:z(t.labelBox.x0),y:z(t.labelBox.y0),w:z(t.labelBox.x1-t.labelBox.x0),h:z(t.labelBox.y1-t.labelBox.y0)}:void 0,labelContainer:m(p(e)),dataPosition:{x:z(t.nx),y:z(t.ny)}})),edges:[],groups:e.regions.map(t=>({id:`quadrant#${t.number}`,x:y(t.x),y:y(t.y),w:y(t.width),h:y(t.height),members:e.points.map((e,t)=>({point:e,index:t})).filter(({point:e})=>t.number===(e.nx>=.5?e.ny>=.5?1:4:e.ny>=.5?2:3)).map(({point:e,index:t})=>`point#${t}:${e.label}`),label:t.label})),bounds:{w:y(e.width),h:y(e.height)}};return t.debug&&(i.certificates=f("quadrant",i,"plot-contained")),i}),lowerScene:g(eL)});export{eM as default};
@@ -0,0 +1,16 @@
1
+ import{a as e}from"./chunk-VQYYGAXP.js";import{a as t,b as i}from"./chunk-5X6MJX3H.js";import"./chunk-J7FFAFQF.js";import{b as a,c as r,f as l}from"./chunk-2I4UPL7Q.js";import{e as o,l as n,m as s,n as c}from"./chunk-2SH76OTH.js";import{b as d,d as h}from"./chunk-AMJLVPUB.js";import{y as u,z as m}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{a as p,c as f}from"./chunk-CN7WTBWB.js";import{D as g,a as x,b as b,c as y,d as v,e as k,g as w,i as S}from"./chunk-HLWUNUCM.js";import{A as $,c as F,s as W,x as z,y as L}from"./chunk-X2UYKWKM.js";import{b as M,c as C,i as E,j as R,k as _,q as N}from"./chunk-TYZOZXUJ.js";import{c as O,h as T}from"./chunk-NO7ZIVRU.js";import{Ca as j,H as I,M as B,Tb as X,Z as V,aa as A,o as P,ob as Y}from"./chunk-Z3FDIVLN.js";import{G as U}from"./chunk-N5ELX7LR.js";import"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var H=Object.freeze({id:"radar",upstreamId:"radar",maturity:"experimental",label:"Radar",headers:["radar-beta"],aliases:[],config:{section:"radar",keys:["width","height","marginTop","marginRight","marginBottom","marginLeft","axisScaleFactor","axisLabelFactor","curveTension","useMaxWidth","tickLabels","useWidth"],noopKeys:["useWidth"]},identity:{id:"family:radar",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["category"],semanticRoles:["prelude","chrome","grid","pie-slice","point","axis","legend","title"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"grid",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"pie-slice",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"point",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"axis",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"legend",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"legend",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`radar-beta
2
+ title Skills
3
+ axis speed["Speed"], power["Power"], range["Range"]
4
+ curve now["Current"]{4, 3, 5}
5
+ curve goal["Target"]{5, 5, 4}
6
+ max 5`,detect:U,detectLoose:U}),G=["axisColor","axisStrokeWidth","axisLabelFontSize","curveOpacity","curveStrokeWidth","graticuleColor","graticuleStrokeWidth","graticuleOpacity","legendBoxSize","legendFontSize"],D=["width","height","axisScaleFactor"],q=Object.freeze({dimension:4096,margin:4096,factor:8,axisLabelFactorMin:1.1,fontSize:256,lineWidth:64,legendBoxSize:512}),Z=["marginTop","marginRight","marginBottom","marginLeft"];function J(e={}){let t=u(e,["radar"])??{},i={};for(let e of D){let a=m(t,[e]),r="width"===e||"height"===e?q.dimension:q.factor;"number"==typeof a&&Number.isFinite(a)&&a>0&&a<=r&&(i[e]=a)}let a=m(t,["axisLabelFactor"]);for(let e of("number"==typeof a&&Number.isFinite(a)&&a>=q.axisLabelFactorMin&&a<=q.factor&&(i.axisLabelFactor=a),Z)){let a=m(t,[e]);"number"==typeof a&&Number.isFinite(a)&&a>=0&&a<=q.margin&&(i[e]=a)}let r=m(t,["curveTension"]);"number"==typeof r&&Number.isFinite(r)&&r>=0&&r<=1&&(i.curveTension=r);let l=m(t,["useMaxWidth"]);"boolean"==typeof l&&(i.useMaxWidth=l);let o=m(t,["tickLabels"]);"boolean"==typeof o&&(i.tickLabels=o);let n=u(e,["themeVariables","radar"])??{};for(let e of["axisStrokeWidth","axisLabelFontSize","curveStrokeWidth","graticuleStrokeWidth","legendBoxSize","legendFontSize"]){let t=m(n,[e]),a="legendBoxSize"===e?q.legendBoxSize:e.endsWith("FontSize")?q.fontSize:q.lineWidth;"number"==typeof t&&Number.isFinite(t)&&t>0&&t<=a&&(i[e]=t)}for(let e of["curveOpacity","graticuleOpacity"]){let t=m(n,[e]);"number"==typeof t&&Number.isFinite(t)&&t>=0&&t<=1&&(i[e]=t)}for(let e of["axisColor","graticuleColor"]){let t=C(m(n,[e]),"graticuleColor"===e);t&&(i[e]=t)}let s=C(m(e,["themeVariables","titleColor"]));s&&(i.titleColor=s);let c=m(e,["themeVariables","fontSize"]),d="number"==typeof c?c:"string"==typeof c&&/^\d+(?:\.\d+)?(?:px)?$/i.test(c.trim())?Number.parseFloat(c):NaN;Number.isFinite(d)&&d>0&&d<=q.fontSize&&(i.titleFontSize=d);let h=[],p=!1;for(let t=0;t<12;t++){let i=C(m(e,["themeVariables",`cScale${t}`]));i&&(h[t]=i,p=!0)}return p&&(i.paletteOverrides=Array.from(h,e=>e??null)),i}var Q={width:s(q.dimension),height:s(q.dimension),marginTop:c(q.margin),marginRight:c(q.margin),marginBottom:c(q.margin),marginLeft:c(q.margin),axisScaleFactor:s(q.factor),axisLabelFactor:n(q.axisLabelFactorMin,q.factor),curveTension:n(0,1),useMaxWidth:o,tickLabels:o},K=/^radar-beta(?:[\t ]*:)?(?=$|\s)/i,ee=/^title(?:[\t ]+(.*))?$/i,et=/^axis\s+([\s\S]+)$/i,ei=/^curve\s+([\s\S]+)$/i,ea=/^(showLegend|ticks|max|min|graticule)\b(.*)$/i,er=/^(?:0|[1-9]\d*|\d+\.\d+|0\.\d+)$/,el=String.raw`[\w](?:[\w-]*[\w])?`,eo=String.raw`(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')`,en=new RegExp(String.raw`^(${el})\s*(?:\[\s*(${eo})\s*\])?$`),es=new RegExp(String.raw`^(${el})\s*(?:\[\s*(${eo})\s*\])?\s*\{([\s\S]*)\}$`),ec=new RegExp(String.raw`^(${el})(?:\s*:\s*|\s+)(.+)$`),ed={spanning:"\"'",wholeLine:e=>/^(?:title|accTitle|accDescr)(?=[\s:{]|$)/i.test(e)};function eh(e,t){let i=[],a=0,r=0,l=null,o=!1,n="";for(let t of e){if(o){n+=t,o=!1;continue}if(l&&"\\"===t){n+=t,o=!0;continue}if('"'===t||"'"===t){l===t?l=null:null===l&&(l=t),n+=t;continue}l||("["===t?a++:"]"===t?a--:"{"===t?r++:"}"===t&&r--),","!==t||l||0!==a||0!==r?n+=t:(i.push(n.trim()),n="")}if(i.push(n.trim()),l||0!==a||0!==r)throw Error(`Radar ${t} has unbalanced quotes or delimiters.`);if(i.some(e=>0===e.length))throw Error(`Radar ${t} contains an empty comma-separated entry.`);return i}function eu(e,t){let i=e[0];if('"'!==i&&"'"!==i||e.at(-1)!==i)throw Error(`Radar ${t} must use a quoted label.`);let a="";for(let i=1;i<e.length-1;i++){let r=e[i];if("\\"!==r){a+=r;continue}if(++i>=e.length-1)throw Error(`Radar ${t} has an incomplete escape.`);let l=e[i];a+="n"===l?`
7
+ `:"r"===l?"\r":"t"===l?" ":"b"===l?"\b":"f"===l?"\f":l}return a}var em=["showLegend","graticule","accTitle","accDescr","title","ticks","curve","axis","max","min"];function ep(e,t){for(let i of em){if(e.slice(t,t+i.length).toLowerCase()!==i.toLowerCase())continue;let a=e[t+i.length];if(void 0===a||/[\s:]/.test(a))return i}}function ef(e,t){let i=e.trim();if(i.startsWith("-")||i.startsWith("+"))throw Error(`Radar ${t} "${i}" has a sign \u2014 radar numbers must be non-negative (the grammar has no sign token).`);if(!er.test(i))throw Error(`Radar ${t} "${i}" is not a valid number.`);let a=Number.parseFloat(i);if(!Number.isFinite(a))throw Error(`Radar ${t} "${i}" is not finite.`);return a}function eg(e={}){return{nodeLabelFontSize:e.legendFontSize??13,edgeLabelFontSize:e.axisLabelFontSize??12.5,groupHeaderFontSize:e.titleFontSize??18,nodeLabelFontWeight:500,edgeLabelFontWeight:500,groupHeaderFontWeight:600,nodePaddingX:0,nodePaddingY:0,nodeLineWidth:e.curveStrokeWidth??2.2,edgeLineWidth:e.axisStrokeWidth??1,groupCornerRadius:0,groupPaddingX:0,groupPaddingY:0,groupLineWidth:O.outerBox}}function ex(e){return Math.round(100*e)/100}function eb(e,t){return 2*Math.PI*e/t}function ey(e,t,i,a){return{x:e+i*Math.sin(a),y:t-i*Math.cos(a)}}function ev(e,t,i=0){return e.left<t.right+i&&t.left<e.right+i&&e.top<t.bottom+i&&t.top<e.bottom+i}function ek(e,i,a,r,l){let o=T(i,eg(a),r),n=e.axes.length;if(n>256)throw Error("Radar charts support at most 256 axes.");let s=120;(void 0!==a.width||void 0!==a.height)&&(s=Math.min(Math.max(Math.min(a.width??a.height??240,a.height??a.width??240)/2-56,40),400)),l?.radius!==void 0&&(s=l.radius);let c=a.axisScaleFactor??1,d=a.axisLabelFactor??1.05,h=a.curveTension??.17,u="circle"===e.graticule&&h>0,m=function(e){if(!Number.isFinite(e.min)||e.min<0)throw Error(`Radar min must be a finite non-negative number, got ${e.min}.`);if(void 0!==e.max&&(!Number.isFinite(e.max)||e.max<0))throw Error(`Radar max must be a finite non-negative number, got ${e.max}.`);let t=!1,i=1;for(let a of e.curves)for(let e of a.values){if(!Number.isFinite(e)||e<0)throw Error(`Radar curve "${a.id}" contains a non-finite or negative value.`);(!t||e>i)&&(i=e),t=!0}let a=e.max??(t?i:1);if(!(a>e.min))throw Error(`Radar scale is degenerate: max (${a}) must be greater than min (${e.min}). Set an explicit \`max\`, or ensure curve values span a range.`);return{min:e.min,max:a}}(e),{min:p,max:f}=m,g=e=>s*((Math.min(Math.max(e,m.min),m.max)-m.min)/(m.max-m.min)),x=o.edgeLabelFontSize,b=o.edgeLabelFontWeight,y=o.groupHeaderFontSize,v=Math.max(o.groupHeaderFontWeight,600),k=Math.max(58,Math.min(96,1.05*s)),w=t=>e.axes.map(e=>V(e.label,{display:"literal",transform:o.edgeTextTransform,fontSize:x,fontWeight:b,letterSpacing:o.edgeLetterSpacing,maxWidth:t})),S=96,$=w(96);for(let e=0;e<8&&Math.max(0,...$.map(e=>e.width))>k&&S>58;e++)$=w(S=Math.max(58,S-12));let F=$.map(e=>e.lines),W=$.map(e=>e.width),z=$.map(e=>e.height),L=Array(n).fill(0);for(let t of e.curves)t.values.length===n&&t.values.forEach((e,t)=>{L[t]=Math.max(L[t],g(e))});let M=1.05*s+8,C=void 0===a.axisLabelFactor?0:s*(d-1.05),E=e.axes.map((e,t)=>{let i=Math.sin(eb(t,n));return i>.3?"start":i<-.3?"end":"middle"}),R=Math.max(s,s*c,...L)+3+7,_=Array(n).fill(0).map((e,t)=>Math.max(0,R+z[t]/2-M)+C),N=Array(n).fill(!1),O=e=>{let t=eb(e,n),i=M+_[e],a=i*Math.sin(t),r=-i*Math.cos(t),l=W[e],o="start"===E[e]?a:"end"===E[e]?a-l:a-l/2;return{left:o,right:o+l,top:r-z[e]/2,bottom:r+z[e]/2,rx:a,ry:r}},j=[];for(let e=0;e<n;e++){let t=_[e],i=()=>j.some(t=>ev(O(e),O(t),2));if(i()){N[e]=!0;let a=6,r=!1;for(let l=0;l<48;l++){if(_[e]=t+a,!i()){r=!0;break}a*=2}if(!r)throw Error("Radar axis labels could not be placed within finite layout bounds.")}j.push(e)}let I=a.marginLeft??22,B=a.marginRight??22,X=a.marginTop??22,P=a.marginBottom??22,Y=s*Math.max(1,c),U=Y,H=Y,G=Y,D=Y;for(let e=0;e<n;e++){let t=O(e);U=Math.max(U,-t.left),H=Math.max(H,t.right),G=Math.max(G,-t.top),D=Math.max(D,t.bottom)}if(a.width){let e=a.width/2;U=Math.max(U,e),H=Math.max(H,e)}if(a.height){let e=a.height/2;G=Math.max(G,e),D=Math.max(D,e)}let q=l?Math.max(l.maxWidth,I+U+H+B):void 0,Z=o.nodeLabelFontSize,J=o.nodeLabelFontWeight,Q=e.showLegend&&e.curves.length>0,K=a.legendBoxSize??14,ee=12.923076923076923*Z,et=void 0===q?0:q-I-B-K-8,ei=et>0?et:ee,ea=(Q?e.curves.map(e=>{let t=V(e.label,{display:"literal",transform:o.nodeTextTransform,fontSize:Z,fontWeight:J,letterSpacing:o.nodeLetterSpacing,maxWidth:ei});return l&&t.width>ei+.01?V(t.prepared,{...t,maxWidth:ee}):t}):[]).map(e=>({block:e})),er={gap:9,minRowHeight:K,leadingWidth:K+8,columnGap:16,...void 0===q?{}:{maxWidth:q-I-B}},el=A(ea,er),eo=Q?el.width:0,en=el.height;Q&&!l&&(G=Math.max(G,en/2),D=Math.max(D,en/2));let es=e.title?V(e.title,{display:"literal",transform:o.groupTextTransform,fontSize:y,fontWeight:v,letterSpacing:o.groupLetterSpacing,...void 0===q?{}:{maxWidth:Math.max(1,q-I-B)}}):void 0;es&&void 0!==q&&es.width>q-I-B+.01&&(es=V(es.prepared,es));let ec=es?es.height:0,ed=es?ec+16:0,eh=I+U+H+(Q&&!l?30+eo:0)+B,eu=l&&Q?Math.max(eh,I+eo+B):eh,em=I+U+(eu-eh)/2,ep=es?.width??0,ef=Math.max(0,ep/2-em),ek=Math.max(0,em+ep/2-eu),ew=eu+ef+ek,eS=X+ed+G+D+P+(l&&Q?30+en:0),e$=em+ef,eF=X+ed+G,eW=[];for(let t=1;n>0&&t<=e.ticks;t++){let i=s*t/e.ticks,a=t===e.ticks?f:p+(f-p)*(t/e.ticks),r="polygon"===e.graticule?e.axes.map((e,t)=>{let a=ey(e$,eF,i,eb(t,n));return{x:ex(a.x),y:ex(a.y)}}):[];eW.push({r:ex(i),value:a,points:r,emphasized:t===e.ticks})}let ez=e.axes.map((e,t)=>{let i,a,r=eb(t,n),l=ey(e$,eF,s*c,r),o=M+_[t],d=ey(e$,eF,o,r),h=N[t]||_[t]>9?(i=ey(e$,eF,Math.max(s,s*c)+1,r),a=ey(e$,eF,o-z[t]/2-2,r),{x1:ex(i.x),y1:ex(i.y),x2:ex(a.x),y2:ex(a.y)}):void 0;return{id:e.id,label:e.label,block:$[t],x:ex(l.x),y:ex(l.y),labelX:ex(d.x),labelY:ex(d.y),anchor:E[t],lines:F[t],labelWidth:ex(W[t]),leader:h}}),eL=e.curves.map((e,t)=>{let i=e.values.length===n,a=i?e.values.map((e,t)=>{let i=ey(e$,eF,g(e),eb(t,n));return{x:ex(i.x),y:ex(i.y)}}):[];return{id:e.id,label:e.label,colorIndex:t,areaPath:i?function(e,t,i){if(0===e.length)return"";if(!t||e.length<3)return"M "+e.map(e=>`${ex(e.x)} ${ex(e.y)}`).join(" L ")+" Z";let a=e.length,r=`M ${ex(e[0].x)} ${ex(e[0].y)}`;for(let t=0;t<a;t++){let l=e[(t-1+a)%a],o=e[t],n=e[(t+1)%a],s=e[(t+2)%a],c=o.x+(n.x-l.x)*i,d=o.y+(n.y-l.y)*i,h=n.x-(s.x-o.x)*i,u=n.y-(s.y-o.y)*i;r+=` C ${ex(c)} ${ex(d)} ${ex(h)} ${ex(u)} ${ex(n.x)} ${ex(n.y)}`}return r+" Z"}(a,u,h):"",vertices:a,arityMismatch:!i}}),eM=[];if(a.tickLabels&&n>0){let e=eb(0,n)+Math.PI/n;for(let i of[...eW].reverse()){let a=ey(e$,eF,i.r,e),r=t(i.value),l=V(r,{display:"literal",fontSize:9.5,fontWeight:b,letterSpacing:o.edgeLetterSpacing}),n=l.width+8,s={text:r,block:l,x:ex(a.x),y:ex(a.y),w:ex(n),h:ex(15.5)},c={left:s.x-s.w/2,right:s.x+s.w/2,top:s.y-s.h/2,bottom:s.y+s.h/2};eM.some(e=>ev(c,{left:e.x-e.w/2,right:e.x+e.w/2,top:e.y-e.h/2,bottom:e.y+e.h/2},1))||eM.unshift(s)}}let eC=[];if(Q){let t=l?(ew-eo)/2:ef+I+U+H+30,i=l?eF+D+30:eF-en/2,a=A(ea,{...er,top:i});e.curves.forEach((e,i)=>{let{item:{block:r},x:l=0,top:o,height:n,textY:s}=a.rows[i];eC.push({label:e.label,lines:r.lines,block:r,colorIndex:i,x:ex(t+l),y:ex(o+(n-K)/2),swatchSize:K,textX:ex(t+l+K+8),textY:ex(s)})})}return{width:ex(ew),height:ex(eS),cx:ex(e$),cy:ex(eF),radius:ex(s),title:e.title?{text:es.text,block:es,x:ex(e$),y:ex(X+ec/2),fontSize:y}:void 0,accessibility:e.accessibility?{...e.accessibility}:void 0,rings:eW,axes:ez,curves:eL,tickLabels:eM,legend:eC,polygonGraticule:"polygon"===e.graticule,typography:{axisFontSize:x,axisFontWeight:b,legendFontSize:Z,legendFontWeight:J,titleFontSize:y,titleFontWeight:v,tickFontSize:9.5,tickFontWeight:b},visual:a}}function ew(e,t,i){let a=j(e,t);if(null!==a&&a>=4.5)return e;let r=[i,"#000000","#ffffff"].map(e=>({color:e,ratio:j(e,t)})).filter(e=>null!==e.ratio).sort((e,t)=>t.ratio-e.ratio)[0];return r&&r.ratio>=4.5?r.color:i}function eS(e){return Math.round(100*e)/100}function e$(e){let t=new Map;for(let i of e)t.set(i,(t.get(i)??0)+1);let i=new Map;return e.map(e=>{if((t.get(e)??0)<=1)return e;let a=i.get(e)??0;return i.set(e,a+1),`${e}#${a}`})}var eF=F(function(e,t){let a,{positioned:r,colors:l,resolved:o}=t,n=o.renderOptions,s=l.font??"Inter",c=n.transparent??!1,d=T(n,eg(r.visual),o.styleFace),h=[],u=i(r.curves.length,{accent:l.accent,bg:l.bg,overrides:r.visual.paletteOverrides}),m=r.visual.curveOpacity??.5,p=r.visual.axisColor??d.edgeStrokeColor??"var(--_line)",f=r.visual.graticuleColor??d.edgeStrokeColor??"var(--_line)",g=r.visual.axisStrokeWidth??1,x=r.visual.graticuleStrokeWidth??1,b=r.visual.graticuleOpacity??.7,y=r.visual.titleColor??d.groupTextColor??d.nodeTextColor??"var(--_text)",v=d.nodeBorderColor??"var(--bg)",k=r.visual.axisColor??ew(d.edgeTextColor??l.fg,l.bg,l.fg),w=ew(d.edgeTextColor??l.fg,l.bg,l.fg),S={title:r.accessibility?.title??r.title?.text??"Radar chart",description:r.accessibility?.description},$=e$(r.axes.map(e=>e.id)),F=e$(r.curves.map(e=>e.id)),W=[r.width,r.height,S.title??""];for(let e of r.axes)W.push(e.id);for(let e of r.curves)W.push(e.label);let z=`radar-${X(W.join("|"))}`,L=`${z}-title`,M=`${z}-desc`,C=[(a=r.visual.useMaxWidth?{width:"100%",height:"100%",style:`max-width:${r.width}px`}:{},_(r.width,r.height,l,c,{...a,attrs:{id:z,"aria-roledescription":"radar chart",...N(S.title,S.description,L,M,"radar chart")}}))];S.title&&C.push(`<title id="${L}">${B(S.title)}</title>`),S.description&&C.push(`<desc id="${M}">${B(S.description)}</desc>`),C.push(R(s,!1,l.shadow,l.embedFontImport));let O=E(l);O&&C.push(`<defs>${O}</defs>`),h.push(e.documentOpen({id:"prelude",width:r.width,height:r.height,colors:l,transparent:c,font:s,hasMonoFont:!1},C.join(`
8
+ `)));for(let t=0;t<r.rings.length;t++){let i=r.rings[t];h.push(e.shape({id:`ring:${t}`,role:"grid",geometry:r.polygonGraticule?{kind:"polygon",points:i.points}:{kind:"circle",cx:r.cx,cy:r.cy,r:i.r},paint:{fill:"none",stroke:f,strokeOpacity:String(b),strokeWidth:String(i.emphasized?eS(1.4*x):x)},attributes:{className:`radar-ring${i.emphasized?" radar-ring-outer":""}`}}))}for(let[t,i]of r.axes.entries()){let a=$[t];h.push(e.shape({id:`spoke:${a}`,role:"grid",geometry:{kind:"line",x1:r.cx,y1:r.cy,x2:i.x,y2:i.y},paint:{stroke:p,strokeWidth:String(g)},attributes:{className:"radar-axis-line"}}))}let j=new Map;for(let[t,i]of r.curves.entries()){if(i.arityMismatch||0===i.vertices.length)continue;let a=F[t],l={category:i.label},n=P(o.styleFace,"pie-slice",l,{includeFallback:!1}),s=r.visual.paletteOverrides?.[i.colorIndex],c=s??n?.fillColor??u[i.colorIndex],p=s??n?.strokeColor??n?.borderColor??c;j.set(i.colorIndex,p);let f=n?.lineWidth??d.nodeLineWidth,g={fill:c,fillOpacity:String(m),stroke:p,strokeWidth:String(f),strokeLinejoin:"round"},x={className:"radar-area",data:{curve:i.label}};h.push(e.shape({id:`curve:${a}`,role:"pie-slice",geometry:r.polygonGraticule?{kind:"polygon",points:i.vertices}:{kind:"path",d:i.areaPath},paint:g,channels:l,attributes:x}))}for(let[t,i]of r.curves.entries()){if(i.arityMismatch)continue;let a=F[t],l={category:i.label},n=P(o.styleFace,"point",l,{includeFallback:!1}),s=r.visual.paletteOverrides?.[i.colorIndex]??n?.fillColor??j.get(i.colorIndex)??u[i.colorIndex],c=n?.strokeColor??n?.borderColor??v,d=n?.lineWidth??1.2;i.vertices.forEach((t,i)=>{h.push(e.shape({id:`dot:${a}:${i}`,role:"point",geometry:{kind:"circle",cx:t.x,cy:t.y,r:3},paint:{fill:s,stroke:c,strokeWidth:String(d)},channels:l,attributes:{className:"radar-dot"}}))})}for(let[t,i]of r.axes.entries()){if(!i.leader)continue;let a=$[t],r=i.leader;h.push(e.shape({id:`leader:${a}`,role:"grid",geometry:{kind:"line",x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2},paint:{stroke:f,strokeOpacity:"0.5",strokeWidth:"1"},attributes:{className:"radar-leader"}}))}for(let t=0;t<r.tickLabels.length;t++){let i=r.tickLabels[t],a=eS(i.x-i.w/2),l=eS(i.y-i.h/2);h.push(e.shape({id:`tick-box:${t}`,role:"grid",geometry:{kind:"rect",x:a,y:l,width:i.w,height:i.h,rx:4,ry:4},paint:{fill:"var(--bg)",stroke:f,strokeOpacity:"0.35",strokeWidth:"0.75"},attributes:{className:"radar-tick-box"}}))}for(let t=0;t<r.tickLabels.length;t++){let i=r.tickLabels[t];h.push(e.text({id:`tick:${t}`,role:"axis",text:i.text,x:i.x,y:i.y,fontSize:r.typography.tickFontSize,fontWeight:r.typography.tickFontWeight,letterSpacing:d.edgeLetterSpacing,block:i.block,display:"literal",anchor:"middle",dominantBaseline:"middle",baselineShift:0,paint:{fill:w},attributes:{className:"radar-tick-label"}}))}for(let[t,i]of r.axes.entries()){let a=$[t],l=i.lines;h.push(e.text({id:`axis-label:${a}`,role:"axis",text:l.join(`
9
+ `),x:i.labelX,y:i.labelY,fontSize:r.typography.axisFontSize,block:i.block,fontWeight:r.typography.axisFontWeight,letterSpacing:d.edgeLetterSpacing,display:"literal",anchor:i.anchor,dominantBaseline:"middle",baselineShift:0,paint:{fill:k},attributes:{className:"radar-axis-label",ariaLabel:i.label}}))}for(let t of r.legend){let i={category:t.label},a=P(o.styleFace,"legend",i,{includeFallback:!1}),l=r.visual.paletteOverrides?.[t.colorIndex]??a?.fillColor??j.get(t.colorIndex)??u[t.colorIndex],n=a?.strokeColor??a?.borderColor??d.nodeBorderColor??"var(--_node-stroke)",s=a?.lineWidth??1;h.push(e.shape({id:`legend-swatch:${t.colorIndex}`,role:"legend",geometry:{kind:"rect",x:t.x,y:t.y,width:t.swatchSize,height:t.swatchSize,rx:2,ry:2},paint:{fill:l,fillOpacity:"1",stroke:n,strokeWidth:String(s)},channels:i,attributes:{className:"radar-legend-swatch"}})),h.push(e.text({id:`legend-label:${t.colorIndex}`,role:"legend",text:t.lines.join(`
10
+ `),x:t.textX,y:t.textY,fontSize:r.typography.legendFontSize,fontWeight:r.typography.legendFontWeight,letterSpacing:d.nodeLetterSpacing,block:t.block,display:"literal",anchor:"start",dominantBaseline:"middle",baselineShift:0,paint:{fill:a?.textColor??d.nodeTextColor??"var(--_text)"},attributes:{className:"radar-legend-text"}}))}return r.title&&h.push(e.text({id:"title",role:"title",text:r.title.text,x:r.title.x,y:r.title.y,fontSize:r.title.fontSize,fontWeight:r.typography.titleFontWeight,letterSpacing:d.groupLetterSpacing,block:r.title.block,display:"literal",anchor:"middle",dominantBaseline:"middle",baselineShift:0,paint:{fill:y},attributes:{className:"radar-title"}})),h.push(e.documentClose()),{family:"radar",width:r.width,height:r.height,colors:l,transparent:c,parts:h}}),eW=v(H,{configDiagnostics:e=>[...function(e){let t=d(e,"themeVariables");if(!t||!("radar"in t))return[];let i=d(t,"radar");if(!i)return[{code:"INEFFECTIVE_CONFIG",field:"themeVariables.radar",message:"themeVariables.radar must be an object; the invalid value has no effect."}];let a=new Set(G),r=[],l=new Set(["axisStrokeWidth","curveStrokeWidth","graticuleStrokeWidth"]),o=new Set(["axisLabelFontSize","legendFontSize"]),c=new Set(["curveOpacity","graticuleOpacity"]),h=new Set(["axisColor","graticuleColor"]);for(let e of Object.keys(i).sort(Y)){let t=i[e],d;a.has(e)?l.has(e)&&!s(q.lineWidth).valid(t)?d=s(q.lineWidth).expected:o.has(e)&&!s(q.fontSize).valid(t)?d=s(q.fontSize).expected:"legendBoxSize"!==e||s(q.legendBoxSize).valid(t)?c.has(e)&&!n(0,1).valid(t)?d="a finite number from 0 through 1":h.has(e)&&!M(t)&&(d="a safe CSS color without url(), variables, or context-breaking characters"):d=s(q.legendBoxSize).expected:d="a documented radar theme field",d&&r.push({code:"INEFFECTIVE_CONFIG",field:`themeVariables.radar.${e}`,message:`themeVariables.radar.${e} must be ${d}; the invalid value has no effect.`})}return r}(e.root),...h("radar",e,Q)],statementEnds:function(e){return r(e,ed)},normalizeRequest:e=>({familyConfig:{visual:J(e.source.frontmatter)}}),layout:t=>y(function(t,i={},a={},r){let l=ek(t,i,a,r),o=i.radar?.maxWidth;return void 0===o?l:e(l,o,(e,n)=>{let s;if(2===e&&(void 0!==a.width||void 0!==a.height))return;if(2===e){let e=t.axes.map((e,i)=>Math.sin(eb(i,t.axes.length))),i=Math.max(0,...e)-Math.min(0,...e),r=Math.max(1,a.axisScaleFactor??1)+(void 0===a.axisLabelFactor?0:a.axisLabelFactor-1.05);s=Math.max(60,l.radius-Math.max(0,n.width-o)/Math.max(1,i*r))}let c=ek(t,i,a,r,{maxWidth:o,...void 0===s?{}:{radius:s}});return l.tickLabels.some((e,t)=>c.tickLabels[t]?.text!==e.text)?n:c})}(function(e,t={}){let i=L(l(e.join(`
11
+ `).split(/\r?\n/),ed).map(a));$(i);let r=i.familyLines.join(`
12
+ `).trimStart();if(!r)throw Error("Radar chart is empty");let o=r.match(K);if(!o)throw Error(`Radar chart must start with "radar-beta", got: "${r.split(/\r?\n/,1)[0]}"`);k("radar")&&w("radar","header",o[0],{offset:0,endOffset:o[0].length,unit:"normalized"});let n=function(e,t){let i=[],a=0;for(;a<e.length;){for(;a<e.length&&/\s/.test(e[a]);)a++;if(a>=e.length)break;let r=a,l=ep(e,a);if(l&&/^(?:title|accTitle)$/i.test(l)){for(;a<e.length&&e[a]!==`
13
+ `&&"\r"!==e[a];)a++;let o=e.slice(r,a).trim();o&&(i.push(o),k("radar")&&w("radar",l,o,{offset:r+t,endOffset:a+t,unit:"normalized"}));continue}if(l?.toLowerCase()==="accdescr"){let o=a+l.length;for(;o<e.length&&/[\t ]/.test(e[o]);)o++;if(":"===e[o])for(o++;o<e.length&&/[\t ]/.test(e[o]);)o++;if("{"===e[o]){let n=e.indexOf("}",o+1);if(n<0)throw Error(`Radar statement is missing a closing "}": "${e.slice(r).trim()}"`);a=n+1,i.push(e.slice(r,a).trim()),k("radar")&&w("radar",l,i[i.length-1],{offset:r+t,endOffset:a+t,unit:"normalized"});continue}for(;a<e.length&&e[a]!==`
14
+ `&&"\r"!==e[a];)a++;let n=e.slice(r,a).trim();n&&(i.push(n),k("radar")&&w("radar",l,n,{offset:r+t,endOffset:a+t,unit:"normalized"}));continue}let o=0,n=0,s=null,c=!1;for(;a<e.length;a++){let t=e[a];if(c){c=!1;continue}if(s&&"\\"===t){c=!0;continue}if('"'===t||"'"===t){s===t?s=null:null===s&&(s=t);continue}if(!s){if("["===t?o++:"]"===t?o--:"{"===t?n++:"}"===t&&n--,o<0||n<0)throw Error(`Radar statement has an unexpected closing delimiter: "${e.slice(r,a+1).trim()}"`);if((t===`
15
+ `||"\r"===t)&&0===o&&0===n)break;if(/[\t ]/.test(t)&&0===o&&0===n){let t=a+1;for(;t<e.length&&/[\t ]/.test(e[t]);)t++;let i=a-1;for(;i>=r&&/[\t ]/.test(e[i]);)i--;if(","!==e[i]&&ep(e,t))break}}}if(s||0!==o||0!==n)throw Error(`Radar statement has unbalanced quotes or delimiters: "${e.slice(r,a).trim()}"`);let d=e.slice(r,a).trim();d&&(i.push(d),k("radar")&&w("radar",l??"unrecognized",d,{offset:r+t,endOffset:a+t,unit:"normalized"}))}return i}(r.slice(o[0].length),o[0].length),s=t.title;void 0!==s&&k("radar")&&S("radar","setFrontmatterTitle",s);let c={...void 0!==i.accessibility.title?{title:I(i.accessibility.title)}:{},...void 0!==i.accessibility.descr?{description:I(i.accessibility.descr)}:{}},d=[],h=[],u=0,m,p=5,f="circle",g=!0,x={};for(let e=0;e<n.length;e++){let t=n[e],a,r=z(t.split(`
16
+ `),0);if(void 0===r)throw Error('Radar accDescr block is missing a closing "}"');if(null!==r){let e=I(r.value);r.title?(x.title=r.value,void 0===i.accessibility.title&&(c.title=e)):(x.descr=r.value,void 0===i.accessibility.descr&&(c.description=e)),k("radar")&&S("radar",r.title?"setAccessibilityTitle":"setAccessibilityDescription",e);continue}if(a=t.match(ee)){s=I((a[1]??"").trim()),k("radar")&&S("radar","setTitle",s);continue}if(a=t.match(et)){for(let e of eh(a[1],"axis list")){if(d.length>=256)throw Error("Radar charts support at most 256 axes.");d.push(function(e){let t=e.match(en);if(!t)throw W({what:`Invalid radar axis: "${e}"`,expectedForm:'an id (not ending in "-") with an optional quoted label',example:'axis speed["Top Speed"], range'});let i=t[1],a=void 0!==t[2]?I(eu(t[2],`axis "${i}" label`)):i;return{id:i,label:a}}(e)),k("radar")&&S("radar","appendAxis",d[d.length-1])}continue}if(a=t.match(ei)){for(let e of eh(a[1],"curve list"))h.push(e),k("radar")&&S("radar","appendPendingCurve",e);continue}if(ea.test(t)){for(let e of eh(t,"option list")){let t=e.match(ea);if(!t)throw Error(`Invalid radar option: "${e}"`);let i=t[1].toLowerCase(),a=t[2].trim();switch(i){case"showlegend":if(!/^(true|false)$/i.test(a))throw Error(`Radar showLegend must be true or false, got "${a}".`);g="true"===a.toLowerCase(),k("radar")&&S("radar","setShowLegend",g);break;case"ticks":p=function(e){let t=ef(e,"ticks");if(!Number.isInteger(t)||t<1||t>64)throw Error(`Radar ticks must be an integer from 1 through 64, got "${e.trim()}".`);return t}(a),k("radar")&&S("radar","setTicks",p);break;case"max":m=ef(a,"max"),k("radar")&&S("radar","setMax",m);break;case"min":u=ef(a,"min"),k("radar")&&S("radar","setMin",u);break;case"graticule":if("circle"!==a&&"polygon"!==a)throw Error(`Radar graticule must be circle or polygon, got "${a}".`);f=a,k("radar")&&S("radar","setGraticule",f)}}continue}throw W({what:`Unrecognized radar chart line: "${t}"`,expectedForm:"a title, accessibility directive, axis, curve, or option (min/max/ticks/graticule/showLegend)",example:"axis a, b, c"})}let b=h.map(e=>{let t=function(e,t){let i=e.match(es);if(!i)throw W({what:`Invalid radar curve: "${e}"`,expectedForm:'an id (not ending in "-") with an optional quoted label and a `{…}` value block',example:'curve a["Alice"]{85, 90, 80}'});let a=i[1],r=void 0!==i[2]?I(eu(i[2],`curve "${a}" label`)):a,l=eh(i[3],`curve "${a}" value block`),o=l.map(e=>!/^[+-]?(?:\d|\.)/.test(e)),n=o.some(Boolean),s=o.every(Boolean);if(n&&!s)throw Error(`Radar curve "${a}" mixes positional and keyed entries \u2014 use one form.`);if(!n)return{id:a,label:r,values:l.map(e=>ef(e,`curve "${a}" value`))};if(0===t.length)throw Error(`Radar curve "${a}" uses keyed entries (axis: value) but no axes are declared.`);let c=new Map;for(let e of l){let t=e.match(ec);if(!t)throw Error(`Radar curve "${a}" has an invalid keyed entry: "${e}".`);let i=t[1],r=ef(t[2],`curve "${a}" entry for "${i}"`);c.has(i)||(c.set(i,r),k("radar")&&S("radar","setCurveAxisValue",{curve:a,axis:i,value:r}))}let d=t.map(e=>{let t=c.get(e.id);if(void 0===t)throw Error(`Radar curve "${a}" is missing an entry for axis "${e.id}".`);return k("radar")&&S("radar","resolveCurveAxisValue",{curve:a,axis:e.id,value:t}),t});return{id:a,label:r,values:d}}(e,d);return k("radar")&&S("radar","resolveCurve",t),t});if(void 0!==m&&m<=u)throw Error(`Radar max (${m}) must be greater than min (${u}).`);return{title:s,...c.title||c.description?{accessibility:c}:{},...Object.keys(x).length>0?{statementAccessibility:x}:{},axes:d,curves:b,min:u,max:m,ticks:p,graticule:f,showLegend:g}}(t.source.lines,{title:"string"==typeof t.source.frontmatter.title?t.source.frontmatter.title:void 0}),t.renderOptions,t.familyConfig?.visual??J(t.source.frontmatter),t.styleFace),{injectAccessibility:!1}),projectPositioned:x(function({positioned:e}){let t=[],i=e.rings.map((t,i)=>({id:`ring:${i}`,x:f(e.cx-t.r),y:f(e.cy-t.r),w:f(2*t.r),h:f(2*t.r),members:[]}));e.axes.forEach((i,a)=>{let r=Math.max(8,i.block?.width??i.labelWidth),l=i.block?.height??0,o="start"===i.anchor?i.labelX:"end"===i.anchor?i.labelX-r:i.labelX-r/2;t.push({id:`axis#${a}:${i.id}`,x:f(o),y:f(i.labelY-l/2),w:f(r),h:f(l),shape:"rectangle",label:i.label,role:"labelled-mark",...g(i.block,i.labelX,i.labelY,p(e),i.anchor)})}),e.tickLabels.forEach((i,a)=>{let r=i.block?.width??i.w,l=i.block?.height??i.h;t.push({id:`tick:${a}`,x:f(i.x-r/2),y:f(i.y-l/2),w:f(r),h:f(l),shape:"rectangle",label:i.text,role:"labelled-mark",...g(i.block,i.x,i.y,p(e))})});let a=new Map;for(let t of e.curves)a.set(t.id,(a.get(t.id)??0)+1);let r=new Map;for(let[i,l]of(e.curves.forEach(e=>{let i=r.get(e.id)??0;r.set(e.id,i+1);let l=(a.get(e.id)??0)>1?`${e.id}#${i}`:e.id;e.vertices.forEach((e,i)=>{t.push({id:`dot:${l}:${i}`,x:f(e.x-3),y:f(e.y-3),w:f(6),h:f(6),shape:"circle",role:"mark"})})}),e.legend.entries())){t.push({id:`legend-swatch#${i}`,x:f(l.x),y:f(l.y),w:f(l.swatchSize),h:f(l.swatchSize),shape:"rectangle",role:"mark"});let a=Math.max(8,l.block?.width??0),r=l.block?.height??0;t.push({id:`legend-label#${i}`,x:f(l.textX),y:f(l.textY-r/2),w:f(a),h:f(r),shape:"rectangle",label:l.lines.join(" "),role:"labelled-mark",...g(l.block,l.textX,l.textY,p(e),"start")})}if(e.title){let i=e.title.block?.width??0,a=e.title.block?.height??0;t.push({id:"title",x:f(e.title.x-i/2),y:f(e.title.y-a/2),w:f(i),h:f(a),shape:"rectangle",label:e.title.text,role:"labelled-mark",...g(e.title.block,e.title.x,e.title.y,p(e))})}return{version:1,nodes:t,edges:[],groups:i,bounds:{w:f(e.width),h:f(e.height)}}}),lowerScene:b(eF)});export{eW as default};
@@ -0,0 +1,3 @@
1
+ import{b as e,c as t,d as n,e as i,f as r,g as a,k as o,l as s,m as l}from"./chunk-RIVTHZAQ.js";import{a as c,b as d,c as u}from"./chunk-E2WMJZNM.js";import{e as f,f as p,g as h,h as m,i as g,j as y,k as w,l as b}from"./chunk-AMJLVPUB.js";import{g as v}from"./chunk-DF6765YX.js";import{f as x,h as $,k as k,l as S,m as j,n as M,o as E,q as C,t as O,v as F,w as N,x as I}from"./chunk-J35HAQQF.js";import{b as z,e as A,f as W}from"./chunk-X2UYKWKM.js";import{g as L,n as R}from"./chunk-TYZOZXUJ.js";import{A as D,Ab as G,B as V,Bb as B,Cb as T,Db as q,Ea as P,Eb as _,Fb as U,Ga as H,Gb as J,Hb as K,Jb as Z,Kb as Y,Lb as X,Mb as Q,Nb as ee,Pb as et,Q as en,Xb as ei,Y as er,Ya as ea,ab as eo,bb as es,cb as el,gb as ec,hb as ed,lb as eu,nb as ef,q as ep,s as eh,u as em,v as eg,vb as ey,w as ew,xb as eb,yb as ev,z as ex,zb as e$}from"./chunk-Z3FDIVLN.js";import"./chunk-N5ELX7LR.js";import{a as ek}from"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";function eS(e,t){return e.match(RegExp(`\\b${t}\\s*=\\s*(["'])(.*?)\\1`,"i"))?.[2]}function ej(e,t){return eS(e,"style")?.match(RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()??eS(e,t)}function eM(e,t,n){let i=Number.parseFloat(ej(e,t)??"");return Number.isFinite(i)?i:n}function eE(e,t){let n=ej(e,"font-weight")?.trim().toLowerCase();if(void 0===n)return t;if("normal"===n)return 400;if("bold"===n)return 700;if("bolder"===n)return t<350?400:t<550?700:900;if("lighter"===n)return t<550?100:t<750?400:700;let i=Number.parseFloat(n);return Number.isFinite(i)?i:t}function eC(e){return e.children.filter(e=>"element"===e.kind)}function eO(e,t){var n;let i="b"===t.name||"strong"===t.name,r=e.mono||(n=t.attrs,/\bclass\s*=\s*(["'])[^"']*\bmono\b/i.test(n)||/(?:^|[,\s])monospace(?:[,\s]|$)/i.test(ej(n,"font-family")??""));return{size:eM(t.attrs,"font-size",e.size),weight:i?Math.max(700,eE(t.attrs,e.weight)):eE(t.attrs,e.weight),letterSpacing:eM(t.attrs,"letter-spacing",e.letterSpacing),mono:r,fontFamily:ej(t.attrs,"font-family")??(r&&!e.mono?void 0:e.fontFamily),fontStyle:"i"===t.name||"em"===t.name||"italic"===ej(t.attrs,"font-style")?"italic":"normal"===ej(t.attrs,"font-style")?"normal":e.fontStyle}}function eF(e,t){return RegExp(`\\b${t}\\s*=`,"i").test(e)}function eN(e){return"tspan"===e.name&&["x","y","dx","dy"].some(t=>eF(e.attrs,t))}var eI=new WeakMap,ez=0,eA=new WeakMap,eW=0,eL=new WeakMap,eR=new V(128,8388608),eD=new V(128,0x1000000,e=>{eR.delete(e)}),eG=new WeakSet;function eV(e,t){let n=eI.get(e);return void 0===n&&(n=ez++,eI.set(e,n)),`${n}:${t}`}function eB(e){let t=structuredClone(e),n=new WeakSet,i=(e,t)=>{if(!(null===e||"object"!=typeof e||null===t||"object"!=typeof t||n.has(e)))if(n.add(e),er(e,t),e instanceof Map&&t instanceof Map){let n=t.entries();for(let[t,r]of e){let[e,a]=n.next().value;i(t,e),i(r,a)}}else if(e instanceof Set&&t instanceof Set){let n=t.values();for(let t of e)i(t,n.next().value)}else for(let n of Object.keys(e))i(e[n],t[n])};return i(e,t),t}function eT(e,t,n,i,r){let a={result:n,...i?{projection:i}:{}},o=2*t.length+L([a,Y(n)],0x1000000)+1024;if(o>0x1000000)return void eo("positioned-layout","store-skipped","weight-limit");let s=a;if(r){try{s=eB(a)}catch(e){if(e instanceof Error&&"DataCloneError"===e.name)return void eo("positioned-layout","store-skipped","uncloneable");throw e}X(n,s.result)}r||eA.set(s,{locallyRepeated:!1}),eD.set(eV(e,t),s,o),eG.add(s.result)}function eq(e,t,n){let i=eL.get(t);if(!n)return void eL.delete(t);if(!i||i.request!==e||eD.get(i.key)!==i.snapshot)return;let r=++eW,a=eA.get(i.snapshot);a.locallyRepeated=a.lastUse===r-1,a.lastUse=r;let o=eR.get(i.key);return o?.owner===i.snapshot?o.drawing:void 0}var eP=new Set(["rectangle","rounded","note","service","diamond","stadium","hexagon","cylinder"]),e_={journey:"x",sequence:"none",xychart:"center",quadrant:"center"};function eU(e){return e.role?"box"===e.role:eP.has(e.shape)}function eH(e,t,n,i){return Number.isFinite(e)&&Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(i)&&n>=0&&i>=0}function eJ(e,t){let n=Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x),i=Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y);return n>.5&&i>.5}function eK(e,t,n="both"){let i="center"===n?t.x+t.w/2>=e.x-.5&&t.x+t.w/2<=e.x+e.w+.5:t.x>=e.x-.5&&t.x+t.w<=e.x+e.w+.5,r="x"===n||("center"===n?t.y+t.h/2>=e.y-.5&&t.y+t.h/2<=e.y+e.h+.5:t.y>=e.y-.5&&t.y+t.h<=e.y+e.h+.5);return i&&r}function eZ(e,t,n){let i=t,r=new Set;for(;i?.parentId&&!r.has(i.id);){if(r.add(i.id),i.parentId===e.id)return!0;i=n.get(i.parentId)}return!1}var eY=new WeakMap,eX=new WeakMap,eQ=new WeakSet;function e0(e,t,n){if(Z(e,{...t,role:n}),"agentic"!==t.requested||"elk"!==t.selected||eQ.has(e))return;eQ.add(e);let i={code:"INEFFECTIVE_CONFIG",field:"graphLayout.backend",message:`Agentic graph layout declined this input; using the requested ELK fallback: ${t.reason??"candidate rejected"}`};(p(e).onConfigDiagnostic??(e=>console.warn(e.message)))(i)}var e1=new Set(["media","supports","container","layer","document"]),e5=new WeakSet;function e2(e,t,n=E()){let i=e.id.startsWith("family:"),r=C(t,i?"external":"internal",n);if(!i&&!n)return r;let a=[];i&&r.family!==e.id&&a.push({code:"SCENE_DOCUMENT",path:"scene.family",message:`external family "${e.id}" emitted a document owned by "${r.family}"`});let o=new Set(e.semanticRoles),s=new Set(e.semanticChannels),l=new Map(e.scenePrimitiveEvidence.map(e=>[`${e.role}\0${e.primitive}`,e]));if(function e(t,n,i="scene.parts"){t.forEach((t,r)=>{let a=`${i}[${r}]`;n(t,a),"group"===t.kind&&e(t.children.map(e=>e.node),n,`${a}.children`)})}(r.parts,(e,t)=>{if(!o.has(e.role))return void a.push({code:"SCENE_PRIMITIVE_CLAIM",path:`${t}.role`,message:`emitted undeclared role "${e.role}"`});for(let n of Object.keys(e.channels??{}))s.has(n)||a.push({code:"SCENE_CHANNEL_CLAIM",path:`${t}.channels.${n}`,message:`emitted undeclared semantic channel "${n}"`});for(let n of $(e)){let i=l.get(`${e.role}\0${n}`);i&&"applicable"===i.applicability&&"unsupported"!==i.realization||a.push({code:"SCENE_PRIMITIVE_CLAIM",path:t,message:`emitted undeclared ${e.role}/${n} primitive`})}}),a.length>0)throw new S(Object.freeze(a));return r}var e3=new WeakMap,e6=new WeakMap;function e8(e,t){let n=e6.get(t);n||(n=new WeakMap,e6.set(t,n));let i=n.get(e);if(i)return eo("positioned-scene","hit"),E(e)&&!i.crossChecks&&(e2(p(e).family,i.scene,!0),i.crossChecks=!0),i.scene;eo("positioned-scene","miss");let r=p(e);if(!r.family.lowerScene)throw Error(`Resolved ${e.output} family has no Scene lowering`);let a="png"===e.output&&!1!==e.appearance.colors.embedFontImport?{...e.appearance.colors,embedFontImport:!1}:e.appearance.colors,o=E(e),s=()=>r.family.lowerScene({positioned:t.positioned,colors:a,resolved:m(e)}),l=eh(r.textMeasurement,()=>e2(r.family,o||r.family.id.startsWith("family:")?s():ea(s),o));return n.set(e,{scene:l,crossChecks:o}),l}function e7(o,s){let l=p(o),c=E(o)?"scene-assertions":l.family.id.startsWith("family:")?"external-family":l.backend&&!F(l.backend.backend)?"alternate-backend":("layout"===l.mode?"default"===o.appearance.inferredBackend:"scene"===l.mode&&l.backend?.inputName==="default")?void 0:"unsupported-mode",d=c?void 0:A(l.family.lowerScene);if(d||(c??="no-native-producer"),c){eo("native-drawing","bypass",c),es("native-drawing",c);return}let u=e3.get(s);u||(u=new WeakMap,e3.set(s,u));let f=u.get(o);if(f){if(eo("native-drawing","hit"),f.producer===A(l.family.lowerScene))return f.drawing;eo("native-drawing","bypass","changed-producer"),u.delete(o)}l.backend&&I(l.backend.conformance,l.backend.inputName);let h=eq(o,s,(d=A(l.family.lowerScene))===W(l.family.lowerScene));if(h){eo("native-drawing","hit",void 0,"positioned-owner");let e=d;if(e&&e===A(l.family.lowerScene)&&e===W(l.family.lowerScene))return u.set(o,{drawing:h,producer:e,certification:h.certification}),h;eo("native-drawing","bypass","changed-producer"),eq(o,s,!1),d=A(l.family.lowerScene)}if(eo("native-drawing","miss"),!(d=A(l.family.lowerScene))){eo("native-drawing","bypass","no-native-producer"),es("native-drawing","no-native-producer");return}let g=d,y="png"===o.output&&!1!==o.appearance.colors.embedFontImport?{...o.appearance.colors,embedFontImport:!1}:o.appearance.colors,w=eh(l.textMeasurement,()=>{let c;return function(o,s,l,c){var d;let u,f,p={family:l,width:s.positioned.width,height:s.positioned.height,colors:s.colors,transparent:s.resolved.renderOptions.transparent??!1},h=a(r);l.startsWith("family:")&&h.uncertain();let m=h.snapshot(p),g=M(p),y=new WeakSet,w=e=>(h.retainFragment()&&y.add(e),Object.freeze(e)),b=e=>{let t=h.leaf(e),n=g.node(t.node);return w({kind:"leaf",node:t.node,svg:n,conditional:t.conditional,nodeCount:1,depth:0,prepared:"document"===e.kind?!/<\s*text/i.test(n):"text"!==e.kind||"prepared"===e.measurement&&void 0!==e.block})},v={shape:e=>b(ev(e)),text:e=>b(G(e)),connector:e=>b(e$(e)),documentOpen:(e,t)=>{let n=h.snapshot(e);return n?(m=Object.freeze({family:l,width:n.width,height:n.height,colors:n.colors,transparent:n.transparent}),m=h.header(m,t)):h.uncertain(),b(J(e,t))},documentContent:(e,t)=>b(B(e,t)),documentText:e=>b(T(e)),definitions:(e,t)=>b(q(e,t)),documentClose:()=>b(_()),group(t){let n=Object.getOwnPropertyDescriptor(t,"children");n&&"value"in n||h.uncertain();let{children:i,...r}=t,a=h.parts(i,k.maxNodes),o=[],s=1,l=0,c=1,d=!0,u=[];for(let e of a){let t=Object.getOwnPropertyDescriptor(e,"node"),n=Object.getOwnPropertyDescriptor(e,"indent");t&&"value"in t&&n&&"value"in n||h.uncertain();let i=Object.freeze({node:e.node,indent:e.indent});o.push(i),y.has(i.node)||h.uncertain(),u.push(i.node),s+=i.node.nodeCount,l+=i.node.svg.length,c=Math.max(c,1+i.node.depth),d=d&&i.node.prepared}if(s>k.maxNodes)throw RangeError("Native drawing contains too many emitted nodes");if(l>k.maxSerializationBytesPerNode)throw RangeError("Native group has an oversized SVG serialization");let f=U({...r,children:[]});g.node(f),g.depth(c);let p=h.snapshot(f),m=p?h.group(p):void 0,b=p?.identity??{id:f.id,role:f.role};for(let e of u)"leaf"!==e.kind||"shape"!==e.node.kind||e.node.identity||g.enclosure(e.node.id,b);let v=[f.open];for(let e of o)v.push(ey(e.node.svg,e.indent));v.push(f.close);let x=v.join(f.join);return g.serialization(x),w({kind:"group",svg:x,children:Object.freeze(u),matrix:m,own:b,owner:p?.owner,conditional:!p||"conditional"===f.visibility,opacity:e(p?.paint?.opacity),nodeCount:s,depth:c,prepared:!/<\s*text/i.test(f.open+f.close)&&d})},pathArtwork:e=>K(v,e)},x=ea(()=>o(v,s));for(let e of["parts","family","width","height","colors","transparent"]){let t=Object.getOwnPropertyDescriptor(x,e);t&&"value"in t||h.uncertain()}let $=h.parts(x.parts,k.maxNodes);for(let e of $)y.has(e)||h.uncertain();let E=g.finish();if(!E.valid)throw new S(E.diagnostics);let C=0,F=-1,N=!0;for(let e of $)C+=e.nodeCount,F+=e.svg.length+1,N=N&&e.prepared;if(C>k.maxNodes)throw RangeError("Native drawing contains too many emitted nodes");if(F>k.maxFinalSvgBytes)throw RangeError("Native drawing exceeds the final SVG limit");let I=O(x,{seed:0,...c?{style:c}:{}}),z=$.map((e,t)=>0===t&&I?`${e.svg}
2
+ ${I}`:e.svg).join(`
3
+ `);j(z,"native drawing output");let A=m??Object.freeze({...p,colors:Object.freeze({bg:"none",fg:"none"})}),W=h.snapshot({family:x.family,width:x.width,height:x.height,colors:x.colors,transparent:x.transparent}),L=Object.freeze({...A,family:W?.family??l});W&&h.same({...W,width:Number(en(W.width)),height:Number(en(W.height))},L)||h.uncertain();let R=(d=h.observe,u=i(L),f=[],function e(i,r,a){for(let o=0;o<i.length;o++){let s=i[o],l=`${r}.${o}`;if("group"===s.kind){f.push(s);let i,r=1,o;for(let e=f.length-1;e>=0;e--){let n=f[e];(void 0!==n.matrix||void 0!==i)&&(i=H(n.matrix??P,i??P)),r=t(n.opacity,r),n.conditional&&(o=!0)}let c=n(a?.ancestors,s.own),d=s.owner?.id===s.own.id&&s.owner.role===s.own.role?c.at(-1):s.owner;e(s.children,l,{parentMatrix:i,ancestors:c,owner:d,conditional:o,groupOpacity:r}),f.pop()}else if(a){let e=!s.conditional&&d(s.node,s.svg);u.leaf(s.node,l,a.parentMatrix,a.ancestors,a.conditional||!e,a.groupOpacity,s.node.owner??a.owner)}else{let e=!s.conditional&&d(s.node,s.svg);u.leaf(s.node,l,void 0,void 0,!e)}}}($,"scene"),u.finish());return h.finish(R,L),Object.freeze({svg:z,header:L,preparedText:N,paint:R})}(g,{positioned:(c=eX.get(s))&&c!==g?eB(s.positioned):s.positioned,colors:y,resolved:m(o)},l.family.id,o.appearance.styled?o.appearance.style:void 0)});return u.set(o,{drawing:w,producer:g,evidence:w}),w}function e4(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function e9(e,t,n){return(await te(e,t,n)).svg}async function te(e,t,n){"default"!==w(t=y(t))&&await import("./builtin-backends-7SOZZHPF.js"),v(n);let i,r=new Map;for(;;)try{return i??=Q("request",()=>b(e,t,"svg",void 0,{expectedFamilyId:n.id,familyDescriptor:n})),function(e){return el(()=>(function(e){var t;!function(e){if(e5.has(e))return;e5.add(e);let t=p(e),n=t.configDiagnostics??[];if(0===n.length)return;let i=t.onConfigDiagnostic??(e=>console.warn(e.message));for(let e of n)i(e)}(e);let n=[],i=(t=Q("layout",()=>{let t,n,i,r;return n=A((t=p(e)).family.lowerScene),i="scene"===t.mode&&N(t.backend?.backend)&&z(t.family)&&!t.textMeasurement&&!!n&&n===W(t.family.lowerScene)&&!E(e),r=function(e,t,n,i,r){let a=p(t),o=a.family;if(o.id!==e)throw Error(`Resolved request planned family ${o.id}, not ${e}`);if(!o.layout)throw Error(`No layout registered for Mermaid family ${e}`);let s=!e.startsWith("family:"),l=`${e}:final`;if(s&&!o.projectPositioned)throw new ee([{strategy:l,violations:["missing final geometry projection"]}]);let c=m(t),d=globalThis.process?.env,u=D("position-cache")&&s&&"gantt"!==e&&!a.textMeasurement&&(d?.AGENTIC_MERMAID_ELK_CACHE??globalThis.AGENTIC_MERMAID_ELK_CACHE)!=="0",f=u&&n===t.source?{...n,cleanup:void 0}:n,h=u?JSON.stringify([f,t.renderOptions,t.appearance,t.familyConfig,i,"class"===e?c.paintBackendId??"backend:default":void 0,Object.entries(d??{}).filter(([e])=>e.startsWith("APL_")).sort(),ex.map(D)]):void 0,g=void 0!==h&&h.length<=65536?h:void 0;return void 0===g&&eo("positioned-layout","bypass",D("position-cache")?s?"gantt"===e?"time-dependent-family":a.textMeasurement?"custom-text-measurement":void 0===h?"elk-cache-disabled":"key-limit":"external-family":"disabled"),eh(a.textMeasurement,()=>{var a,d;let u="ascii"===t.output||"unicode"===t.output||"html"===t.output?"companion":"primary";if(r&&void 0!==g){let e=function(e,t,n){let i=eV(e,t),r=eD.get(i);if(eo("positioned-layout",r?"hit":"miss"),n&&r&&eA.has(r)){let e=Object.freeze({...r.result});return X(r.result,e),eL.set(e,{key:i,snapshot:r,request:n}),eG.add(e),{...r,result:e}}return r}(o,g,"svg"===t.output?t:void 0);if(e?.projection){for(let n of Y(e.result))e0(t,n,u);return eY.set(e.result,e.projection),e.result}}let f=void 0===g?void 0:function(e,t,n=!1){let i=eD.get(eV(e,t));if(n||eo("positioned-layout",i?"hit":"miss"),!i)return;let r=eB(i.result);return X(i.result,r),r}(o,g,r),p=[],h=f??("positioned"in(a=ei(e=>{p.push(e),e0(t,e,u)},()=>o.layout({source:n,renderOptions:c.renderOptions,...c.styleFace?{styleFace:c.styleFace}:{},...c.paintBackendId?{paintBackendId:c.paintBackendId}:{},...c.familyConfig?{familyConfig:c.familyConfig}:{},...c.familyAppearance?{familyAppearance:c.familyAppearance}:{}})))?a:{positioned:a});if(f)for(let e of Y(f))e0(t,e,u);else for(let e of p)Z(h,e);if(s)try{let t=o.projectPositioned({positioned:h.positioned,options:i}),n=(d={...t,kind:e},function(e){let t=[];eH(0,0,e.bounds.w,e.bounds.h)||t.push({metric:"nonFiniteGeometry",detail:`bounds ${e.bounds.w}\xd7${e.bounds.h}`});let n=(n,i,r)=>{r&&(eH(r.x,r.y,r.w,r.h)?(r.x<-.5||r.y<-.5||r.x+r.w>e.bounds.w+.5||r.y+r.h>e.bounds.h+.5)&&t.push({metric:"offCanvas",detail:"node"===n?`node ${i} at (${r.x},${r.y}) ${r.w}\xd7${r.h}`:`${n} ${i}`}):t.push({metric:"nonFiniteGeometry",detail:`${n} ${i}`}))};for(let t of e.nodes)n("node",t.id,t);for(let t of e.nodes)"hidden"!==t.labelVisibility&&"semantic"!==t.labelVisibility&&n("label",t.id,t.labelBounds);for(let t of e.edges)n("label",t.id,t.label?.bounds);for(let t of e.labels??[])"hidden"!==t.visibility&&"semantic"!==t.visibility&&n("label",t.id,t.bounds);for(let n of e.edges){let i=!1;for(let[r,a]of n.path){if(!Number.isFinite(r)||!Number.isFinite(a)){t.push({metric:"nonFiniteGeometry",detail:`edge ${n.id} path`}),i=!0;break}!i&&(r<-.5||a<-.5||r>e.bounds.w+.5||a>e.bounds.h+.5)&&(t.push({metric:"offCanvas",detail:`edge ${n.id} point (${r},${a})`}),i=!0)}}for(let t of e.groups)n("group",t.id,t);let i=e.nodes.filter(eU);for(let e=0;e<i.length;e++)for(let n=e+1;n<i.length;n++){let r=i[e],a=i[n];eH(r.x,r.y,r.w,r.h)&&eH(a.x,a.y,a.w,a.h)&&eJ(r,a)&&t.push({metric:"nodeOverlaps",detail:`${r.id} overlaps ${a.id}`})}let r=e_[e.kind]??"both",a=new Map(e.groups.map(e=>[e.id,e]));if("none"!==r){let n=new Map(e.nodes.map(e=>[e.id,e]));for(let i of e.groups){let e=i.parentId?a.get(i.parentId):void 0;for(let a of(e&&eH(i.x,i.y,i.w,i.h)&&eH(e.x,e.y,e.w,e.h)&&(eK(e,i,r)||t.push({metric:"groupBreaches",detail:`${i.id} outside parent ${e.id}`})),i.members)){let e=n.get(a);!e||!eH(e.x,e.y,e.w,e.h)||eK(i,e,r)||t.push({metric:"groupBreaches",detail:`${a} outside ${i.id}`})}}}for(let n=0;n<e.groups.length;n++)for(let i=n+1;i<e.groups.length;i++){let r=e.groups[n],o=e.groups[i];!eH(r.x,r.y,r.w,r.h)||!eH(o.x,o.y,o.w,o.h)||eJ(r,o)&&(eK(r,o)||eK(o,r)||eZ(r,o,a)||eZ(o,r,a)||t.push({metric:"groupOverlaps",detail:`${r.id} partially overlaps ${o.id}`}))}return{violations:t,groupById:a}}(d).violations);if(n.length)throw new ee([{strategy:l,violations:n.map(e=>`${e.metric}: ${e.detail}`)}]);eY.set(h,t)}catch(e){throw e instanceof ee?e:new ee([{strategy:l,violations:[e instanceof Error?e.message:String(e)]}])}return f||void 0===g||(r&&"svg"===t.output&&("sequence"===e||"flowchart"===e||"state"===e)?function(e,t,n,i){eT(e,t,n,i,!1)}:function(e,t,n,i){eT(e,t,n,i,!0)})(o,g,h,eY.get(h)),h})}(t.family.id,e,e.source,{},i),i&&eG.has(r)&&eX.set(r,n),r}),eh(p(e).textMeasurement,()=>(function(e,t,n,i){let r,a,h=p(e);if("scene"!==h.mode&&"family-svg"!==h.mode||!h.executionDecision)throw Error(`Resolved ${e.output} request has no graphical execution plan`);let g=e.renderOptions,y=h.family,w=(r=e.appearance.colors,a="png"===e.output&&!1!==r.embedFontImport?{...r,embedFontImport:!1}:r,{positioned:t.positioned,colors:a,resolved:m(e)}),b,v=!1,$;if("scene"===h.mode){let n=i?void 0:Q("drawing",()=>e7(e,t)),r=n?void 0:Q("scene",()=>(function(e,t){if("scene"!==p(e).mode)throw Error(`Resolved ${e.output} request has no Scene execution plan`);return e8(e,t)})(e,t));if($=Q("paint-certification",()=>(function(e,t){let n=e3.get(t)?.get(e)?.drawing??e7(e,t);if(n){let i=e3.get(t).get(e);if(eo("paint-certification",i.certification?"hit":"miss",void 0,"native"),i.certification)return i.certification;let r=i.evidence,a=s(r.header,r.paint,eY.get(t),{outputSupported:!e.appearance.colors.shadow});i.certification=a;let o=Object.freeze({svg:n.svg,preparedText:n.preparedText,certification:a}),l=p(e).family.lowerScene;return i.producer===A(l)&&i.producer===W(l)?function(e,t,n){let i=eL.get(t);if(!i||i.request!==e||eD.get(i.key)!==i.snapshot)return;let r=eA.get(i.snapshot);if(r.oversized)return eo("native-drawing","store-skipped","weight-limit");let a=r.drawingWeight??2*i.key.length+4*n.svg.length+1024,o=eR.leastRecentlyUsed(),s=o&&eA.get(o.owner)?.lastUse,l=void 0!==s&&eW-s>=128;if(!r.locallyRepeated&&!l&&!eR.canFit(i.key,a))return eo("native-drawing","store-skipped","drawing-budget");let c={owner:i.snapshot,drawing:n},d=2*i.key.length+L(n,8388608)+1024;if(r.drawingWeight=d,d>8388608){r.oversized=!0,eo("native-drawing","store-skipped","weight-limit");return}r.locallyRepeated||l||eR.canFit(i.key,d)?eR.set(i.key,c,d):eo("native-drawing","store-skipped","drawing-budget")}(e,t,o):(eo("native-drawing","store-skipped","changed-producer"),eq(e,t,!1)),a}let i=e8(e,t),r=e6.get(t).get(e);if(eo("paint-certification",r.certification?"hit":"miss",void 0,"scene"),r.certification)return r.certification;let a=p(e),l=!e.appearance.colors.shadow&&("layout"===a.mode?"default"===e.appearance.inferredBackend:"scene"===a.mode&&a.backend?.inputName==="default");return r.certification=o(i,eY.get(t),{outputSupported:l})})(e,t)),"strict"===g.layoutSafety&&"passed"!==$.status||"failed"===$.status&&h.backend?.inputName==="default")throw new l($);b=n?.svg??Q("backend",()=>{let t={seed:g.seed??0,...e.appearance.styled?{style:e.appearance.style}:{}};return i?.begin(t,r),h.backend.backend.render(r,t)}),v=h.backend?.inputName==="default"&&!y.id.startsWith("family:")&&(n?.preparedText??eb(r))}else{if("strict"===g.layoutSafety)throw new f("Strict layout safety requires native Scene evidence");b=Q("backend",()=>y.renderSvg(w))}j(b,"backend/family SVG output");let k=R(b,w.colors);$?.repairs.length&&h.backend?.inputName==="default"&&(k=function(e,t){let n=ec(e);if(!n)throw Error("Cannot certify a graphical output with no SVG root");let i=e.slice(n.start,n.end).replace(/\sviewBox="[^"]*"/g,""),r=` viewBox="${t.x} ${t.y} ${t.width} ${t.height}"`;return ef(e,n,i.slice(0,-1)+r+">")}(k,$.viewport)),j(k,"color-resolved SVG output"),v||(k=function(e,t){let n=function(e){let t=[],n=[],i=0;for(;i<e.length;){let r=e.indexOf("<",i);if(r<0){n.length>0&&i<e.length&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(i)}),i=e.length;break}if(n.length>0&&r>i&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(i,r)}),e.startsWith("\x3c!--",r)){let t=e.indexOf("--\x3e",r+4);if(t<0)return null;i=t+3;continue}let a=function(e,t){let n="";for(let i=t+1;i<e.length;i++){let t=e[i];if(n){t===n&&(n="");continue}if('"'===t||"'"===t){n=t;continue}if(">"===t)return i}return -1}(e,r);if(a<0)return null;let o=e.slice(r,a+1);if(/^<\?/.test(o)||/^<!/.test(o)){i=a+1;continue}let s=o.match(/^<\/\s*([\w:-]+)\s*>$/);if(s){let e=n.pop();if(!e||e.name!==s[1].toLowerCase())return null;e.closeStart=r,i=a+1;continue}let l=o.match(/^<\s*([\w:-]+)([\s\S]*?)(\/?)>$/);if(!l)return null;let c={kind:"element",name:l[1].toLowerCase(),attrs:l[2],openEnd:a+1,closeStart:a+1,children:[]};n.length>0?n[n.length-1].children.push(c):t.push(c),"/"!==l[3]&&n.push(c),i=a+1}return 0===n.length?t:null}(e);if(!n)return e;let i=[],r={size:0,weight:400,letterSpacing:0,mono:!1,fontStyle:"normal",fontFamily:t},a=(e,t,n,r=!1)=>{if(eF(e.attrs,"data-prepared-text"))return;let o=eO(t,e),s=r||eF(e.attrs,"data-literal-text"),l="text"===e.name&&!n,c=l||n&&eN(e);if(c&&eF(e.attrs,"textLength"))return;if(c&&!(l&&function e(t){return eC(t).some(t=>eN(t)||e(t))}(e))){let n,r,a,o=(n=[],r=!1,(a=(e,t,i)=>{let o=eO(t,e);if(!(!i&&eN(e))){if(!i&&eF(e.attrs,"textLength")){r=!0;return}for(let t of e.children)if("text-node"===t.kind){let e=ek(t.raw);e.length>0&&n.push({text:e,metrics:o})}else a(t,o,!1)}})(e,t,!0),{runs:n,blocked:r}),l=o.blocked?null:function(e,t=!1){let n=e.filter(e=>e.text.length>0);if(0===n.length||n.every(e=>0===e.text.trim().length))return null;let i=0,r=0,a=0;for(let e of n){if(!(e.metrics.size>0))return null;let n=ep(e.text).length;r>0&&n>0&&(i+=a),i+=e.metrics.mono?eg(e.text,e.metrics.size,e.metrics.letterSpacing,e.metrics.weight,e.metrics.fontStyle,e.metrics.fontFamily):t?em(e.text,e.metrics.size,e.metrics.weight,e.metrics.fontStyle,e.metrics.fontFamily)+Math.max(0,n-1)*e.metrics.letterSpacing:ew(e.text,e.metrics.size,e.metrics.weight,e.metrics.letterSpacing,e.metrics.fontStyle,e.metrics.fontFamily),r=n,a=e.metrics.letterSpacing}return Math.round(1e3*i)/1e3}(o.runs,s);null!==l&&i.push({offset:e.openEnd-1,text:` textLength="${l}" lengthAdjust="spacingAndGlyphs" data-font-metrics="deterministic-fit"`})}let d=n||l;for(let t of eC(e))a(t,o,d,s)};for(let e of n)a(e,r,!1);let o=e;for(let e of i.sort((e,t)=>t.offset-e.offset))o=o.slice(0,e.offset)+e.text+o.slice(e.offset);return o}(k,e.appearance.font)),j(k,"font-geometry-fitted SVG output");let S=g.idPrefix??"";S&&j(k=u(k,S),"namespaced SVG output");let M=e.source.accessibility,E="c4"===y.id?"C4 architecture diagram":void 0;(t.injectAccessibility??!0)&&(M.title||M.descr||E)&&j(k=function(e,t,n,i){let r=`${n}svg-title`,a=`${n}svg-desc`,o=[],s=[];if(t.title&&(o.push(`aria-labelledby="${r}"`),s.push(`<title id="${r}">${e4(t.title)}</title>`)),t.descr&&(o.push(`aria-describedby="${a}"`),s.push(`<desc id="${a}">${e4(t.descr)}</desc>`)),0===s.length&&!i)return e;let l=ec(e);if(!l||ed(l,"aria-labelledby")||ed(l,"aria-describedby"))return e;!i||t.title||ed(l,"aria-label")||o.push(`aria-label="${e4(i).replace(/"/g,"&quot;")}"`);let c=`${ed(l,"role")?"":' role="img"'} ${o.join(" ")}`,d=e.slice(l.start,l.end);return ef(e,l,`${d.slice(0,-1)}${c}>${s.join("")}`)}(k,M,S,E),"accessibility-projected SVG output"),i&&(k=i.finish(k)),j(k=function(e){let t=ec(e);if(!t)return e;let n=eu(e);if(0===n.length)return e;let i=`am-${function(e){let t=0xdeadbeef,n=0x41c6ce57;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);t=Math.imul(t^r,0x9e3779b1),n=Math.imul(n^r,0x5f356495)}return t=Math.imul(t^t>>>16,0x85ebca6b)^Math.imul(n^n>>>13,0xc2b2ae35),n=Math.imul(n^n>>>16,0x85ebca6b)^Math.imul(t^t>>>13,0xc2b2ae35),`${(n>>>0).toString(36).padStart(7,"0")}${(t>>>0).toString(36).padStart(7,"0")}`}(e)}`,r=e;for(let e=n.length-1;e>=0;e--){let t=n[e];r=`${r.slice(0,t.start)}${function e(t,n){let i="",r=0,a=0,o,s=0;for(;r<t.length;){let l=t[r];if(o){"\\"===l?r++:l===o&&(o=void 0),r++;continue}if("/"===l&&"*"===t[r+1]){let e=t.indexOf("*/",r+2);r=e<0?t.length:e+2;continue}if('"'===l||"'"===l)o=l;else if("("===l)s++;else if(")"===l)s=Math.max(0,s-1);else if(";"===l&&0===s)i+=t.slice(a,r+1),a=r+1;else if("{"===l&&0===s){let o=function(e,t){let n=0,i;for(let r=t;r<e.length;r++){let t=e[r];if(i)"\\"===t?r++:t===i&&(i=void 0);else if("/"===t&&"*"===e[r+1]){let t=e.indexOf("*/",r+2);if(t<0)return e.length;r=t+1}else if('"'===t||"'"===t)i=t;else if("{"===t)n++;else if("}"===t&&0==--n)return r}return e.length}(t,r);i+=function(t,n,i){let r=t.match(/^(?:\s*\/\*[\s\S]*?\*\/)*/)[0],a=t.slice(r.length),o=/^\s*@([\w-]+)/.exec(a);if(o){let r=o[1].toLowerCase(),a=e1.has(r)?e(n,i):n;return`${t}{${a}}`}let s=(function(e){let t=[],n=0,i,r=0;for(let a=0;a<e.length;a++){let o=e[a];i?"\\"===o?a++:o===i&&(i=void 0):'"'===o||"'"===o?i=o:"("===o||"["===o?n++:")"===o||"]"===o?n--:","===o&&0===n&&(t.push(e.slice(r,a)),r=a+1)}return t.push(e.slice(r)),t})(a).map(e=>{let t,n;return t=e.match(/^\s*/)[0],0===(n=e.slice(t.length)).length?e:/^svg(?![\w-])/.exec(n)?`${t}svg.${i}${n.slice(3)}`:`${t}.${i} ${n}`}).join(",");return`${r}${s}{${n}}`}(t.slice(a,r),t.slice(r+1,o),n),a=r=o+1;continue}r++}return i+t.slice(a)}(r.slice(t.start,t.end),i)}${r.slice(t.end)}`}let a=r.slice(t.start,t.end),o=ed(t,"class"),s=o?`${a.slice(0,o.valueEnd-t.start)}${o.value?" ":""}${i}${a.slice(o.valueEnd-t.start)}`:`${a.slice(0,-1)} class="${i}">`;return ef(r,t,s)}(c(k)),"style-scoped SVG output"),g.compact&&j(k=d(k),"compacted SVG output");let C="png"===e.output?"strict":g.security,O=Q("svg-security",()=>x(k,C));return n.push(...O.diagnostics),j(k=O.svg,"final SVG output"),Object.freeze({svg:k,executionDecision:h.executionDecision,...$?{layoutCertification:$}:{}})})(e,t,n,void 0)));return function(e,t,n){let i=Object.hasOwn(t,"layoutCertification")?t.layoutCertification:void 0;return function(e,t){let n=t,i;return Object.freeze({svg:e,get receipt(){return void 0===i&&(i=n(),n=void 0),i}})}(t.svg,()=>{var r;let a=(j(r=t.svg,"graphical projection digest input"),g(JSON.stringify(r)));return Object.freeze({...h(e,n),graphicalProjectionDigest:a,executionDecision:t.executionDecision,...i?{layoutCertification:Object.freeze({...i,outputDigest:a})}:{}})})}(e,i,n)})(e))}(i)}catch(i){let e=et(i),t=e?e.load:i?.loadHtmlEntityTable,n=e?"ELK"===e.dependency||"YAML"===e.dependency||"Agentic layout"===e.dependency||"Forest layout"===e.dependency?e.dependency:void 0:"function"==typeof t?"HTML entities":void 0;if(!n||"function"!=typeof t||r.has(n)||[...r.values()].includes(t))throw i;r.set(n,t),await t()}}export{e9 as renderLoadedFamilySvg,te as renderLoadedFamilySvgWithReceipt};
@@ -0,0 +1,19 @@
1
+ import{a as e,b as t,d as i}from"./chunk-ICC7HBJX.js";import{a as r}from"./chunk-BY2CPG6B.js";import"./chunk-SZELX2EJ.js";import{b as s,c as n,e as o,f as l,p as a}from"./chunk-2SH76OTH.js";import{d as c}from"./chunk-AMJLVPUB.js";import{s as d,u as h,v as m}from"./chunk-DF6765YX.js";import"./chunk-J35HAQQF.js";import{a as p,b as u,c as f}from"./chunk-CN7WTBWB.js";import{C as y,D as g,a as b,b as w,c as _,d as x,e as q,g as k,i as S}from"./chunk-HLWUNUCM.js";import{M as R,N as v,aa as T,c as E,ca as C,qa as N}from"./chunk-X2UYKWKM.js";import{j as I,k as A,r as M,u as D}from"./chunk-TYZOZXUJ.js";import{h as L,l as $,n as O,o as z}from"./chunk-NO7ZIVRU.js";import{$ as W,M as F,Mb as P,N as j,Yb as U,Z as B,da as V,o as H}from"./chunk-Z3FDIVLN.js";import{N as Y}from"./chunk-N5ELX7LR.js";import"./chunk-5UVGUSD6.js";import"./chunk-CSFUKSU6.js";var X=Object.freeze({id:"requirement",upstreamId:"requirement",maturity:"stable",label:"Requirement",headers:["requirementDiagram","requirement"],aliases:[],config:{section:"requirement",keys:["rect_fill","text_color","rect_border_size","rect_border_color","rect_min_width","rect_min_height","maxWidth","fontSize","rect_padding","line_height","nodeSpacing","rankSpacing","useMaxWidth","look","theme"],noopKeys:["useMaxWidth","look","theme"]},identity:{id:"family:requirement",kind:"family",version:"1.0.0",compatibility:{core:"0.5.3"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:[],semanticRoles:["prelude","title","chrome","node","label","relationship","attribute","edge-label","defs"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"node",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"node",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"relationship",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"attribute",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"edge-label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"edge-label",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"marker",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`requirementDiagram
2
+ requirement fast {
3
+ id: 1
4
+ text: Respond within 100ms
5
+ risk: high
6
+ verifymethod: test
7
+ }
8
+ element benchmark {
9
+ type: "test"
10
+ }
11
+ benchmark - verifies -> fast`,detect:Y,detectLoose:Y}),K=class extends Error{constructor(e,t,i){super(e)}};function G(e,t,i=0,r="",s=!1){let n=t.slice(0,i).split(/\r\n?|\n/),o=n.length,l=n.at(-1).length+1;return Error(`${e} ${s?"lexical":"parse"} error at line ${o}, column ${l}: ${r||"unrecognized input"}`)}var Q=class{type="requirement";direction="TB";requirements=new Map;elements=new Map;relations=[];classes=new Map;authoredStyles=new Map;title;accTitle;accDescr;newId="";newText="";newRisk="";newVerifyMethod="";newElementType="";newDocRef="";styleCopies=0;copy(e,t){if(this.styleCopies+=t.length,this.styleCopies>1e6)throw new K("Requirement diagram applies too many style declarations.","limit",{type:"requirement"});for(let i of t)e.push(i)}setDirection(e){this.direction=e,q("requirement")&&S("requirement","setDirection",e)}addRequirement(e,t){let i=this.requirements.get(e);return void 0===i&&(R("nodes",this.requirements.size+this.elements.size+1),i={name:e,type:t,requirementId:this.newId,text:this.newText,risk:this.newRisk,verifyMethod:this.newVerifyMethod,cssStyles:[],classes:["default"]},this.requirements.set(e,i),q("requirement")&&S("requirement","addRequirement",i)),this.newId=this.newText=this.newRisk=this.newVerifyMethod="",i}setNewReqId(e){this.newId=e,q("requirement")&&S("requirement","setNewReqId",e)}setNewReqText(e){this.newText=e,q("requirement")&&S("requirement","setNewReqText",e)}setNewReqRisk(e){this.newRisk=e,q("requirement")&&S("requirement","setNewReqRisk",e)}setNewReqVerifyMethod(e){this.newVerifyMethod=e,q("requirement")&&S("requirement","setNewReqVerifyMethod",e)}addElement(e){let t=this.elements.get(e);return void 0===t&&(R("nodes",this.requirements.size+this.elements.size+1),t={name:e,type:this.newElementType,docRef:this.newDocRef,cssStyles:[],classes:["default"]},this.elements.set(e,t),q("requirement")&&S("requirement","addElement",t)),this.newElementType=this.newDocRef="",t}setNewElementType(e){this.newElementType=e,q("requirement")&&S("requirement","setNewElementType",e)}setNewElementDocRef(e){this.newDocRef=e,q("requirement")&&S("requirement","setNewElementDocRef",e)}addRelationship(e,t,i){R("edges",this.relations.length+1),this.relations.push({type:e,src:t,dst:i}),q("requirement")&&S("requirement","addRelationship",{type:e,src:t,dst:i})}node(e){return this.requirements.get(e)??this.elements.get(e)}setCssStyle(e,t){for(let i of e){let e=this.authoredStyles.get(i)??[];this.copy(e,t),this.authoredStyles.set(i,e)}for(let i of e){let e=this.node(i);if(!t||!e)return;for(let r of((e.directStyles??=[]).push(...t.flatMap(e=>e.split(","))),t))this.copy(e.cssStyles,r.includes(",")?r.split(","):[r]),q("requirement")&&S("requirement","setCssStyle",{id:i,style:r,node:e})}}setClass(e,t){for(let i of e){let e=this.node(i);if(e)for(let r of t){e.classes.push(r),q("requirement")&&S("requirement","setClass",{id:i,className:r});let t=this.classes.get(r)?.styles;t&&this.copy(e.cssStyles,t)}}}defineClass(e,t){for(let i of e){let e=this.classes.get(i);for(let r of(void 0===e&&(e={id:i,styles:[],textStyles:[]},this.classes.set(i,e)),t))r.includes("color")&&e.textStyles.push(r.replace("fill","bgFill")),e.styles.push(r);q("requirement")&&S("requirement","defineClass",e);let r=t.flatMap(e=>e.split(","));for(let e of this.requirements.values())e.classes.includes(i)&&this.copy(e.cssStyles,r);for(let e of this.elements.values())e.classes.includes(i)&&this.copy(e.cssStyles,r)}}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,""),q("requirement")&&S("requirement","setAccTitle",this.accTitle)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
12
+ `),q("requirement")&&S("requirement","setAccDescription",this.accDescr)}},Z=["$end","INVALID","title","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","direction_tb","direction_bt","direction_rl","direction_lr","NEWLINE","EOF","RD","STRUCT_START","STRUCT_STOP","STYLE_SEPARATOR","COLONSEP","ID","TEXT","RISK","VERIFYMTHD","REQUIREMENT","FUNCTIONAL_REQUIREMENT","INTERFACE_REQUIREMENT","PERFORMANCE_REQUIREMENT","PHYSICAL_REQUIREMENT","DESIGN_CONSTRAINT","LOW_RISK","MED_RISK","HIGH_RISK","VERIFY_ANALYSIS","VERIFY_DEMONSTRATION","VERIFY_INSPECTION","VERIFY_TEST","ELEMENT","CONTAINS","COPIES","DERIVES","SATISFIES","VERIFIES","REFINES","TRACES","TYPE","DOCREF","STYLE","CLASSDEF","CLASS","ALPHA","COLON","SEMICOLON","PERCENT","MINUS","BRKT","END_ARROW_L","END_ARROW_R","LINE","qString","unqString","COMMA"],J=new Map([["requirementdiagram",14],["id",19],["text",20],["risk",21],["verifymethod",22],["requirement",23],["functionalrequirement",24],["interfacerequirement",25],["performancerequirement",26],["physicalrequirement",27],["designconstraint",28],["low",29],["medium",30],["high",31],["analysis",32],["demonstration",33],["inspection",34],["test",35],["element",36],["contains",37],["copies",38],["derives",39],["satisfies",40],["verifies",41],["refines",42],["traces",43],["type",44],["docref",45],["style",46],["classdef",47],["class",48]]);function ee(e){return e<128?32===e||e>=9&&e<=13:160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e||65279===e}function et(e){return 10===e||13===e||8232===e||8233===e}function ei(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||95===e}var er=/accTitle\s*:\s*/iy,es=/accDescr\s*:\s*/iy,en=/accDescr\s*\{\s*/iy,eo=/direction\s+(?:(TB)|(BT)|(RL)|LR)/gi,el=/[\n\r\u2028\u2029]/g,ea=new Uint8Array(128);for(let e of`:,\r
13
+ {<>-=`)ea[e.charCodeAt(0)]=1;function ec(e,t){let i=e.length,r=[],s=[],n=[],o=[],l=0,a=!1,c=0,h=[[],[],[],[]],m=[[],[],[],[]],p=[0,0,0,0],u=!1,f=-1;eo.lastIndex=0;for(let t=eo.exec(e);null!==t;t=eo.exec(e)){let e=void 0!==t[1]?0:void 0!==t[2]?1:void 0!==t[3]?2:3;h[e].push(t.index),m[e].push(eo.lastIndex),u=!0}let y=(t,i,o)=>{r.push(t),s.push(e.slice(i,o)),n.push(i),c=o},g=e=>{o.push(l),l=e},b=()=>{o.length>0&&(l=o.pop())},w=(t,i)=>(t.lastIndex=i,t.test(e)?t.lastIndex:-1),_=t=>{let r=d(e,t);return -1===r?i:r},x=o=>{let l=32|o;if(116===l&&"itle"===e.slice(c+1,c+5).toLowerCase()&&ee(e.charCodeAt(c+5))){let t=c+6;for(;t<i;){let i=e.charCodeAt(t);if(35===i||10===i||13===i||59===i)break;t++}if(t>c+6)return y(2,c,t),!0}if(97===l&&(32|e.charCodeAt(c+1))==99&&(32|e.charCodeAt(c+2))==99){let e;if((e=w(er,c))>=0)return g(3),y(3,c,e),!0;if((e=w(es,c))>=0)return g(4),y(5,c,e),!0;if((e=w(en,c))>=0)return g(5),c=e,!0}if(u&&!et(o)&&(()=>{if(f<c){el.lastIndex=c,f=el.test(e)?el.lastIndex-1:i;for(let e=0;e<4;e++){let t=h[e],i=p[e];for(;i<t.length&&t[i]<=f;)i++;p[e]=i}}for(let e=0;e<4;e++){let t=p[e]-1;if(t>=0&&h[e][t]>=c)return y(8+e,c,_(m[e][t])),!0}return!1})())return!0;if(10===o||13===o){let t=c;for(;t<i;){let i=e.charCodeAt(t);if(10===i)t++;else if(13===i)t+=10===e.charCodeAt(t+1)?2:1;else break}return y(12,c,t),!0}if(ee(o)){for(c++;c<i&&ee(e.charCodeAt(c))&&!et(e.charCodeAt(c));)c++;return!0}if(35===o||37===o)return e.startsWith("%%",c)&&t?.(c,_(c)),c=_(c),!0;if(ei(o)){let t=c+1;for(;t<i&&ei(e.charCodeAt(t));)t++;if(t-c<=22){let i=J.get(e.slice(c,t).toLowerCase());if(void 0!==i)return(46===i||47===i||48===i)&&(a=!1,g(2)),y(i,c,t),!0}for(;t<i;){let i=e.charCodeAt(t);if(i<128&&1===ea[i])break;t++}return r.push(59),s.push(e.slice(c,t).trim()),n.push(c),c=t,!0}switch(o){case 123:return y(15,c,c+1),!0;case 125:return y(16,c,c+1),!0;case 58:return 58===e.charCodeAt(c+1)&&58===e.charCodeAt(c+2)?y(17,c,c+3):y(18,c,c+1),!0;case 60:return 45===e.charCodeAt(c+1)&&(y(55,c,c+2),!0);case 45:return 62===e.charCodeAt(c+1)?y(56,c,c+2):y(57,c,c+1),!0;case 34:return g(1),c++,!0;case 44:return y(60,c,c+1),!0}return!1},q=t=>{if(ei(t)){let t=c+1;for(;t<i&&ei(e.charCodeAt(t));)t++;let r=t;for(;r<i&&ee(e.charCodeAt(r))&&!et(e.charCodeAt(r));)r++;if(a&&40===e.charCodeAt(r)){t=r;let s=0;for(;t<i;){let i=e.charCodeAt(t);if(et(i)||0===s&&(44===i||59===i))break;40===i?s++:41===i&&(s=Math.max(0,s-1)),t++}}return y(49,c,t),!0}switch(t){case 58:return a=!0,y(50,c,c+1),!0;case 59:return a=!1,y(51,c,c+1),!0;case 37:return y(52,c,c+1),!0;case 45:return y(53,c,c+1),!0;case 35:return y(54,c,c+1),!0;case 32:return c++,!0;case 34:return g(1),c++,!0;case 10:return b(),c++,!0;case 13:return b(),c+=10===e.charCodeAt(c+1)?2:1,!0;case 44:return a=!1,y(60,c,c+1),!0}return!1};for(;c<i;){let t=e.charCodeAt(c),o=!0;switch(l){case 0:o=x(t);break;case 2:o=q(t);break;case 1:if(34===t)b(),c++;else{let t=e.indexOf('"',c);y(58,c,-1===t?i:t)}break;case 3:b(),y(4,c,_(c));break;case 4:b(),y(6,c,_(c));break;case 5:if(125===t)b(),c++;else{let t=e.indexOf("}",c);y(7,c,-1===t?i:t)}}if(!o)return r.push(1),s.push(""),n.push(c),{types:r,texts:s,starts:n}}let k=0===l?13:1===l?58:3===l?4:4===l?6:5===l?7:-1;return -1!==k&&y(k,i,i),y(0,i,i),{types:r,texts:s,starts:n}}var ed=["Requirement","Functional Requirement","Interface Requirement","Performance Requirement","Physical Requirement","Design Constraint","Low","Medium","High","Analysis","Demonstration","Inspection","Test","","contains","copies","derives","satisfies","verifies","refines","traces"];function eh(e){return 49===e||50===e||54===e||53===e||51===e}var em=M("requirement-arrow",{width:9,height:7},"end",{fill:"none",stroke:"var(--_arrow)",strokeWidth:"1"},"userSpaceOnUse"),ep=r([em]),eu={id:"requirement-contains",shape:"circle",size:{width:12,height:12},ref:{x:0,y:6},orient:"auto",units:"userSpaceOnUse",geometry:{kind:"compound",children:[{kind:"circle",cx:6,cy:6,r:5},{kind:"path",d:"M2 6H10M6 2V10"}]},paint:{fill:"var(--bg)",stroke:"var(--_arrow)",strokeWidth:"1"}},ef=E(function(e,t){let{positioned:i,colors:r}=t,s=t.resolved.renderOptions.transparent??!1,n=r.font??"Inter",o=[],l=i.style.edgeStrokeColor?{...em,paint:{...em.paint,stroke:i.style.edgeStrokeColor}}:em,a=i.style.edgeStrokeColor?{...eu,paint:{...eu.paint,stroke:i.style.edgeStrokeColor}}:eu,c=[l,a],d=N(r),h=A(i.width,i.height,r,s);for(let t of(i.model.accessibilityTitle&&(h+=`<title>${F(i.model.accessibilityTitle)}</title>`),i.model.accessibilityDescription&&(h+=`<desc>${F(i.model.accessibilityDescription)}</desc>`),h+=I(n,!1,void 0,r.embedFontImport),o.push(e.documentOpen({id:"prelude",width:i.width,height:i.height,colors:r,transparent:s,font:n,hasMonoFont:!1},h),e.definitions({id:"defs",markerResources:c},`<defs>${D(c)}</defs>`)),i.nodes)){let r=t.style.fill??i.style.nodeFillColor??"var(--_node-fill)",s=t.style.stroke??i.style.nodeBorderColor??"var(--_node-stroke)",n=t.style.color??i.style.nodeTextColor??d("var(--_text)",r),l=[{indent:2,node:e.shape({id:`frame:${t.id}`,role:"node",identity:!1,owner:{id:t.id,role:"node"},geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:i.style.cornerRadius},paint:{fill:r,stroke:s,strokeWidth:t.style["stroke-width"]??String(i.style.nodeLineWidth),...void 0!==t.style["stroke-dasharray"]?{strokeDasharray:t.style["stroke-dasharray"]}:{}}})},{indent:2,node:e.shape({id:`separator:${t.id}`,role:"chrome",geometry:{kind:"line",x1:t.x,y1:t.y+t.headerHeight,x2:t.x+t.width,y2:t.y+t.headerHeight},paint:{stroke:s,strokeWidth:"0.75"}})},{indent:2,node:e.text({id:`header:${t.id}`,role:"label",owner:{id:t.id,role:"node"},text:t.header.text,block:t.header,x:t.x+t.width/2,y:t.y+t.headerHeight/2,fontSize:t.header.fontSize,anchor:"middle",paint:{fill:n}})},...t.rows.map((i,r)=>({indent:2,node:e.text({id:`field:${t.id}:${r}`,role:"attribute",owner:{id:t.id,role:"node"},text:i.block.text,block:i.block,x:t.x+t.paddingX,y:t.y+i.y,fontSize:i.block.fontSize,anchor:"start",paint:{fill:n}})}))],a=["requirement-node",...(t.requirement??t.element).classes.filter(e=>/^[\w-]+$/.test(e))];o.push(e.group({id:`node:${t.id}`,role:"node",open:`<g class="${j(a.join(" "))}" data-id="${j(t.id)}">`,close:"</g>",children:l}))}for(let t of i.edges){let r=i.style.edgeBendRadius>0&&t.points.length>2?V(t.points,i.style.edgeBendRadius,{terminalClearance:{end:"contains"===t.type?0:ep(em.id,i.style.lineWidth,"end")}}):void 0;o.push(e.connector({id:t.id,role:"relationship",geometry:r?.geometry??{kind:"polyline",points:t.points},lineStyle:"contains"===t.type?"solid":"dashed",paint:{stroke:i.style.edgeStrokeColor??"var(--_line)",strokeWidth:String(i.style.lineWidth),fill:"none",..."contains"!==t.type?{strokeDasharray:"6 4"}:{}},endpoints:{from:t.src,to:t.dst},relationship:{kind:t.type,direction:"forward"},markers:"contains"===t.type?{start:a}:{end:l},labels:[{text:t.label.text,anchor:t.labelPosition}],route:{ownership:"layout",bendRadius:i.style.edgeBendRadius,labelAnchors:[t.labelPosition],...r?{contours:r.contours}:{}}}))}for(let t of i.edges){let r=t.label,s=t.labelPosition;o.push(e.group({id:`edge-label:${t.id}`,role:"edge-label",open:'<g class="requirement-edge-label">',close:"</g>",children:[{indent:2,node:e.shape({id:`label-bg:${t.id}`,role:"chrome",owner:{id:t.id,role:"relationship"},geometry:{kind:"rect",x:s.x-r.width/2-6,y:s.y-r.height/2-4,width:r.width+12,height:r.height+8},paint:{fill:"var(--bg)",stroke:"none"}})},{indent:2,node:e.text({id:`label:${t.id}`,role:"edge-label",owner:{id:t.id,role:"relationship"},text:r.text,block:r,x:s.x,y:s.y,fontSize:r.fontSize,anchor:"middle",paint:{fill:i.style.edgeTextColor??"var(--_text)"}})}]}))}return i.title&&o.push(e.text(z(i.title,i.style))),o.push(e.documentClose()),{family:"requirement",width:i.width,height:i.height,colors:r,transparent:s,parts:o}}),ey=x(X,{configDiagnostics:e=>c("requirement",e,{rect_fill:l,text_color:l,rect_border_color:l,rect_border_size:a(0),rect_min_width:s,rect_min_height:n,rect_padding:n,line_height:n,fontSize:s,maxWidth:s,nodeSpacing:n,rankSpacing:n,useMaxWidth:o,look:l,theme:l}),statementEnds:function(e){let t=e.map((e,t)=>t);if(!e.length)return t;let i=["requirementDiagram",...e.slice(1)].join(`
14
+ `),r=[0];for(let e=0;e<i.length;e++)i[e]===`
15
+ `&&r.push(e+1);try{let e=ec(i),s=0;for(let i=0;i<e.types.length;i++){if(58!==e.types[i])continue;let n=e.starts[i],o=n+e.texts[i].length;for(;s+1<r.length&&r[s+1]<=n;)s++;let l=s;for(;l+1<r.length&&r[l+1]<=o;)l++;t[s]=Math.max(t[s],l),s=l}}catch{}return t},layout:r=>{let s=function(e,t,i){let r=Array.isArray(e)?e.join(`
16
+ `):e,s=r.replace(/^[^\S\r\n]*requirement[^\S\r\n]*(?=\r\n?|\n|$)/i,"requirementDiagram"),n=(s.length,r.length,new Q);for(let e of(function(e,t,i,r){let{types:s,texts:n,starts:o}=ec(e),l=0,a=[],c=[],d=(t,i=t,...r)=>{let n=s[l];if(1===n)throw G("requirement",e,o[l],"",!0);for(let e=i;e>=t;e--)r.unshift(e);let a=r.map(e=>`'${Z[e]}'`).join(", ");throw G("requirement",e,o[l],`Expecting ${a}, got '${Z[n]}'`)},h=e=>(s[l]!==e&&d(e),12===e&&59!==s[l-1]&&r?.(o[l]),n[l++]),m=(e,t)=>{let i=s[l];return(i<e||i>t)&&d(e,t),l++,ed[i-23]},p=()=>{let e=s[l];return 59!==e&&58!==e&&d(58,59),n[l++]},u=()=>{let i=l,r=s[l];if(3===r)l++,t.setAccTitle(h(4).trim());else if(5===r)l++,t.setAccDescription(h(6).trim());else{if(7!==r)return!1;t.setAccDescription(n[l++].trim())}return q("requirement")&&k("requirement",Z[r],e.slice(o[i],o[l]??e.length),{offset:o[i],endOffset:o[l]??e.length,unit:"physical"}),!0},f=()=>{let e=[];for(;;){let t=s[l];if(49!==t&&59!==t&&58!==t&&d(58,59,49),e.push(n[l++]),60!==s[l])return e;l++}},y=()=>{let t=[];for(;;){eh(s[l])||d(49,51,53,54);let i=n[l++];for(;eh(s[l]);){let t=o[l-1]+n[l-1].length;i.includes(":")&&!i.endsWith(":")&&o[l]>t&&(i+=e.slice(t,o[l])),i+=n[l++]}if(t.push(i),60!==s[l])return t;l++}},g=()=>{let e;return 17===s[l]?(l++,e=f(),h(15)):15===s[l]?l++:d(15,15,17),h(12),e},b=i=>{for(a.length=0,c.length=0;;){let t=s[l];if(16===t){l++;break}if(12===t){l++;continue}(i?t<19||t>22:44!==t&&45!==t)&&(i&&d(19,22,12,16),d(44,45,12,16));let r=l;l++,h(18),c.push(21===t?m(29,31):22===t?m(32,35):p()),a.push(t),h(12),q("requirement")&&k("requirement",Z[t],e.slice(o[r],o[l]??e.length),{offset:o[r],endOffset:o[l]??e.length,unit:"physical"})}for(let e=a.length-1;e>=0;e--){let i=c[e];switch(a[e]){case 19:t.setNewReqId(i);break;case 20:t.setNewReqText(i);break;case 21:t.setNewReqRisk(i);break;case 22:t.setNewReqVerifyMethod(i);break;case 44:t.setNewElementType(i);break;default:t.setNewElementDocRef(i)}}};for(;u();)12===s[l]&&l++;14!==s[l]&&d(14,14,3,5,7);let w=l++;for(h(12),q("requirement")&&k("requirement","header",e.slice(o[w],o[l]??e.length),{offset:o[w],endOffset:o[l]??e.length,unit:"physical"});;){let r=l,a=s[l];if(13===a)return;if(12!==a&&3!==a&&5!==a&&7!==a&&q("requirement")&&k("requirement",Z[a],n[r],{offset:o[r],endOffset:o[r]+n[r].length,unit:"physical"}),12===a)l++;else{if(u())continue;if(a>=8&&a<=11)l++,t.setDirection(8===a?"TB":9===a?"BT":10===a?"RL":"LR");else if(a>=23&&a<=28){let e=m(23,28),i=p(),r=g();b(!0),t.addRequirement(i,e),r&&t.setClass([i],r)}else if(36===a){l++;let e=p(),i=g();b(!1),t.addElement(e),i&&t.setClass([e],i)}else if(46===a){l++;let s=f(),n=e.slice(o[r],o[l]),a=y();i?.({prefix:n,styles:a}),t.setCssStyle(s,a)}else if(47===a){l++;let s=f(),n=e.slice(o[r],o[l]),a=y();i?.({prefix:n,styles:a}),t.defineClass(s,a)}else if(48===a){l++;let e=f();t.setClass(e,f())}else if(59===a||58===a){let e=n[l++],i=s[l];if(17===i)l++,t.setClass([e],f());else if(55===i||57===i){l++;let r=m(37,43);h(57===i?56:57);let s=p();57===i?t.addRelationship(r,e,s):t.addRelationship(r,s,e)}else d(17,17,55,57)}else d(12,13,3,5,7,8,9,10,11,23,24,25,26,27,28,36,47,48,46,59,58)}}}(s.endsWith(`
17
+ `)?s:s+`
18
+ `,n,void 0,void 0),n.classes.values()))C(T(e.styles.join(",")),`classDef ${e.id}`);for(let[e,t]of n.authoredStyles)C(T(t.join(",")),`style ${e}`);for(let e of[...n.requirements.values(),...n.elements.values()])C(T((e.directStyles??[]).join(",")),`style ${e.name}`);return{kind:"requirement",direction:n.direction,requirements:[...n.requirements.values()],elements:[...n.elements.values()],relations:n.relations.map((e,t)=>({...e,id:`relation-${t+1}`})),classDefs:[...n.classes.values()],title:n.title,accessibilityTitle:n.accTitle,accessibilityDescription:n.accDescr}}(m(r.source));return s.title??=h(r.source.frontmatter),s.accessibilityTitle=r.source.accessibility.title??s.accessibilityTitle,s.accessibilityDescription=r.source.accessibility.descr??s.accessibilityDescription,_(function(r,s={},n,o={}){v(r);let l=H(n,"relationship",{},{includeFallback:!1}),a=L(s,void 0,l?{...n,edge:{...n?.edge,...l}}:n),c=s.padding??32,d="number"==typeof o.maxWidth&&o.maxWidth>0?o.maxWidth:320,h=(e,t,i=0,r=2e3)=>"number"==typeof o[e]&&Number.isFinite(o[e])&&o[e]>=i?Math.min(o[e],r):t,m=h("rect_padding",16),p=void 0===o.rect_padding?n?.node?.paddingX??m:m,u=void 0===o.rect_padding?n?.node?.paddingY??m:m,f=h("rect_min_width",140,1),y=h("rect_min_height",0),g=h("line_height",0),b={};for(let[e,t]of[["rect_fill","fill"],["text_color","color"],["rect_border_color","stroke"],["rect_border_size","stroke-width"]])("string"==typeof o[e]||"rect_border_size"===e&&"number"==typeof o[e]&&Number.isFinite(o[e]))&&(b[t]=String(o[e]));C(b,"requirement config");let w=[...r.requirements.map(e=>({requirement:e,element:void 0})),...r.elements.map(e=>({requirement:void 0,element:e}))].map(({requirement:e,element:t})=>{let i=e??t,r=C({...b,...T(i.cssStyles.join(","))},`style ${i.name}`),n=Number.parseFloat(r["font-size"]??"")||h("fontSize",a.nodeLabelFontSize,1),o=r["font-weight"]?.trim().toLowerCase(),l=void 0===o?void 0:"normal"===o?400:"bold"===o?700:Number(o);if(void 0!==l&&(!Number.isFinite(l)||l<1||l>1e3))throw Error(`style ${i.name}: font-weight must be normal, bold, or a number from 1 to 1000`);let c=B(`<<${e?.type??"Element"}>>
19
+ ${i.name}`,{fontSize:n,fontWeight:l??a.nodeLabelFontWeight,maxWidth:d,transform:a.nodeTextTransform,letterSpacing:a.nodeLetterSpacing,fontFamily:s.font}),m=e?[["ID",e.requirementId],["Text",e.text],["Risk",e.risk],["Verification",e.verifyMethod]]:[["Type",t.type],["Doc Ref",t.docRef]],w=c.height+Math.max(12,1.5*u),_=W(m.filter(([,e])=>e).map(([e,t])=>{let i=B(`${e}: ${t}`,{fontSize:n,fontWeight:l??400,maxWidth:d,transform:a.nodeTextTransform,letterSpacing:a.nodeLetterSpacing,fontFamily:s.font});return{label:e,block:i}}),{top:w+8,gap:9,minRowHeight:g,align:"start",trailingGap:!0}),x=_.rows.map(({item:e,textY:t})=>({...e,y:t})),q=Math.max(y,_.bottom+8),k=Math.max(f,c.width+2*p,_.width+2*p);return{id:i.name,requirement:e,element:t,x:0,y:0,width:k,height:q,header:c,rows:x,paddingX:p,headerHeight:w,style:r}}),_=new Map(w.map((e,t)=>[e.id,t])),x=r.relations.map(e=>B(`<<${e.type}>>`,{fontSize:a.edgeLabelFontSize,fontWeight:a.edgeLabelFontWeight,transform:a.edgeTextTransform,letterSpacing:a.edgeLetterSpacing}));for(let e of r.relations)if(!_.has(e.src)||!_.has(e.dst))throw Error(`Requirement relation ${e.id} references an undeclared endpoint`);let q=s.nodeSpacing??h("nodeSpacing",40,0,1/0),k=s.layerSpacing??h("rankSpacing",72,0,1/0),S=r.relations.some(e=>"contains"!==e.type)?ep(em.id,a.lineWidth,"end")+a.edgeBendRadius:0,R=U(s,()=>P("agentic",()=>i({nodes:w.map(e=>({id:e.id,width:e.width,height:e.height})),edges:r.relations.map((e,t)=>({source:_.get(e.src),target:_.get(e.dst),minSpan:1,label:{width:x[t].width+16,height:x[t].height+10}})),direction:r.direction,padding:c,nodeSpacing:q,layerSpacing:k,...S?{minimumTerminalLead:S}:{},edgeSpacing:Math.max(6,a.lineWidth+4)})),()=>{let i=new Map(w.map((e,t)=>[e.id,`n${t}`])),s=r.relations.map((e,t)=>({id:`e${t}`,sources:[i.get(e.src)],targets:[i.get(e.dst)],labels:[{text:x[t].text,width:x[t].width+16,height:x[t].height+10}]})),n={id:"requirement-layout",layoutOptions:{"elk.algorithm":"layered","elk.direction":{TB:"DOWN",BT:"UP",LR:"RIGHT",RL:"LEFT"}[r.direction],"elk.edgeRouting":"ORTHOGONAL","elk.spacing.edgeNode":String(S),"elk.layered.spacing.edgeNodeBetweenLayers":String(S),"elk.spacing.nodeNode":String(q),"elk.layered.spacing.nodeNodeBetweenLayers":String(k),"elk.padding":`[top=${c},left=${c},bottom=${c},right=${c}]`},children:w.map(e=>({id:i.get(e.id),width:e.width,height:e.height})),edges:s},o=w.length?e(n):{...n,width:2*c,height:2*c},l=w.map(()=>({x:0,y:0}));for(let e of o.children??[])l[Number(e.id.slice(1))]={x:e.x??0,y:e.y??0};return{width:o.width??0,height:o.height??2*c,nodes:l,edges:r.relations.map((e,i)=>{let r=o.edges?.[i],s=r?.labels?.[0];return{points:t((r?.sections??[]).flatMap(e=>[e.startPoint,...e.bendPoints??[],e.endPoint])),...s?.x!==void 0?{labelPosition:{x:s.x+(s.width??0)/2,y:(s.y??0)+(s.height??0)/2}}:{}}})}}),E=$(r.title,a),N=E?.height??0,I=Math.max(R.width??0,(E?.width??0)+2*c,2*c),A=(R.height??2*c)+N;for(let[e,t]of R.nodes.entries()){let i=w[e];i.x=t.x+(I-R.width)/2,i.y=t.y+N}let M=r.relations.map((e,t)=>{let i=R.edges[t],r=(i?.points??[]).map(e=>({x:e.x+(I-R.width)/2,y:e.y+N}));if(r.length<2)throw Error(`No route for requirement relation ${e.id}`);let s=x[t],n=i?.labelPosition,o=r[Math.floor(r.length/2)],l=n?{x:n.x+(I-R.width)/2,y:n.y+N}:o;return{...e,points:r,label:s,labelPosition:l}});return{model:r,width:I,height:A,nodes:w,edges:M,style:a,...E?{title:O(E,I,c)}:{}}}(s,r.renderOptions,r.styleFace,r.source.config.requirement))},projectPositioned:b(function({positioned:e}){let t=e.nodes.flatMap(e=>e.rows.map((t,i)=>({id:`field:${e.id}:${i}`,text:t.block.text,bounds:y(t.block,e.x+e.paddingX,e.y+t.y,"start"),container:u(e)})));return e.title&&t.push({id:"title",text:e.title.text,bounds:y(e.title.block,e.title.x,e.title.y),container:u(p(e))}),{version:1,bounds:{w:f(e.width),h:f(e.height)},nodes:e.nodes.map(e=>({id:e.id,x:f(e.x),y:f(e.y),w:f(e.width),h:f(e.height),shape:"rectangle",label:e.header.text,role:"box",...g(e.header,e.x+e.width/2,e.y+e.headerHeight/2,e)})),edges:e.edges.map(e=>({id:e.id,from:e.src,to:e.dst,path:e.points.map(e=>[f(e.x),f(e.y)]),label:{x:f(e.labelPosition.x),y:f(e.labelPosition.y),text:e.label.text,bounds:y(e.label,e.labelPosition.x,e.labelPosition.y)}})),groups:[],labels:t}}),lowerScene:w(ef)});export{ey as default};