@loopstack/loopstack-studio 0.25.0 → 0.25.2

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 (196) hide show
  1. package/dist/components/ai-elements/message.js +2 -2
  2. package/dist/components/ai-elements/reasoning.js +9 -9
  3. package/dist/loopstack-studio.css +1 -1
  4. package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
  5. package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
  6. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
  7. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
  8. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
  9. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
  10. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
  11. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
  12. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
  13. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
  14. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
  15. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
  16. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
  17. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
  18. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
  19. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
  20. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
  21. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
  22. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
  23. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
  24. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
  25. package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
  26. package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
  27. package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
  28. package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
  29. package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
  30. package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
  31. package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
  32. package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
  33. package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
  34. package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
  35. package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
  36. package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
  37. package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
  38. package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
  39. package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
  40. package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
  41. package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
  42. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
  43. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
  44. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
  45. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
  46. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
  47. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
  48. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
  49. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
  50. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
  51. package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
  52. package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
  53. package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
  54. package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
  55. package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
  56. package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
  57. package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
  58. package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
  59. package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
  60. package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
  61. package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
  62. package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
  63. package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
  64. package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
  65. package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
  66. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
  67. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
  68. package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
  69. package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
  70. package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
  71. package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
  72. package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
  73. package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
  74. package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
  75. package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
  76. package/dist/node_modules/katex/dist/katex.js +1256 -1209
  77. package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
  78. package/dist/node_modules/lodash-es/_baseClone.js +2 -2
  79. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
  80. package/dist/node_modules/lodash-es/_baseToString.js +1 -1
  81. package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
  82. package/dist/node_modules/lodash-es/_createSet.js +1 -1
  83. package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
  84. package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
  85. package/dist/node_modules/lodash-es/findIndex.js +2 -2
  86. package/dist/node_modules/lodash-es/flatMap.js +1 -1
  87. package/dist/node_modules/lodash-es/forEach.js +1 -1
  88. package/dist/node_modules/lodash-es/max.js +1 -1
  89. package/dist/node_modules/lodash-es/min.js +1 -1
  90. package/dist/node_modules/lodash-es/minBy.js +1 -1
  91. package/dist/node_modules/lodash-es/reduce.js +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
  118. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
  119. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
  120. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
  121. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
  122. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
  123. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
  124. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
  125. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
  126. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
  127. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
  128. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
  129. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
  130. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
  131. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
  137. package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
  138. package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
  139. package/dist/node_modules/remend/dist/index.js +333 -264
  140. package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
  141. package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
  142. package/dist/node_modules/streamdown/dist/index.js +1 -1
  143. package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
  144. package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
  145. package/dist/pages/DashboardPage.js +3 -3
  146. package/package.json +2 -2
  147. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
  148. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
  149. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
  150. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
  151. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
  152. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
  153. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
  154. package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
  155. package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
  156. package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
  157. package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
  158. package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
  159. package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
  160. package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
  161. package/dist/node_modules/lodash-es/_baseSome.js +0 -9
  162. package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
  163. package/dist/node_modules/lodash-es/assign.js +0 -14
  164. package/dist/node_modules/lodash-es/compact.js +0 -9
  165. package/dist/node_modules/lodash-es/difference.js +0 -8
  166. package/dist/node_modules/lodash-es/drop.js +0 -8
  167. package/dist/node_modules/lodash-es/dropRight.js +0 -8
  168. package/dist/node_modules/lodash-es/every.js +0 -11
  169. package/dist/node_modules/lodash-es/groupBy.js +0 -6
  170. package/dist/node_modules/lodash-es/head.js +0 -5
  171. package/dist/node_modules/lodash-es/includes.js +0 -13
  172. package/dist/node_modules/lodash-es/indexOf.js +0 -11
  173. package/dist/node_modules/lodash-es/isRegExp.js +0 -5
  174. package/dist/node_modules/lodash-es/negate.js +0 -16
  175. package/dist/node_modules/lodash-es/pickBy.js +0 -15
  176. package/dist/node_modules/lodash-es/reject.js +0 -10
  177. package/dist/node_modules/lodash-es/some.js +0 -11
  178. package/dist/node_modules/lodash-es/uniq.js +0 -6
  179. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
  180. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
  181. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
  182. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
  183. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
  184. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
  185. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
  186. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
  187. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
  188. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
  194. package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
  195. package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
  196. package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
