@cagent/chat-embedding-core 0.0.13 → 0.0.14

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 (320) hide show
  1. package/.env +6 -0
  2. package/README.md +213 -213
  3. package/bun.lock +1548 -1548
  4. package/dist/abnfDiagram-VRR7QNED-3cfb3856.js +1 -0
  5. package/dist/abnfDiagram-VRR7QNED-686410b0.js +1 -0
  6. package/dist/abnfDiagram-VRR7QNED-fb22812d.js +1 -0
  7. package/dist/api/chatRoom.d.ts.map +1 -0
  8. package/dist/arc-24dd4755.js +1 -0
  9. package/dist/arc-5d6257cf.js +1 -0
  10. package/dist/arc-90e71e7e.js +1 -0
  11. package/dist/architecture-TIHT7OUA-a997f441.js +1 -0
  12. package/dist/architecture-TIHT7OUA-faa1f9b3.js +1 -0
  13. package/dist/architectureDiagram-ZJ3FMSHR-87443299.js +1 -0
  14. package/dist/architectureDiagram-ZJ3FMSHR-93988e41.js +1 -0
  15. package/dist/architectureDiagram-ZJ3FMSHR-bde2dd21.js +1 -0
  16. package/dist/blockDiagram-677ZJIJ3-25a94a47.js +1 -0
  17. package/dist/blockDiagram-677ZJIJ3-88bd543c.js +1 -0
  18. package/dist/blockDiagram-677ZJIJ3-c769a3c8.js +1 -0
  19. package/dist/c4Diagram-LMCZKHZV-763880d7.js +1 -0
  20. package/dist/c4Diagram-LMCZKHZV-d7fc839e.js +1 -0
  21. package/dist/c4Diagram-LMCZKHZV-da04a76e.js +1 -0
  22. package/dist/channel-11d3f4bc.js +1 -0
  23. package/dist/channel-534c2e17.js +1 -0
  24. package/dist/channel-c3cf6060.js +1 -0
  25. package/dist/chunk-2Q5K7J3B-2892df89.js +1 -0
  26. package/dist/chunk-2Q5K7J3B-7960ff8e.js +1 -0
  27. package/dist/chunk-2Q5K7J3B-9497bf31.js +1 -0
  28. package/dist/chunk-32BRIVSS-10123eba.js +1 -0
  29. package/dist/chunk-32BRIVSS-10ac68f7.js +1 -0
  30. package/dist/chunk-32BRIVSS-8a8507a2.js +1 -0
  31. package/dist/chunk-5VM5RSS4-36b32f6e.js +1 -0
  32. package/dist/chunk-5VM5RSS4-4b2efd20.js +1 -0
  33. package/dist/chunk-5VM5RSS4-5fc85a49.js +1 -0
  34. package/dist/chunk-EX3LRPZG-36494b87.js +1 -0
  35. package/dist/chunk-EX3LRPZG-6cd1f2fa.js +1 -0
  36. package/dist/chunk-EX3LRPZG-7ac6d0d7.js +1 -0
  37. package/dist/chunk-JWPE2WC7-15a55950.js +1 -0
  38. package/dist/chunk-JWPE2WC7-84faee3d.js +1 -0
  39. package/dist/chunk-JWPE2WC7-e2521b1e.js +1 -0
  40. package/dist/chunk-MOJQB5TN-47f0392f.js +1 -0
  41. package/dist/chunk-MOJQB5TN-5cc2e61b.js +1 -0
  42. package/dist/chunk-MOJQB5TN-ea88675c.js +1 -0
  43. package/dist/chunk-PUDLZKDR-057ec46a.js +1 -0
  44. package/dist/chunk-PUDLZKDR-53309be9.js +1 -0
  45. package/dist/chunk-PUDLZKDR-6de50ada.js +1 -0
  46. package/dist/chunk-RYQCIY6F-06b096c5.js +1 -0
  47. package/dist/chunk-RYQCIY6F-453400cd.js +1 -0
  48. package/dist/chunk-RYQCIY6F-8de649c8.js +1 -0
  49. package/dist/chunk-V7JOEXUC-4083766f.js +1 -0
  50. package/dist/chunk-V7JOEXUC-4e8d7729.js +1 -0
  51. package/dist/chunk-V7JOEXUC-bb2df9b0.js +1 -0
  52. package/dist/chunk-VR4S4FIN-5feb7571.js +1 -0
  53. package/dist/chunk-VR4S4FIN-9df47127.js +1 -0
  54. package/dist/chunk-VR4S4FIN-c4f2681d.js +1 -0
  55. package/dist/chunk-XXDRQBXY-3c9d8bf9.js +1 -0
  56. package/dist/chunk-XXDRQBXY-de00e988.js +1 -0
  57. package/dist/chunk-XXDRQBXY-f923ffed.js +1 -0
  58. package/dist/classDiagram-OUVF2IWQ-5cdf5fe6.js +1 -0
  59. package/dist/classDiagram-OUVF2IWQ-d51bd736.js +1 -0
  60. package/dist/classDiagram-OUVF2IWQ-fc2b54d6.js +1 -0
  61. package/dist/classDiagram-v2-EOCWNBFH-5cdf5fe6.js +1 -0
  62. package/dist/classDiagram-v2-EOCWNBFH-d51bd736.js +1 -0
  63. package/dist/classDiagram-v2-EOCWNBFH-fc2b54d6.js +1 -0
  64. package/dist/components/Badge.d.ts.map +1 -0
  65. package/dist/components/Bot.d.ts.map +1 -0
  66. package/dist/components/FeedbackContentDialog.d.ts.map +1 -0
  67. package/dist/components/RoomReconnectAlert.d.ts.map +1 -0
  68. package/dist/components/Toast.d.ts.map +1 -0
  69. package/dist/components/TypingBubble.d.ts.map +1 -0
  70. package/dist/components/avatars/Avatar.d.ts.map +1 -0
  71. package/dist/components/avatars/DefaultAvatar.d.ts.map +1 -0
  72. package/dist/components/bubbles/AgentReasoningBubble.d.ts.map +1 -0
  73. package/dist/components/bubbles/BotBubble.d.ts.map +1 -0
  74. package/dist/components/bubbles/ChartBubble.d.ts.map +1 -0
  75. package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts.map +1 -0
  76. package/dist/components/bubbles/ChartPlaceholder.d.ts.map +1 -0
  77. package/dist/components/bubbles/ChartPopupModal.d.ts.map +1 -0
  78. package/dist/components/bubbles/FollowUpPromptBubble.d.ts.map +1 -0
  79. package/dist/components/bubbles/GuestBubble.d.ts.map +1 -0
  80. package/dist/components/bubbles/LeadCaptureBubble.d.ts.map +1 -0
  81. package/dist/components/bubbles/LoadingBubble.d.ts.map +1 -0
  82. package/dist/components/bubbles/SourceBubble.d.ts.map +1 -0
  83. package/dist/components/bubbles/StableChartWrapper.d.ts.map +1 -0
  84. package/dist/components/bubbles/StarterPromptBubble.d.ts.map +1 -0
  85. package/dist/components/buttons/AttachmentUploadButton.d.ts.map +1 -0
  86. package/dist/components/buttons/CancelButton.d.ts.map +1 -0
  87. package/dist/components/buttons/CopyMessageButton.d.ts.map +1 -0
  88. package/dist/components/buttons/EditMessageButton.d.ts.map +1 -0
  89. package/dist/components/buttons/FeedbackButtons.d.ts.map +1 -0
  90. package/dist/components/buttons/ImageUploadButton.d.ts.map +1 -0
  91. package/dist/components/buttons/LeadCaptureButtons.d.ts.map +1 -0
  92. package/dist/components/buttons/PopupToast.d.ts.map +1 -0
  93. package/dist/components/buttons/RecordAudioButton.d.ts.map +1 -0
  94. package/dist/components/buttons/SendButton.d.ts.map +1 -0
  95. package/dist/components/dialogs/EditMessageDialog.d.ts.map +1 -0
  96. package/dist/components/icons/AddImageIcon.d.ts.map +1 -0
  97. package/dist/components/icons/AttachmentIcon.d.ts.map +1 -0
  98. package/dist/components/icons/CheckIcon.d.ts.map +1 -0
  99. package/dist/components/icons/CircleDotIcon.d.ts.map +1 -0
  100. package/dist/components/icons/ClipboardIcon.d.ts.map +1 -0
  101. package/dist/components/icons/CopyIcon.d.ts.map +1 -0
  102. package/dist/components/icons/DeleteIcon.d.ts.map +1 -0
  103. package/dist/components/icons/EditIcon.d.ts.map +1 -0
  104. package/dist/components/icons/FullScreenIcon.d.ts.map +1 -0
  105. package/dist/components/icons/RecordIcon.d.ts.map +1 -0
  106. package/dist/components/icons/ResetZoomIcon.d.ts.map +1 -0
  107. package/dist/components/icons/SendIcon.d.ts.map +1 -0
  108. package/dist/components/icons/SparklesIcon.d.ts.map +1 -0
  109. package/dist/components/icons/StopIcon.d.ts.map +1 -0
  110. package/dist/components/icons/ThumbsDownIcon.d.ts.map +1 -0
  111. package/dist/components/icons/ThumbsUpIcon.d.ts.map +1 -0
  112. package/dist/components/icons/TickIcon.d.ts.map +1 -0
  113. package/dist/components/icons/TrashIcon.d.ts.map +1 -0
  114. package/dist/components/icons/XIcon.d.ts.map +1 -0
  115. package/dist/components/icons/ZoomInIcon.d.ts.map +1 -0
  116. package/dist/components/icons/ZoomOutIcon.d.ts.map +1 -0
  117. package/dist/components/icons/index.d.ts.map +1 -0
  118. package/dist/components/image/PreviewImage.d.ts.map +1 -0
  119. package/dist/components/index.d.ts.map +1 -0
  120. package/dist/components/inputs/textInput/components/FilePreview.d.ts.map +1 -0
  121. package/dist/components/inputs/textInput/components/ShortTextInput.d.ts.map +1 -0
  122. package/dist/components/inputs/textInput/components/TextInput.d.ts.map +1 -0
  123. package/dist/components/inputs/textInput/index.d.ts.map +1 -0
  124. package/dist/constants.d.ts.map +1 -0
  125. package/dist/cose-bilkent-JH36ORCC-ac4d2e28.js +1 -0
  126. package/dist/cose-bilkent-JH36ORCC-c3560feb.js +1 -0
  127. package/dist/cose-bilkent-JH36ORCC-f0ddc3e7.js +1 -0
  128. package/dist/cynefin-VYW2F7L2-2458ad91.js +1 -0
  129. package/dist/cynefin-VYW2F7L2-a8648cf6.js +1 -0
  130. package/dist/cynefinDiagram-TSTJHNR4-62a29383.js +1 -0
  131. package/dist/cynefinDiagram-TSTJHNR4-910b3dfd.js +1 -0
  132. package/dist/cynefinDiagram-TSTJHNR4-deb0bb2c.js +1 -0
  133. package/dist/cytoscape.esm-56d2239f.js +1 -0
  134. package/dist/cytoscape.esm-c9352dc8.js +1 -0
  135. package/dist/dagre-VKFMJZFB-1467d0af.js +1 -0
  136. package/dist/dagre-VKFMJZFB-35daad97.js +1 -0
  137. package/dist/dagre-VKFMJZFB-c5b9a4a0.js +1 -0
  138. package/dist/defaultLocale-b4977250.js +1 -0
  139. package/dist/defaultLocale-e35a4def.js +1 -0
  140. package/dist/diagram-FQU43EPY-41eed431.js +1 -0
  141. package/dist/diagram-FQU43EPY-613e9e4e.js +1 -0
  142. package/dist/diagram-FQU43EPY-d256050e.js +1 -0
  143. package/dist/diagram-G47NLZAW-813bbb70.js +1 -0
  144. package/dist/diagram-G47NLZAW-8ef917d1.js +1 -0
  145. package/dist/diagram-G47NLZAW-aa02607c.js +1 -0
  146. package/dist/diagram-NH7WQ7WH-0af7a921.js +1 -0
  147. package/dist/diagram-NH7WQ7WH-0e4f7f17.js +1 -0
  148. package/dist/diagram-NH7WQ7WH-6f91f6aa.js +1 -0
  149. package/dist/diagram-OA4YK3LP-0fba2475.js +1 -0
  150. package/dist/diagram-OA4YK3LP-587273f4.js +1 -0
  151. package/dist/diagram-OA4YK3LP-6cbfc7a5.js +1 -0
  152. package/dist/diagram-WEI45ONY-0241463f.js +1 -0
  153. package/dist/diagram-WEI45ONY-dd634033.js +1 -0
  154. package/dist/diagram-WEI45ONY-e002e844.js +1 -0
  155. package/dist/ebnfDiagram-CCIWWBDH-20ac4ba3.js +1 -0
  156. package/dist/ebnfDiagram-CCIWWBDH-e9974165.js +1 -0
  157. package/dist/ebnfDiagram-CCIWWBDH-ead44055.js +1 -0
  158. package/dist/erDiagram-Q63AITRT-1febb8fc.js +1 -0
  159. package/dist/erDiagram-Q63AITRT-4ea4b93d.js +1 -0
  160. package/dist/erDiagram-Q63AITRT-bcb00855.js +1 -0
  161. package/dist/eventmodeling-45OFAUF4-a82f1f18.js +1 -0
  162. package/dist/eventmodeling-45OFAUF4-dcf667fc.js +1 -0
  163. package/dist/features/bubble/components/Bubble.d.ts.map +1 -0
  164. package/dist/features/bubble/components/BubbleButton.d.ts.map +1 -0
  165. package/dist/features/bubble/components/Tooltip.d.ts.map +1 -0
  166. package/dist/features/bubble/components/index.d.ts.map +1 -0
  167. package/dist/features/bubble/index.d.ts.map +1 -0
  168. package/dist/features/bubble/types.d.ts.map +1 -0
  169. package/dist/features/full/components/Full.d.ts.map +1 -0
  170. package/dist/features/full/components/index.d.ts.map +1 -0
  171. package/dist/features/full/index.d.ts.map +1 -0
  172. package/dist/features/popup/components/DisclaimerPopup.d.ts.map +1 -0
  173. package/dist/features/popup/components/Popup.d.ts.map +1 -0
  174. package/dist/features/popup/components/index.d.ts.map +1 -0
  175. package/dist/features/popup/index.d.ts.map +1 -0
  176. package/dist/features/popup/types.d.ts.map +1 -0
  177. package/dist/flowDiagram-23GEKE2U-14ee2b3c.js +1 -0
  178. package/dist/flowDiagram-23GEKE2U-7ab9c2e4.js +1 -0
  179. package/dist/flowDiagram-23GEKE2U-f7309569.js +1 -0
  180. package/dist/ganttDiagram-NO4QXBWP-249a167d.js +1 -0
  181. package/dist/ganttDiagram-NO4QXBWP-bd530d12.js +1 -0
  182. package/dist/ganttDiagram-NO4QXBWP-e5e495d6.js +1 -0
  183. package/dist/gitGraph-TEB2WS4Q-72ba3362.js +1 -0
  184. package/dist/gitGraph-TEB2WS4Q-d07b15b3.js +1 -0
  185. package/dist/gitGraphDiagram-IHSO6WYX-2964ff91.js +1 -0
  186. package/dist/gitGraphDiagram-IHSO6WYX-4d9324ad.js +1 -0
  187. package/dist/gitGraphDiagram-IHSO6WYX-97bf868b.js +1 -0
  188. package/dist/graph-0df36b9d.js +1 -0
  189. package/dist/graph-c6801890.js +1 -0
  190. package/dist/index.d.ts.map +1 -0
  191. package/dist/info-DKCQHKI2-d8e8a901.js +1 -0
  192. package/dist/info-DKCQHKI2-dd69502c.js +1 -0
  193. package/dist/infoDiagram-FWYZ7A6U-1267309e.js +1 -0
  194. package/dist/infoDiagram-FWYZ7A6U-5b9d28af.js +1 -0
  195. package/dist/infoDiagram-FWYZ7A6U-cc33afe4.js +1 -0
  196. package/dist/init-b029a625.js +1 -0
  197. package/dist/init-cf76ae07.js +1 -0
  198. package/dist/ishikawaDiagram-FXEZZL3T-3f0977e8.js +1 -0
  199. package/dist/ishikawaDiagram-FXEZZL3T-89c1b2f4.js +1 -0
  200. package/dist/ishikawaDiagram-FXEZZL3T-9fef4653.js +1 -0
  201. package/dist/journeyDiagram-5HDEW3XC-563a68ff.js +1 -0
  202. package/dist/journeyDiagram-5HDEW3XC-c8c8d701.js +1 -0
  203. package/dist/journeyDiagram-5HDEW3XC-e6c5e84b.js +1 -0
  204. package/dist/kanban-definition-HUTT4EX6-3719e367.js +1 -0
  205. package/dist/kanban-definition-HUTT4EX6-7bc0cd1e.js +1 -0
  206. package/dist/kanban-definition-HUTT4EX6-d8b002e3.js +1 -0
  207. package/dist/katex-67456a45.js +1 -0
  208. package/dist/katex-b134d23c.js +1 -0
  209. package/dist/layout-e44354bf.js +1 -0
  210. package/dist/layout-ff5d33a1.js +1 -0
  211. package/dist/linear-7b1a23f3.js +1 -0
  212. package/dist/linear-d7ad6d25.js +1 -0
  213. package/dist/linear-e5c99c88.js +1 -0
  214. package/dist/map-05f0ff95.js +1 -0
  215. package/dist/map-d3292a5b.js +1 -0
  216. package/dist/mermaid-parser.core-6df0beec.js +1 -0
  217. package/dist/mermaid-parser.core-d8d1c2b9.js +1 -0
  218. package/dist/mermaid.core-2d237a1e.js +1 -0
  219. package/dist/mermaid.core-70d5aead.js +1 -0
  220. package/dist/mermaid.core-8797d6a9.js +1 -0
  221. package/dist/mindmap-definition-LN4V7U3C-04a12a88.js +1 -0
  222. package/dist/mindmap-definition-LN4V7U3C-86a890ce.js +1 -0
  223. package/dist/mindmap-definition-LN4V7U3C-f495948c.js +1 -0
  224. package/dist/ordinal-221e41d7.js +1 -0
  225. package/dist/ordinal-4a51e46c.js +1 -0
  226. package/dist/packet-7NZHBO7P-b4586e10.js +1 -0
  227. package/dist/packet-7NZHBO7P-f62750ff.js +1 -0
  228. package/dist/pegDiagram-2B236MQR-234fe6d1.js +1 -0
  229. package/dist/pegDiagram-2B236MQR-2826e278.js +1 -0
  230. package/dist/pegDiagram-2B236MQR-64eeb662.js +1 -0
  231. package/dist/pie-RZYD4A2V-106ba3d7.js +1 -0
  232. package/dist/pie-RZYD4A2V-752eda00.js +1 -0
  233. package/dist/pieDiagram-ENE6RG2P-0c3b09b8.js +1 -0
  234. package/dist/pieDiagram-ENE6RG2P-3fb5f734.js +1 -0
  235. package/dist/pieDiagram-ENE6RG2P-af928526.js +1 -0
  236. package/dist/quadrantDiagram-ABIIQ3AL-1a55c0f5.js +1 -0
  237. package/dist/quadrantDiagram-ABIIQ3AL-3d15c26d.js +1 -0
  238. package/dist/quadrantDiagram-ABIIQ3AL-9110fa9c.js +1 -0
  239. package/dist/queries/sendMessageQuery.d.ts.map +1 -0
  240. package/dist/radar-I7S5WNFK-53bde9ff.js +1 -0
  241. package/dist/radar-I7S5WNFK-87e8c5ba.js +1 -0
  242. package/dist/railroad-3IZDKUUU-99427b9f.js +1 -0
  243. package/dist/railroad-3IZDKUUU-9e29587d.js +1 -0
  244. package/dist/railroad-abnf-AHOZXSZD-1d11cb5b.js +1 -0
  245. package/dist/railroad-abnf-AHOZXSZD-c27db0bc.js +1 -0
  246. package/dist/railroad-ebnf-EBAXGLYW-38dff87c.js +1 -0
  247. package/dist/railroad-ebnf-EBAXGLYW-6bb5de0c.js +1 -0
  248. package/dist/railroad-peg-LSFZ7HO6-c9f0aa71.js +1 -0
  249. package/dist/railroad-peg-LSFZ7HO6-efcb0a43.js +1 -0
  250. package/dist/railroadDiagram-RFXS5EU6-14373a87.js +1 -0
  251. package/dist/railroadDiagram-RFXS5EU6-ec9e696e.js +1 -0
  252. package/dist/railroadDiagram-RFXS5EU6-effa5611.js +1 -0
  253. package/dist/register.d.ts.map +1 -0
  254. package/dist/requirementDiagram-TGXJPOKE-3d199581.js +1 -0
  255. package/dist/requirementDiagram-TGXJPOKE-5a337f1a.js +1 -0
  256. package/dist/requirementDiagram-TGXJPOKE-a7960859.js +1 -0
  257. package/dist/sankeyDiagram-HTMAVEWB-209eac30.js +1 -0
  258. package/dist/sankeyDiagram-HTMAVEWB-3c852fda.js +1 -0
  259. package/dist/sankeyDiagram-HTMAVEWB-46aa1eb1.js +1 -0
  260. package/dist/sequenceDiagram-DBY2YBRQ-4121f7c2.js +1 -0
  261. package/dist/sequenceDiagram-DBY2YBRQ-7bad18e4.js +1 -0
  262. package/dist/sequenceDiagram-DBY2YBRQ-af96f48e.js +1 -0
  263. package/dist/sizeCapture-X5ZJPWSS-13826306.js +1 -0
  264. package/dist/sizeCapture-X5ZJPWSS-32e2eec7.js +1 -0
  265. package/dist/sizeCapture-X5ZJPWSS-a078176f.js +1 -0
  266. package/dist/stateDiagram-2N3HPSRC-527374a2.js +1 -0
  267. package/dist/stateDiagram-2N3HPSRC-8047e124.js +1 -0
  268. package/dist/stateDiagram-2N3HPSRC-ba344b5d.js +1 -0
  269. package/dist/stateDiagram-v2-6OUMAXLB-7580bf69.js +1 -0
  270. package/dist/stateDiagram-v2-6OUMAXLB-d4c58fd3.js +1 -0
  271. package/dist/stateDiagram-v2-6OUMAXLB-e5921044.js +1 -0
  272. package/dist/store/constant.d.ts.map +1 -0
  273. package/dist/swimlanes-5IMT3BWC-5834b232.js +1 -0
  274. package/dist/swimlanes-5IMT3BWC-791a3547.js +1 -0
  275. package/dist/swimlanes-5IMT3BWC-db2c593a.js +1 -0
  276. package/dist/swimlanesDiagram-G3AALYLV-36c30eec.js +1 -0
  277. package/dist/swimlanesDiagram-G3AALYLV-89220ddd.js +1 -0
  278. package/dist/swimlanesDiagram-G3AALYLV-b621330d.js +1 -0
  279. package/dist/timeline-definition-FHXFAJF6-0482a67a.js +1 -0
  280. package/dist/timeline-definition-FHXFAJF6-1d165a67.js +1 -0
  281. package/dist/timeline-definition-FHXFAJF6-f9600b97.js +1 -0
  282. package/dist/treeView-QDETBFTQ-0ecf20cd.js +1 -0
  283. package/dist/treeView-QDETBFTQ-96ed8e2f.js +1 -0
  284. package/dist/treemap-6X3UGDF4-0a7f19ca.js +1 -0
  285. package/dist/treemap-6X3UGDF4-9f498e0c.js +1 -0
  286. package/dist/types/chart.d.ts.map +1 -0
  287. package/dist/types.d.ts +1 -0
  288. package/dist/types.d.ts.map +1 -0
  289. package/dist/utils/audioRecording.d.ts.map +1 -0
  290. package/dist/utils/chartInstanceManager.d.ts.map +1 -0
  291. package/dist/utils/chartTagParser.d.ts.map +1 -0
  292. package/dist/utils/chatInputHistory.d.ts.map +1 -0
  293. package/dist/utils/chatStreamHelper.d.ts.map +1 -0
  294. package/dist/utils/index.d.ts.map +1 -0
  295. package/dist/utils/isMobileSignal.d.ts.map +1 -0
  296. package/dist/utils/transcriptApi.d.ts.map +1 -0
  297. package/dist/utils/ultimateJsonParser.d.ts.map +1 -0
  298. package/dist/vennDiagram-L72KCM5P-05176193.js +1 -0
  299. package/dist/vennDiagram-L72KCM5P-25a48393.js +1 -0
  300. package/dist/vennDiagram-L72KCM5P-28cffef7.js +1 -0
  301. package/dist/wardley-OPB4EBWU-08c5f013.js +1 -0
  302. package/dist/wardley-OPB4EBWU-9803a1d9.js +1 -0
  303. package/dist/wardleyDiagram-EHGQE667-052e6de9.js +1 -0
  304. package/dist/wardleyDiagram-EHGQE667-6a614fd9.js +1 -0
  305. package/dist/wardleyDiagram-EHGQE667-d11fe904.js +1 -0
  306. package/dist/web-25bb78b9.js +1 -0
  307. package/dist/web-753300e1.js +1 -0
  308. package/dist/web-c3ed22c4.js +1 -0
  309. package/dist/web.d.ts.map +1 -0
  310. package/dist/web.js +1 -1
  311. package/dist/window.d.ts.map +1 -0
  312. package/dist/xychartDiagram-FW5EYKEG-43118b83.js +1 -0
  313. package/dist/xychartDiagram-FW5EYKEG-d77187fe.js +1 -0
  314. package/dist/xychartDiagram-FW5EYKEG-f2fac492.js +1 -0
  315. package/package.json +86 -86
  316. package/server.js +477 -477
  317. package/.idea/flowise-chatbox.iml +0 -10
  318. package/.idea/modules.xml +0 -8
  319. package/.idea/workspace.xml +0 -4
  320. package/docs/embedding-style-guide.md +0 -417