@@ -0,0 +1,714 @@
1
+ import { __name } from "./chunk-AGHRB4JF.js";
2
+ import { clear, common_default, configureSvgSize, getAccDescription, getAccTitle, getConfig2, getDiagramTitle, setAccDescription, setAccTitle, setDiagramTitle } from "./chunk-ICPOFSXX.js";
3
+ import { selectSvgElement } from "./chunk-426QAEUC.js";
4
+ import { parseFontSize } from "./chunk-5PVQY5BW.js";
5
+ import { at } from "../../../../roughjs/bundled/rough.esm.js";
6
+ var parser = (function() {
7
+ var n = /* @__PURE__ */ __name(function(e, n, r, i) {
8
+ for (r ||= {}, i = e.length; i--; r[e[i]] = n);
9
+ return r;
10
+ }, "o"), r = [1, 4], i = [1, 14], a = [1, 12], o = [1, 13], s = [
11
+ 6,
12
+ 7,
13
+ 8
14
+ ], c = [1, 20], l = [1, 18], u = [1, 19], d = [
15
+ 6,
16
+ 7,
17
+ 11
18
+ ], f = [
19
+ 1,
20
+ 6,
21
+ 13,
22
+ 14
23
+ ], p = [1, 23], m = [1, 24], h = [
24
+ 1,
25
+ 6,
26
+ 7,
27
+ 11,
28
+ 13,
29
+ 14
30
+ ], g = {
31
+ trace: /* @__PURE__ */ __name(function() {}, "trace"),
32
+ yy: {},
33
+ symbols_: {
34
+ error: 2,
35
+ start: 3,
36
+ ishikawa: 4,
37
+ spaceLines: 5,
38
+ SPACELINE: 6,
39
+ NL: 7,
40
+ ISHIKAWA: 8,
41
+ document: 9,
42
+ stop: 10,
43
+ EOF: 11,
44
+ statement: 12,
45
+ SPACELIST: 13,
46
+ TEXT: 14,
47
+ $accept: 0,
48
+ $end: 1
49
+ },
50
+ terminals_: {
51
+ 2: "error",
52
+ 6: "SPACELINE",
53
+ 7: "NL",
54
+ 8: "ISHIKAWA",
55
+ 11: "EOF",
56
+ 13: "SPACELIST",
57
+ 14: "TEXT"
58
+ },
59
+ productions_: [
60
+ 0,
61
+ [3, 1],
62
+ [3, 2],
63
+ [5, 1],
64
+ [5, 2],
65
+ [5, 2],
66
+ [4, 2],
67
+ [4, 3],
68
+ [10, 1],
69
+ [10, 1],
70
+ [10, 1],
71
+ [10, 2],
72
+ [10, 2],
73
+ [9, 3],
74
+ [9, 2],
75
+ [12, 2],
76
+ [12, 1],
77
+ [12, 1],
78
+ [12, 1]
79
+ ],
80
+ performAction: /* @__PURE__ */ __name(function(e, n, r, i, a, o, s) {
81
+ var c = o.length - 1;
82
+ switch (a) {
83
+ case 6:
84
+ case 7: return i;
85
+ case 15:
86
+ i.addNode(o[c - 1].length, o[c].trim());
87
+ break;
88
+ case 16:
89
+ i.addNode(0, o[c].trim());
90
+ break;
91
+ }
92
+ }, "anonymous"),
93
+ table: [
94
+ {
95
+ 3: 1,
96
+ 4: 2,
97
+ 5: 3,
98
+ 6: [1, 5],
99
+ 8: r
100
+ },
101
+ { 1: [3] },
102
+ { 1: [2, 1] },
103
+ {
104
+ 4: 6,
105
+ 6: [1, 7],
106
+ 7: [1, 8],
107
+ 8: r
108
+ },
109
+ {
110
+ 6: i,
111
+ 7: [1, 10],
112
+ 9: 9,
113
+ 12: 11,
114
+ 13: a,
115
+ 14: o
116
+ },
117
+ n(s, [2, 3]),
118
+ { 1: [2, 2] },
119
+ n(s, [2, 4]),
120
+ n(s, [2, 5]),
121
+ {
122
+ 1: [2, 6],
123
+ 6: i,
124
+ 12: 15,
125
+ 13: a,
126
+ 14: o
127
+ },
128
+ {
129
+ 6: i,
130
+ 9: 16,
131
+ 12: 11,
132
+ 13: a,
133
+ 14: o
134
+ },
135
+ {
136
+ 6: c,
137
+ 7: l,
138
+ 10: 17,
139
+ 11: u
140
+ },
141
+ n(d, [2, 18], { 14: [1, 21] }),
142
+ n(d, [2, 16]),
143
+ n(d, [2, 17]),
144
+ {
145
+ 6: c,
146
+ 7: l,
147
+ 10: 22,
148
+ 11: u
149
+ },
150
+ {
151
+ 1: [2, 7],
152
+ 6: i,
153
+ 12: 15,
154
+ 13: a,
155
+ 14: o
156
+ },
157
+ n(f, [2, 14], {
158
+ 7: p,
159
+ 11: m
160
+ }),
161
+ n(h, [2, 8]),
162
+ n(h, [2, 9]),
163
+ n(h, [2, 10]),
164
+ n(d, [2, 15]),
165
+ n(f, [2, 13], {
166
+ 7: p,
167
+ 11: m
168
+ }),
169
+ n(h, [2, 11]),
170
+ n(h, [2, 12])
171
+ ],
172
+ defaultActions: {
173
+ 2: [2, 1],
174
+ 6: [2, 2]
175
+ },
176
+ parseError: /* @__PURE__ */ __name(function(e, n) {
177
+ if (n.recoverable) this.trace(e);
178
+ else {
179
+ var r = Error(e);
180
+ throw r.hash = n, r;
181
+ }
182
+ }, "parseError"),
183
+ parse: /* @__PURE__ */ __name(function(n) {
184
+ var r = this, i = [0], a = [], o = [null], s = [], c = this.table, l = "", u = 0, d = 0, f = 0, p = 2, m = 1, h = s.slice.call(arguments, 1), g = Object.create(this.lexer), _ = { yy: {} };
185
+ for (var v in this.yy) Object.prototype.hasOwnProperty.call(this.yy, v) && (_.yy[v] = this.yy[v]);
186
+ g.setInput(n, _.yy), _.yy.lexer = g, _.yy.parser = this, g.yylloc === void 0 && (g.yylloc = {});
187
+ var y = g.yylloc;
188
+ s.push(y);
189
+ var b = g.options && g.options.ranges;
190
+ typeof _.yy.parseError == "function" ? this.parseError = _.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
191
+ function x(e) {
192
+ i.length -= 2 * e, o.length -= e, s.length -= e;
193
+ }
194
+ __name(x, "popStack");
195
+ function S() {
196
+ var e = a.pop() || g.lex() || m;
197
+ return typeof e != "number" && (e instanceof Array && (a = e, e = a.pop()), e = r.symbols_[e] || e), e;
198
+ }
199
+ __name(S, "lex");
200
+ for (var C, w, T, E, D, O = {}, k, A, j, M;;) {
201
+ if (T = i[i.length - 1], this.defaultActions[T] ? E = this.defaultActions[T] : (C ??= S(), E = c[T] && c[T][C]), E === void 0 || !E.length || !E[0]) {
202
+ var N = "";
203
+ for (k in M = [], c[T]) this.terminals_[k] && k > p && M.push("'" + this.terminals_[k] + "'");
204
+ N = g.showPosition ? "Parse error on line " + (u + 1) + ":\n" + g.showPosition() + "\nExpecting " + M.join(", ") + ", got '" + (this.terminals_[C] || C) + "'" : "Parse error on line " + (u + 1) + ": Unexpected " + (C == m ? "end of input" : "'" + (this.terminals_[C] || C) + "'"), this.parseError(N, {
205
+ text: g.match,
206
+ token: this.terminals_[C] || C,
207
+ line: g.yylineno,
208
+ loc: y,
209
+ expected: M
210
+ });
211
+ }
212
+ if (E[0] instanceof Array && E.length > 1) throw Error("Parse Error: multiple actions possible at state: " + T + ", token: " + C);
213
+ switch (E[0]) {
214
+ case 1:
215
+ i.push(C), o.push(g.yytext), s.push(g.yylloc), i.push(E[1]), C = null, w ? (C = w, w = null) : (d = g.yyleng, l = g.yytext, u = g.yylineno, y = g.yylloc, f > 0 && f--);
216
+ break;
217
+ case 2:
218
+ if (A = this.productions_[E[1]][1], O.$ = o[o.length - A], O._$ = {
219
+ first_line: s[s.length - (A || 1)].first_line,
220
+ last_line: s[s.length - 1].last_line,
221
+ first_column: s[s.length - (A || 1)].first_column,
222
+ last_column: s[s.length - 1].last_column
223
+ }, b && (O._$.range = [s[s.length - (A || 1)].range[0], s[s.length - 1].range[1]]), D = this.performAction.apply(O, [
224
+ l,
225
+ d,
226
+ u,
227
+ _.yy,
228
+ E[1],
229
+ o,
230
+ s
231
+ ].concat(h)), D !== void 0) return D;
232
+ A && (i = i.slice(0, -1 * A * 2), o = o.slice(0, -1 * A), s = s.slice(0, -1 * A)), i.push(this.productions_[E[1]][0]), o.push(O.$), s.push(O._$), j = c[i[i.length - 2]][i[i.length - 1]], i.push(j);
233
+ break;
234
+ case 3: return !0;
235
+ }
236
+ }
237
+ return !0;
238
+ }, "parse")
239
+ };
240
+ g.lexer = /* @__PURE__ */ (function() {
241
+ return {
242
+ EOF: 1,
243
+ parseError: /* @__PURE__ */ __name(function(e, n) {
244
+ if (this.yy.parser) this.yy.parser.parseError(e, n);
245
+ else throw Error(e);
246
+ }, "parseError"),
247
+ setInput: /* @__PURE__ */ __name(function(e, n) {
248
+ return this.yy = n || this.yy || {}, this._input = e, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
249
+ first_line: 1,
250
+ first_column: 0,
251
+ last_line: 1,
252
+ last_column: 0
253
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
254
+ }, "setInput"),
255
+ input: /* @__PURE__ */ __name(function() {
256
+ var e = this._input[0];
257
+ return this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e, e.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), e;
258
+ }, "input"),
259
+ unput: /* @__PURE__ */ __name(function(e) {
260
+ var n = e.length, r = e.split(/(?:\r\n?|\n)/g);
261
+ this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - n), this.offset -= n;
262
+ var i = this.match.split(/(?:\r\n?|\n)/g);
263
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), r.length - 1 && (this.yylineno -= r.length - 1);
264
+ var a = this.yylloc.range;
265
+ return this.yylloc = {
266
+ first_line: this.yylloc.first_line,
267
+ last_line: this.yylineno + 1,
268
+ first_column: this.yylloc.first_column,
269
+ last_column: r ? (r.length === i.length ? this.yylloc.first_column : 0) + i[i.length - r.length].length - r[0].length : this.yylloc.first_column - n
270
+ }, this.options.ranges && (this.yylloc.range = [a[0], a[0] + this.yyleng - n]), this.yyleng = this.yytext.length, this;
271
+ }, "unput"),
272
+ more: /* @__PURE__ */ __name(function() {
273
+ return this._more = !0, this;
274
+ }, "more"),
275
+ reject: /* @__PURE__ */ __name(function() {
276
+ if (this.options.backtrack_lexer) this._backtrack = !0;
277
+ else return 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(), {
278
+ text: "",
279
+ token: null,
280
+ line: this.yylineno
281
+ });
282
+ return this;
283
+ }, "reject"),
284
+ less: /* @__PURE__ */ __name(function(e) {
285
+ this.unput(this.match.slice(e));
286
+ }, "less"),
287
+ pastInput: /* @__PURE__ */ __name(function() {
288
+ var e = this.matched.substr(0, this.matched.length - this.match.length);
289
+ return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
290
+ }, "pastInput"),
291
+ upcomingInput: /* @__PURE__ */ __name(function() {
292
+ var e = this.match;
293
+ return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
294
+ }, "upcomingInput"),
295
+ showPosition: /* @__PURE__ */ __name(function() {
296
+ var e = this.pastInput(), n = Array(e.length + 1).join("-");
297
+ return e + this.upcomingInput() + "\n" + n + "^";
298
+ }, "showPosition"),
299
+ test_match: /* @__PURE__ */ __name(function(e, n) {
300
+ var r, i, a;
301
+ if (this.options.backtrack_lexer && (a = {
302
+ yylineno: this.yylineno,
303
+ yylloc: {
304
+ first_line: this.yylloc.first_line,
305
+ last_line: this.last_line,
306
+ first_column: this.yylloc.first_column,
307
+ last_column: this.yylloc.last_column
308
+ },
309
+ yytext: this.yytext,
310
+ match: this.match,
311
+ matches: this.matches,
312
+ matched: this.matched,
313
+ yyleng: this.yyleng,
314
+ offset: this.offset,
315
+ _more: this._more,
316
+ _input: this._input,
317
+ yy: this.yy,
318
+ conditionStack: this.conditionStack.slice(0),
319
+ done: this.done
320
+ }, this.options.ranges && (a.yylloc.range = this.yylloc.range.slice(0))), i = e[0].match(/(?:\r\n?|\n).*/g), i && (this.yylineno += i.length), this.yylloc = {
321
+ first_line: this.yylloc.last_line,
322
+ last_line: this.yylineno + 1,
323
+ first_column: this.yylloc.last_column,
324
+ last_column: i ? i[i.length - 1].length - i[i.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
325
+ }, this.yytext += e[0], this.match += e[0], this.matches = e, 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(e[0].length), this.matched += e[0], r = this.performAction.call(this, this.yy, this, n, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), r) return r;
326
+ if (this._backtrack) {
327
+ for (var o in a) this[o] = a[o];
328
+ return !1;
329
+ }
330
+ return !1;
331
+ }, "test_match"),
332
+ next: /* @__PURE__ */ __name(function() {
333
+ if (this.done) return this.EOF;
334
+ this._input || (this.done = !0);
335
+ var e, n, r, i;
336
+ this._more || (this.yytext = "", this.match = "");
337
+ for (var a = this._currentRules(), o = 0; o < a.length; o++) if (r = this._input.match(this.rules[a[o]]), r && (!n || r[0].length > n[0].length)) {
338
+ if (n = r, i = o, this.options.backtrack_lexer) {
339
+ if (e = this.test_match(r, a[o]), e !== !1) return e;
340
+ if (this._backtrack) {
341
+ n = !1;
342
+ continue;
343
+ } else return !1;
344
+ } else if (!this.options.flex) break;
345
+ }
346
+ return n ? (e = this.test_match(n, a[i]), e === !1 ? !1 : e) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
347
+ text: "",
348
+ token: null,
349
+ line: this.yylineno
350
+ });
351
+ }, "next"),
352
+ lex: /* @__PURE__ */ __name(function() {
353
+ return this.next() || this.lex();
354
+ }, "lex"),
355
+ begin: /* @__PURE__ */ __name(function(e) {
356
+ this.conditionStack.push(e);
357
+ }, "begin"),
358
+ popState: /* @__PURE__ */ __name(function() {
359
+ return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
360
+ }, "popState"),
361
+ _currentRules: /* @__PURE__ */ __name(function() {
362
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
363
+ }, "_currentRules"),
364
+ topState: /* @__PURE__ */ __name(function(e) {
365
+ return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
366
+ }, "topState"),
367
+ pushState: /* @__PURE__ */ __name(function(e) {
368
+ this.begin(e);
369
+ }, "pushState"),
370
+ stateStackSize: /* @__PURE__ */ __name(function() {
371
+ return this.conditionStack.length;
372
+ }, "stateStackSize"),
373
+ options: { "case-insensitive": !0 },
374
+ performAction: /* @__PURE__ */ __name(function(e, n, r, i) {
375
+ switch (r) {
376
+ case 0: return 6;
377
+ case 1: return 8;
378
+ case 2: return 8;
379
+ case 3: return 6;
380
+ case 4: return 7;
381
+ case 5: return 13;
382
+ case 6: return 14;
383
+ case 7: return 11;
384
+ }
385
+ }, "anonymous"),
386
+ rules: [
387
+ /^(?:\s*%%.*)/i,
388
+ /^(?:ishikawa-beta\b)/i,
389
+ /^(?:ishikawa\b)/i,
390
+ /^(?:[\s]+[\n])/i,
391
+ /^(?:[\n]+)/i,
392
+ /^(?:[\s]+)/i,
393
+ /^(?:[^\n]+)/i,
394
+ /^(?:$)/i
395
+ ],
396
+ conditions: { INITIAL: {
397
+ rules: [
398
+ 0,
399
+ 1,
400
+ 2,
401
+ 3,
402
+ 4,
403
+ 5,
404
+ 6,
405
+ 7
406
+ ],
407
+ inclusive: !0
408
+ } }
409
+ };
410
+ })();
411
+ function _() {
412
+ this.yy = {};
413
+ }
414
+ return __name(_, "Parser"), _.prototype = g, g.Parser = _, new _();
415
+ })();
416
+ parser.parser = parser;
417
+ var ishikawa_default = parser, IshikawaDB = class {
418
+ constructor() {
419
+ this.stack = [], this.clear = this.clear.bind(this), this.addNode = this.addNode.bind(this), this.getRoot = this.getRoot.bind(this);
420
+ }
421
+ static #e = __name(this, "IshikawaDB");
422
+ clear() {
423
+ this.root = void 0, this.stack = [], this.baseLevel = void 0, clear();
424
+ }
425
+ getRoot() {
426
+ return this.root;
427
+ }
428
+ addNode(e, n) {
429
+ let i = common_default.sanitizeText(n, getConfig2());
430
+ if (!this.root) {
431
+ this.root = {
432
+ text: i,
433
+ children: []
434
+ }, this.stack = [{
435
+ level: 0,
436
+ node: this.root
437
+ }], setDiagramTitle(i);
438
+ return;
439
+ }
440
+ this.baseLevel ??= e;
441
+ let a = e - this.baseLevel + 1;
442
+ for (a <= 0 && (a = 1); this.stack.length > 1 && this.stack[this.stack.length - 1].level >= a;) this.stack.pop();
443
+ let o = this.stack[this.stack.length - 1].node, c = {
444
+ text: i,
445
+ children: []
446
+ };
447
+ o.children.push(c), this.stack.push({
448
+ level: a,
449
+ node: c
450
+ });
451
+ }
452
+ getAccTitle() {
453
+ return getAccTitle();
454
+ }
455
+ setAccTitle(e) {
456
+ setAccTitle(e);
457
+ }
458
+ getAccDescription() {
459
+ return getAccDescription();
460
+ }
461
+ setAccDescription(e) {
462
+ setAccDescription(e);
463
+ }
464
+ getDiagramTitle() {
465
+ return getDiagramTitle();
466
+ }
467
+ setDiagramTitle(e) {
468
+ setDiagramTitle(e);
469
+ }
470
+ }, FONT_SIZE_DEFAULT = 14, SPINE_BASE_LENGTH = 250, BONE_STUB = 30, BONE_BASE = 60, BONE_PER_CHILD = 5, ANGLE = 82 * Math.PI / 180, COS_A = Math.cos(ANGLE), SIN_A = Math.sin(ANGLE), applyPaddedViewBox = /* @__PURE__ */ __name((e, n, r) => {
471
+ let a = e.node().getBBox(), o = a.width + n * 2, s = a.height + n * 2;
472
+ configureSvgSize(e, s, o, r), e.attr("viewBox", `${a.x - n} ${a.y - n} ${o} ${s}`);
473
+ }, "applyPaddedViewBox"), draw = /* @__PURE__ */ __name((e, n, r, i) => {
474
+ let a = i.db.getRoot();
475
+ if (!a) return;
476
+ let o = getConfig2(), { look: c, handDrawnSeed: l, themeVariables: u } = o, d = parseFontSize(o.fontSize)[0] ?? FONT_SIZE_DEFAULT, h = c === "handDrawn", g = a.children ?? [], _ = o.ishikawa?.diagramPadding ?? 20, b = o.ishikawa?.useMaxWidth ?? !1, x = selectSvgElement(n), S = x.append("g").attr("class", "ishikawa"), C = h ? at.svg(x.node()) : void 0, w = C ? {
477
+ roughSvg: C,
478
+ seed: l ?? 0,
479
+ lineColor: u?.lineColor ?? "#333",
480
+ fillColor: u?.mainBkg ?? "#fff"
481
+ } : void 0, T = `ishikawa-arrow-${n}`;
482
+ h || S.append("defs").append("marker").attr("id", T).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 Z").attr("class", "ishikawa-arrow");
483
+ let D = 0, A = SPINE_BASE_LENGTH, j = h ? void 0 : drawLine(S, D, A, D, A, "ishikawa-spine");
484
+ if (drawHead(S, D, A, a.text, d, w), !g.length) {
485
+ h && drawLine(S, D, A, D, A, "ishikawa-spine", w), applyPaddedViewBox(x, _, b);
486
+ return;
487
+ }
488
+ D -= 20;
489
+ let M = g.filter((e, n) => n % 2 == 0), P = g.filter((e, n) => n % 2 == 1), F = sideStats(M), I = sideStats(P), L = F.total + I.total, R = SPINE_BASE_LENGTH, z = SPINE_BASE_LENGTH;
490
+ if (L > 0) {
491
+ let e = SPINE_BASE_LENGTH * 2, n = SPINE_BASE_LENGTH * .3;
492
+ R = Math.max(n, e * (F.total / L)), z = Math.max(n, e * (I.total / L));
493
+ }
494
+ let B = d * 2;
495
+ R = Math.max(R, F.max * B), z = Math.max(z, I.max * B), A = Math.max(R, SPINE_BASE_LENGTH), j && j.attr("y1", A).attr("y2", A), S.select(".ishikawa-head-group").attr("transform", `translate(0,${A})`);
496
+ let V = Math.ceil(g.length / 2);
497
+ for (let e = 0; e < V; e++) {
498
+ let n = S.append("g").attr("class", "ishikawa-pair");
499
+ for (let [r, i, a] of [[
500
+ g[e * 2],
501
+ -1,
502
+ R
503
+ ], [
504
+ g[e * 2 + 1],
505
+ 1,
506
+ z
507
+ ]]) r && drawBranch(n, r, D, A, i, a, d, w);
508
+ D = n.selectAll("text").nodes().reduce((e, n) => Math.min(e, n.getBBox().x), Infinity);
509
+ }
510
+ if (h) drawLine(S, D, A, 0, A, "ishikawa-spine", w);
511
+ else {
512
+ j.attr("x1", D);
513
+ let e = `url(#${T})`;
514
+ S.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", e);
515
+ }
516
+ applyPaddedViewBox(x, _, b);
517
+ }, "draw"), sideStats = /* @__PURE__ */ __name((n) => {
518
+ let r = /* @__PURE__ */ __name((e) => e.children.reduce((e, n) => e + 1 + r(n), 0), "countDescendants");
519
+ return n.reduce((e, n) => {
520
+ let i = r(n);
521
+ return e.total += i, e.max = Math.max(e.max, i), e;
522
+ }, {
523
+ total: 0,
524
+ max: 0
525
+ });
526
+ }, "sideStats"), drawHead = /* @__PURE__ */ __name((e, n, r, i, a, o) => {
527
+ let s = Math.max(6, Math.floor(110 / (a * .6))), c = e.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${n},${r})`), l = drawMultilineText(c, wrapText(i, s), 0, 0, "ishikawa-head-label", "start", a), u = l.node().getBBox(), d = Math.max(60, u.width + 6), f = Math.max(40, u.height * 2 + 40), p = `M 0 ${-f / 2} L 0 ${f / 2} Q ${d * 2.4} 0 0 ${-f / 2} Z`;
528
+ if (o) {
529
+ let e = o.roughSvg.path(p, {
530
+ roughness: 1.5,
531
+ seed: o.seed,
532
+ fill: o.fillColor,
533
+ fillStyle: "hachure",
534
+ fillWeight: 2.5,
535
+ hachureGap: 5,
536
+ stroke: o.lineColor,
537
+ strokeWidth: 2
538
+ });
539
+ c.insert(() => e, ":first-child").attr("class", "ishikawa-head");
540
+ } else c.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", p);
541
+ l.attr("transform", `translate(${(d - u.width) / 2 - u.x + 3},${-u.y - u.height / 2})`);
542
+ }, "drawHead"), flattenTree = /* @__PURE__ */ __name((n, r) => {
543
+ let i = [], a = [], o = /* @__PURE__ */ __name((e, n, s) => {
544
+ let c = r === -1 ? [...e].reverse() : e;
545
+ for (let e of c) {
546
+ let r = i.length, c = e.children ?? [];
547
+ i.push({
548
+ depth: s,
549
+ text: wrapText(e.text, 15),
550
+ parentIndex: n,
551
+ childCount: c.length
552
+ }), s % 2 == 0 ? (a.push(r), c.length && o(c, r, s + 1)) : (c.length && o(c, r, s + 1), a.push(r));
553
+ }
554
+ }, "walk");
555
+ return o(n, -1, 2), {
556
+ entries: i,
557
+ yOrder: a
558
+ };
559
+ }, "flattenTree"), drawCauseLabel = /* @__PURE__ */ __name((e, n, r, i, a, o, s) => {
560
+ let c = e.append("g").attr("class", "ishikawa-label-group"), l = drawMultilineText(c, n, r, i + 11 * a, "ishikawa-label cause", "middle", o).node().getBBox();
561
+ if (s) {
562
+ let e = s.roughSvg.rectangle(l.x - 20, l.y - 2, l.width + 40, l.height + 4, {
563
+ roughness: 1.5,
564
+ seed: s.seed,
565
+ fill: s.fillColor,
566
+ fillStyle: "hachure",
567
+ fillWeight: 2.5,
568
+ hachureGap: 5,
569
+ stroke: s.lineColor,
570
+ strokeWidth: 2
571
+ });
572
+ c.insert(() => e, ":first-child").attr("class", "ishikawa-label-box");
573
+ } else c.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", l.x - 20).attr("y", l.y - 2).attr("width", l.width + 40).attr("height", l.height + 4);
574
+ }, "drawCauseLabel"), drawArrowMarker = /* @__PURE__ */ __name((e, n, r, i, a, o) => {
575
+ let s = Math.sqrt(i * i + a * a);
576
+ if (s === 0) return;
577
+ let c = i / s, l = a / s, u = -l * 6, d = c * 6, f = n, p = r, m = `M ${f} ${p} L ${f - c * 6 * 2 + u} ${p - l * 6 * 2 + d} L ${f - c * 6 * 2 - u} ${p - l * 6 * 2 - d} Z`, h = o.roughSvg.path(m, {
578
+ roughness: 1,
579
+ seed: o.seed,
580
+ fill: o.lineColor,
581
+ fillStyle: "solid",
582
+ stroke: o.lineColor,
583
+ strokeWidth: 1
584
+ });
585
+ e.append(() => h);
586
+ }, "drawArrowMarker"), drawBranch = /* @__PURE__ */ __name((e, n, r, i, a, o, s, c) => {
587
+ let l = n.children ?? [], u = o * (l.length ? 1 : .2), d = -COS_A * u, f = SIN_A * u * a, p = r + d, m = i + f;
588
+ if (drawLine(e, r, i, p, m, "ishikawa-branch", c), c && drawArrowMarker(e, r, i, r - p, i - m, c), drawCauseLabel(e, n.text, p, m, a, s, c), !l.length) return;
589
+ let { entries: h, yOrder: g } = flattenTree(l, a), _ = h.length, v = Array(_);
590
+ for (let [e, n] of g.entries()) v[n] = i + f * ((e + 1) / (_ + 1));
591
+ let y = /* @__PURE__ */ new Map();
592
+ y.set(-1, {
593
+ x0: r,
594
+ y0: i,
595
+ x1: p,
596
+ y1: m,
597
+ childCount: l.length,
598
+ childrenDrawn: 0
599
+ });
600
+ let C = -COS_A, E = SIN_A * a, D = a < 0 ? "ishikawa-label up" : "ishikawa-label down";
601
+ for (let [n, r] of h.entries()) {
602
+ let i = v[n], a = y.get(r.parentIndex), o = e.append("g").attr("class", "ishikawa-sub-group"), l = 0, u = 0, d = 0;
603
+ if (r.depth % 2 == 0) {
604
+ let e = a.y1 - a.y0;
605
+ l = lerp(a.x0, a.x1, e ? (i - a.y0) / e : .5), u = i, d = l - (r.childCount > 0 ? BONE_BASE + r.childCount * BONE_PER_CHILD : BONE_STUB), drawLine(o, l, i, d, i, "ishikawa-sub-branch", c), c && drawArrowMarker(o, l, i, 1, 0, c), drawMultilineText(o, r.text, d, i, "ishikawa-label align", "end", s);
606
+ } else {
607
+ let e = a.childrenDrawn++;
608
+ l = lerp(a.x0, a.x1, (a.childCount - e) / (a.childCount + 1)), u = a.y0, d = l + C * ((i - u) / E), drawLine(o, l, u, d, i, "ishikawa-sub-branch", c), c && drawArrowMarker(o, l, u, l - d, u - i, c), drawMultilineText(o, r.text, d, i, D, "end", s);
609
+ }
610
+ r.childCount > 0 && y.set(n, {
611
+ x0: l,
612
+ y0: u,
613
+ x1: d,
614
+ y1: i,
615
+ childCount: r.childCount,
616
+ childrenDrawn: 0
617
+ });
618
+ }
619
+ }, "drawBranch"), splitLines = /* @__PURE__ */ __name((e) => e.split(/<br\s*\/?>|\n/), "splitLines"), wrapText = /* @__PURE__ */ __name((e, n) => {
620
+ if (e.length <= n) return e;
621
+ let r = [];
622
+ for (let i of e.split(/\s+/)) {
623
+ let e = r.length - 1;
624
+ e >= 0 && r[e].length + 1 + i.length <= n ? r[e] += " " + i : r.push(i);
625
+ }
626
+ return r.join("\n");
627
+ }, "wrapText"), drawMultilineText = /* @__PURE__ */ __name((e, n, r, i, a, o, s) => {
628
+ let c = splitLines(n), l = s * 1.05, u = e.append("text").attr("class", a).attr("text-anchor", o).attr("x", r).attr("y", i - (c.length - 1) * l / 2);
629
+ for (let [e, n] of c.entries()) u.append("tspan").attr("x", r).attr("dy", e === 0 ? 0 : l).text(n);
630
+ return u;
631
+ }, "drawMultilineText"), lerp = /* @__PURE__ */ __name((e, n, r) => e + (n - e) * r, "lerp"), drawLine = /* @__PURE__ */ __name((e, n, r, i, a, o, s) => {
632
+ if (s) {
633
+ let c = s.roughSvg.line(n, r, i, a, {
634
+ roughness: 1.5,
635
+ seed: s.seed,
636
+ stroke: s.lineColor,
637
+ strokeWidth: 2
638
+ });
639
+ e.append(() => c).attr("class", o);
640
+ return;
641
+ }
642
+ return e.append("line").attr("class", o).attr("x1", n).attr("y1", r).attr("x2", i).attr("y2", a);
643
+ }, "drawLine"), diagram = {
644
+ parser: ishikawa_default,
645
+ get db() {
646
+ return new IshikawaDB();
647
+ },
648
+ renderer: { draw },
649
+ styles: /* @__PURE__ */ __name((e) => `
650
+ .ishikawa .ishikawa-spine,
651
+ .ishikawa .ishikawa-branch,
652
+ .ishikawa .ishikawa-sub-branch {
653
+ stroke: ${e.lineColor};
654
+ stroke-width: 2;
655
+ fill: none;
656
+ }
657
+
658
+ .ishikawa .ishikawa-sub-branch {
659
+ stroke-width: 1;
660
+ }
661
+
662
+ .ishikawa .ishikawa-arrow {
663
+ fill: ${e.lineColor};
664
+ }
665
+
666
+ .ishikawa .ishikawa-head {
667
+ fill: ${e.mainBkg};
668
+ stroke: ${e.lineColor};
669
+ stroke-width: 2;
670
+ }
671
+
672
+ .ishikawa .ishikawa-label-box {
673
+ fill: ${e.mainBkg};
674
+ stroke: ${e.lineColor};
675
+ stroke-width: 2;
676
+ }
677
+
678
+ .ishikawa text {
679
+ font-family: ${e.fontFamily};
680
+ font-size: ${e.fontSize};
681
+ fill: ${e.textColor};
682
+ }
683
+
684
+ .ishikawa .ishikawa-head-label {
685
+ font-weight: 600;
686
+ text-anchor: middle;
687
+ dominant-baseline: middle;
688
+ font-size: 14px;
689
+ }
690
+
691
+ .ishikawa .ishikawa-label {
692
+ text-anchor: end;
693
+ }
694
+
695
+ .ishikawa .ishikawa-label.cause {
696
+ text-anchor: middle;
697
+ dominant-baseline: middle;
698
+ }
699
+
700
+ .ishikawa .ishikawa-label.align {
701
+ text-anchor: end;
702
+ dominant-baseline: middle;
703
+ }
704
+
705
+ .ishikawa .ishikawa-label.up {
706
+ dominant-baseline: baseline;
707
+ }
708
+
709
+ .ishikawa .ishikawa-label.down {
710
+ dominant-baseline: hanging;
711
+ }
712
+ `, "getStyles")
713
+ };
714
+ export { diagram };