@@ -0,0 +1 @@
1
+ ((e,r)=>{e&&!e.getElementById("livereloadscript")&&((r=e.createElement("script")).async=1,r.src="//"+(self.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",r.id="livereloadscript",e.getElementsByTagName("head")[0].appendChild(r))})(self.document);export{r as TreemapModule,s as createTreemapServices}from"./mermaid-parser.core-6df0beec.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/types/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,wDAAwD;IACxD,eAAe,EAAE,WAAW,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,+BAA+B;IAC/B,IAAI,SAAS;IACb,gDAAgD;IAChD,WAAW,gBAAgB;IAC3B,+CAA+C;IAC/C,UAAU,eAAe;IACzB,qCAAqC;IACrC,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioRecording.d.ts","sourceRoot":"","sources":["../../src/utils/audioRecording.ts"],"names":[],"mappings":"AAmBA,wBAAgB,cAAc,WAE7B;AAED,gCAAgC;AAChC,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAC1C,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAC9C,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,QAkExC;AACD;GACG;AACH,wBAAgB,kBAAkB,CAAC,sBAAsB,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,QAuBvF;AAED,mDAAmD;AACnD,wBAAgB,oBAAoB,SAMnC;AA8FD,KAAK,aAAa,GAAG;IACnB,UAAU,EAAE,IAAI,EAAE,CAAC;IACnB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mBAAmB,EAAE,WAAW,GAAG,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB,EAAE,MAAM,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aA6G3B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartInstanceManager.d.ts","sourceRoot":"","sources":["../../src/utils/chartInstanceManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,SAAS,CAAiC;IAElD;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAQxC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAIlC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAYzB;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI;IAIhC;;OAEG;IACH,UAAU,IAAI,IAAI;IAWlB;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,MAAM,IAAI,MAAM,EAAE;CAGnB;AAGD,eAAO,MAAM,YAAY,sBAA6B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartTagParser.d.ts","sourceRoot":"","sources":["../../src/utils/chartTagParser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,gBAAgB,EAAwD,MAAM,eAAe,CAAC;AAOzH;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,eAAe,CAAqB;IAE5C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAiB7C;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,qBAAqB;IAwC7B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,cAAc;IAwCtB,OAAO,CAAC,iBAAiB;IAyBzB;;;OAGG;IACH,KAAK,IAAI,gBAAgB;IAsBzB;;OAEG;IACH,KAAK,IAAI,IAAI;CAQd"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatInputHistory.d.ts","sourceRoot":"","sources":["../../src/utils/chatInputHistory.ts"],"names":[],"mappings":"AACA,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C,CAAC;AAEF,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO;IAPjB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,UAAU,CAAS;gBAGjB,aAAa,GAAE,MAAM,MAAiB,EACtC,OAAO,GAAE,kBAAiC;IAMpD,UAAU,IAAI,MAAM,EAAE;IAItB,eAAe,IAAI,MAAM;IAIzB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAejC,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAY9C,YAAY,IAAI,MAAM;IAWtB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,WAAW;CAWpB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatStreamHelper.d.ts","sourceRoot":"","sources":["../../src/utils/chatStreamHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG3D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAGD,eAAO,MAAM,iBAAiB,QAAO,MAEpC,CAAC;AAGF,eAAO,MAAM,iBAAiB,YAAa,MAAM,UAAU,UAAU,aAAa,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,WASvG,CAAC;AAGF,eAAO,MAAM,cAAc,WAAY,UAAU,KAAG,OAEnD,CAAC;AAGF,eAAO,MAAM,cAAc,WAAY,UAAU,KAAG,OAEnD,CAAC;AAGF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,MAMtD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,+DAAuG,CAAC;AAEjI,eAAO,MAAM,SAAS,6DAAqG,CAAC;AAE5H,eAAO,MAAM,OAAO,UAAW,MAAM,GAAG,SAAS,GAAG,IAAI,uBAA8E,CAAC;AAEvI,eAAO,MAAM,UAAU,UAAW,MAAM,GAAG,SAAS,GAAG,IAAI,oBAA2E,CAAC;AAEvI;;;GAGG;AACH,eAAO,MAAM,WAAW;SAGX,MAAM;YACH,MAAM;;;;;2BAKQ,WAAW,KAAK,QAAQ,IAAI,CAAC;;;;EAuD1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,MAAM,UAAU,MAAM,YAAW,OAAO,MAAM,EAAE,GAAG,CAAC,SAiBvG,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,MAAM,QAQzD,CAAC;AAEF,eAAO,MAAM,6BAA6B,eAAgB,MAAM,SAyB/D,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,WAO1F,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,MAAM,UAAU,MAAM,UAAU,MAAM,SAKtE,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MAczC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMobileSignal.d.ts","sourceRoot":"","sources":["../../src/utils/isMobileSignal.ts"],"names":[],"mappings":"AAEA,eAAO,MAAO,QAAQ,oDAAE,WAAW,gDAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcriptApi.d.ts","sourceRoot":"","sources":["../../src/utils/transcriptApi.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,SAAgB,IAAI,0BAA0B,MAAM,KAAG,QAAQ,MAAM,CAoCzG,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ultimateJsonParser.d.ts","sourceRoot":"","sources":["../../src/utils/ultimateJsonParser.ts"],"names":[],"mappings":"AAsBA,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAkDzD"}
@@ -0,0 +1 @@
1
+ import{b7 as t,_ as e,E as n,F as s,G as r,s as i,g as a,n as o,o as l,b as h,c,v as u,K as f,j as d,ao as y,Y as g,$ as x,a0 as p,k as m}from"./mermaid.core-8797d6a9.js";import"./web-c3ed22c4.js";var v=(e,n)=>t(e,"a",-n);const b=1e-10;function I(t,e){var n=function(t){var e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s)for(const r of _(t[n],t[s]))r.parentIndex=[n,s],e.push(r);return e}(t),s=n.filter((e=>function(t,e){return e.every((e=>k(t,e)<e.radius+b))}(e,t)));let r=0,i=0;var a=[];if(1<s.length){var o=S(s);for(let t=0;t<s.length;++t){var l=s[t];l.angle=Math.atan2(l.x-o.x,l.y-o.y)}s.sort(((t,e)=>e.angle-t.angle));let e=s[s.length-1];for(let n=0;n<s.length;++n){var h=s[n],c=(i+=(e.x+h.x)*(h.y-e.y),{x:(h.x+e.x)/2,y:(h.y+e.y)/2});let o=null;for(let n=0;n<h.parentIndex.length;++n)if(e.parentIndex.includes(h.parentIndex[n])){var u=t[h.parentIndex[n]],f=Math.atan2(h.x-u.x,h.y-u.y),d=Math.atan2(e.x-u.x,e.y-u.y);let s=d-f;s<0&&(s+=2*Math.PI),f=d-s/2;let r=k(c,{x:u.x+u.radius*Math.sin(f),y:u.y+u.radius*Math.cos(f)});r>2*u.radius&&(r=2*u.radius),(null==o||o.width>r)&&(o={circle:u,width:r,p1:h,p2:e,large:r>u.radius,sweep:!0})}null!=o&&(a.push(o),r+=M(o.circle.radius,o.width),e=h)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let s=0;s<t.length;++s)if(k(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?r=i=0:(r=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-b,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return i/=2,e&&(e.area=r+i,e.arcArea=r,e.polygonArea=i,e.arcs=a,e.innerPoints=s,e.intersectionPoints=n),r+i}function M(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function k(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function w(t,e,n){var s;return t+e<=n?0:n<=Math.abs(t-e)?Math.PI*Math.min(t,e)*Math.min(t,e):(s=e-(n*n-t*t+e*e)/(2*n),M(t,t-(n*n-e*e+t*t)/(2*n))+M(e,s))}function _(t,e){var n,s,r=k(t,e),i=t.radius,a=e.radius;return i+a<=r||r<=Math.abs(i-a)?[]:(a=(i*i-a*a+r*r)/(2*r),i=Math.sqrt(i*i-a*a),n=t.x+a*(e.x-t.x)/r,a=t.y+a*(e.y-t.y)/r,[{x:n+(s=-(e.y-t.y)*(i/r)),y:a-(e=-(e.x-t.x)*(i/r))},{x:n-s,y:a+e}])}function S(t){var e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function E(t){var e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function T(t,e){return E(t).map((()=>E(e)))}function z(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function A(t){return Math.sqrt(z(t,t))}function R(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function N(t,e,n,s,r){for(let i=0;i<t.length;++i)t[i]=e*n[i]+s*r[i]}function D(t,e,n){var s=(n=n||{}).maxIterations||200*e.length,r=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,a=n.minErrorDelta||1e-6,o=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,h=void 0!==n.chi?n.chi:2,c=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e);for(let n=y[0].id=0;n<d;++n){var g=e.slice();g[n]=g[n]?g[n]*r:i,y[n+1]=g,y[n+1].fx=t(g),y[n+1].id=n+1}function x(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}var p=(t,e)=>t.fx-e.fx,m=e.slice(),v=e.slice(),b=e.slice(),I=e.slice();for(let e=0;e<s;++e){y.sort(p),n.history&&((M=y.map((t=>{var e=t.slice();return e.fx=t.fx,e.id=t.id,e}))).sort(((t,e)=>t.id-e.id)),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:M}));for(let t=f=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<a&&f<o)break;for(let t=0;t<d;++t){for(let e=m[t]=0;e<d;++e)m[t]+=y[e][t];m[t]/=d}var M=y[d];if(N(v,1+l,m,-l,M),v.fx=t(v),v.fx<y[0].fx)N(I,1+h,m,-h,M),I.fx=t(I),I.fx<v.fx?x(I):x(v);else if(v.fx>=y[d-1].fx){let e=!1;if(v.fx>M.fx?(N(b,1+c,m,-c,M),b.fx=t(b),b.fx<M.fx?x(b):e=!0):(N(b,1-c*l,m,c*l,M),b.fx=t(b),b.fx<v.fx?x(b):e=!0),e){if(1<=u)break;for(let e=1;e<y.length;++e)N(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else x(v)}return y.sort(p),{fx:y[0].fx,x:y[0]}}function O(t,e,n,s,r,i,a){const o=n.fx,l=z(n.fxprime,e);let h=o,c=o,u=l,f=0;function d(c,f,d){for(let y=0;y<16;++y)if(r=(c+f)/2,N(s.x,1,n.x,r,e),h=s.fx=t(s.x,s.fxprime),u=z(s.fxprime,e),h>o+i*r*l||h>=d)f=r;else{if(Math.abs(u)<=-a*l)return r;0<=u*(f-c)&&(f=c),c=r,d=h}return 0}r=r||1,i=i||1e-6,a=a||.1;for(let y=0;y<10;++y){if(N(s.x,1,n.x,r,e),h=s.fx=t(s.x,s.fxprime),u=z(s.fxprime,e),h>o+i*r*l||y&&h>=c)return d(f,r,c);if(Math.abs(u)<=-a*l)return r;if(0<=u)return d(r,f,h);c=h,f=r,r*=2}return r}function C(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},r={x:e.slice(),fx:0,fxprime:e.slice()};var i,a,o,l=e.slice();let h=1;a=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),R(i=s.fxprime.slice(),s.fxprime,-1);for(let e=0;e<a&&(h=O(t,i,s,r,h),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:h}),h?(N(l,1,r.fxprime,-1,s.fxprime),o=z(s.fxprime,s.fxprime),N(i,Math.max(0,z(l,r.fxprime)/o),i,-1,r.fxprime),o=s,s=r,r=o):R(i,s.fxprime,-1),!(A(s.fxprime)<=1e-5));++e);return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:h}),s}function F(t,e={}){e.maxIterations=e.maxIterations||500;var n=e.initialLayout||L;const s=e.lossFunction||$,r=function(t,e={}){e=e.distinct;var n=t.map((t=>Object.assign({},t)));function s(t){return t.join(";")}if(e){var r=new Map;for(const t of n)for(let e=0;e<t.sets.length;e++){var i=String(t.sets[e]);r.set(i,t.size+(r.get(i)||0));for(let n=e+1;n<t.sets.length;n++){var a=i+";"+(o=String(t.sets[n])),o=o+";"+i;r.set(a,t.size+(r.get(a)||0)),r.set(o,t.size+(r.get(o)||0))}}for(const t of n)t.sets.length<3&&(t.size=r.get(s(t.sets)))}var l,h,c=[],u=new Set;for(const t of n)1===t.sets.length?c.push(t.sets[0]):2===t.sets.length&&(l=t.sets[0],h=t.sets[1],u.add(s(t.sets)),u.add(s([h,l])));c.sort(((t,e)=>t===e?0:t<e?-1:1));for(let t=0;t<c.length;++t){var f=c[t];for(let e=t+1;e<c.length;++e){var d=c[e];u.has(s([f,d]))||n.push({sets:[f,d],size:0})}}return n}(t,e),i=n(r,e),a=Object.keys(i);var o=[];for(const t of a)o.push(i[t].x),o.push(i[t].y);var l=D((t=>{var e={};for(let s=0;s<a.length;++s){var n=a[s];e[n]={x:t[2*s],y:t[2*s+1],radius:i[n].radius}}return s(e,r)}),o,e).x;for(let t=0;t<a.length;++t){var h=a[t];i[h].x=l[2*t],i[h].y=l[2*t+1]}return i}const j=1e-10;function P(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+j?Math.abs(t-e):function(t,e,n,s){var r=(s=s||{}).maxIterations||100,i=s.tolerance||1e-10,a=t(e);let o=n-e;if(0<a*(s=t(n)))throw"Initial bisect points must have opposite signs";if(0===a)return e;if(0===s)return n;for(let n=0;n<r;++n){var l=e+(o/=2),h=t(l);if(0<=h*a&&(e=l),Math.abs(o)<i||0===h)return l}return e+o}((s=>w(t,e,s)-n),0,t+e)}function L(t,e={}){let n=function(t,e){var n,s=e&&e.lossFunction?e.lossFunction:$;const r={},i={};for(const e of t)1===e.sets.length&&(n=e.sets[0],r[n]={x:1e10,y:1e10,rowid:r.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},i[n]=[]);for(const e of t=t.filter((t=>2===t.sets.length))){let t=null!=e.weight?e.weight:1;var a=e.sets[0],o=e.sets[1];e.size+j>=Math.min(r[a].size,r[o].size)&&(t=0),i[a].push({set:o,size:e.size,weight:t}),i[o].push({set:a,size:e.size,weight:t})}const l=[];function h(t,e){return e.size-t.size}Object.keys(i).forEach((t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;l.push({set:t,size:e})})),l.sort(h);const c={};function u(t){return t.set in c}function f(t,e){r[e].x=t.x,r[e].y=t.y,c[e]=!0}f({x:0,y:0},l[0].set);for(let e=1;e<l.length;++e){var d=l[e].set,y=i[d].filter(u),g=r[d];if(y.sort(h),0===y.length)throw"ERROR: missing pairwise overlap information";for(var x=[],p=0;p<y.length;++p){var m=r[y[p].set],v=P(g.radius,m.radius,y[p].size);x.push({x:m.x+v,y:m.y}),x.push({x:m.x-v,y:m.y}),x.push({y:m.y+v,x:m.x}),x.push({y:m.y-v,x:m.x});for(let t=p+1;t<y.length;++t){var b=r[y[t].set],I=P(g.radius,b.radius,y[t].size);b=_({x:m.x,y:m.y,radius:v},{x:b.x,y:b.y,radius:I});x.push(...b)}}let n=1e50,a=x[0];for(const e of x){r[d].x=e.x,r[d].y=e.y;var M=s(r,t);M<n&&(n=M,a=e)}f(a,d)}return r}(t,e);var s=e.lossFunction||$;return 8<=t.length&&s(e=function(t,e={}){var n=e.restarts||10,s=[],r={};for(const e of t)1===e.sets.length&&(r[e.sets[0]]=s.length,s.push(e));let{distances:i,constraints:a}=function(t,e,n){const s=T(e.length,e.length),r=T(e.length,e.length);return t.filter((t=>2===t.sets.length)).forEach((t=>{var i=n[t.sets[0]],a=n[t.sets[1]],o=P(Math.sqrt(e[i].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[i][a]=s[a][i]=o;let l=0;t.size+1e-10>=Math.min(e[i].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),r[i][a]=r[a][i]=l})),{distances:s,constraints:r}}(t,s,r);const o=A(i.map(A))/i.length;i=i.map((t=>t.map((t=>t/o))));var l=(t,e)=>function(t,e,n,s){for(let t=0;t<e.length;++t)e[t]=0;let r=0;for(let d=0;d<n.length;++d){var i=t[2*d],a=t[2*d+1];for(let y=d+1;y<n.length;++y){var o=t[2*y],l=t[2*y+1],h=n[d][y],c=s[d][y],u=(o-i)*(o-i)+(l-a)*(l-a),f=Math.sqrt(u);u-=h*h,0<c&&f<=h||c<0&&h<=f||(r+=2*u*u,e[2*d]+=4*u*(i-o),e[2*d+1]+=4*u*(a-l),e[2*y]+=4*u*(o-i),e[2*y+1]+=4*u*(l-a))}}return r}(t,e,i,a);let h=null;for(let t=0;t<n;++t){var c=C(l,E(2*i.length).map(Math.random),e);(!h||c.fx<h.fx)&&(h=c)}var u=h.x,f={};for(let t=0;t<s.length;++t){var d=s[t];f[d.sets[0]]={x:u[2*t]*o,y:u[2*t+1]*o,radius:Math.sqrt(d.size/Math.PI)}}if(e.history)for(const t of e.history)R(t.x,o);return f}(t,e),t)+1e-8<s(n,t)?e:n}function $(t,e){let n=0;for(const i of e)if(1!==i.sets.length){let e;e=2===i.sets.length?(r=t[i.sets[0]],s=t[i.sets[1]],w(r.radius,s.radius,k(r,s))):I(i.sets.map((e=>t[e])));var s,r=null!=i.weight?i.weight:1;n+=r*(e-i.size)*(e-i.size)}return n}function q(t,e){let n=0;for(const i of e)if(1!==i.sets.length){let e;e=2===i.sets.length?(s=t[i.sets[0]],r=t[i.sets[1]],w(s.radius,r.radius,k(s,r))):I(i.sets.map((e=>t[e])));var s=null!=i.weight?i.weight:1,r=Math.log((e+1)/(i.size+1));n+=s*r*r}return n}function U(t,e,n){if(null==n?t.sort(((t,e)=>e.radius-t.radius)):t.sort(n),0<t.length){var s=t[0].x,r=t[0].y;for(const e of t)e.x-=s,e.y-=r}if(2===t.length&&k(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),1<t.length){n=Math.atan2(t[1].x,t[1].y)-e;var i=Math.cos(n),a=Math.sin(n);for(const e of t){var o=e.x,l=e.y;e.x=i*o-a*l,e.y=a*o+i*l}}if(2<t.length){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){var h=t[1].y/(1e-10+t[1].x);for(const e of t){var c=(e.x+h*e.y)/(1+h*h);e.x=2*c-e.x,e.y=2*c*h-e.y}}}}function B(t){var e=e=>({max:t.reduce(((t,n)=>Math.max(t,n[e]+n.radius)),Number.NEGATIVE_INFINITY),min:t.reduce(((t,n)=>Math.min(t,n[e]-n.radius)),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function G(t,e,n){null==e&&(e=Math.PI/2);let s=X(t).map((t=>Object.assign({},t)));var r=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}t.forEach((t=>{t.parent=t}));for(let r=0;r<t.length;++r)for(let i=r+1;i<t.length;++i){var n=t[r].radius+t[i].radius;k(t[r],t[i])+1e-10<n&&(n=t[i],s=t[r],n=e(n),s=e(s),n.parent=s)}var s,r=new Map;for(let n=0;n<t.length;++n){var i=e(t[n]).parent.setid;r.has(i)||r.set(i,[]),r.get(i).push(t[n])}return t.forEach((t=>{delete t.parent})),Array.from(r.values())}(s);for(const t of r){U(t,e,n);var i=B(t);t.size=(i.xRange.max-i.xRange.min)*(i.yRange.max-i.yRange.min),t.bounds=i}r.sort(((t,e)=>e.size-t.size));let a=(s=r[0]).bounds;const o=(a.xRange.max-a.xRange.min)/50;function l(t,e,n){if(t){var r=t.bounds;let i,l;e?i=a.xRange.max-r.xRange.min+o:(i=a.xRange.max-r.xRange.max,(e=(r.xRange.max-r.xRange.min)/2-(a.xRange.max-a.xRange.min)/2)<0&&(i+=e)),n?l=a.yRange.max-r.yRange.min+o:(l=a.yRange.max-r.yRange.max,(e=(r.yRange.max-r.yRange.min)/2-(a.yRange.max-a.yRange.min)/2)<0&&(l+=e));for(const e of t)e.x+=i,e.y+=l,s.push(e)}}let h=1;for(;h<r.length;)l(r[h],!0,!1),l(r[h+1],!1,!0),l(r[h+2],!0,!0),h+=3,a=B(s);return V(s)}function W(t,e,n,s,r){var i=X(t);e-=2*s,n-=2*s;const{xRange:a,yRange:o}=B(i);if(a.max===a.min||o.max===o.min)return console.log("not scaling solution: zero size detected"),t;let l,h;h=r?(l=e/(t=2*Math.sqrt(r/Math.PI)),n/t):(l=e/(a.max-a.min),n/(o.max-o.min));const c=Math.min(h,l),u=(e-(a.max-a.min)*c)/2,f=(n-(o.max-o.min)*c)/2;return V(i.map((t=>({radius:c*t.radius,x:s+u+(t.x-a.min)*c,y:s+f+(t.y-o.min)*c,setid:t.setid}))))}function V(t){var e={};for(const n of t)e[n.setid]=n;return e}function X(t){return Object.keys(t).map((e=>Object.assign(t[e],{setid:e})))}function Y(t={}){let e=!1,n=600,s=350,r=15,i=1e3,a=Math.PI/2,o=!0,l=null,h=!0,c=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,v=function(t){return t in x?x[t]:(t=x[t]=p[m],(m+=1)>=p.length&&(m=0),t)},b=F,I=$;function M(x){let p=x.datum();const m=new Set;p.forEach((t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])})),p=p.filter((t=>!t.sets.some((t=>m.has(t)))));let M={},k={};if(0<p.length){let t=b(p,{lossFunction:I,distinct:d});o&&(t=G(t,a,f)),M=W(t,n,s,r,l),k=J(M,p,g)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach((t=>{t.label&&(w[t.sets]=t.label)})),x.selectAll("svg").data([M]).enter().append("svg");var S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} `+s):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>et(t.sets.map((t=>{let r=E[t],i=M[t];return r=r||{x:n/2,y:s/2,radius:1},i=i||{x:n/2,y:s/2,radius:1},{x:r.x*(1-e)+i.x*e,y:r.y*(1-e)+i.y*e,radius:r.radius*(1-e)+i.radius*e}})),y)}S.selectAll(".venn-area path").each((function(t){var e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){return t=t.split(" "),{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}(e))}));S=S.selectAll(".venn-area").data(p,(t=>t.sets));var A=S.enter().append("g").attr("class",(t=>"venn-area venn-"+(1==t.sets.length?"circle":"intersection")+(t.colour||t.color?" venn-coloured":""))).attr("data-venn-sets",(t=>t.sets.join("_"))),R=A.append("path"),N=A.append("text").attr("class","label").text((t=>_(t))).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function D(t){return"function"==typeof t.transition?t.transition("venn").duration(i):t}c&&(R.style("fill-opacity","0").filter((t=>1==t.sets.length)).style("fill",(t=>t.colour||t.color||v(t.sets))).style("fill-opacity",".25"),N.style("fill",(e=>e.colour||e.color?"#FFF":t.textFill||(1==e.sets.length?v(e.sets):"#444"))));let O=x;T&&"function"==typeof O.transition?(O=D(x)).selectAll("path").attrTween("d",z):O.selectAll("path").attr("d",(t=>et(t.sets.map((t=>M[t])))),y);R=O.selectAll("text").filter((t=>t.sets in k)).text((t=>_(t))).attr("x",(t=>Math.floor(k[t.sets].x))).attr("y",(t=>Math.floor(k[t.sets].y))),h&&(T?"on"in R?R.on("end",K(M,_)):R.each("end",K(M,_)):R.each(K(M,_))),x=D(S.exit()).remove();var C=("function"==typeof S.transition&&x.selectAll("path").attrTween("d",z),x.selectAll("text").attr("x",n/2).attr("y",s/2));return null!==u&&(N.style("font-size","0px"),R.style("font-size",u),C.style("font-size","0px")),{circles:M,textCentres:k,nodes:S,enter:A,update:O,exit:x}}return M.wrap=function(t){return arguments.length?(h=t,M):h},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(s=t,M):s},M.padding=function(t){return arguments.length?(r=t,M):r},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(v=t,M):v},M.colors=function(t){return arguments.length?(v=t,M):v},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(i=t,M):i},M.layoutFunction=function(t){return arguments.length?(b=t,M):b},M.normalize=function(t){return arguments.length?(o=t,M):o},M.scaleToFit=function(t){return arguments.length?(l=t,M):l},M.styled=function(t){return arguments.length?(c=t,M):c},M.orientation=function(t){return arguments.length?(a=t,M):a},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?$:"logRatio"===t?q:t,M):I},M}function K(t,e){return function(n){const s=this;var r=t[n.sets[0]].radius||50,i=(n=e(n)||"").split(/\s+/).reverse(),a=(n.length+i.length)/3,o=i.pop();let l=[o],h=0;s.textContent=null;const c=[];function u(t){var e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,c.push(e),s.append(e),e}let f=u(o);for(;o=i.pop();){l.push(o);var d=l.join(" ");(f.textContent=d).length>a&&f.getComputedTextLength()>r&&(l.pop(),f.textContent=l.join(" "),l=[o],f=u(o),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");c.forEach(((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",y+1.1*e+"em")}))}}function Z(t,e,n){let s=e[0].radius-k(e[0],t);for(let n=1;n<e.length;++n){var r=e[n].radius-k(e[n],t);r<=s&&(s=r)}for(let e=0;e<n.length;++e){var i=k(n[e],t)-n[e].radius;i<=s&&(s=i)}return s}function H(t,e,n){var s=[];for(const e of t)s.push({x:e.x,y:e.y}),s.push({x:e.x+e.radius/2,y:e.y}),s.push({x:e.x-e.radius/2,y:e.y}),s.push({x:e.x,y:e.y+e.radius/2}),s.push({x:e.x,y:e.y-e.radius/2});let r=s[0],i=Z(s[0],t,e);for(let n=1;n<s.length;++n){var a=Z(s[n],t,e);a>=i&&(r=s[n],i=a)}var o=D((n=>-1*Z({x:n[0],y:n[1]},t,e)),[r.x,r.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:n?0:o[0],y:o[1]};let h=!0;for(const e of t)if(k(l,e)>e.radius){h=!1;break}for(const t of e)if(k(l,t)<t.radius){h=!1;break}return h?l:1==t.length?{x:t[0].x,y:t[0].y}:(I(t,n={}),0===n.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==n.arcs.length?{x:n.arcs[0].circle.x,y:n.arcs[0].circle.y}:e.length?H(t,[]):S(n.arcs.map((t=>t.p1))))}function J(t,e,n){var s={},r=function(t){var e={},n=Object.keys(t);for(const t of n)e[t]=[];for(let l=0;l<n.length;l++){var s=n[l],r=t[s];for(let h=l+1;h<n.length;++h){var i=n[h],a=t[i],o=k(r,a);o+a.radius<=r.radius+1e-10?e[i].push(s):o+r.radius<=a.radius+1e-10&&e[s].push(i)}}return e}(t);for(let d=0;d<e.length;++d){var i=e[d].sets,a={},o={};for(let t=0;t<i.length;++t){a[i[t]]=!0;var l=r[i[t]];for(let t=0;t<l.length;++t)o[l[t]]=!0}var h,c=[],u=[];for(h in t)h in a?c.push(t[h]):h in o||u.push(t[h]);var f=H(c,u,n);(s[i]=f).disjoint&&0<e[d].size&&console.log("WARNING: area "+i+" not represented on screen")}return s}function Q(t){return 0===t.length?[]:(I(t,t={}),t.arcs)}function tt(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0);var s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length)return function(t,e,n){var s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}(s((e=t[0].circle).x),s(e.y),s(e.radius));var r=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const e of t){var i=s(e.circle.radius);r.push("\nA",i,i,0,e.large?1:0,e.sweep?1:0,s(e.p1.x),s(e.p1.y))}return r.join(" ")}function et(t,e){return tt(Q(t),e)}var nt,st=function(){var t=e((function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n}),"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],r=[1,17],i=[1,18],a=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],o=[1,31],l=[1,39],h=[7,8,11,12,17,19,22,24,27],c=[1,57],u=[1,56],f=[1,58],d=[1,59],y=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33];n={trace:e((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e((function(t,e,n,s,r,i,a){var o,l=i.length-1;switch(r){case 1:return i[l-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:i[l-1].push(i[l]),this.$=i[l-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=i[l];break;case 8:s.setDiagramTitle(i[l].substr(6)),this.$=i[l].substr(6);break;case 9:s.addSubsetData([i[l]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([i[l-1]],i[l],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([i[l-2]],void 0,parseFloat(i[l])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([i[l-3]],i[l-2],parseFloat(i[l])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(i[l].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(i[l]),s.addSubsetData(i[l],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(i[l-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(i[l-1]),s.addSubsetData(i[l-1],i[l],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(i[l-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(i[l-2]),s.addSubsetData(i[l-2],void 0,parseFloat(i[l])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(i[l-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(i[l-3]),s.addSubsetData(i[l-3],i[l-2],parseFloat(i[l])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(i[l-1],i[l],void 0);break;case 20:case 21:s.addTextData(i[l-2],i[l-1],i[l]);break;case 23:s.addStyleData(i[l-1],i[l]);break;case 24:case 25:case 26:if(!(o=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(o,i[l],void 0);break;case 27:case 28:if(!(o=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(o,i[l-1],i[l]);break;case 29:case 41:case 34:this.$=[i[l]];break;case 30:case 42:this.$=[...i[l-2],i[l]];break;case 31:this.$=[i[l-2],i[l]];break;case 33:this.$=i[l].join(" ")}}),"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:r,21:i},{13:20,18:19,20:r,21:i},{13:20,18:21,20:r,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:r,21:i},t(s,[2,9],{14:[1,27],15:[1,28]}),t(a,[2,43]),t(a,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:o}),t(a,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:o},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:r,21:i},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(h,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(a,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:c,20:u,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:y},t(s,[2,12]),t(s,[2,16]),t(h,[2,30]),t(h,[2,31]),t(h,[2,32]),t(h,[2,33],{30:61,16:c,20:u,31:f,32:d,33:y}),t(g,[2,34]),t(g,[2,36]),t(g,[2,37]),t(g,[2,38]),t(g,[2,39]),t(g,[2,40]),t(g,[2,35])],defaultActions:{6:[2,1]},parseError:e((function(t,e){var n;if(!e.recoverable)throw(n=new Error(t)).hash=e,n;this.trace(t)}),"parseError"),parse:e((function(t){var n,s=this,r=[0],i=[],a=[null],o=[],l=this.table,h="",c=0,u=0,f=o.slice.call(arguments,1),d=Object.create(this.lexer),y={yy:{}};for(n in this.yy)Object.prototype.hasOwnProperty.call(this.yy,n)&&(y.yy[n]=this.yy[n]);d.setInput(t,y.yy),y.yy.lexer=d,y.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var g=d.yylloc,x=(o.push(g),d.options&&d.options.ranges);function p(){var t=i.pop()||d.lex()||1;return"number"!=typeof t&&(t instanceof Array&&(t=(i=t).pop()),t=s.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,e((function(t){r.length=r.length-2*t,a.length=a.length-t,o.length=o.length-t}),"popStack"),e(p,"lex");for(var m,v,b,I,M,k,w={};;){if(v=r[r.length-1],void 0===(b=this.defaultActions[v]||(null==m&&(m=p()),l[v]&&l[v][m]))||!b.length||!b[0]){var _,S=[];for(I in l[v])this.terminals_[I]&&2<I&&S.push("'"+this.terminals_[I]+"'");_=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(_,{text:d.match,token:this.terminals_[m]||m,line:d.yylineno,loc:g,expected:S})}if(b[0]instanceof Array&&1<b.length)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+m);switch(b[0]){case 1:r.push(m),a.push(d.yytext),o.push(d.yylloc),r.push(b[1]),m=null,u=d.yyleng,h=d.yytext,c=d.yylineno,g=d.yylloc;break;case 2:if(M=this.productions_[b[1]][1],w.$=a[a.length-M],w._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},x&&(w._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),void 0!==(k=this.performAction.apply(w,[h,u,c,y.yy,b[1],a,o].concat(f))))return k;M&&(r=r.slice(0,-1*M*2),a=a.slice(0,-1*M),o=o.slice(0,-1*M)),r.push(this.productions_[b[1]][0]),a.push(w.$),o.push(w._$),k=l[r[r.length-2]][r[r.length-1]],r.push(k);break;case 3:return!0}}return!0}),"parse")},o={EOF:1,parseError:e((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:e((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:e((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:e((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g),s=(this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e,t=this.match.split(/(?:\r\n?|\n)/g),this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1),this.yylloc.range);return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===t.length?this.yylloc.first_column:0)+t[t.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:e((function(){return this._more=!0,this}),"more"),reject:e((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:e((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:e((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(20<t.length?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:e((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(20<t.length?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:e((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:e((function(t,e){var n,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)&&(s.yylloc.range=this.yylloc.range.slice(0)),(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var r in s)this[r]=s[r];return!1}),"test_match"),next:e((function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,n,s,r=this._currentRules(),i=0;i<r.length;i++)if((n=this._input.match(this.rules[r[i]]))&&(!e||n[0].length>e[0].length))if(e=n,s=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[i])))return t;if(!this._backtrack)return!1;e=!1}else if(!this.options.flex)break;return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:e((function(){return this.next()||this.lex()}),"lex"),begin:e((function(t){this.conditionStack.push(t)}),"begin"),popState:e((function(){return 0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:e((function(){return(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]]:this.conditions.INITIAL).rules}),"_currentRules"),topState:e((function(t){return 0<=(t=this.conditionStack.length-1-Math.abs(t||0))?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:e((function(t){this.begin(t)}),"pushState"),stateStackSize:e((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:e((function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}}),"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};function x(){this.yy={}}return n.lexer=o,e(x,"Parser"),new((x.prototype=n).Parser=x)}(),rt=st.parser=st,it=[],at=[],ot=[],lt=new Set,ht=!1,ct=e(((t,e,n)=>{var s=pt(t).sort();n=n??10/Math.pow(t.length,2);1===(nt=s).length&&lt.add(s[0]),it.push({sets:s,size:n,label:e?ft(e):void 0})}),"addSubsetData"),ut=e((()=>it),"getSubsetData"),ft=e((t=>2<=(t=t.trim()).length&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t),"normalizeText"),dt=e((t=>t&&ft(t)),"normalizeStyleValue"),yt=e(((t,e,n)=>{e=ft(e),at.push({sets:pt(t).sort(),id:e,label:n?ft(n):void 0})}),"addTextData"),gt=e(((t,e)=>{t=pt(t).sort();var n,s,r={};for([n,s]of e)r[n]=dt(s)??s;ot.push({targets:t,styles:r})}),"addStyleData"),xt=e((()=>ot),"getStyleData"),pt=e((t=>t.map((t=>ft(t)))),"normalizeIdentifierList"),mt=e((t=>{if(0<(t=pt(t).filter((t=>!lt.has(t)))).length)throw new Error("unknown set identifier: "+t.join(", "))}),"validateUnionIdentifiers"),vt=e((()=>at),"getTextData"),bt=e((()=>nt),"getCurrentSets"),It=e((()=>ht),"getIndentMode"),Mt=e((t=>{ht=t}),"setIndentMode"),kt=n.venn;function wt(){return s(kt,r().venn)}e(wt,"getConfig");var _t={getConfig:wt,clear:e((()=>{u(),it.length=0,at.length=0,ot.length=0,lt.clear(),nt=void 0,ht=!1}),"customClear"),setAccTitle:i,getAccTitle:a,setDiagramTitle:o,getDiagramTitle:l,getAccDescription:h,setAccDescription:c,addSubsetData:ct,getSubsetData:ut,addTextData:yt,addStyleData:gt,validateUnionIdentifiers:mt,getTextData:vt,getStyleData:xt,getCurrentSets:bt,getIndentMode:It,setIndentMode:Mt},St=e((t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`),"getStyles");function Et(t){var e=new Map;for(const r of t){var n=r.targets.join("|"),s=e.get(n);s?Object.assign(s,r.styles):e.set(n,{...r.styles})}return e}e(Et,"buildStyleByKey");var Tt=e(((t,e,n,s)=>{s=s.db;var i=s.getConfig?.();const{themeVariables:a,look:o,handDrawnSeed:l}=r(),h="handDrawn"===o,c=[a.venn1,a.venn2,a.venn3,a.venn4,a.venn5,a.venn6,a.venn7,a.venn8].filter(Boolean);var u=s.getDiagramTitle?.(),b=s.getSubsetData(),I=s.getTextData();const M=Et(s.getStyleData());s=Rt(b),b=i?.width??800;var k=i?.height??450;const w=b/1600;var _=u?48*w:0;const S=a.primaryTextColor??a.textColor;(e=f(e)).attr("viewBox",`0 0 ${b} `+k),u&&e.append("text").text(u).attr("class","venn-title").attr("font-size",32*w+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*w).style("fill",a.vennTitleTextColor||a.titleColor),u=d(document.createElement("div"));var E=Y().width(b).height(k-_);u.datum(s).call(E);const T=h?y.svg(u.select("svg").node()):void 0;E=function(t,e={}){const{lossFunction:n,layoutFunction:s=F,normalize:r=!0,orientation:i=Math.PI/2,orientationOrder:a,width:o=600,height:l=350,padding:h=15,scaleToFit:c=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?q:n:$,distinct:f});const g=W(y=r?G(y,i,a):y,o,l,h,c),x=J(g,t,u),p=new Map(Object.keys(g).map((t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}]))),m=t.map((t=>{var e=t.sets.map((t=>p.get(t))),n=Q(e);return{circles:e,arcs:n,path:tt(n,d),area:t,has:new Set(t.sets)}}));return m.map((({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+function(t){let e="";for(const n of m)n.has.size>t.length&&t.every((t=>n.has.has(t)))&&(e+=" "+n.path);return e}(s.sets)})))}(s,{width:b,height:k-_,padding:i?.padding??15});const z=new Map;for(const t of E){var A=zt([...t.data.sets].sort());z.set(A,t)}0<I.length&&At(i,z,u,I,w,M);const R=g(a.background||"#f4f4f4");u.selectAll(".venn-circle").each((function(t,e){var n=d(this),s=(t=zt([...t.sets].sort()),M.get(t)),r=s?.fill||c[e%c.length]||a.primaryColor,i=(n.classed("venn-set-"+e%8,!0),s?.["fill-opacity"]??.1),o=s?.stroke||r,u=s?.["stroke-width"]||""+5*w;h&&T?(t=z.get(t))&&0<t.circles.length&&(t=t.circles[0],t=T.circle(t.x,t.y,2*t.radius,{roughness:.7,seed:l,fill:v(r,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:o,strokeWidth:parseFloat(String(u))}),n.select("path").remove(),n.node()?.insertBefore(t,n.select("text").node())):n.select("path").style("fill",r).style("fill-opacity",i).style("stroke",o).style("stroke-width",u).style("stroke-opacity",.95),e=s?.color||(R?x:p)(r,30);n.select("text").style("font-size",48*w+"px").style("fill",e)})),h&&T?u.selectAll(".venn-intersection").each((function(t){var e,n,s=d(this),r=(t=zt([...t.sets].sort()),t=M.get(t),t?.fill);r?(n=(e=s.select("path")).attr("d"))&&(n=T.path(n,{roughness:.7,seed:l,fill:v(r,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),(r=e.node())?.parentNode?.insertBefore(n,r),e.remove()):s.select("path").style("fill-opacity",0),s.select("text").style("font-size",48*w+"px").style("fill",t?.color??a.vennSetTextColor??S)})):(u.selectAll(".venn-intersection text").style("font-size",48*w+"px").style("fill",(t=>(t=zt([...t.sets].sort()),M.get(t)?.color??a.vennSetTextColor??S))),u.selectAll(".venn-intersection path").style("fill-opacity",(t=>(t=zt([...t.sets].sort()),M.get(t)?.fill?1:0))).style("fill",(t=>(t=zt([...t.sets].sort()),M.get(t)?.fill??"transparent"))));var N=e.append("g").attr("transform",`translate(0, ${_})`);if((s=u.select("svg").node())&&"childNodes"in s)for(const t of[...s.childNodes])N.node()?.appendChild(t);m(e,k,b,i?.useMaxWidth??!0)}),"draw");function zt(t){return t.join("|")}function At(t,e,n,s,r,i){var a,o,l=t?.useDebugLayout??!1,h=n.select("svg").append("g").attr("class","venn-text-nodes"),c=new Map;for(const t of s){var u=zt(t.sets),f=c.get(u);f?f.push(t):c.set(u,[t])}for([a,o]of c.entries()){var d=e.get(a);if(d?.text){const t=d.text.x,e=d.text.y;var y=Math.min(...d.circles.map((t=>t.radius))),g=Math.min(...d.circles.map((n=>n.radius-Math.hypot(t-n.x,e-n.y))));let n=Number.isFinite(g)?Math.max(0,g):0;0===n&&Number.isFinite(y)&&(n=.6*y);var x,p,m=h.append("g").attr("class","venn-text-area").attr("font-size",40*r+"px"),v=(g=(l&&m.append("circle").attr("class","venn-text-debug-circle").attr("cx",t).attr("cy",e).attr("r",n).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*r).attr("stroke-dasharray",6*r+" "+4*r),Math.max(80*r,2*n*.95)),y=Math.max(60*r,2*n*.95),d=(d.data.label&&0<d.data.label.length?Math.min(32*r,.25*n):0)+(o.length<=2?30*r:0),t-g/2),b=e-y/2+d,I=Math.max(1,Math.ceil(Math.sqrt(o.length))),M=g/I,k=y/Math.max(1,Math.ceil(o.length/I));for([x,p]of o.entries()){var w=v+M*(.5+(S=x%I)),_=b+k*((E=Math.floor(x/I))+.5),S=(l&&m.append("rect").attr("class","venn-text-debug-cell").attr("x",v+M*S).attr("y",b+k*E).attr("width",M).attr("height",k).attr("fill","none").attr("stroke","teal").attr("stroke-width",+r).attr("stroke-dasharray",4*r+" "+3*r),.9*M),E=.9*k;w=m.append("foreignObject").attr("class","venn-text-node-fo").attr("width",S).attr("height",E).attr("x",w-S/2).attr("y",_-E/2).attr("overflow","visible"),S=i.get(p.id)?.color,_=w.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(p.label??p.id);S&&_.style("color",S)}}}}function Rt(t){var e=new Set(t.map((t=>[...t.sets].sort().join("|")))),n=new Map(t.filter((t=>1===t.sets.length&&void 0!==t.size)).map((t=>[t.sets[0],t.size]))),s=[];for(const l of t)if(!(l.sets.length<3)){var r=[...l.sets].sort();for(let t=0;t<r.length-1;t++)for(let l=t+1;l<r.length;l++){var i,a=[r[t],r[l]],o=a.join("|");e.has(o)||(e.add(o),o=n.get(a[0]),i=n.get(a[1]),o=void 0!==o&&void 0!==i?Math.min(o,i)/4:2.5,s.push({sets:a,size:o,label:""}))}}return 0<s.length?[...t,...s]:t}e(zt,"stableSetsKey"),e(At,"renderTextNodes"),e(Rt,"ensurePairwiseSubsets");var Nt={parser:rt,db:_t,renderer:{draw:Tt},styles:St};export{Nt as diagram};
@@ -0,0 +1 @@
1
+ var t,e;(t=self.document)&&!t.getElementById("livereloadscript")&&((e=t.createElement("script")).async=1,e.src="//"+(self.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",e.id="livereloadscript",t.getElementsByTagName("head")[0].appendChild(e));import{b7 as n,_ as r,E as s,F as i,G as a,s as l,g as o,n as h,o as c,b as u,c as f,v as d,K as y,j as g,ao as p,Y as x,$ as m,a0 as v,k as b}from"./mermaid.core-70d5aead.js";import"./web-25bb78b9.js";var I=(t,e)=>n(t,"a",-e);let M=1e-10;function k(t,e){var n=function(t){var e,n=[];for(let r=0;r<t.length;++r)for(let s=r+1;s<t.length;++s)for(e of E(t[r],t[s]))e.parentIndex=[r,s],n.push(e);return n}(t),r=n.filter(e=>function(t,e){return e.every(e=>_(t,e)<e.radius+M)}(e,t));let s=0,i=0;var a=[];if(1<r.length){var l=T(r);for(let t=0;t<r.length;++t){var o=r[t];o.angle=Math.atan2(o.x-l.x,o.y-l.y)}r.sort((t,e)=>e.angle-t.angle);let e=r[r.length-1];for(let n=0;n<r.length;++n){var h=r[n],c=(i+=(e.x+h.x)*(h.y-e.y),{x:(h.x+e.x)/2,y:(h.y+e.y)/2});let l=null;for(let n=0;n<h.parentIndex.length;++n)if(e.parentIndex.includes(h.parentIndex[n])){var u=t[h.parentIndex[n]],f=Math.atan2(h.x-u.x,h.y-u.y),d=Math.atan2(e.x-u.x,e.y-u.y);let r=d-f;r<0&&(r+=2*Math.PI),f=d-r/2;let s=_(c,{x:u.x+u.radius*Math.sin(f),y:u.y+u.radius*Math.cos(f)});s>2*u.radius&&(s=2*u.radius),(null==l||l.width>s)&&(l={circle:u,width:s,p1:h,p2:e,large:s>u.radius,sweep:!0})}null!=l&&(a.push(l),s+=w(l.circle.radius,l.width),e=h)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let r=0;r<t.length;++r)if(_(t[r],e)>Math.abs(e.radius-t[r].radius)){n=!0;break}n?s=i=0:(s=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-M,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return i/=2,e&&(e.area=s+i,e.arcArea=s,e.polygonArea=i,e.arcs=a,e.innerPoints=r,e.intersectionPoints=n),s+i}function w(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function _(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function S(t,e,n){var r;return t+e<=n?0:n<=Math.abs(t-e)?Math.PI*Math.min(t,e)*Math.min(t,e):(r=e-(n*n-t*t+e*e)/(2*n),w(t,t-(n*n-e*e+t*t)/(2*n))+w(e,r))}function E(t,e){var n,r,s=_(t,e),i=t.radius,a=e.radius;return i+a<=s||s<=Math.abs(i-a)?[]:(a=(i*i-a*a+s*s)/(2*s),i=Math.sqrt(i*i-a*a),[{x:(n=t.x+a*(e.x-t.x)/s)+(r=i/s*-(e.y-t.y)),y:(a=t.y+a*(e.y-t.y)/s)-(i=i/s*-(e.x-t.x))},{x:n-r,y:a+i}])}function T(t){var e,n={x:0,y:0};for(e of t)n.x+=e.x,n.y+=e.y;return n.x/=t.length,n.y/=t.length,n}function z(t){var e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function A(t,e){return z(t).map(()=>z(e))}function R(t,e){let n=0;for(let r=0;r<t.length;++r)n+=t[r]*e[r];return n}function N(t){return Math.sqrt(R(t,t))}function D(t,e,n){for(let r=0;r<e.length;++r)t[r]=e[r]*n}function O(t,e,n,r,s){for(let i=0;i<t.length;++i)t[i]=e*n[i]+r*s[i]}function C(t,e,n){var r=(n=n||{}).maxIterations||200*e.length,s=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,a=n.minErrorDelta||1e-6,l=n.minErrorDelta||1e-5,o=void 0!==n.rho?n.rho:1,h=void 0!==n.chi?n.chi:2,c=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f,d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e);for(let n=y[0].id=0;n<d;++n){var g=e.slice();g[n]=g[n]?g[n]*s:i,y[n+1]=g,y[n+1].fx=t(g),y[n+1].id=n+1}function p(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}var x=(t,e)=>t.fx-e.fx,m=e.slice(),v=e.slice(),b=e.slice(),I=e.slice();for(let e=0;e<r;++e){y.sort(x),n.history&&((M=y.map(t=>{var e=t.slice();return e.fx=t.fx,e.id=t.id,e})).sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:M}));for(let t=f=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<a&&f<l)break;for(let t=0;t<d;++t){for(let e=m[t]=0;e<d;++e)m[t]+=y[e][t];m[t]/=d}var M=y[d];if(O(v,1+o,m,-o,M),v.fx=t(v),v.fx<y[0].fx)O(I,1+h,m,-h,M),I.fx=t(I),I.fx<v.fx?p(I):p(v);else if(v.fx>=y[d-1].fx){let e=!1;if(v.fx>M.fx?(O(b,1+c,m,-c,M),b.fx=t(b),b.fx<M.fx?p(b):e=!0):(O(b,1-c*o,m,c*o,M),b.fx=t(b),b.fx<v.fx?p(b):e=!0),e){if(1<=u)break;for(let e=1;e<y.length;++e)O(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else p(v)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function F(t,e,n,r,s,i,a){let l=n.fx,o=R(n.fxprime,e),h=l,c=l,u=o,f=0;function d(c,f,d){for(let y=0;y<16;++y)if(s=(c+f)/2,O(r.x,1,n.x,s,e),h=r.fx=t(r.x,r.fxprime),u=R(r.fxprime,e),h>l+i*s*o||h>=d)f=s;else{if(Math.abs(u)<=-a*o)return s;0<=u*(f-c)&&(f=c),c=s,d=h}return 0}s=s||1,i=i||1e-6,a=a||.1;for(let y=0;y<10;++y){if(O(r.x,1,n.x,s,e),h=r.fx=t(r.x,r.fxprime),u=R(r.fxprime,e),h>l+i*s*o||y&&h>=c)return d(f,s,c);if(Math.abs(u)<=-a*o)return s;if(0<=u)return d(s,f,h);c=h,f=s,s*=2}return s}function j(t,e,n){let r={x:e.slice(),fx:0,fxprime:e.slice()},s={x:e.slice(),fx:0,fxprime:e.slice()};var i,a,l,o=e.slice();let h=1;a=(n=n||{}).maxIterations||20*e.length,r.fx=t(r.x,r.fxprime),D(i=r.fxprime.slice(),r.fxprime,-1);for(let e=0;e<a&&(h=F(t,i,r,s,h),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:h}),h?(O(o,1,s.fxprime,-1,r.fxprime),l=R(r.fxprime,r.fxprime),O(i,Math.max(0,R(o,s.fxprime)/l),i,-1,s.fxprime),l=r,r=s,s=l):D(i,r.fxprime,-1),!(N(r.fxprime)<=1e-5));++e);return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:h}),r}function P(t,e={}){e.maxIterations=e.maxIterations||500;var n=e.initialLayout||q;let r=e.lossFunction||B,s=function(t,e={}){e=e.distinct;var n=t.map(t=>Object.assign({},t));function r(t){return t.join(";")}if(e){var s,i,a=new Map;for(s of n)for(let t=0;t<s.sets.length;t++){var l=String(s.sets[t]);a.set(l,s.size+(a.get(l)||0));for(let e=t+1;e<s.sets.length;e++){var o=l+";"+(h=String(s.sets[e])),h=h+";"+l;a.set(o,s.size+(a.get(o)||0)),a.set(h,s.size+(a.get(h)||0))}}for(i of n)i.sets.length<3&&(i.size=a.get(r(i.sets)))}var c,u,f,d=[],y=new Set;for(c of n)1===c.sets.length?d.push(c.sets[0]):2===c.sets.length&&(u=c.sets[0],f=c.sets[1],y.add(r(c.sets)),y.add(r([f,u])));d.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<d.length;++t){var g=d[t];for(let e=t+1;e<d.length;++e){var p=d[e];y.has(r([g,p]))||n.push({sets:[g,p],size:0})}}return n}(t,e),i=n(s,e),a=Object.keys(i);var l,o=[];for(l of a)o.push(i[l].x),o.push(i[l].y);var h=C(t=>{var e={};for(let r=0;r<a.length;++r){var n=a[r];e[n]={x:t[2*r],y:t[2*r+1],radius:i[n].radius}}return r(e,s)},o,e).x;for(let t=0;t<a.length;++t){var c=a[t];i[c].x=h[2*t],i[c].y=h[2*t+1]}return i}let L=1e-10;function $(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+L?Math.abs(t-e):function(t,e,n,r){var s=(r=r||{}).maxIterations||100,i=r.tolerance||1e-10,a=t(e);let l=n-e;if(0<a*(r=t(n)))throw"Initial bisect points must have opposite signs";if(0===a)return e;if(0===r)return n;for(let n=0;n<s;++n){var o=e+(l/=2),h=t(o);if(0<=h*a&&(e=o),Math.abs(l)<i||0===h)return o}return e+l}(r=>S(t,e,r)-n,0,t+e)}function q(t,e={}){let n=function(t,e){var n,r,s,i=e&&e.lossFunction?e.lossFunction:B;let a={},l={};for(n of t)1===n.sets.length&&(r=n.sets[0],a[r]={x:1e10,y:1e10,rowid:a.length,size:n.size,radius:Math.sqrt(n.size/Math.PI)},l[r]=[]);for(s of t=t.filter(t=>2===t.sets.length)){let t=null!=s.weight?s.weight:1;var o=s.sets[0],h=s.sets[1];s.size+L>=Math.min(a[o].size,a[h].size)&&(t=0),l[o].push({set:h,size:s.size,weight:t}),l[h].push({set:o,size:s.size,weight:t})}let c=[];function u(t,e){return e.size-t.size}Object.keys(l).forEach(t=>{let e=0;for(let n=0;n<l[t].length;++n)e+=l[t][n].size*l[t][n].weight;c.push({set:t,size:e})}),c.sort(u);let f={};function d(t){return t.set in f}function y(t,e){a[e].x=t.x,a[e].y=t.y,f[e]=!0}y({x:0,y:0},c[0].set);for(let e=1;e<c.length;++e){var g=c[e].set,p=l[g].filter(d),x=a[g];if(p.sort(u),0===p.length)throw"ERROR: missing pairwise overlap information";for(var m,v=[],b=0;b<p.length;++b){var I=a[p[b].set],M=$(x.radius,I.radius,p[b].size);v.push({x:I.x+M,y:I.y}),v.push({x:I.x-M,y:I.y}),v.push({y:I.y+M,x:I.x}),v.push({y:I.y-M,x:I.x});for(let t=b+1;t<p.length;++t){var k=a[p[t].set],w=$(x.radius,k.radius,p[t].size);k=E({x:I.x,y:I.y,radius:M},{x:k.x,y:k.y,radius:w});v.push(...k)}}let n=1e50,r=v[0];for(m of v){a[g].x=m.x,a[g].y=m.y;var _=i(a,t);_<n&&(n=_,r=m)}y(r,g)}return a}(t,e);var r=e.lossFunction||B;return 8<=t.length&&r(e=function(t,e={}){var n,r=e.restarts||10,s=[],i={};for(n of t)1===n.sets.length&&(i[n.sets[0]]=s.length,s.push(n));let{distances:a,constraints:l}=function(t,e,n){let r=A(e.length,e.length),s=A(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{var i=n[t.sets[0]],a=n[t.sets[1]],l=$(Math.sqrt(e[i].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);r[i][a]=r[a][i]=l;let o=0;t.size+1e-10>=Math.min(e[i].size,e[a].size)?o=1:t.size<=1e-10&&(o=-1),s[i][a]=s[a][i]=o}),{distances:r,constraints:s}}(t,s,i),o=N(a.map(N))/a.length;a=a.map(t=>t.map(t=>t/o));var h=(t,e)=>function(t,e,n,r){for(let t=0;t<e.length;++t)e[t]=0;let s=0;for(let d=0;d<n.length;++d){var i=t[2*d],a=t[2*d+1];for(let y=d+1;y<n.length;++y){var l=t[2*y],o=t[2*y+1],h=n[d][y],c=r[d][y],u=(l-i)*(l-i)+(o-a)*(o-a),f=Math.sqrt(u);u-=h*h,0<c&&f<=h||c<0&&h<=f||(s+=2*u*u,e[2*d]+=4*u*(i-l),e[2*d+1]+=4*u*(a-o),e[2*y]+=4*u*(l-i),e[2*y+1]+=4*u*(o-a))}}return s}(t,e,a,l);let c=null;for(let t=0;t<r;++t){var u=j(h,z(2*a.length).map(Math.random),e);(!c||u.fx<c.fx)&&(c=u)}var f=c.x,d={};for(let t=0;t<s.length;++t){var y=s[t];d[y.sets[0]]={x:f[2*t]*o,y:f[2*t+1]*o,radius:Math.sqrt(y.size/Math.PI)}}if(e.history)for(var g of e.history)D(g.x,o);return d}(t,e),t)+1e-8<r(n,t)?e:n}function B(t,e){let n=0;for(var r of e)if(1!==r.sets.length){let e;e=2===r.sets.length?(i=t[r.sets[0]],s=t[r.sets[1]],S(i.radius,s.radius,_(i,s))):k(r.sets.map(e=>t[e]));var s,i=null!=r.weight?r.weight:1;n+=i*(e-r.size)*(e-r.size)}return n}function U(t,e){let n=0;for(var r of e)if(1!==r.sets.length){let e;e=2===r.sets.length?(s=t[r.sets[0]],i=t[r.sets[1]],S(s.radius,i.radius,_(s,i))):k(r.sets.map(e=>t[e]));var s=null!=r.weight?r.weight:1,i=Math.log((e+1)/(r.size+1));n+=s*i*i}return n}function G(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),0<t.length){var r,s=t[0].x,i=t[0].y;for(r of t)r.x-=s,r.y-=i}if(2===t.length&&_(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),1<t.length){n=Math.atan2(t[1].x,t[1].y)-e;var a,l=Math.cos(n),o=Math.sin(n);for(a of t){var h=a.x,c=a.y;a.x=l*h-o*c,a.y=o*h+l*c}}if(2<t.length){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){var u,f=t[1].y/(1e-10+t[1].x);for(u of t){var d=(u.x+f*u.y)/(1+f*f);u.x=2*d-u.x,u.y=2*d*f-u.y}}}}function W(t){var e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function V(t,e,n){null==e&&(e=Math.PI/2);let r=K(t).map(t=>Object.assign({},t));var s,i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}t.forEach(t=>{t.parent=t});for(let s=0;s<t.length;++s)for(let i=s+1;i<t.length;++i){var n=t[s].radius+t[i].radius;_(t[s],t[i])+1e-10<n&&(n=t[i],r=t[s],n=e(n),r=e(r),n.parent=r)}var r,s=new Map;for(let n=0;n<t.length;++n){var i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(r);for(s of i){G(s,e,n);var a=W(s);s.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),s.bounds=a}i.sort((t,e)=>e.size-t.size);let l=(r=i[0]).bounds,o=(l.xRange.max-l.xRange.min)/50;function h(t,e,n){if(t){var s,i=t.bounds;let a,h;for(s of(e?a=l.xRange.max-i.xRange.min+o:(a=l.xRange.max-i.xRange.max,(e=(i.xRange.max-i.xRange.min)/2-(l.xRange.max-l.xRange.min)/2)<0&&(a+=e)),n?h=l.yRange.max-i.yRange.min+o:(h=l.yRange.max-i.yRange.max,(e=(i.yRange.max-i.yRange.min)/2-(l.yRange.max-l.yRange.min)/2)<0&&(h+=e)),t))s.x+=a,s.y+=h,r.push(s)}}let c=1;for(;c<i.length;)h(i[c],!0,!1),h(i[c+1],!1,!0),h(i[c+2],!0,!0),c+=3,l=W(r);return Y(r)}function X(t,e,n,r,s){var i=K(t);e-=2*r,n-=2*r;let{xRange:a,yRange:l}=W(i);if(a.max===a.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let o,h,c=(h=s?(o=e/(t=2*Math.sqrt(s/Math.PI)),n/t):(o=e/(a.max-a.min),n/(l.max-l.min)),Math.min(h,o)),u=(e-(a.max-a.min)*c)/2,f=(n-(l.max-l.min)*c)/2;return Y(i.map(t=>({radius:c*t.radius,x:r+u+(t.x-a.min)*c,y:r+f+(t.y-l.min)*c,setid:t.setid})))}function Y(t){var e,n={};for(e of t)n[e.setid]=e;return n}function K(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function Z(t={}){let e=!1,n=600,r=350,s=15,i=1e3,a=Math.PI/2,l=!0,o=null,h=!0,c=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,p={},x=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,v=function(t){return t in p?p[t]:(t=p[t]=x[m],(m+=1)>=x.length&&(m=0),t)},b=P,I=B;function M(p){let x=p.datum(),m=new Set,M=(x.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),x=x.filter(t=>!t.sets.some(t=>m.has(t))),{}),k={};if(0<x.length){let t=b(x,{lossFunction:I,distinct:d});l&&(t=V(t,a,f)),M=X(t,n,r,s,o),k=tt(M,x,g)}let w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}x.forEach(t=>{t.label&&(w[t.sets]=t.label)}),p.selectAll("svg").data([M]).enter().append("svg");var S=p.select("svg");e?S.attr("viewBox",`0 0 ${n} `+r):S.attr("width",n).attr("height",r);let E={},T=!1;function z(t){return e=>rt(t.sets.map(t=>{let s=E[t],i=M[t];return s=s||{x:n/2,y:r/2,radius:1},i=i||{x:n/2,y:r/2,radius:1},{x:s.x*(1-e)+i.x*e,y:s.y*(1-e)+i.y*e,radius:s.radius*(1-e)+i.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){var e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){return t=t.split(" "),{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}(e))});S=S.selectAll(".venn-area").data(x,t=>t.sets);var A=S.enter().append("g").attr("class",t=>"venn-area venn-"+(1==t.sets.length?"circle":"intersection")+(t.colour||t.color?" venn-coloured":"")).attr("data-venn-sets",t=>t.sets.join("_")),R=A.append("path"),N=A.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",r/2);function D(t){return"function"==typeof t.transition?t.transition("venn").duration(i):t}c&&(R.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour||t.color||v(t.sets)).style("fill-opacity",".25"),N.style("fill",e=>e.colour||e.color?"#FFF":t.textFill||(1==e.sets.length?v(e.sets):"#444")));let O=p;T&&"function"==typeof O.transition?(O=D(p)).selectAll("path").attrTween("d",z):O.selectAll("path").attr("d",t=>rt(t.sets.map(t=>M[t])),y);R=O.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y)),h&&(T?"on"in R?R.on("end",H(M,_)):R.each("end",H(M,_)):R.each(H(M,_))),p=D(S.exit()).remove();var C=("function"==typeof S.transition&&p.selectAll("path").attrTween("d",z),p.selectAll("text").attr("x",n/2).attr("y",r/2));return null!==u&&(N.style("font-size","0px"),R.style("font-size",u),C.style("font-size","0px")),{circles:M,textCentres:k,nodes:S,enter:A,update:O,exit:p}}return M.wrap=function(t){return arguments.length?(h=t,M):h},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(r=t,M):r},M.padding=function(t){return arguments.length?(s=t,M):s},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(v=t,M):v},M.colors=function(t){return arguments.length?(v=t,M):v},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(i=t,M):i},M.layoutFunction=function(t){return arguments.length?(b=t,M):b},M.normalize=function(t){return arguments.length?(l=t,M):l},M.scaleToFit=function(t){return arguments.length?(o=t,M):o},M.styled=function(t){return arguments.length?(c=t,M):c},M.orientation=function(t){return arguments.length?(a=t,M):a},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?B:"logRatio"===t?U:t,M):I},M}function H(t,e){return function(n){let r=this;var s=t[n.sets[0]].radius||50,i=(n=e(n)||"").split(/\s+/).reverse(),a=(n.length+i.length)/3,l=i.pop();let o=[l],h=0,c=(r.textContent=null,[]);function u(t){var e=r.ownerDocument.createElementNS(r.namespaceURI,"tspan");return e.textContent=t,c.push(e),r.append(e),e}let f=u(l);for(;l=i.pop();){o.push(l);var d=o.join(" ");(f.textContent=d).length>a&&f.getComputedTextLength()>s&&(o.pop(),f.textContent=o.join(" "),o=[l],f=u(l),h++)}let y=.35-1.1*h/2,g=r.getAttribute("x"),p=r.getAttribute("y");c.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",p),t.setAttribute("dy",y+1.1*e+"em")})}}function J(t,e,n){let r=e[0].radius-_(e[0],t);for(let n=1;n<e.length;++n){var s=e[n].radius-_(e[n],t);s<=r&&(r=s)}for(let e=0;e<n.length;++e){var i=_(n[e],t)-n[e].radius;i<=r&&(r=i)}return r}function Q(t,e,n){var r,s=[];for(r of t)s.push({x:r.x,y:r.y}),s.push({x:r.x+r.radius/2,y:r.y}),s.push({x:r.x-r.radius/2,y:r.y}),s.push({x:r.x,y:r.y+r.radius/2}),s.push({x:r.x,y:r.y-r.radius/2});let i=s[0],a=J(s[0],t,e);for(let n=1;n<s.length;++n){var l=J(s[n],t,e);l>=a&&(i=s[n],a=l)}var o,h,c=C(n=>-1*J({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,u={x:n?0:c[0],y:c[1]};let f=!0;for(o of t)if(_(u,o)>o.radius){f=!1;break}for(h of e)if(_(u,h)<h.radius){f=!1;break}return f?u:1==t.length?{x:t[0].x,y:t[0].y}:(k(t,n={}),0===n.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==n.arcs.length?{x:n.arcs[0].circle.x,y:n.arcs[0].circle.y}:e.length?Q(t,[]):T(n.arcs.map(t=>t.p1)))}function tt(t,e,n){var r={},s=function(t){var e,n={},r=Object.keys(t);for(e of r)n[e]=[];for(let e=0;e<r.length;e++){var s=r[e],i=t[s];for(let h=e+1;h<r.length;++h){var a=r[h],l=t[a],o=_(i,l);o+l.radius<=i.radius+1e-10?n[a].push(s):o+i.radius<=l.radius+1e-10&&n[s].push(a)}}return n}(t);for(let d=0;d<e.length;++d){var i=e[d].sets,a={},l={};for(let t=0;t<i.length;++t){a[i[t]]=!0;var o=s[i[t]];for(let t=0;t<o.length;++t)l[o[t]]=!0}var h,c=[],u=[];for(h in t)h in a?c.push(t[h]):h in l||u.push(t[h]);var f=Q(c,u,n);(r[i]=f).disjoint&&0<e[d].size&&console.log("WARNING: area "+i+" not represented on screen")}return r}function et(t){return 0===t.length?[]:(k(t,t={}),t.arcs)}function nt(t,e){if(0===t.length)return"M 0 0";let n=Math.pow(10,e||0);var r=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length)return function(t,e,n){var r=[];return r.push("\nM",t,e),r.push("\nm",-n,0),r.push("\na",n,n,0,1,0,2*n,0),r.push("\na",n,n,0,1,0,2*-n,0),r.join(" ")}(r((e=t[0].circle).x),r(e.y),r(e.radius));var s,i=["\nM",r(t[0].p2.x),r(t[0].p2.y)];for(s of t){var a=r(s.circle.radius);i.push("\nA",a,a,0,s.large?1:0,s.sweep?1:0,r(s.p1.x),r(s.p1.y))}return i.join(" ")}function rt(t,e){return nt(et(t),e)}var st,it=(()=>{var t=r(function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},"o"),e=[7,8,11,12,17,19,22,24],n=[1,17],s=[1,18],i=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],o=[7,8,11,12,17,19,22,24,27],h=[1,57],c=[1,56],u=[1,58],f=[1,59],d=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:r(function(t,e,n,r,s,i,a){var l,o=i.length-1;switch(s){case 1:return i[o-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:i[o-1].push(i[o]),this.$=i[o-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=i[o];break;case 8:r.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 9:r.addSubsetData([i[o]],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 10:r.addSubsetData([i[o-1]],i[o],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 11:r.addSubsetData([i[o-2]],void 0,parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 12:r.addSubsetData([i[o-3]],i[o-2],parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 13:if(i[o].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o]),r.addSubsetData(i[o],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 14:if(i[o-1].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-1]),r.addSubsetData(i[o-1],i[o],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 15:if(i[o-2].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-2]),r.addSubsetData(i[o-2],void 0,parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 16:if(i[o-3].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-3]),r.addSubsetData(i[o-3],i[o-2],parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 17:case 18:case 19:r.addTextData(i[o-1],i[o],void 0);break;case 20:case 21:r.addTextData(i[o-2],i[o-1],i[o]);break;case 23:r.addStyleData(i[o-1],i[o]);break;case 24:case 25:case 26:if(!(l=r.getCurrentSets()))throw new Error("text requires set");r.addTextData(l,i[o],void 0);break;case 27:case 28:if(!(l=r.getCurrentSets()))throw new Error("text requires set");r.addTextData(l,i[o-1],i[o]);break;case 29:case 41:case 34:this.$=[i[o]];break;case 30:case 42:this.$=[...i[o-2],i[o]];break;case 31:this.$=[i[o-2],i[o]];break;case 33:this.$=i[o].join(" ")}},"anonymous"),table:[t(g=[5,8],[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(e,[2,4],{6:5}),t(g,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(e,[2,5]),t(e,[2,6]),t(e,[2,7]),t(e,[2,8]),{13:16,20:n,21:s},{13:20,18:19,20:n,21:s},{13:20,18:21,20:n,21:s},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:s},t(e,[2,9],{14:[1,27],15:[1,28]}),t(i,[2,43]),t(i,[2,44]),t(e,[2,13],{14:[1,29],15:[1,30],27:a}),t(i,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(e,[2,22]),t(e,[2,24],{14:[1,35]}),t(e,[2,25],{14:[1,36]}),t(e,[2,26]),{20:l,25:37,26:38,27:a},t(e,[2,10],{15:[1,40]}),{16:[1,41]},t(e,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:s},t(e,[2,17],{14:[1,45]}),t(e,[2,18],{14:[1,46]}),t(e,[2,19]),t(e,[2,27]),t(e,[2,28]),t(e,[2,23],{27:[1,47]}),t(o,[2,29]),{15:[1,48]},{16:[1,49]},t(e,[2,11]),{16:[1,50]},t(e,[2,15]),t(i,[2,42]),t(e,[2,20]),t(e,[2,21]),{20:l,26:51},{16:h,20:c,21:[1,53],28:52,29:54,30:55,31:u,32:f,33:d},t(e,[2,12]),t(e,[2,16]),t(o,[2,30]),t(o,[2,31]),t(o,[2,32]),t(o,[2,33],{30:61,16:h,20:c,31:u,32:f,33:d}),t(y,[2,34]),t(y,[2,36]),t(y,[2,37]),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,35])],defaultActions:{6:[2,1]},parseError:r(function(t,e){var n;if(!e.recoverable)throw(n=new Error(t)).hash=e,n;this.trace(t)},"parseError"),parse:r(function(t){var e,n=this,s=[0],i=[],a=[null],l=[],o=this.table,h="",c=0,u=0,f=l.slice.call(arguments,1),d=Object.create(this.lexer),y={yy:{}};for(e in this.yy)Object.prototype.hasOwnProperty.call(this.yy,e)&&(y.yy[e]=this.yy[e]);d.setInput(t,y.yy),y.yy.lexer=d,y.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var g=d.yylloc,p=(l.push(g),d.options&&d.options.ranges);function x(){var t=i.pop()||d.lex()||1;return"number"!=typeof t&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,r(function(t){s.length=s.length-2*t,a.length=a.length-t,l.length=l.length-t},"popStack"),r(x,"lex");for(var m,v,b,I,M,k,w={};;){if(v=s[s.length-1],void 0===(b=this.defaultActions[v]||(null==m&&(m=x()),o[v]&&o[v][m]))||!b.length||!b[0]){var _,S=[];for(I in o[v])this.terminals_[I]&&2<I&&S.push("'"+this.terminals_[I]+"'");_=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(_,{text:d.match,token:this.terminals_[m]||m,line:d.yylineno,loc:g,expected:S})}if(b[0]instanceof Array&&1<b.length)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+m);switch(b[0]){case 1:s.push(m),a.push(d.yytext),l.push(d.yylloc),s.push(b[1]),m=null,u=d.yyleng,h=d.yytext,c=d.yylineno,g=d.yylloc;break;case 2:if(M=this.productions_[b[1]][1],w.$=a[a.length-M],w._$={first_line:l[l.length-(M||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(M||1)].first_column,last_column:l[l.length-1].last_column},p&&(w._$.range=[l[l.length-(M||1)].range[0],l[l.length-1].range[1]]),void 0!==(k=this.performAction.apply(w,[h,u,c,y.yy,b[1],a,l].concat(f))))return k;M&&(s=s.slice(0,-1*M*2),a=a.slice(0,-1*M),l=l.slice(0,-1*M)),s.push(this.productions_[b[1]][0]),a.push(w.$),l.push(w._$),k=o[s[s.length-2]][s[s.length-1]],s.push(k);break;case 3:return!0}}return!0},"parse")};a={EOF:1,parseError:r(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:r(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:r(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g),r=(this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e,t=this.match.split(/(?:\r\n?|\n)/g),this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1),this.yylloc.range);return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===t.length?this.yylloc.first_column:0)+t[t.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:r(function(t){this.unput(this.match.slice(t))},"less"),pastInput:r(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(20<t.length?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(20<t.length?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:r(function(t,e){var n,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)&&(r.yylloc.range=this.yylloc.range.slice(0)),(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var s in r)this[s]=r[s];return!1},"test_match"),next:r(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,n,r,s=this._currentRules(),i=0;i<s.length;i++)if((n=this._input.match(this.rules[s[i]]))&&(!e||n[0].length>e[0].length))if(e=n,r=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[i])))return t;if(!this._backtrack)return!1;e=!1}else if(!this.options.flex)break;return e?!1!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:r(function(){return this.next()||this.lex()},"lex"),begin:r(function(t){this.conditionStack.push(t)},"begin"),popState:r(function(){return 0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:r(function(){return(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]]:this.conditions.INITIAL).rules},"_currentRules"),topState:r(function(t){return 0<=(t=this.conditionStack.length-1-Math.abs(t||0))?this.conditionStack[t]:"INITIAL"},"topState"),pushState:r(function(t){this.begin(t)},"pushState"),stateStackSize:r(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:r(function(t,e,n,r){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};function p(){this.yy={}}return g.lexer=a,r(p,"Parser"),new((p.prototype=g).Parser=p)})(),at=it.parser=it,lt=[],ot=[],ht=[],ct=new Set,ut=!1,ft=r((t,e,n)=>{var r=vt(t).sort();n=n??10/Math.pow(t.length,2);1===(st=r).length&&ct.add(r[0]),lt.push({sets:r,size:n,label:e?yt(e):void 0})},"addSubsetData"),dt=r(()=>lt,"getSubsetData"),yt=r(t=>2<=(t=t.trim()).length&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t,"normalizeText"),gt=r(t=>t&&yt(t),"normalizeStyleValue"),pt=r((t,e,n)=>{e=yt(e),ot.push({sets:vt(t).sort(),id:e,label:n?yt(n):void 0})},"addTextData"),xt=r((t,e)=>{t=vt(t).sort();var n,r,s={};for([n,r]of e)s[n]=gt(r)??r;ht.push({targets:t,styles:s})},"addStyleData"),mt=r(()=>ht,"getStyleData"),vt=r(t=>t.map(t=>yt(t)),"normalizeIdentifierList"),bt=r(t=>{if(0<(t=vt(t).filter(t=>!ct.has(t))).length)throw new Error("unknown set identifier: "+t.join(", "))},"validateUnionIdentifiers"),It=r(()=>ot,"getTextData"),Mt=r(()=>st,"getCurrentSets"),kt=r(()=>ut,"getIndentMode"),wt=r(t=>{ut=t},"setIndentMode"),_t=s.venn;function St(){return i(_t,a().venn)}r(St,"getConfig");var Et={getConfig:St,clear:r(()=>{d(),lt.length=0,ot.length=0,ht.length=0,ct.clear(),st=void 0,ut=!1},"customClear"),setAccTitle:l,getAccTitle:o,setDiagramTitle:h,getDiagramTitle:c,getAccDescription:u,setAccDescription:f,addSubsetData:ft,getSubsetData:dt,addTextData:pt,addStyleData:xt,validateUnionIdentifiers:bt,getTextData:It,getStyleData:mt,getCurrentSets:Mt,getIndentMode:kt,setIndentMode:wt},Tt=r(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles"),zt=Tt;function At(t){var e,n=new Map;for(e of t){var r=e.targets.join("|"),s=n.get(r);s?Object.assign(s,e.styles):n.set(r,{...e.styles})}return n}r(At,"buildStyleByKey");var Rt=r((t,e,n,r)=>{r=r.db;var s=r.getConfig?.();let{themeVariables:i,look:l,handDrawnSeed:o}=a(),h="handDrawn"===l,c=[i.venn1,i.venn2,i.venn3,i.venn4,i.venn5,i.venn6,i.venn7,i.venn8].filter(Boolean);var u=r.getDiagramTitle?.(),f=r.getSubsetData(),d=r.getTextData();let M=At(r.getStyleData());r=Ot(f),f=s?.width??800;var k=s?.height??450;let w=f/1600;var _=u?48*w:0;let S=i.primaryTextColor??i.textColor;(e=y(e)).attr("viewBox",`0 0 ${f} `+k),u&&e.append("text").text(u).attr("class","venn-title").attr("font-size",32*w+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*w).style("fill",i.vennTitleTextColor||i.titleColor),u=g(document.createElement("div"));var E=Z().width(f).height(k-_);u.datum(r).call(E);let T=h?p.svg(u.select("svg").node()):void 0;var z;E=function(t,e={}){let{lossFunction:n,layoutFunction:r=P,normalize:s=!0,orientation:i=Math.PI/2,orientationOrder:a,width:l=600,height:o=350,padding:h=15,scaleToFit:c=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e,y=r(t,{lossFunction:"default"!==n&&n?"logRatio"===n?U:n:B,distinct:f}),g=X(y=s?V(y,i,a):y,l,o,h,c),p=tt(g,t,u),x=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{var e=t.sets.map(t=>x.get(t)),n=et(e);return{circles:e,arcs:n,path:nt(n,d),area:t,has:new Set(t.sets)}});return m.map(({circles:t,arcs:e,path:n,area:r})=>({data:r,text:p[r.sets],circles:t,arcs:e,path:n,distinctPath:n+(t=>{let e="";for(let n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e})(r.sets)}))}(r,{width:f,height:k-_,padding:s?.padding??15});let A=new Map;for(z of E){var R=Nt([...z.data.sets].sort());A.set(R,z)}0<d.length&&Dt(s,A,u,d,w,M);let N=x(i.background||"#f4f4f4");u.selectAll(".venn-circle").each(function(t,e){var n=g(this),r=(t=Nt([...t.sets].sort()),M.get(t)),s=r?.fill||c[e%c.length]||i.primaryColor,a=(n.classed("venn-set-"+e%8,!0),r?.["fill-opacity"]??.1),l=r?.stroke||s,u=r?.["stroke-width"]||""+5*w;h&&T?(t=A.get(t))&&0<t.circles.length&&(t=t.circles[0],t=T.circle(t.x,t.y,2*t.radius,{roughness:.7,seed:o,fill:I(s,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:l,strokeWidth:parseFloat(String(u))}),n.select("path").remove(),n.node()?.insertBefore(t,n.select("text").node())):n.select("path").style("fill",s).style("fill-opacity",a).style("stroke",l).style("stroke-width",u).style("stroke-opacity",.95),e=r?.color||(N?m:v)(s,30);n.select("text").style("font-size",48*w+"px").style("fill",e)}),h&&T?u.selectAll(".venn-intersection").each(function(t){var e,n,r=g(this),s=(t=Nt([...t.sets].sort()),t=M.get(t),t?.fill);s?(n=(e=r.select("path")).attr("d"))&&(n=T.path(n,{roughness:.7,seed:o,fill:I(s,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),(s=e.node())?.parentNode?.insertBefore(n,s),e.remove()):r.select("path").style("fill-opacity",0),r.select("text").style("font-size",48*w+"px").style("fill",t?.color??i.vennSetTextColor??S)}):(u.selectAll(".venn-intersection text").style("font-size",48*w+"px").style("fill",t=>(t=Nt([...t.sets].sort()),M.get(t)?.color??i.vennSetTextColor??S)),u.selectAll(".venn-intersection path").style("fill-opacity",t=>(t=Nt([...t.sets].sort()),M.get(t)?.fill?1:0)).style("fill",t=>(t=Nt([...t.sets].sort()),M.get(t)?.fill??"transparent")));var D=e.append("g").attr("transform",`translate(0, ${_})`);if((r=u.select("svg").node())&&"childNodes"in r)for(var O of[...r.childNodes])D.node()?.appendChild(O);b(e,k,f,s?.useMaxWidth??!0)},"draw");function Nt(t){return t.join("|")}function Dt(t,e,n,r,s,i){var a,l,o,h=t?.useDebugLayout??!1,c=n.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(a of r){var f=Nt(a.sets),d=u.get(f);d?d.push(a):u.set(f,[a])}for([l,o]of u.entries()){var y=e.get(l);if(y?.text){let t=y.text.x,e=y.text.y;var g=Math.min(...y.circles.map(t=>t.radius)),p=Math.min(...y.circles.map(n=>n.radius-Math.hypot(t-n.x,e-n.y)));let n=Number.isFinite(p)?Math.max(0,p):0;0===n&&Number.isFinite(g)&&(n=.6*g);var x,m,v=c.append("g").attr("class","venn-text-area").attr("font-size",40*s+"px"),b=(p=(h&&v.append("circle").attr("class","venn-text-debug-circle").attr("cx",t).attr("cy",e).attr("r",n).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*s).attr("stroke-dasharray",6*s+" "+4*s),Math.max(80*s,2*n*.95)),g=Math.max(60*s,2*n*.95),y=(y.data.label&&0<y.data.label.length?Math.min(32*s,.25*n):0)+(o.length<=2?30*s:0),t-p/2),I=e-g/2+y,M=Math.max(1,Math.ceil(Math.sqrt(o.length))),k=p/M,w=g/Math.max(1,Math.ceil(o.length/M));for([x,m]of o.entries()){var _=b+k*(.5+(E=x%M)),S=I+w*((T=Math.floor(x/M))+.5),E=(h&&v.append("rect").attr("class","venn-text-debug-cell").attr("x",b+k*E).attr("y",I+w*T).attr("width",k).attr("height",w).attr("fill","none").attr("stroke","teal").attr("stroke-width",+s).attr("stroke-dasharray",4*s+" "+3*s),.9*k),T=.9*w;_=v.append("foreignObject").attr("class","venn-text-node-fo").attr("width",E).attr("height",T).attr("x",_-E/2).attr("y",S-T/2).attr("overflow","visible"),E=i.get(m.id)?.color,S=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(m.label??m.id);E&&S.style("color",E)}}}}function Ot(t){var e,n=new Set(t.map(t=>[...t.sets].sort().join("|"))),r=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(e of t)if(!(e.sets.length<3)){var i=[...e.sets].sort();for(let t=0;t<i.length-1;t++)for(let e=t+1;e<i.length;e++){var a,l=[i[t],i[e]],o=l.join("|");n.has(o)||(n.add(o),o=r.get(l[0]),a=r.get(l[1]),o=void 0!==o&&void 0!==a?Math.min(o,a)/4:2.5,s.push({sets:l,size:o,label:""}))}}return 0<s.length?[...t,...s]:t}r(Nt,"stableSetsKey"),r(Dt,"renderTextNodes"),r(Ot,"ensurePairwiseSubsets");var Ct={parser:at,db:Et,renderer:{draw:Rt},styles:zt};export{Ct as diagram};
@@ -0,0 +1 @@
1
+ var t,e;(t=self.document)&&!t.getElementById("livereloadscript")&&((e=t.createElement("script")).async=1,e.src="//"+(self.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",e.id="livereloadscript",t.getElementsByTagName("head")[0].appendChild(e));import{b7 as n,_ as r,E as s,F as i,G as a,s as l,g as o,n as h,o as c,b as u,c as f,v as d,K as y,j as g,ao as p,Y as x,$ as m,a0 as v,k as b}from"./mermaid.core-2d237a1e.js";import"./web-753300e1.js";var I=(t,e)=>n(t,"a",-e);let M=1e-10;function k(t,e){var n=function(t){var e,n=[];for(let r=0;r<t.length;++r)for(let s=r+1;s<t.length;++s)for(e of E(t[r],t[s]))e.parentIndex=[r,s],n.push(e);return n}(t),r=n.filter(e=>function(t,e){return e.every(e=>_(t,e)<e.radius+M)}(e,t));let s=0,i=0;var a=[];if(1<r.length){var l=T(r);for(let t=0;t<r.length;++t){var o=r[t];o.angle=Math.atan2(o.x-l.x,o.y-l.y)}r.sort((t,e)=>e.angle-t.angle);let e=r[r.length-1];for(let n=0;n<r.length;++n){var h=r[n],c=(i+=(e.x+h.x)*(h.y-e.y),{x:(h.x+e.x)/2,y:(h.y+e.y)/2});let l=null;for(let n=0;n<h.parentIndex.length;++n)if(e.parentIndex.includes(h.parentIndex[n])){var u=t[h.parentIndex[n]],f=Math.atan2(h.x-u.x,h.y-u.y),d=Math.atan2(e.x-u.x,e.y-u.y);let r=d-f;r<0&&(r+=2*Math.PI),f=d-r/2;let s=_(c,{x:u.x+u.radius*Math.sin(f),y:u.y+u.radius*Math.cos(f)});s>2*u.radius&&(s=2*u.radius),(null==l||l.width>s)&&(l={circle:u,width:s,p1:h,p2:e,large:s>u.radius,sweep:!0})}null!=l&&(a.push(l),s+=w(l.circle.radius,l.width),e=h)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let r=0;r<t.length;++r)if(_(t[r],e)>Math.abs(e.radius-t[r].radius)){n=!0;break}n?s=i=0:(s=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-M,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return i/=2,e&&(e.area=s+i,e.arcArea=s,e.polygonArea=i,e.arcs=a,e.innerPoints=r,e.intersectionPoints=n),s+i}function w(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function _(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function S(t,e,n){var r;return t+e<=n?0:n<=Math.abs(t-e)?Math.PI*Math.min(t,e)*Math.min(t,e):(r=e-(n*n-t*t+e*e)/(2*n),w(t,t-(n*n-e*e+t*t)/(2*n))+w(e,r))}function E(t,e){var n,r,s=_(t,e),i=t.radius,a=e.radius;return i+a<=s||s<=Math.abs(i-a)?[]:(a=(i*i-a*a+s*s)/(2*s),i=Math.sqrt(i*i-a*a),[{x:(n=t.x+a*(e.x-t.x)/s)+(r=i/s*-(e.y-t.y)),y:(a=t.y+a*(e.y-t.y)/s)-(i=i/s*-(e.x-t.x))},{x:n-r,y:a+i}])}function T(t){var e,n={x:0,y:0};for(e of t)n.x+=e.x,n.y+=e.y;return n.x/=t.length,n.y/=t.length,n}function z(t){var e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function A(t,e){return z(t).map(()=>z(e))}function R(t,e){let n=0;for(let r=0;r<t.length;++r)n+=t[r]*e[r];return n}function N(t){return Math.sqrt(R(t,t))}function D(t,e,n){for(let r=0;r<e.length;++r)t[r]=e[r]*n}function O(t,e,n,r,s){for(let i=0;i<t.length;++i)t[i]=e*n[i]+r*s[i]}function C(t,e,n){var r=(n=n||{}).maxIterations||200*e.length,s=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,a=n.minErrorDelta||1e-6,l=n.minErrorDelta||1e-5,o=void 0!==n.rho?n.rho:1,h=void 0!==n.chi?n.chi:2,c=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f,d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e);for(let n=y[0].id=0;n<d;++n){var g=e.slice();g[n]=g[n]?g[n]*s:i,y[n+1]=g,y[n+1].fx=t(g),y[n+1].id=n+1}function p(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}var x=(t,e)=>t.fx-e.fx,m=e.slice(),v=e.slice(),b=e.slice(),I=e.slice();for(let e=0;e<r;++e){y.sort(x),n.history&&((M=y.map(t=>{var e=t.slice();return e.fx=t.fx,e.id=t.id,e})).sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:M}));for(let t=f=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<a&&f<l)break;for(let t=0;t<d;++t){for(let e=m[t]=0;e<d;++e)m[t]+=y[e][t];m[t]/=d}var M=y[d];if(O(v,1+o,m,-o,M),v.fx=t(v),v.fx<y[0].fx)O(I,1+h,m,-h,M),I.fx=t(I),I.fx<v.fx?p(I):p(v);else if(v.fx>=y[d-1].fx){let e=!1;if(v.fx>M.fx?(O(b,1+c,m,-c,M),b.fx=t(b),b.fx<M.fx?p(b):e=!0):(O(b,1-c*o,m,c*o,M),b.fx=t(b),b.fx<v.fx?p(b):e=!0),e){if(1<=u)break;for(let e=1;e<y.length;++e)O(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else p(v)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function F(t,e,n,r,s,i,a){let l=n.fx,o=R(n.fxprime,e),h=l,c=l,u=o,f=0;function d(c,f,d){for(let y=0;y<16;++y)if(s=(c+f)/2,O(r.x,1,n.x,s,e),h=r.fx=t(r.x,r.fxprime),u=R(r.fxprime,e),h>l+i*s*o||h>=d)f=s;else{if(Math.abs(u)<=-a*o)return s;0<=u*(f-c)&&(f=c),c=s,d=h}return 0}s=s||1,i=i||1e-6,a=a||.1;for(let y=0;y<10;++y){if(O(r.x,1,n.x,s,e),h=r.fx=t(r.x,r.fxprime),u=R(r.fxprime,e),h>l+i*s*o||y&&h>=c)return d(f,s,c);if(Math.abs(u)<=-a*o)return s;if(0<=u)return d(s,f,h);c=h,f=s,s*=2}return s}function j(t,e,n){let r={x:e.slice(),fx:0,fxprime:e.slice()},s={x:e.slice(),fx:0,fxprime:e.slice()};var i,a,l,o=e.slice();let h=1;a=(n=n||{}).maxIterations||20*e.length,r.fx=t(r.x,r.fxprime),D(i=r.fxprime.slice(),r.fxprime,-1);for(let e=0;e<a&&(h=F(t,i,r,s,h),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:h}),h?(O(o,1,s.fxprime,-1,r.fxprime),l=R(r.fxprime,r.fxprime),O(i,Math.max(0,R(o,s.fxprime)/l),i,-1,s.fxprime),l=r,r=s,s=l):D(i,r.fxprime,-1),!(N(r.fxprime)<=1e-5));++e);return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:h}),r}function P(t,e={}){e.maxIterations=e.maxIterations||500;var n=e.initialLayout||q;let r=e.lossFunction||B,s=function(t,e={}){e=e.distinct;var n=t.map(t=>Object.assign({},t));function r(t){return t.join(";")}if(e){var s,i,a=new Map;for(s of n)for(let t=0;t<s.sets.length;t++){var l=String(s.sets[t]);a.set(l,s.size+(a.get(l)||0));for(let e=t+1;e<s.sets.length;e++){var o=l+";"+(h=String(s.sets[e])),h=h+";"+l;a.set(o,s.size+(a.get(o)||0)),a.set(h,s.size+(a.get(h)||0))}}for(i of n)i.sets.length<3&&(i.size=a.get(r(i.sets)))}var c,u,f,d=[],y=new Set;for(c of n)1===c.sets.length?d.push(c.sets[0]):2===c.sets.length&&(u=c.sets[0],f=c.sets[1],y.add(r(c.sets)),y.add(r([f,u])));d.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<d.length;++t){var g=d[t];for(let e=t+1;e<d.length;++e){var p=d[e];y.has(r([g,p]))||n.push({sets:[g,p],size:0})}}return n}(t,e),i=n(s,e),a=Object.keys(i);var l,o=[];for(l of a)o.push(i[l].x),o.push(i[l].y);var h=C(t=>{var e={};for(let r=0;r<a.length;++r){var n=a[r];e[n]={x:t[2*r],y:t[2*r+1],radius:i[n].radius}}return r(e,s)},o,e).x;for(let t=0;t<a.length;++t){var c=a[t];i[c].x=h[2*t],i[c].y=h[2*t+1]}return i}let L=1e-10;function $(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+L?Math.abs(t-e):function(t,e,n,r){var s=(r=r||{}).maxIterations||100,i=r.tolerance||1e-10,a=t(e);let l=n-e;if(0<a*(r=t(n)))throw"Initial bisect points must have opposite signs";if(0===a)return e;if(0===r)return n;for(let n=0;n<s;++n){var o=e+(l/=2),h=t(o);if(0<=h*a&&(e=o),Math.abs(l)<i||0===h)return o}return e+l}(r=>S(t,e,r)-n,0,t+e)}function q(t,e={}){let n=function(t,e){var n,r,s,i=e&&e.lossFunction?e.lossFunction:B;let a={},l={};for(n of t)1===n.sets.length&&(r=n.sets[0],a[r]={x:1e10,y:1e10,rowid:a.length,size:n.size,radius:Math.sqrt(n.size/Math.PI)},l[r]=[]);for(s of t=t.filter(t=>2===t.sets.length)){let t=null!=s.weight?s.weight:1;var o=s.sets[0],h=s.sets[1];s.size+L>=Math.min(a[o].size,a[h].size)&&(t=0),l[o].push({set:h,size:s.size,weight:t}),l[h].push({set:o,size:s.size,weight:t})}let c=[];function u(t,e){return e.size-t.size}Object.keys(l).forEach(t=>{let e=0;for(let n=0;n<l[t].length;++n)e+=l[t][n].size*l[t][n].weight;c.push({set:t,size:e})}),c.sort(u);let f={};function d(t){return t.set in f}function y(t,e){a[e].x=t.x,a[e].y=t.y,f[e]=!0}y({x:0,y:0},c[0].set);for(let e=1;e<c.length;++e){var g=c[e].set,p=l[g].filter(d),x=a[g];if(p.sort(u),0===p.length)throw"ERROR: missing pairwise overlap information";for(var m,v=[],b=0;b<p.length;++b){var I=a[p[b].set],M=$(x.radius,I.radius,p[b].size);v.push({x:I.x+M,y:I.y}),v.push({x:I.x-M,y:I.y}),v.push({y:I.y+M,x:I.x}),v.push({y:I.y-M,x:I.x});for(let t=b+1;t<p.length;++t){var k=a[p[t].set],w=$(x.radius,k.radius,p[t].size);k=E({x:I.x,y:I.y,radius:M},{x:k.x,y:k.y,radius:w});v.push(...k)}}let n=1e50,r=v[0];for(m of v){a[g].x=m.x,a[g].y=m.y;var _=i(a,t);_<n&&(n=_,r=m)}y(r,g)}return a}(t,e);var r=e.lossFunction||B;return 8<=t.length&&r(e=function(t,e={}){var n,r=e.restarts||10,s=[],i={};for(n of t)1===n.sets.length&&(i[n.sets[0]]=s.length,s.push(n));let{distances:a,constraints:l}=function(t,e,n){let r=A(e.length,e.length),s=A(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{var i=n[t.sets[0]],a=n[t.sets[1]],l=$(Math.sqrt(e[i].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);r[i][a]=r[a][i]=l;let o=0;t.size+1e-10>=Math.min(e[i].size,e[a].size)?o=1:t.size<=1e-10&&(o=-1),s[i][a]=s[a][i]=o}),{distances:r,constraints:s}}(t,s,i),o=N(a.map(N))/a.length;a=a.map(t=>t.map(t=>t/o));var h=(t,e)=>function(t,e,n,r){for(let t=0;t<e.length;++t)e[t]=0;let s=0;for(let d=0;d<n.length;++d){var i=t[2*d],a=t[2*d+1];for(let y=d+1;y<n.length;++y){var l=t[2*y],o=t[2*y+1],h=n[d][y],c=r[d][y],u=(l-i)*(l-i)+(o-a)*(o-a),f=Math.sqrt(u);u-=h*h,0<c&&f<=h||c<0&&h<=f||(s+=2*u*u,e[2*d]+=4*u*(i-l),e[2*d+1]+=4*u*(a-o),e[2*y]+=4*u*(l-i),e[2*y+1]+=4*u*(o-a))}}return s}(t,e,a,l);let c=null;for(let t=0;t<r;++t){var u=j(h,z(2*a.length).map(Math.random),e);(!c||u.fx<c.fx)&&(c=u)}var f=c.x,d={};for(let t=0;t<s.length;++t){var y=s[t];d[y.sets[0]]={x:f[2*t]*o,y:f[2*t+1]*o,radius:Math.sqrt(y.size/Math.PI)}}if(e.history)for(var g of e.history)D(g.x,o);return d}(t,e),t)+1e-8<r(n,t)?e:n}function B(t,e){let n=0;for(var r of e)if(1!==r.sets.length){let e;e=2===r.sets.length?(i=t[r.sets[0]],s=t[r.sets[1]],S(i.radius,s.radius,_(i,s))):k(r.sets.map(e=>t[e]));var s,i=null!=r.weight?r.weight:1;n+=i*(e-r.size)*(e-r.size)}return n}function U(t,e){let n=0;for(var r of e)if(1!==r.sets.length){let e;e=2===r.sets.length?(s=t[r.sets[0]],i=t[r.sets[1]],S(s.radius,i.radius,_(s,i))):k(r.sets.map(e=>t[e]));var s=null!=r.weight?r.weight:1,i=Math.log((e+1)/(r.size+1));n+=s*i*i}return n}function G(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),0<t.length){var r,s=t[0].x,i=t[0].y;for(r of t)r.x-=s,r.y-=i}if(2===t.length&&_(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),1<t.length){n=Math.atan2(t[1].x,t[1].y)-e;var a,l=Math.cos(n),o=Math.sin(n);for(a of t){var h=a.x,c=a.y;a.x=l*h-o*c,a.y=o*h+l*c}}if(2<t.length){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){var u,f=t[1].y/(1e-10+t[1].x);for(u of t){var d=(u.x+f*u.y)/(1+f*f);u.x=2*d-u.x,u.y=2*d*f-u.y}}}}function W(t){var e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function V(t,e,n){null==e&&(e=Math.PI/2);let r=K(t).map(t=>Object.assign({},t));var s,i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}t.forEach(t=>{t.parent=t});for(let s=0;s<t.length;++s)for(let i=s+1;i<t.length;++i){var n=t[s].radius+t[i].radius;_(t[s],t[i])+1e-10<n&&(n=t[i],r=t[s],n=e(n),r=e(r),n.parent=r)}var r,s=new Map;for(let n=0;n<t.length;++n){var i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(r);for(s of i){G(s,e,n);var a=W(s);s.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),s.bounds=a}i.sort((t,e)=>e.size-t.size);let l=(r=i[0]).bounds,o=(l.xRange.max-l.xRange.min)/50;function h(t,e,n){if(t){var s,i=t.bounds;let a,h;for(s of(e?a=l.xRange.max-i.xRange.min+o:(a=l.xRange.max-i.xRange.max,(e=(i.xRange.max-i.xRange.min)/2-(l.xRange.max-l.xRange.min)/2)<0&&(a+=e)),n?h=l.yRange.max-i.yRange.min+o:(h=l.yRange.max-i.yRange.max,(e=(i.yRange.max-i.yRange.min)/2-(l.yRange.max-l.yRange.min)/2)<0&&(h+=e)),t))s.x+=a,s.y+=h,r.push(s)}}let c=1;for(;c<i.length;)h(i[c],!0,!1),h(i[c+1],!1,!0),h(i[c+2],!0,!0),c+=3,l=W(r);return Y(r)}function X(t,e,n,r,s){var i=K(t);e-=2*r,n-=2*r;let{xRange:a,yRange:l}=W(i);if(a.max===a.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let o,h,c=(h=s?(o=e/(t=2*Math.sqrt(s/Math.PI)),n/t):(o=e/(a.max-a.min),n/(l.max-l.min)),Math.min(h,o)),u=(e-(a.max-a.min)*c)/2,f=(n-(l.max-l.min)*c)/2;return Y(i.map(t=>({radius:c*t.radius,x:r+u+(t.x-a.min)*c,y:r+f+(t.y-l.min)*c,setid:t.setid})))}function Y(t){var e,n={};for(e of t)n[e.setid]=e;return n}function K(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function Z(t={}){let e=!1,n=600,r=350,s=15,i=1e3,a=Math.PI/2,l=!0,o=null,h=!0,c=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,p={},x=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,v=function(t){return t in p?p[t]:(t=p[t]=x[m],(m+=1)>=x.length&&(m=0),t)},b=P,I=B;function M(p){let x=p.datum(),m=new Set,M=(x.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),x=x.filter(t=>!t.sets.some(t=>m.has(t))),{}),k={};if(0<x.length){let t=b(x,{lossFunction:I,distinct:d});l&&(t=V(t,a,f)),M=X(t,n,r,s,o),k=tt(M,x,g)}let w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}x.forEach(t=>{t.label&&(w[t.sets]=t.label)}),p.selectAll("svg").data([M]).enter().append("svg");var S=p.select("svg");e?S.attr("viewBox",`0 0 ${n} `+r):S.attr("width",n).attr("height",r);let E={},T=!1;function z(t){return e=>rt(t.sets.map(t=>{let s=E[t],i=M[t];return s=s||{x:n/2,y:r/2,radius:1},i=i||{x:n/2,y:r/2,radius:1},{x:s.x*(1-e)+i.x*e,y:s.y*(1-e)+i.y*e,radius:s.radius*(1-e)+i.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){var e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){return t=t.split(" "),{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}(e))});S=S.selectAll(".venn-area").data(x,t=>t.sets);var A=S.enter().append("g").attr("class",t=>"venn-area venn-"+(1==t.sets.length?"circle":"intersection")+(t.colour||t.color?" venn-coloured":"")).attr("data-venn-sets",t=>t.sets.join("_")),R=A.append("path"),N=A.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",r/2);function D(t){return"function"==typeof t.transition?t.transition("venn").duration(i):t}c&&(R.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour||t.color||v(t.sets)).style("fill-opacity",".25"),N.style("fill",e=>e.colour||e.color?"#FFF":t.textFill||(1==e.sets.length?v(e.sets):"#444")));let O=p;T&&"function"==typeof O.transition?(O=D(p)).selectAll("path").attrTween("d",z):O.selectAll("path").attr("d",t=>rt(t.sets.map(t=>M[t])),y);R=O.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y)),h&&(T?"on"in R?R.on("end",H(M,_)):R.each("end",H(M,_)):R.each(H(M,_))),p=D(S.exit()).remove();var C=("function"==typeof S.transition&&p.selectAll("path").attrTween("d",z),p.selectAll("text").attr("x",n/2).attr("y",r/2));return null!==u&&(N.style("font-size","0px"),R.style("font-size",u),C.style("font-size","0px")),{circles:M,textCentres:k,nodes:S,enter:A,update:O,exit:p}}return M.wrap=function(t){return arguments.length?(h=t,M):h},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(r=t,M):r},M.padding=function(t){return arguments.length?(s=t,M):s},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(v=t,M):v},M.colors=function(t){return arguments.length?(v=t,M):v},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(i=t,M):i},M.layoutFunction=function(t){return arguments.length?(b=t,M):b},M.normalize=function(t){return arguments.length?(l=t,M):l},M.scaleToFit=function(t){return arguments.length?(o=t,M):o},M.styled=function(t){return arguments.length?(c=t,M):c},M.orientation=function(t){return arguments.length?(a=t,M):a},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?B:"logRatio"===t?U:t,M):I},M}function H(t,e){return function(n){let r=this;var s=t[n.sets[0]].radius||50,i=(n=e(n)||"").split(/\s+/).reverse(),a=(n.length+i.length)/3,l=i.pop();let o=[l],h=0,c=(r.textContent=null,[]);function u(t){var e=r.ownerDocument.createElementNS(r.namespaceURI,"tspan");return e.textContent=t,c.push(e),r.append(e),e}let f=u(l);for(;l=i.pop();){o.push(l);var d=o.join(" ");(f.textContent=d).length>a&&f.getComputedTextLength()>s&&(o.pop(),f.textContent=o.join(" "),o=[l],f=u(l),h++)}let y=.35-1.1*h/2,g=r.getAttribute("x"),p=r.getAttribute("y");c.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",p),t.setAttribute("dy",y+1.1*e+"em")})}}function J(t,e,n){let r=e[0].radius-_(e[0],t);for(let n=1;n<e.length;++n){var s=e[n].radius-_(e[n],t);s<=r&&(r=s)}for(let e=0;e<n.length;++e){var i=_(n[e],t)-n[e].radius;i<=r&&(r=i)}return r}function Q(t,e,n){var r,s=[];for(r of t)s.push({x:r.x,y:r.y}),s.push({x:r.x+r.radius/2,y:r.y}),s.push({x:r.x-r.radius/2,y:r.y}),s.push({x:r.x,y:r.y+r.radius/2}),s.push({x:r.x,y:r.y-r.radius/2});let i=s[0],a=J(s[0],t,e);for(let n=1;n<s.length;++n){var l=J(s[n],t,e);l>=a&&(i=s[n],a=l)}var o,h,c=C(n=>-1*J({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,u={x:n?0:c[0],y:c[1]};let f=!0;for(o of t)if(_(u,o)>o.radius){f=!1;break}for(h of e)if(_(u,h)<h.radius){f=!1;break}return f?u:1==t.length?{x:t[0].x,y:t[0].y}:(k(t,n={}),0===n.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==n.arcs.length?{x:n.arcs[0].circle.x,y:n.arcs[0].circle.y}:e.length?Q(t,[]):T(n.arcs.map(t=>t.p1)))}function tt(t,e,n){var r={},s=function(t){var e,n={},r=Object.keys(t);for(e of r)n[e]=[];for(let e=0;e<r.length;e++){var s=r[e],i=t[s];for(let h=e+1;h<r.length;++h){var a=r[h],l=t[a],o=_(i,l);o+l.radius<=i.radius+1e-10?n[a].push(s):o+i.radius<=l.radius+1e-10&&n[s].push(a)}}return n}(t);for(let d=0;d<e.length;++d){var i=e[d].sets,a={},l={};for(let t=0;t<i.length;++t){a[i[t]]=!0;var o=s[i[t]];for(let t=0;t<o.length;++t)l[o[t]]=!0}var h,c=[],u=[];for(h in t)h in a?c.push(t[h]):h in l||u.push(t[h]);var f=Q(c,u,n);(r[i]=f).disjoint&&0<e[d].size&&console.log("WARNING: area "+i+" not represented on screen")}return r}function et(t){return 0===t.length?[]:(k(t,t={}),t.arcs)}function nt(t,e){if(0===t.length)return"M 0 0";let n=Math.pow(10,e||0);var r=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length)return function(t,e,n){var r=[];return r.push("\nM",t,e),r.push("\nm",-n,0),r.push("\na",n,n,0,1,0,2*n,0),r.push("\na",n,n,0,1,0,2*-n,0),r.join(" ")}(r((e=t[0].circle).x),r(e.y),r(e.radius));var s,i=["\nM",r(t[0].p2.x),r(t[0].p2.y)];for(s of t){var a=r(s.circle.radius);i.push("\nA",a,a,0,s.large?1:0,s.sweep?1:0,r(s.p1.x),r(s.p1.y))}return i.join(" ")}function rt(t,e){return nt(et(t),e)}var st,it=(()=>{var t=r(function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},"o"),e=[7,8,11,12,17,19,22,24],n=[1,17],s=[1,18],i=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],o=[7,8,11,12,17,19,22,24,27],h=[1,57],c=[1,56],u=[1,58],f=[1,59],d=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:r(function(t,e,n,r,s,i,a){var l,o=i.length-1;switch(s){case 1:return i[o-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:i[o-1].push(i[o]),this.$=i[o-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=i[o];break;case 8:r.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 9:r.addSubsetData([i[o]],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 10:r.addSubsetData([i[o-1]],i[o],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 11:r.addSubsetData([i[o-2]],void 0,parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 12:r.addSubsetData([i[o-3]],i[o-2],parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 13:if(i[o].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o]),r.addSubsetData(i[o],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 14:if(i[o-1].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-1]),r.addSubsetData(i[o-1],i[o],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 15:if(i[o-2].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-2]),r.addSubsetData(i[o-2],void 0,parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 16:if(i[o-3].length<2)throw new Error("union requires multiple identifiers");r.validateUnionIdentifiers&&r.validateUnionIdentifiers(i[o-3]),r.addSubsetData(i[o-3],i[o-2],parseFloat(i[o])),r.setIndentMode&&r.setIndentMode(!0);break;case 17:case 18:case 19:r.addTextData(i[o-1],i[o],void 0);break;case 20:case 21:r.addTextData(i[o-2],i[o-1],i[o]);break;case 23:r.addStyleData(i[o-1],i[o]);break;case 24:case 25:case 26:if(!(l=r.getCurrentSets()))throw new Error("text requires set");r.addTextData(l,i[o],void 0);break;case 27:case 28:if(!(l=r.getCurrentSets()))throw new Error("text requires set");r.addTextData(l,i[o-1],i[o]);break;case 29:case 41:case 34:this.$=[i[o]];break;case 30:case 42:this.$=[...i[o-2],i[o]];break;case 31:this.$=[i[o-2],i[o]];break;case 33:this.$=i[o].join(" ")}},"anonymous"),table:[t(g=[5,8],[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(e,[2,4],{6:5}),t(g,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(e,[2,5]),t(e,[2,6]),t(e,[2,7]),t(e,[2,8]),{13:16,20:n,21:s},{13:20,18:19,20:n,21:s},{13:20,18:21,20:n,21:s},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:s},t(e,[2,9],{14:[1,27],15:[1,28]}),t(i,[2,43]),t(i,[2,44]),t(e,[2,13],{14:[1,29],15:[1,30],27:a}),t(i,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(e,[2,22]),t(e,[2,24],{14:[1,35]}),t(e,[2,25],{14:[1,36]}),t(e,[2,26]),{20:l,25:37,26:38,27:a},t(e,[2,10],{15:[1,40]}),{16:[1,41]},t(e,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:s},t(e,[2,17],{14:[1,45]}),t(e,[2,18],{14:[1,46]}),t(e,[2,19]),t(e,[2,27]),t(e,[2,28]),t(e,[2,23],{27:[1,47]}),t(o,[2,29]),{15:[1,48]},{16:[1,49]},t(e,[2,11]),{16:[1,50]},t(e,[2,15]),t(i,[2,42]),t(e,[2,20]),t(e,[2,21]),{20:l,26:51},{16:h,20:c,21:[1,53],28:52,29:54,30:55,31:u,32:f,33:d},t(e,[2,12]),t(e,[2,16]),t(o,[2,30]),t(o,[2,31]),t(o,[2,32]),t(o,[2,33],{30:61,16:h,20:c,31:u,32:f,33:d}),t(y,[2,34]),t(y,[2,36]),t(y,[2,37]),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,35])],defaultActions:{6:[2,1]},parseError:r(function(t,e){var n;if(!e.recoverable)throw(n=new Error(t)).hash=e,n;this.trace(t)},"parseError"),parse:r(function(t){var e,n=this,s=[0],i=[],a=[null],l=[],o=this.table,h="",c=0,u=0,f=l.slice.call(arguments,1),d=Object.create(this.lexer),y={yy:{}};for(e in this.yy)Object.prototype.hasOwnProperty.call(this.yy,e)&&(y.yy[e]=this.yy[e]);d.setInput(t,y.yy),y.yy.lexer=d,y.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var g=d.yylloc,p=(l.push(g),d.options&&d.options.ranges);function x(){var t=i.pop()||d.lex()||1;return"number"!=typeof t&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,r(function(t){s.length=s.length-2*t,a.length=a.length-t,l.length=l.length-t},"popStack"),r(x,"lex");for(var m,v,b,I,M,k,w={};;){if(v=s[s.length-1],void 0===(b=this.defaultActions[v]||(null==m&&(m=x()),o[v]&&o[v][m]))||!b.length||!b[0]){var _,S=[];for(I in o[v])this.terminals_[I]&&2<I&&S.push("'"+this.terminals_[I]+"'");_=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(_,{text:d.match,token:this.terminals_[m]||m,line:d.yylineno,loc:g,expected:S})}if(b[0]instanceof Array&&1<b.length)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+m);switch(b[0]){case 1:s.push(m),a.push(d.yytext),l.push(d.yylloc),s.push(b[1]),m=null,u=d.yyleng,h=d.yytext,c=d.yylineno,g=d.yylloc;break;case 2:if(M=this.productions_[b[1]][1],w.$=a[a.length-M],w._$={first_line:l[l.length-(M||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(M||1)].first_column,last_column:l[l.length-1].last_column},p&&(w._$.range=[l[l.length-(M||1)].range[0],l[l.length-1].range[1]]),void 0!==(k=this.performAction.apply(w,[h,u,c,y.yy,b[1],a,l].concat(f))))return k;M&&(s=s.slice(0,-1*M*2),a=a.slice(0,-1*M),l=l.slice(0,-1*M)),s.push(this.productions_[b[1]][0]),a.push(w.$),l.push(w._$),k=o[s[s.length-2]][s[s.length-1]],s.push(k);break;case 3:return!0}}return!0},"parse")};a={EOF:1,parseError:r(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:r(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:r(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g),r=(this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e,t=this.match.split(/(?:\r\n?|\n)/g),this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1),this.yylloc.range);return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===t.length?this.yylloc.first_column:0)+t[t.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:r(function(t){this.unput(this.match.slice(t))},"less"),pastInput:r(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(20<t.length?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(20<t.length?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:r(function(t,e){var n,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)&&(r.yylloc.range=this.yylloc.range.slice(0)),(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var s in r)this[s]=r[s];return!1},"test_match"),next:r(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,n,r,s=this._currentRules(),i=0;i<s.length;i++)if((n=this._input.match(this.rules[s[i]]))&&(!e||n[0].length>e[0].length))if(e=n,r=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[i])))return t;if(!this._backtrack)return!1;e=!1}else if(!this.options.flex)break;return e?!1!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:r(function(){return this.next()||this.lex()},"lex"),begin:r(function(t){this.conditionStack.push(t)},"begin"),popState:r(function(){return 0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:r(function(){return(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]]:this.conditions.INITIAL).rules},"_currentRules"),topState:r(function(t){return 0<=(t=this.conditionStack.length-1-Math.abs(t||0))?this.conditionStack[t]:"INITIAL"},"topState"),pushState:r(function(t){this.begin(t)},"pushState"),stateStackSize:r(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:r(function(t,e,n,r){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};function p(){this.yy={}}return g.lexer=a,r(p,"Parser"),new((p.prototype=g).Parser=p)})(),at=it.parser=it,lt=[],ot=[],ht=[],ct=new Set,ut=!1,ft=r((t,e,n)=>{var r=vt(t).sort();n=n??10/Math.pow(t.length,2);1===(st=r).length&&ct.add(r[0]),lt.push({sets:r,size:n,label:e?yt(e):void 0})},"addSubsetData"),dt=r(()=>lt,"getSubsetData"),yt=r(t=>2<=(t=t.trim()).length&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t,"normalizeText"),gt=r(t=>t&&yt(t),"normalizeStyleValue"),pt=r((t,e,n)=>{e=yt(e),ot.push({sets:vt(t).sort(),id:e,label:n?yt(n):void 0})},"addTextData"),xt=r((t,e)=>{t=vt(t).sort();var n,r,s={};for([n,r]of e)s[n]=gt(r)??r;ht.push({targets:t,styles:s})},"addStyleData"),mt=r(()=>ht,"getStyleData"),vt=r(t=>t.map(t=>yt(t)),"normalizeIdentifierList"),bt=r(t=>{if(0<(t=vt(t).filter(t=>!ct.has(t))).length)throw new Error("unknown set identifier: "+t.join(", "))},"validateUnionIdentifiers"),It=r(()=>ot,"getTextData"),Mt=r(()=>st,"getCurrentSets"),kt=r(()=>ut,"getIndentMode"),wt=r(t=>{ut=t},"setIndentMode"),_t=s.venn;function St(){return i(_t,a().venn)}r(St,"getConfig");var Et={getConfig:St,clear:r(()=>{d(),lt.length=0,ot.length=0,ht.length=0,ct.clear(),st=void 0,ut=!1},"customClear"),setAccTitle:l,getAccTitle:o,setDiagramTitle:h,getDiagramTitle:c,getAccDescription:u,setAccDescription:f,addSubsetData:ft,getSubsetData:dt,addTextData:pt,addStyleData:xt,validateUnionIdentifiers:bt,getTextData:It,getStyleData:mt,getCurrentSets:Mt,getIndentMode:kt,setIndentMode:wt},Tt=r(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles"),zt=Tt;function At(t){var e,n=new Map;for(e of t){var r=e.targets.join("|"),s=n.get(r);s?Object.assign(s,e.styles):n.set(r,{...e.styles})}return n}r(At,"buildStyleByKey");var Rt=r((t,e,n,r)=>{r=r.db;var s=r.getConfig?.();let{themeVariables:i,look:l,handDrawnSeed:o}=a(),h="handDrawn"===l,c=[i.venn1,i.venn2,i.venn3,i.venn4,i.venn5,i.venn6,i.venn7,i.venn8].filter(Boolean);var u=r.getDiagramTitle?.(),f=r.getSubsetData(),d=r.getTextData();let M=At(r.getStyleData());r=Ot(f),f=s?.width??800;var k=s?.height??450;let w=f/1600;var _=u?48*w:0;let S=i.primaryTextColor??i.textColor;(e=y(e)).attr("viewBox",`0 0 ${f} `+k),u&&e.append("text").text(u).attr("class","venn-title").attr("font-size",32*w+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*w).style("fill",i.vennTitleTextColor||i.titleColor),u=g(document.createElement("div"));var E=Z().width(f).height(k-_);u.datum(r).call(E);let T=h?p.svg(u.select("svg").node()):void 0;var z;E=function(t,e={}){let{lossFunction:n,layoutFunction:r=P,normalize:s=!0,orientation:i=Math.PI/2,orientationOrder:a,width:l=600,height:o=350,padding:h=15,scaleToFit:c=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e,y=r(t,{lossFunction:"default"!==n&&n?"logRatio"===n?U:n:B,distinct:f}),g=X(y=s?V(y,i,a):y,l,o,h,c),p=tt(g,t,u),x=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{var e=t.sets.map(t=>x.get(t)),n=et(e);return{circles:e,arcs:n,path:nt(n,d),area:t,has:new Set(t.sets)}});return m.map(({circles:t,arcs:e,path:n,area:r})=>({data:r,text:p[r.sets],circles:t,arcs:e,path:n,distinctPath:n+(t=>{let e="";for(let n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e})(r.sets)}))}(r,{width:f,height:k-_,padding:s?.padding??15});let A=new Map;for(z of E){var R=Nt([...z.data.sets].sort());A.set(R,z)}0<d.length&&Dt(s,A,u,d,w,M);let N=x(i.background||"#f4f4f4");u.selectAll(".venn-circle").each(function(t,e){var n=g(this),r=(t=Nt([...t.sets].sort()),M.get(t)),s=r?.fill||c[e%c.length]||i.primaryColor,a=(n.classed("venn-set-"+e%8,!0),r?.["fill-opacity"]??.1),l=r?.stroke||s,u=r?.["stroke-width"]||""+5*w;h&&T?(t=A.get(t))&&0<t.circles.length&&(t=t.circles[0],t=T.circle(t.x,t.y,2*t.radius,{roughness:.7,seed:o,fill:I(s,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:l,strokeWidth:parseFloat(String(u))}),n.select("path").remove(),n.node()?.insertBefore(t,n.select("text").node())):n.select("path").style("fill",s).style("fill-opacity",a).style("stroke",l).style("stroke-width",u).style("stroke-opacity",.95),e=r?.color||(N?m:v)(s,30);n.select("text").style("font-size",48*w+"px").style("fill",e)}),h&&T?u.selectAll(".venn-intersection").each(function(t){var e,n,r=g(this),s=(t=Nt([...t.sets].sort()),t=M.get(t),t?.fill);s?(n=(e=r.select("path")).attr("d"))&&(n=T.path(n,{roughness:.7,seed:o,fill:I(s,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),(s=e.node())?.parentNode?.insertBefore(n,s),e.remove()):r.select("path").style("fill-opacity",0),r.select("text").style("font-size",48*w+"px").style("fill",t?.color??i.vennSetTextColor??S)}):(u.selectAll(".venn-intersection text").style("font-size",48*w+"px").style("fill",t=>(t=Nt([...t.sets].sort()),M.get(t)?.color??i.vennSetTextColor??S)),u.selectAll(".venn-intersection path").style("fill-opacity",t=>(t=Nt([...t.sets].sort()),M.get(t)?.fill?1:0)).style("fill",t=>(t=Nt([...t.sets].sort()),M.get(t)?.fill??"transparent")));var D=e.append("g").attr("transform",`translate(0, ${_})`);if((r=u.select("svg").node())&&"childNodes"in r)for(var O of[...r.childNodes])D.node()?.appendChild(O);b(e,k,f,s?.useMaxWidth??!0)},"draw");function Nt(t){return t.join("|")}function Dt(t,e,n,r,s,i){var a,l,o,h=t?.useDebugLayout??!1,c=n.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(a of r){var f=Nt(a.sets),d=u.get(f);d?d.push(a):u.set(f,[a])}for([l,o]of u.entries()){var y=e.get(l);if(y?.text){let t=y.text.x,e=y.text.y;var g=Math.min(...y.circles.map(t=>t.radius)),p=Math.min(...y.circles.map(n=>n.radius-Math.hypot(t-n.x,e-n.y)));let n=Number.isFinite(p)?Math.max(0,p):0;0===n&&Number.isFinite(g)&&(n=.6*g);var x,m,v=c.append("g").attr("class","venn-text-area").attr("font-size",40*s+"px"),b=(p=(h&&v.append("circle").attr("class","venn-text-debug-circle").attr("cx",t).attr("cy",e).attr("r",n).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*s).attr("stroke-dasharray",6*s+" "+4*s),Math.max(80*s,2*n*.95)),g=Math.max(60*s,2*n*.95),y=(y.data.label&&0<y.data.label.length?Math.min(32*s,.25*n):0)+(o.length<=2?30*s:0),t-p/2),I=e-g/2+y,M=Math.max(1,Math.ceil(Math.sqrt(o.length))),k=p/M,w=g/Math.max(1,Math.ceil(o.length/M));for([x,m]of o.entries()){var _=b+k*(.5+(E=x%M)),S=I+w*((T=Math.floor(x/M))+.5),E=(h&&v.append("rect").attr("class","venn-text-debug-cell").attr("x",b+k*E).attr("y",I+w*T).attr("width",k).attr("height",w).attr("fill","none").attr("stroke","teal").attr("stroke-width",+s).attr("stroke-dasharray",4*s+" "+3*s),.9*k),T=.9*w;_=v.append("foreignObject").attr("class","venn-text-node-fo").attr("width",E).attr("height",T).attr("x",_-E/2).attr("y",S-T/2).attr("overflow","visible"),E=i.get(m.id)?.color,S=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(m.label??m.id);E&&S.style("color",E)}}}}function Ot(t){var e,n=new Set(t.map(t=>[...t.sets].sort().join("|"))),r=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(e of t)if(!(e.sets.length<3)){var i=[...e.sets].sort();for(let t=0;t<i.length-1;t++)for(let e=t+1;e<i.length;e++){var a,l=[i[t],i[e]],o=l.join("|");n.has(o)||(n.add(o),o=r.get(l[0]),a=r.get(l[1]),o=void 0!==o&&void 0!==a?Math.min(o,a)/4:2.5,s.push({sets:l,size:o,label:""}))}}return 0<s.length?[...t,...s]:t}r(Nt,"stableSetsKey"),r(Dt,"renderTextNodes"),r(Ot,"ensurePairwiseSubsets");var Ct={parser:at,db:Et,renderer:{draw:Rt},styles:zt};export{Ct as diagram};
@@ -0,0 +1 @@
1
+ export{W as WardleyModule,t as createWardleyServices}from"./mermaid-parser.core-d8d1c2b9.js";
@@ -0,0 +1 @@
1
+ var e,r;(e=self.document)&&!e.getElementById("livereloadscript")&&((r=e.createElement("script")).async=1,r.src="//"+(self.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",r.id="livereloadscript",e.getElementsByTagName("head")[0].appendChild(r));export{W as WardleyModule,t as createWardleyServices}from"./mermaid-parser.core-6df0beec.js";
@@ -0,0 +1 @@
1
+ import{p as t}from"./chunk-JWPE2WC7-e2521b1e.js";import{_ as e,l as a,d as r,v as n,s as o,g as i,n as s,o as l,b as d,c,L as p,G as x,F as h,K as y,k as g}from"./mermaid.core-8797d6a9.js";import{v as f}from"./mermaid-parser.core-d8d1c2b9.js";import"./web-c3ed22c4.js";var u=e(((t,e)=>{var a=t<=1?100*t:t;if(a<0||100<a)throw new Error(e+" must be between 0-1 (decimal) or 0-100 (percentage). Received: "+t);return a}),"toPercent"),m=e(((t,e,a)=>({x:u(e,a+" evolution"),y:u(t,a+" visibility")})),"toCoordinates"),w=e((t=>{if(t)return"+<>"===t?"bidirectional":"+<"===t?"backward":"+>"===t?"forward":void 0}),"getFlowFromPort"),k=e((t=>{var e;return t?.startsWith("+")?(e=/^\+'([^']*)'/.exec(t)?.[1],t.includes("<>")?{flow:"bidirectional",label:e}:t.includes("<")?{flow:"backward",label:e}:t.includes(">")?{flow:"forward",label:e}:{label:e}):{}}),"extractFlowFromArrow"),b=e(((e,a)=>{var r,n;t(e,a),e.size&&a.setSize(e.size.width,e.size.height),e.evolution&&(r=e.evolution.stages.map((t=>t.secondName?t.name.trim()+" / "+t.secondName.trim():t.name.trim())),n=e.evolution.stages.filter((t=>void 0!==t.boundary)).map((t=>t.boundary)),a.updateAxes({stages:r,stageBoundaries:n})),e.anchors.forEach((t=>{var e=m(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")})),e.components.forEach((t=>{var e=m(t.visibility,t.evolution,`Component "${t.name}"`),r=t.label?(t.label.negX?-1:1)*t.label.offsetX:void 0,n=t.label?(t.label.negY?-1:1)*t.label.offsetY:void 0,o=t.decorator?.strategy;a.addNode(t.name,t.name,e.x,e.y,"component",r,n,t.inertia,o)})),e.notes.forEach((t=>{var e=m(t.visibility,t.evolution,`Note "${t.text}"`);a.addNote(t.text,e.x,e.y)})),e.pipelines.forEach((t=>{var e=a.getNode(t.parent);if(!e||"number"!=typeof e.y)throw new Error(`Pipeline "${t.parent}" must reference an existing component with coordinates.`);const r=e.y;a.startPipeline(t.parent),t.components.forEach((e=>{var n=t.parent+"_"+e.name,o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,s=u(e.evolution,`Pipeline component "${e.name}" evolution`);a.addNode(n,e.name,s,r,"pipeline-component",o,i),a.addPipelineComponent(t.parent,n)}))})),e.links.forEach((t=>{var e=!!t.arrow&&(t.arrow.includes("-.->")||t.arrow.includes(".-."));let r=w(t.fromPort)??w(t.toPort);var{flow:n,label:o}=k(t.arrow),n=(!r&&n&&(r=n),t.linkLabel),o=o??n;a.addLink(a.resolveNodeId(t.from),a.resolveNodeId(t.to),e,o,r)})),e.evolves.forEach((t=>{var e,r=a.getNode(t.component);void 0!==r?.y&&(e=u(t.target,`Evolve target for "${t.component}"`),a.addTrend(t.component,e,r.y))})),0<e.annotations.length&&(r=e.annotations[0],n=m(r.x,r.y,"Annotations box"),a.setAnnotationsBox(n.x,n.y)),e.annotation.forEach((t=>{var e=m(t.x,t.y,"Annotation "+t.number);a.addAnnotation(t.number,[{x:e.x,y:e.y}],t.text)})),e.accelerators.forEach((t=>{var e=m(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)})),e.deaccelerators.forEach((t=>{var e=m(t.x,t.y,`Deaccelerator "${t.name}"`);a.addDeaccelerator(t.name,e.x,e.y)}))}),"populateDb"),v={parser:{yy:void 0},parse:e((async t=>{t=await f("wardley",t);var e=(a.debug(t),v.parser?.yy);if(!e||"function"!=typeof e.addNode)throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");b(t,e)}),"parse")},$=new class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{e(this,"WardleyBuilder")}addNode(t){var e=this.nodes.get(t.id)??{id:t.id,label:t.label};e={...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY};this.nodes.set(t.id,e)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]}),(t=this.nodes.get(t))&&(t.isPipelineParent=!0)}addPipelineComponent(t,e){(t=this.pipelines.get(t))&&t.componentIds.push(e),(t=this.nodes.get(e))&&(t.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(!this.nodes.has(t))for(var[e,a]of this.nodes)if(a.label===t)return e;return t}build(){var t=[];for(const e of this.nodes.values()){if("number"!=typeof e.x||"number"!=typeof e.y)throw new Error(`Node "${e.label}" is missing coordinates`);t.push(e)}return{nodes:t,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}};function S(){return r()["wardley-beta"]}function M(t,e,a,r,n,o,i,s,l){$.addNode({id:t,label:e,x:a,y:r,className:n,labelOffsetX:o,labelOffsetY:i,inertia:s,sourceStrategy:l})}function C(t,e,a=!1,r,n){$.addLink({source:t,target:e,dashed:a,label:r,flow:n})}function P(t,e,a){$.addTrend({nodeId:t,targetX:e,targetY:a})}function N(t,e,a){$.addAnnotation({number:t,coordinates:e,text:a})}function z(t,e,a){$.addNote({text:t,x:e,y:a})}function L(t,e,a){$.addAccelerator({name:t,x:e,y:a})}function T(t,e,a){$.addDeaccelerator({name:t,x:e,y:a})}function A(t,e){$.setAnnotationsBox(t,e)}function E(t,e){$.setSize(t,e)}function I(t){$.startPipeline(t)}function B(t,e){$.addPipelineComponent(t,e)}function F(t){$.setAxes(t)}function R(t){return $.getNode(t)}function X(t){return $.resolveNodeId(t)}function Y(){return $.build()}function O(){$.clear(),n()}e(S,"getConfig"),e(M,"addNode"),e(C,"addLink"),e(P,"addTrend"),e(N,"addAnnotation"),e(z,"addNote"),e(L,"addAccelerator"),e(T,"addDeaccelerator"),e(A,"setAnnotationsBox"),e(E,"setSize"),e(I,"startPipeline"),e(B,"addPipelineComponent"),e(F,"updateAxes"),e(R,"getNode"),e(X,"resolveNodeId"),e(Y,"getWardleyData"),e(O,"clear");var D={getConfig:S,addNode:M,addLink:C,addTrend:P,addAnnotation:N,addNote:z,addAccelerator:L,addDeaccelerator:T,setAnnotationsBox:A,setSize:E,startPipeline:I,addPipelineComponent:B,updateAxes:F,getNode:R,resolveNodeId:X,getWardleyData:Y,clear:O,setAccTitle:o,getAccTitle:i,setDiagramTitle:s,getDiagramTitle:l,getAccDescription:d,setAccDescription:c},W=["Genesis","Custom Built","Product","Commodity"],j=e((()=>{var t=r().themeVariables;return{backgroundColor:t.wardley?.backgroundColor??t.background??"#fff",axisColor:t.wardley?.axisColor??"#000",axisTextColor:t.wardley?.axisTextColor??t.primaryTextColor??"#222",gridColor:t.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:t.wardley?.componentFill??"#fff",componentStroke:t.wardley?.componentStroke??"#000",componentLabelColor:t.wardley?.componentLabelColor??t.primaryTextColor??"#222",linkStroke:t.wardley?.linkStroke??"#000",evolutionStroke:t.wardley?.evolutionStroke??"#dc3545",annotationStroke:t.wardley?.annotationStroke??"#000",annotationTextColor:t.wardley?.annotationTextColor??t.primaryTextColor??"#222",annotationFill:t.wardley?.annotationFill??t.background??"#fff"}}),"getTheme"),q=e((()=>{var t=r()["wardley-beta"];return{width:t?.width??900,height:t?.height??600,padding:t?.padding??48,nodeRadius:t?.nodeRadius??6,nodeLabelOffset:t?.nodeLabelOffset??8,axisFontSize:t?.axisFontSize??12,labelFontSize:t?.labelFontSize??10,showGrid:t?.showGrid??!1,useMaxWidth:t?.useMaxWidth??!0}}),"getConfigValues"),G={draw:e(((t,r,n,o)=>{a.debug("Rendering Wardley map\n"+t);const i=q(),s=j(),l=1.6*i.nodeRadius,d=(t=o.db).getWardleyData();o=t.getDiagramTitle();var c=d.size?.width??i.width;const p=d.size?.height??i.height;var x=((t=y(r)).selectAll("*").remove(),g(t,p,c,i.useMaxWidth),t.attr("viewBox",`0 0 ${c} `+p),t.append("g").attr("class","wardley-map"));(t=t.append("defs")).append("marker").attr("id","arrow-"+r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",s.evolutionStroke).attr("stroke","none"),t.append("marker").attr("id","link-arrow-end-"+r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",s.linkStroke).attr("stroke","none"),t.append("marker").attr("id","link-arrow-start-"+r).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",s.linkStroke).attr("stroke","none"),x.append("rect").attr("class","wardley-background").attr("width",c).attr("height",p).attr("fill",s.backgroundColor);const h=c-2*i.padding,f=p-2*i.padding,u=(o&&x.append("text").attr("class","wardley-title").attr("x",c/2).attr("y",i.padding/2).attr("fill",s.axisTextColor).attr("font-size",1.05*i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(o),e((t=>i.padding+t/100*h),"projectX")),m=e((t=>p-i.padding-t/100*f),"projectY");(t=x.append("g").attr("class","wardley-axes")).append("line").attr("x1",i.padding).attr("x2",c-i.padding).attr("y1",p-i.padding).attr("y2",p-i.padding).attr("stroke",s.axisColor).attr("stroke-width",1),t.append("line").attr("x1",i.padding).attr("x2",i.padding).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke",s.axisColor).attr("stroke-width",1),o=d.axes.xLabel??"Evolution";var w=d.axes.yLabel??"Visibility";if(0<(o=(t.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",i.padding+h/2).attr("y",p-i.padding/4).attr("fill",s.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(o),t.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",i.padding/3).attr("y",i.padding+f/2).attr("fill",s.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${i.padding/3} ${i.padding+f/2})`).text(w),d.axes.stages&&0<d.axes.stages.length?d.axes.stages:W)).length){const e=x.append("g").attr("class","wardley-stages");t=d.axes.stageBoundaries;const a=[];if(t&&t.length===o.length){let e=0;t.forEach((t=>{a.push({start:e,end:t}),e=t}))}else{const t=1/o.length;o.forEach(((e,r)=>{a.push({start:r*t,end:(r+1)*t})}))}o.forEach(((t,r)=>{var n=a[r],o=i.padding+n.start*h;n=(o+(i.padding+n.end*h))/2;0<r&&e.append("line").attr("x1",o).attr("x2",o).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),e.append("text").attr("class","wardley-stage-label").attr("x",n).attr("y",p-i.padding/1.5).attr("fill",s.axisTextColor).attr("font-size",i.axisFontSize-2).attr("text-anchor","middle").text(t)}))}if(i.showGrid){var k=x.append("g").attr("class","wardley-grid");for(let t=1;t<4;t++){var b=t/4,v=i.padding+h*b;k.append("line").attr("x1",v).attr("x2",v).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke",s.gridColor).attr("stroke-dasharray","2 6"),k.append("line").attr("x1",i.padding).attr("x2",c-i.padding).attr("y1",p-i.padding-f*b).attr("y2",p-i.padding-f*b).attr("stroke",s.gridColor).attr("stroke-dasharray","2 6")}}const $=new Map;if(d.nodes.forEach((t=>{$.set(t.id,{x:u(t.x),y:m(t.y),node:t})})),0<d.pipelines.length){const t=x.append("g").attr("class","wardley-pipelines"),e=x.append("g").attr("class","wardley-pipeline-links");d.pipelines.forEach((a=>{if(0!==a.componentIds.length){var r,n,o,c=a.componentIds.map((t=>({id:t,pos:$.get(t),node:d.nodes.find((e=>e.id===t))}))).filter((t=>t.pos&&t.node)).sort(((t,e)=>t.node.x-e.node.x));for(let t=0;t<c.length-1;t++){var p=c[t],x=c[t+1];e.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",p.pos.x).attr("y1",p.pos.y).attr("x2",x.pos.x).attr("y2",x.pos.y).attr("stroke",s.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,y=-1/0,g=0;a.componentIds.forEach((t=>{(t=$.get(t))&&(h=Math.min(h,t.x),y=Math.max(y,t.x),g=t.y)})),h!==1/0&&y!==-1/0&&(r=4*i.nodeRadius,n=g-r/2,(a=$.get(a.nodeId))&&(o=(h+y)/2,a.x=o,a.y=n-l/6),t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",n).attr("width",y-h+30).attr("height",r).attr("fill","none").attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4))}}))}w=x.append("g").attr("class","wardley-links");const S=new Map;d.pipelines.forEach((t=>{S.set(t.nodeId,new Set(t.componentIds))})),t=d.links.filter((t=>!(!$.has(t.source)||!$.has(t.target)||S.get(t.target)?.has(t.source)))),w.selectAll("line").data(t).enter().append("line").attr("class",(t=>"wardley-link"+(t.dashed?" wardley-link--dashed":""))).attr("x1",(t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find((e=>e.id===t.source)).isPipelineParent?l/Math.sqrt(2):i.nodeRadius,n=a.x-e.x;a=a.y-e.y,a=Math.sqrt(n*n+a*a);return e.x+n/a*r})).attr("y1",(t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find((e=>e.id===t.source)).isPipelineParent?l/Math.sqrt(2):i.nodeRadius,n=a.x-e.x;a=a.y-e.y,n=Math.sqrt(n*n+a*a);return e.y+a/n*r})).attr("x2",(t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find((e=>e.id===t.target)).isPipelineParent?l/Math.sqrt(2):i.nodeRadius,n=e.x-a.x;e=e.y-a.y,e=Math.sqrt(n*n+e*e);return a.x+n/e*r})).attr("y2",(t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find((e=>e.id===t.target)).isPipelineParent?l/Math.sqrt(2):i.nodeRadius,n=e.x-a.x;e=e.y-a.y,n=Math.sqrt(n*n+e*e);return a.y+e/n*r})).attr("stroke",s.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(t=>t.dashed?"6 6":null)).attr("marker-end",(t=>"forward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-end-${r})`:null)).attr("marker-start",(t=>"backward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-start-${r})`:null)),w.selectAll("text").data(t.filter((t=>t.label))).enter().append("text").attr("class","wardley-link-label").attr("x",(t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.x+t.x)/2),r=t.y-e.y;t=t.x-e.x;return a+r/Math.sqrt(t*t+r*r)*8})).attr("y",(t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.y+t.y)/2),r=t.x-e.x;t=t.y-e.y;return a+-r/Math.sqrt(r*r+t*t)*8})).attr("fill",s.axisTextColor).attr("font-size",i.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.x+t.x)/2),r=(e.y+t.y)/2,n=t.x-e.x;a+=(t=t.y-e.y)/(e=Math.sqrt(n*n+t*t))*8,r+=-n/e*8;let o=180*Math.atan2(t,n)/Math.PI;return(90<o||o<-90)&&(o+=180),`rotate(${o} ${a} ${r})`})).text((t=>t.label)),o=x.append("g").attr("class","wardley-trends"),w=d.trends.map((t=>{var e,a,r,n,o=$.get(t.nodeId);return o?(e=u(t.targetX),t=m(t.targetY),a=e-o.x,r=t-o.y,n=Math.sqrt(a*a+r*r),{origin:o,targetX:e,targetY:t,adjustedX2:(o=i.nodeRadius+2)<n?e-a/n*o:e,adjustedY2:o<n?t-r/n*o:t}):null})).filter((t=>null!==t)),o.selectAll("line").data(w).enter().append("line").attr("class","wardley-trend").attr("x1",(t=>t.origin.x)).attr("y1",(t=>t.origin.y)).attr("x2",(t=>t.adjustedX2)).attr("y2",(t=>t.adjustedY2)).attr("stroke",s.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`),(t=x.append("g").attr("class","wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class",(t=>["wardley-node",t.className?"wardley-node--"+t.className:""].filter(Boolean).join(" ")))).filter((t=>"outsource"===t.sourceStrategy)).append("circle").attr("class","wardley-outsource-overlay").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y)).attr("r",2*i.nodeRadius).attr("fill","#666").attr("stroke",s.componentStroke).attr("stroke-width",1),t.filter((t=>"buy"===t.sourceStrategy)).append("circle").attr("class","wardley-buy-overlay").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y)).attr("r",2*i.nodeRadius).attr("fill","#ccc").attr("stroke",s.componentStroke).attr("stroke-width",1),t.filter((t=>"build"===t.sourceStrategy)).append("circle").attr("class","wardley-build-overlay").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y)).attr("r",2*i.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1),(o=t.filter((t=>"market"===t.sourceStrategy))).append("circle").attr("class","wardley-market-overlay").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y)).attr("r",2*i.nodeRadius).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),t.filter((t=>!t.isPipelineParent&&"market"!==t.sourceStrategy&&"anchor"!==t.className)).append("circle").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y)).attr("r",i.nodeRadius).attr("fill",s.componentFill).attr("stroke",s.componentStroke).attr("stroke-width",1),w=.7*i.nodeRadius;const M=1.2*i.nodeRadius;if(o.append("line").attr("class","wardley-market-line").attr("x1",(t=>$.get(t.id).x)).attr("y1",(t=>$.get(t.id).y-M)).attr("x2",(t=>$.get(t.id).x-M*Math.cos(Math.PI/6))).attr("y2",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("stroke",s.componentStroke).attr("stroke-width",1),o.append("line").attr("class","wardley-market-line").attr("x1",(t=>$.get(t.id).x-M*Math.cos(Math.PI/6))).attr("y1",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("x2",(t=>$.get(t.id).x+M*Math.cos(Math.PI/6))).attr("y2",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("stroke",s.componentStroke).attr("stroke-width",1),o.append("line").attr("class","wardley-market-line").attr("x1",(t=>$.get(t.id).x+M*Math.cos(Math.PI/6))).attr("y1",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("x2",(t=>$.get(t.id).x)).attr("y2",(t=>$.get(t.id).y-M)).attr("stroke",s.componentStroke).attr("stroke-width",1),o.append("circle").attr("class","wardley-market-dot").attr("cx",(t=>$.get(t.id).x)).attr("cy",(t=>$.get(t.id).y-M)).attr("r",w).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),o.append("circle").attr("class","wardley-market-dot").attr("cx",(t=>$.get(t.id).x-M*Math.cos(Math.PI/6))).attr("cy",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("r",w).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),o.append("circle").attr("class","wardley-market-dot").attr("cx",(t=>$.get(t.id).x+M*Math.cos(Math.PI/6))).attr("cy",(t=>$.get(t.id).y+M*Math.sin(Math.PI/6))).attr("r",w).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),t.filter((t=>!0===t.isPipelineParent)).append("rect").attr("x",(t=>$.get(t.id).x-l/2)).attr("y",(t=>$.get(t.id).y-l/2)).attr("width",l).attr("height",l).attr("fill",s.componentFill).attr("stroke",s.componentStroke).attr("stroke-width",1),t.filter((t=>!0===t.inertia)).append("line").attr("class","wardley-inertia").attr("x1",(t=>{var e=$.get(t.id);let a=t.isPipelineParent?l/2+15:i.nodeRadius+15;return t.sourceStrategy&&(a+=i.nodeRadius+10),e.x+a})).attr("y1",(t=>{var e=$.get(t.id);t=t.isPipelineParent?l:2*i.nodeRadius;return e.y-t/2})).attr("x2",(t=>{var e=$.get(t.id);let a=t.isPipelineParent?l/2+15:i.nodeRadius+15;return t.sourceStrategy&&(a+=i.nodeRadius+10),e.x+a})).attr("y2",(t=>{var e=$.get(t.id);t=t.isPipelineParent?l:2*i.nodeRadius;return e.y+t/2})).attr("stroke",s.componentStroke).attr("stroke-width",6),t.append("text").attr("x",(t=>{var e=$.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetX?e.x+t.labelOffsetX:e.x;let a=i.nodeLabelOffset;return t.sourceStrategy&&void 0===t.labelOffsetX&&(a+=10),t=t.labelOffsetX??a,e.x+t})).attr("y",(t=>{var e=$.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetY?e.y+t.labelOffsetY:e.y-3;let a=-i.nodeLabelOffset;return t.sourceStrategy&&void 0===t.labelOffsetY&&(a-=10),t=t.labelOffsetY??a,e.y+t})).attr("class","wardley-node-label").attr("fill",(t=>"evolved"===t.className?s.evolutionStroke:"anchor"===t.className?"#000":s.componentLabelColor)).attr("font-size",i.labelFontSize).attr("font-weight",(t=>"anchor"===t.className?"bold":"normal")).attr("text-anchor",(t=>"anchor"===t.className?"middle":"start")).attr("dominant-baseline",(t=>"anchor"===t.className?"middle":"auto")).text((t=>t.label)),0<d.annotations.length){const e=x.append("g").attr("class","wardley-annotations");if(d.annotations.forEach((t=>{var a=t.coordinates.map((t=>({x:u(t.x),y:m(t.y)})));if(1<a.length)for(let t=0;t<a.length-1;t++)e.append("line").attr("class","wardley-annotation-line").attr("x1",a[t].x).attr("y1",a[t].y).attr("x2",a[t+1].x).attr("y2",a[t+1].y).attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");a.forEach((a=>{var r=e.append("g").attr("class","wardley-annotation");r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("fill","white").attr("stroke",s.axisColor).attr("stroke-width",1.5),r.append("text").attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(t.number)}))})),d.annotationsBox){let a=u(d.annotationsBox.x),r=m(d.annotationsBox.y);const n=e.append("g").attr("class","wardley-annotations-box");o=[...d.annotations].filter((t=>t.text)).sort(((t,e)=>t.number-e.number));const l=[];if(o.forEach(((t,e)=>{e=n.append("text").attr("x",a+10).attr("y",r+10+16*(e+1)).attr("font-size",11).attr("fill",s.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(t.number+". "+t.text),l.push(e)})),0<l.length){let e=0,d=0;l.forEach((t=>{var a=(t=t.node()).getComputedTextLength();e=Math.max(e,a),a=t.getBBox();d=Math.max(d,a.height)}));w=e+20+105,t=16*o.length+20+d/2,o=i.padding;var C=c-i.padding-w,P=i.padding,N=p-i.padding-t;a=Math.max(o,Math.min(a,C)),r=Math.max(P,Math.min(r,N)),l.forEach(((t,e)=>{t.attr("x",a+10).attr("y",r+10+16*(e+1))})),n.insert("rect","text").attr("x",a).attr("y",r).attr("width",w).attr("height",t).attr("fill","white").attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(0<d.notes.length){const t=x.append("g").attr("class","wardley-notes");d.notes.forEach((e=>{var a=u(e.x),r=m(e.y);t.append("text").attr("x",a).attr("y",r).attr("text-anchor","start").attr("font-size",11).attr("fill",s.axisTextColor).attr("font-weight","bold").text(e.text)}))}if(0<d.accelerators.length){const t=x.append("g").attr("class","wardley-accelerators");d.accelerators.forEach((e=>{var a=u(e.x),r=m(e.y),n=`\n M ${a} ${r-15}\n L ${a+60-20} ${r-15}\n L ${a+60-20} ${r-15-8}\n L ${a+60} ${r}\n L ${a+60-20} ${r+15+8}\n L ${a+60-20} ${r+15}\n L ${a} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(e.name)}))}if(0<d.deaccelerators.length){const t=x.append("g").attr("class","wardley-deaccelerators");d.deaccelerators.forEach((e=>{var a=u(e.x),r=m(e.y),n=`\n M ${a+60} ${r-15}\n L ${a+20} ${r-15}\n L ${a+20} ${r-15-8}\n L ${a} ${r}\n L ${a+20} ${r+15+8}\n L ${a+20} ${r+15}\n L ${a+60} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(e.name)}))}}),"draw")},V=e((({wardley:t}={})=>{var e=p(),a=x();e=h(e,a.themeVariables);return`\n .wardley-background {\n fill: ${(a=h(e.wardley,t)).backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${a.axisColor};\n }\n .wardley-axis-label {\n fill: ${a.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${a.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${a.gridColor};\n }\n .wardley-node circle {\n fill: ${a.componentFill};\n stroke: ${a.componentStroke};\n }\n .wardley-node-label {\n fill: ${a.componentLabelColor};\n }\n .wardley-link {\n stroke: ${a.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${a.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${a.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${a.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${a.annotationFill};\n stroke: ${a.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${a.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${a.annotationFill};\n stroke: ${a.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${a.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${a.componentStroke};\n }\n .wardley-notes text {\n fill: ${a.axisTextColor};\n }\n `}),"styles"),H={parser:v,db:D,renderer:G,styles:V};export{H as diagram};
@@ -0,0 +1 @@
1
+ var t,e;(t=self.document)&&!t.getElementById("livereloadscript")&&((e=t.createElement("script")).async=1,e.src="//"+(self.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",e.id="livereloadscript",t.getElementsByTagName("head")[0].appendChild(e));import{p as a}from"./chunk-JWPE2WC7-15a55950.js";import{_ as r,l as n,d as o,v as i,s as l,g as s,n as d,o as c,b as p,c as h,L as x,G as y,F as g,K as f,k as u}from"./mermaid.core-70d5aead.js";import{v as m}from"./mermaid-parser.core-6df0beec.js";import"./web-25bb78b9.js";var w=r((t,e)=>{var a=t<=1?100*t:t;if(a<0||100<a)throw new Error(e+" must be between 0-1 (decimal) or 0-100 (percentage). Received: "+t);return a},"toPercent"),k=r((t,e,a)=>({x:w(e,a+" evolution"),y:w(t,a+" visibility")}),"toCoordinates"),b=r(t=>{if(t)return"+<>"===t?"bidirectional":"+<"===t?"backward":"+>"===t?"forward":void 0},"getFlowFromPort"),v=r(t=>{var e;return t?.startsWith("+")?(e=/^\+'([^']*)'/.exec(t)?.[1],t.includes("<>")?{flow:"bidirectional",label:e}:t.includes("<")?{flow:"backward",label:e}:t.includes(">")?{flow:"forward",label:e}:{label:e}):{}},"extractFlowFromArrow"),$=r((t,e)=>{var r,n;a(t,e),t.size&&e.setSize(t.size.width,t.size.height),t.evolution&&(r=t.evolution.stages.map(t=>t.secondName?t.name.trim()+" / "+t.secondName.trim():t.name.trim()),n=t.evolution.stages.filter(t=>void 0!==t.boundary).map(t=>t.boundary),e.updateAxes({stages:r,stageBoundaries:n})),t.anchors.forEach(t=>{var a=k(t.visibility,t.evolution,`Anchor "${t.name}"`);e.addNode(t.name,t.name,a.x,a.y,"anchor")}),t.components.forEach(t=>{var a=k(t.visibility,t.evolution,`Component "${t.name}"`),r=t.label?(t.label.negX?-1:1)*t.label.offsetX:void 0,n=t.label?(t.label.negY?-1:1)*t.label.offsetY:void 0,o=t.decorator?.strategy;e.addNode(t.name,t.name,a.x,a.y,"component",r,n,t.inertia,o)}),t.notes.forEach(t=>{var a=k(t.visibility,t.evolution,`Note "${t.text}"`);e.addNote(t.text,a.x,a.y)}),t.pipelines.forEach(t=>{var a=e.getNode(t.parent);if(!a||"number"!=typeof a.y)throw new Error(`Pipeline "${t.parent}" must reference an existing component with coordinates.`);let r=a.y;e.startPipeline(t.parent),t.components.forEach(a=>{var n=t.parent+"_"+a.name,o=a.label?(a.label.negX?-1:1)*a.label.offsetX:void 0,i=a.label?(a.label.negY?-1:1)*a.label.offsetY:void 0,l=w(a.evolution,`Pipeline component "${a.name}" evolution`);e.addNode(n,a.name,l,r,"pipeline-component",o,i),e.addPipelineComponent(t.parent,n)})}),t.links.forEach(t=>{var a=!!t.arrow&&(t.arrow.includes("-.->")||t.arrow.includes(".-."));let r=b(t.fromPort)??b(t.toPort);var{flow:n,label:o}=v(t.arrow),n=(!r&&n&&(r=n),t.linkLabel),o=o??n;e.addLink(e.resolveNodeId(t.from),e.resolveNodeId(t.to),a,o,r)}),t.evolves.forEach(t=>{var a,r=e.getNode(t.component);void 0!==r?.y&&(a=w(t.target,`Evolve target for "${t.component}"`),e.addTrend(t.component,a,r.y))}),0<t.annotations.length&&(r=t.annotations[0],n=k(r.x,r.y,"Annotations box"),e.setAnnotationsBox(n.x,n.y)),t.annotation.forEach(t=>{var a=k(t.x,t.y,"Annotation "+t.number);e.addAnnotation(t.number,[{x:a.x,y:a.y}],t.text)}),t.accelerators.forEach(t=>{var a=k(t.x,t.y,`Accelerator "${t.name}"`);e.addAccelerator(t.name,a.x,a.y)}),t.deaccelerators.forEach(t=>{var a=k(t.x,t.y,`Deaccelerator "${t.name}"`);e.addDeaccelerator(t.name,a.x,a.y)})},"populateDb"),S={parser:{yy:void 0},parse:r(async t=>{t=await m("wardley",t);var e=(n.debug(t),S.parser?.yy);if(!e||"function"!=typeof e.addNode)throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");$(t,e)},"parse")},C=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{r(this,"WardleyBuilder")}addNode(t){var e=this.nodes.get(t.id)??{id:t.id,label:t.label};e={...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY};this.nodes.set(t.id,e)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]}),(t=this.nodes.get(t))&&(t.isPipelineParent=!0)}addPipelineComponent(t,e){(t=this.pipelines.get(t))&&t.componentIds.push(e),(t=this.nodes.get(e))&&(t.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(!this.nodes.has(t))for(var[e,a]of this.nodes)if(a.label===t)return e;return t}build(){var t,e=[];for(t of this.nodes.values()){if("number"!=typeof t.x||"number"!=typeof t.y)throw new Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},M=new C;function P(){return o()["wardley-beta"]}function N(t,e,a,r,n,o,i,l,s){M.addNode({id:t,label:e,x:a,y:r,className:n,labelOffsetX:o,labelOffsetY:i,inertia:l,sourceStrategy:s})}function z(t,e,a=!1,r,n){M.addLink({source:t,target:e,dashed:a,label:r,flow:n})}function T(t,e,a){M.addTrend({nodeId:t,targetX:e,targetY:a})}function L(t,e,a){M.addAnnotation({number:t,coordinates:e,text:a})}function E(t,e,a){M.addNote({text:t,x:e,y:a})}function A(t,e,a){M.addAccelerator({name:t,x:e,y:a})}function I(t,e,a){M.addDeaccelerator({name:t,x:e,y:a})}function B(t,e){M.setAnnotationsBox(t,e)}function F(t,e){M.setSize(t,e)}function R(t){M.startPipeline(t)}function X(t,e){M.addPipelineComponent(t,e)}function Y(t){M.setAxes(t)}function O(t){return M.getNode(t)}function D(t){return M.resolveNodeId(t)}function W(){return M.build()}function j(){M.clear(),i()}r(P,"getConfig"),r(N,"addNode"),r(z,"addLink"),r(T,"addTrend"),r(L,"addAnnotation"),r(E,"addNote"),r(A,"addAccelerator"),r(I,"addDeaccelerator"),r(B,"setAnnotationsBox"),r(F,"setSize"),r(R,"startPipeline"),r(X,"addPipelineComponent"),r(Y,"updateAxes"),r(O,"getNode"),r(D,"resolveNodeId"),r(W,"getWardleyData"),r(j,"clear");var q={getConfig:P,addNode:N,addLink:z,addTrend:T,addAnnotation:L,addNote:E,addAccelerator:A,addDeaccelerator:I,setAnnotationsBox:B,setSize:F,startPipeline:R,addPipelineComponent:X,updateAxes:Y,getNode:O,resolveNodeId:D,getWardleyData:W,clear:j,setAccTitle:l,getAccTitle:s,setDiagramTitle:d,getDiagramTitle:c,getAccDescription:p,setAccDescription:h},G=["Genesis","Custom Built","Product","Commodity"],V=r(()=>{var t=o().themeVariables;return{backgroundColor:t.wardley?.backgroundColor??t.background??"#fff",axisColor:t.wardley?.axisColor??"#000",axisTextColor:t.wardley?.axisTextColor??t.primaryTextColor??"#222",gridColor:t.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:t.wardley?.componentFill??"#fff",componentStroke:t.wardley?.componentStroke??"#000",componentLabelColor:t.wardley?.componentLabelColor??t.primaryTextColor??"#222",linkStroke:t.wardley?.linkStroke??"#000",evolutionStroke:t.wardley?.evolutionStroke??"#dc3545",annotationStroke:t.wardley?.annotationStroke??"#000",annotationTextColor:t.wardley?.annotationTextColor??t.primaryTextColor??"#222",annotationFill:t.wardley?.annotationFill??t.background??"#fff"}},"getTheme"),H=r(()=>{var t=o()["wardley-beta"];return{width:t?.width??900,height:t?.height??600,padding:t?.padding??48,nodeRadius:t?.nodeRadius??6,nodeLabelOffset:t?.nodeLabelOffset??8,axisFontSize:t?.axisFontSize??12,labelFontSize:t?.labelFontSize??10,showGrid:t?.showGrid??!1,useMaxWidth:t?.useMaxWidth??!0}},"getConfigValues"),Z=r((t,e,a,o)=>{n.debug("Rendering Wardley map\n"+t);let i=H(),l=V(),s=1.6*i.nodeRadius,d=(t=o.db).getWardleyData();o=t.getDiagramTitle();var c=d.size?.width??i.width;let p=d.size?.height??i.height;var h=((t=f(e)).selectAll("*").remove(),u(t,p,c,i.useMaxWidth),t.attr("viewBox",`0 0 ${c} `+p),t.append("g").attr("class","wardley-map"));(t=t.append("defs")).append("marker").attr("id","arrow-"+e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",l.evolutionStroke).attr("stroke","none"),t.append("marker").attr("id","link-arrow-end-"+e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",l.linkStroke).attr("stroke","none"),t.append("marker").attr("id","link-arrow-start-"+e).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",l.linkStroke).attr("stroke","none"),h.append("rect").attr("class","wardley-background").attr("width",c).attr("height",p).attr("fill",l.backgroundColor);let x=c-2*i.padding,y=p-2*i.padding,g=(o&&h.append("text").attr("class","wardley-title").attr("x",c/2).attr("y",i.padding/2).attr("fill",l.axisTextColor).attr("font-size",1.05*i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(o),r(t=>i.padding+t/100*x,"projectX")),m=r(t=>p-i.padding-t/100*y,"projectY");(t=h.append("g").attr("class","wardley-axes")).append("line").attr("x1",i.padding).attr("x2",c-i.padding).attr("y1",p-i.padding).attr("y2",p-i.padding).attr("stroke",l.axisColor).attr("stroke-width",1),t.append("line").attr("x1",i.padding).attr("x2",i.padding).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke",l.axisColor).attr("stroke-width",1),o=d.axes.xLabel??"Evolution";var w=d.axes.yLabel??"Visibility";if(0<(o=(t.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",i.padding+x/2).attr("y",p-i.padding/4).attr("fill",l.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(o),t.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",i.padding/3).attr("y",i.padding+y/2).attr("fill",l.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${i.padding/3} ${i.padding+y/2})`).text(w),d.axes.stages&&0<d.axes.stages.length?d.axes.stages:G)).length){let e=h.append("g").attr("class","wardley-stages");t=d.axes.stageBoundaries;let a=[];if(t&&t.length===o.length){let e=0;t.forEach(t=>{a.push({start:e,end:t}),e=t})}else{let t=1/o.length;o.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}o.forEach((t,r)=>{var n=a[r],o=i.padding+n.start*x;n=(o+(i.padding+n.end*x))/2;0<r&&e.append("line").attr("x1",o).attr("x2",o).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),e.append("text").attr("class","wardley-stage-label").attr("x",n).attr("y",p-i.padding/1.5).attr("fill",l.axisTextColor).attr("font-size",i.axisFontSize-2).attr("text-anchor","middle").text(t)})}if(i.showGrid){var k=h.append("g").attr("class","wardley-grid");for(let t=1;t<4;t++){var b=t/4,v=i.padding+x*b;k.append("line").attr("x1",v).attr("x2",v).attr("y1",i.padding).attr("y2",p-i.padding).attr("stroke",l.gridColor).attr("stroke-dasharray","2 6"),k.append("line").attr("x1",i.padding).attr("x2",c-i.padding).attr("y1",p-i.padding-y*b).attr("y2",p-i.padding-y*b).attr("stroke",l.gridColor).attr("stroke-dasharray","2 6")}}let $=new Map;if(d.nodes.forEach(t=>{$.set(t.id,{x:g(t.x),y:m(t.y),node:t})}),0<d.pipelines.length){let t=h.append("g").attr("class","wardley-pipelines"),e=h.append("g").attr("class","wardley-pipeline-links");d.pipelines.forEach(a=>{if(0!==a.componentIds.length){var r,n,o,c=a.componentIds.map(t=>({id:t,pos:$.get(t),node:d.nodes.find(e=>e.id===t)})).filter(t=>t.pos&&t.node).sort((t,e)=>t.node.x-e.node.x);for(let t=0;t<c.length-1;t++){var p=c[t],h=c[t+1];e.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",p.pos.x).attr("y1",p.pos.y).attr("x2",h.pos.x).attr("y2",h.pos.y).attr("stroke",l.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let x=1/0,y=-1/0,g=0;a.componentIds.forEach(t=>{(t=$.get(t))&&(x=Math.min(x,t.x),y=Math.max(y,t.x),g=t.y)}),x!==1/0&&y!==-1/0&&(r=4*i.nodeRadius,n=g-r/2,(a=$.get(a.nodeId))&&(o=(x+y)/2,a.x=o,a.y=n-s/6),t.append("rect").attr("class","wardley-pipeline-box").attr("x",x-15).attr("y",n).attr("width",y-x+30).attr("height",r).attr("fill","none").attr("stroke",l.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4))}})}w=h.append("g").attr("class","wardley-links");let S=new Map;d.pipelines.forEach(t=>{S.set(t.nodeId,new Set(t.componentIds))}),t=d.links.filter(t=>!(!$.has(t.source)||!$.has(t.target)||S.get(t.target)?.has(t.source))),w.selectAll("line").data(t).enter().append("line").attr("class",t=>"wardley-link"+(t.dashed?" wardley-link--dashed":"")).attr("x1",t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,n=a.x-e.x;a=a.y-e.y,a=Math.sqrt(n*n+a*a);return e.x+n/a*r}).attr("y1",t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,n=a.x-e.x;a=a.y-e.y,n=Math.sqrt(n*n+a*a);return e.y+a/n*r}).attr("x2",t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,n=e.x-a.x;e=e.y-a.y,e=Math.sqrt(n*n+e*e);return a.x+n/e*r}).attr("y2",t=>{var e=$.get(t.source),a=$.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,n=e.x-a.x;e=e.y-a.y,n=Math.sqrt(n*n+e*e);return a.y+e/n*r}).attr("stroke",l.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>"forward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-end-${e})`:null).attr("marker-start",t=>"backward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-start-${e})`:null),w.selectAll("text").data(t.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.x+t.x)/2),r=t.y-e.y;t=t.x-e.x;return a+r/Math.sqrt(t*t+r*r)*8}).attr("y",t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.y+t.y)/2),r=t.x-e.x;t=t.y-e.y;return a+-r/Math.sqrt(r*r+t*t)*8}).attr("fill",l.axisTextColor).attr("font-size",i.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{var e=$.get(t.source),a=(t=$.get(t.target),(e.x+t.x)/2),r=(e.y+t.y)/2,n=t.x-e.x;a+=(t=t.y-e.y)/(e=Math.sqrt(n*n+t*t))*8,r+=-n/e*8;let o=180*Math.atan2(t,n)/Math.PI;return(90<o||o<-90)&&(o+=180),`rotate(${o} ${a} ${r})`}).text(t=>t.label),o=h.append("g").attr("class","wardley-trends"),w=d.trends.map(t=>{var e,a,r,n,o=$.get(t.nodeId);return o?(e=g(t.targetX),t=m(t.targetY),a=e-o.x,r=t-o.y,n=Math.sqrt(a*a+r*r),{origin:o,targetX:e,targetY:t,adjustedX2:(o=i.nodeRadius+2)<n?e-a/n*o:e,adjustedY2:o<n?t-r/n*o:t}):null}).filter(t=>null!==t),o.selectAll("line").data(w).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",l.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${e})`),(t=h.append("g").attr("class","wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?"wardley-node--"+t.className:""].filter(Boolean).join(" "))).filter(t=>"outsource"===t.sourceStrategy).append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y).attr("r",2*i.nodeRadius).attr("fill","#666").attr("stroke",l.componentStroke).attr("stroke-width",1),t.filter(t=>"buy"===t.sourceStrategy).append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y).attr("r",2*i.nodeRadius).attr("fill","#ccc").attr("stroke",l.componentStroke).attr("stroke-width",1),t.filter(t=>"build"===t.sourceStrategy).append("circle").attr("class","wardley-build-overlay").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y).attr("r",2*i.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1),(o=t.filter(t=>"market"===t.sourceStrategy)).append("circle").attr("class","wardley-market-overlay").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y).attr("r",2*i.nodeRadius).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",1),t.filter(t=>!t.isPipelineParent&&"market"!==t.sourceStrategy&&"anchor"!==t.className).append("circle").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y).attr("r",i.nodeRadius).attr("fill",l.componentFill).attr("stroke",l.componentStroke).attr("stroke-width",1),w=.7*i.nodeRadius;let C=1.2*i.nodeRadius;if(o.append("line").attr("class","wardley-market-line").attr("x1",t=>$.get(t.id).x).attr("y1",t=>$.get(t.id).y-C).attr("x2",t=>$.get(t.id).x-C*Math.cos(Math.PI/6)).attr("y2",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("stroke",l.componentStroke).attr("stroke-width",1),o.append("line").attr("class","wardley-market-line").attr("x1",t=>$.get(t.id).x-C*Math.cos(Math.PI/6)).attr("y1",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("x2",t=>$.get(t.id).x+C*Math.cos(Math.PI/6)).attr("y2",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("stroke",l.componentStroke).attr("stroke-width",1),o.append("line").attr("class","wardley-market-line").attr("x1",t=>$.get(t.id).x+C*Math.cos(Math.PI/6)).attr("y1",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("x2",t=>$.get(t.id).x).attr("y2",t=>$.get(t.id).y-C).attr("stroke",l.componentStroke).attr("stroke-width",1),o.append("circle").attr("class","wardley-market-dot").attr("cx",t=>$.get(t.id).x).attr("cy",t=>$.get(t.id).y-C).attr("r",w).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",2),o.append("circle").attr("class","wardley-market-dot").attr("cx",t=>$.get(t.id).x-C*Math.cos(Math.PI/6)).attr("cy",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("r",w).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",2),o.append("circle").attr("class","wardley-market-dot").attr("cx",t=>$.get(t.id).x+C*Math.cos(Math.PI/6)).attr("cy",t=>$.get(t.id).y+C*Math.sin(Math.PI/6)).attr("r",w).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",2),t.filter(t=>!0===t.isPipelineParent).append("rect").attr("x",t=>$.get(t.id).x-s/2).attr("y",t=>$.get(t.id).y-s/2).attr("width",s).attr("height",s).attr("fill",l.componentFill).attr("stroke",l.componentStroke).attr("stroke-width",1),t.filter(t=>!0===t.inertia).append("line").attr("class","wardley-inertia").attr("x1",t=>{var e=$.get(t.id);let a=t.isPipelineParent?s/2+15:i.nodeRadius+15;return t.sourceStrategy&&(a+=i.nodeRadius+10),e.x+a}).attr("y1",t=>{var e=$.get(t.id);t=t.isPipelineParent?s:2*i.nodeRadius;return e.y-t/2}).attr("x2",t=>{var e=$.get(t.id);let a=t.isPipelineParent?s/2+15:i.nodeRadius+15;return t.sourceStrategy&&(a+=i.nodeRadius+10),e.x+a}).attr("y2",t=>{var e=$.get(t.id);t=t.isPipelineParent?s:2*i.nodeRadius;return e.y+t/2}).attr("stroke",l.componentStroke).attr("stroke-width",6),t.append("text").attr("x",t=>{var e=$.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetX?e.x+t.labelOffsetX:e.x;let a=i.nodeLabelOffset;return t.sourceStrategy&&void 0===t.labelOffsetX&&(a+=10),t=t.labelOffsetX??a,e.x+t}).attr("y",t=>{var e=$.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetY?e.y+t.labelOffsetY:e.y-3;let a=-i.nodeLabelOffset;return t.sourceStrategy&&void 0===t.labelOffsetY&&(a-=10),t=t.labelOffsetY??a,e.y+t}).attr("class","wardley-node-label").attr("fill",t=>"evolved"===t.className?l.evolutionStroke:"anchor"===t.className?"#000":l.componentLabelColor).attr("font-size",i.labelFontSize).attr("font-weight",t=>"anchor"===t.className?"bold":"normal").attr("text-anchor",t=>"anchor"===t.className?"middle":"start").attr("dominant-baseline",t=>"anchor"===t.className?"middle":"auto").text(t=>t.label),0<d.annotations.length){let e=h.append("g").attr("class","wardley-annotations");if(d.annotations.forEach(t=>{var a=t.coordinates.map(t=>({x:g(t.x),y:m(t.y)}));if(1<a.length)for(let t=0;t<a.length-1;t++)e.append("line").attr("class","wardley-annotation-line").attr("x1",a[t].x).attr("y1",a[t].y).attr("x2",a[t+1].x).attr("y2",a[t+1].y).attr("stroke",l.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");a.forEach(a=>{var r=e.append("g").attr("class","wardley-annotation");r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("fill","white").attr("stroke",l.axisColor).attr("stroke-width",1.5),r.append("text").attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",l.axisTextColor).attr("font-weight","bold").text(t.number)})}),d.annotationsBox){let a=g(d.annotationsBox.x),r=m(d.annotationsBox.y),n=e.append("g").attr("class","wardley-annotations-box");o=[...d.annotations].filter(t=>t.text).sort((t,e)=>t.number-e.number);let s=[];if(o.forEach((t,e)=>{e=n.append("text").attr("x",a+10).attr("y",r+10+16*(e+1)).attr("font-size",11).attr("fill",l.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(t.number+". "+t.text),s.push(e)}),0<s.length){let e=0,d=0;s.forEach(t=>{var a=(t=t.node()).getComputedTextLength();e=Math.max(e,a),a=t.getBBox();d=Math.max(d,a.height)});w=e+20+105,t=16*o.length+20+d/2,o=i.padding;var M=c-i.padding-w,P=i.padding,N=p-i.padding-t;a=Math.max(o,Math.min(a,M)),r=Math.max(P,Math.min(r,N)),s.forEach((t,e)=>{t.attr("x",a+10).attr("y",r+10+16*(e+1))}),n.insert("rect","text").attr("x",a).attr("y",r).attr("width",w).attr("height",t).attr("fill","white").attr("stroke",l.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(0<d.notes.length){let t=h.append("g").attr("class","wardley-notes");d.notes.forEach(e=>{var a=g(e.x),r=m(e.y);t.append("text").attr("x",a).attr("y",r).attr("text-anchor","start").attr("font-size",11).attr("fill",l.axisTextColor).attr("font-weight","bold").text(e.text)})}if(0<d.accelerators.length){let t=h.append("g").attr("class","wardley-accelerators");d.accelerators.forEach(e=>{var a=g(e.x),r=m(e.y),n=`\n M ${a} ${r-15}\n L ${a+60-20} ${r-15}\n L ${a+60-20} ${r-15-8}\n L ${a+60} ${r}\n L ${a+60-20} ${r+15+8}\n L ${a+60-20} ${r+15}\n L ${a} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",l.axisTextColor).attr("font-weight","bold").text(e.name)})}if(0<d.deaccelerators.length){let t=h.append("g").attr("class","wardley-deaccelerators");d.deaccelerators.forEach(e=>{var a=g(e.x),r=m(e.y),n=`\n M ${a+60} ${r-15}\n L ${a+20} ${r-15}\n L ${a+20} ${r-15-8}\n L ${a} ${r}\n L ${a+20} ${r+15+8}\n L ${a+20} ${r+15}\n L ${a+60} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",l.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",l.axisTextColor).attr("font-weight","bold").text(e.name)})}},"draw"),_={draw:Z},J=r(({wardley:t}={})=>{var e=x(),a=y();e=g(e,a.themeVariables);return`\n .wardley-background {\n fill: ${(a=g(e.wardley,t)).backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${a.axisColor};\n }\n .wardley-axis-label {\n fill: ${a.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${a.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${a.gridColor};\n }\n .wardley-node circle {\n fill: ${a.componentFill};\n stroke: ${a.componentStroke};\n }\n .wardley-node-label {\n fill: ${a.componentLabelColor};\n }\n .wardley-link {\n stroke: ${a.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${a.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${a.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${a.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${a.annotationFill};\n stroke: ${a.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${a.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${a.annotationFill};\n stroke: ${a.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${a.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${a.componentStroke};\n }\n .wardley-notes text {\n fill: ${a.axisTextColor};\n }\n `},"styles"),K={parser:S,db:q,renderer:_,styles:J};export{K as diagram};