@draftably/editor 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +26 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/assets/engine.worker-DmHew5f6.js +6813 -0
  4. package/dist/assets/import-d2.worker-CnXfFXoa.js +5395 -0
  5. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +87 -0
  6. package/dist/chunks/arc-rJj0TtXf.js +83 -0
  7. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +4781 -0
  8. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +1440 -0
  9. package/dist/chunks/browser-iNhbPsGc.js +40 -0
  10. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +1524 -0
  11. package/dist/chunks/channel-qMvPU6eH.js +5 -0
  12. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +670 -0
  13. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +18 -0
  14. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +262 -0
  15. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +68 -0
  16. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +19 -0
  17. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +8 -0
  18. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +19 -0
  19. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +8 -0
  20. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +451 -0
  21. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +1570 -0
  22. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +2608 -0
  23. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +22361 -0
  24. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +299 -0
  25. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +18791 -0
  26. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +2157 -0
  27. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  28. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +531 -0
  29. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +153 -0
  30. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +346 -0
  31. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +480 -0
  32. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +219 -0
  33. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +2586 -0
  34. package/dist/chunks/dot-importer-B23jwEkx.js +1547 -0
  35. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +109 -0
  36. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +49229 -0
  37. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +1064 -0
  38. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +1771 -0
  39. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +2729 -0
  40. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +815 -0
  41. package/dist/chunks/graph-CKJmgLki.js +1541 -0
  42. package/dist/chunks/import-core-C-I1wGfw.js +145 -0
  43. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +24 -0
  44. package/dist/chunks/init-DjUOC4st.js +16 -0
  45. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +624 -0
  46. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +834 -0
  47. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +724 -0
  48. package/dist/chunks/katex-BsrBVQKd.js +11314 -0
  49. package/dist/chunks/linear-4t7D_ros.js +259 -0
  50. package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
  51. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +478 -0
  52. package/dist/chunks/mermaid.core-DXv6D2Sm.js +19244 -0
  53. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +837 -0
  54. package/dist/chunks/mount-C1Xk_GQz.js +22131 -0
  55. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  56. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +95 -0
  57. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +208 -0
  58. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +1029 -0
  59. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +77 -0
  60. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +889 -0
  61. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +859 -0
  62. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +2972 -0
  63. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +46 -0
  64. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +1520 -0
  65. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +4991 -0
  66. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +13 -0
  67. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +1058 -0
  68. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +7945 -0
  69. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +1578 -0
  70. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +678 -0
  71. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +1536 -0
  72. package/dist/element.js +36 -0
  73. package/dist/index.js +4 -0
  74. package/dist/types/src/cli/links.d.ts +4 -0
  75. package/dist/types/src/cli/pdf.d.ts +29 -0
  76. package/dist/types/src/cli/png.d.ts +23 -0
  77. package/dist/types/src/cli/svg.d.ts +4 -0
  78. package/dist/types/src/components/Icon.d.ts +14 -0
  79. package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
  80. package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
  81. package/dist/types/src/components/canvas/Frame.d.ts +22 -0
  82. package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
  83. package/dist/types/src/components/canvas/Notes.d.ts +5 -0
  84. package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
  85. package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
  86. package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
  87. package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
  88. package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
  89. package/dist/types/src/components/controls.d.ts +88 -0
  90. package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
  91. package/dist/types/src/components/scene/GroupView.d.ts +22 -0
  92. package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
  93. package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
  94. package/dist/types/src/components/scene/NodeView.d.ts +18 -0
  95. package/dist/types/src/components/scene/parts.d.ts +50 -0
  96. package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
  97. package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
  98. package/dist/types/src/components/session-context.d.ts +486 -0
  99. package/dist/types/src/dsl/cells.d.ts +91 -0
  100. package/dist/types/src/dsl/channels.d.ts +53 -0
  101. package/dist/types/src/dsl/compile.d.ts +162 -0
  102. package/dist/types/src/dsl/frame.d.ts +38 -0
  103. package/dist/types/src/dsl/lanes.d.ts +23 -0
  104. package/dist/types/src/dsl/layout-edits.d.ts +58 -0
  105. package/dist/types/src/dsl/legend-notes.d.ts +3 -0
  106. package/dist/types/src/dsl/project.d.ts +39 -0
  107. package/dist/types/src/dsl/source-edits.d.ts +37 -0
  108. package/dist/types/src/dsl/syntax.d.ts +317 -0
  109. package/dist/types/src/dsl/translate.d.ts +69 -0
  110. package/dist/types/src/editor/Editor.d.ts +6 -0
  111. package/dist/types/src/editor/element.d.ts +15 -0
  112. package/dist/types/src/editor/mount.d.ts +23 -0
  113. package/dist/types/src/import/browser.d.ts +3 -0
  114. package/dist/types/src/import/detect.d.ts +31 -0
  115. package/dist/types/src/import/dot-importer.d.ts +3 -0
  116. package/dist/types/src/import/import-core.d.ts +105 -0
  117. package/dist/types/src/import/mermaid-facade.d.ts +120 -0
  118. package/dist/types/src/import/mermaid-importer.d.ts +4 -0
  119. package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
  120. package/dist/types/src/import/scratch.d.ts +3 -0
  121. package/dist/types/src/lib/engine-tasks.d.ts +88 -0
  122. package/dist/types/src/lib/font-data.d.ts +9 -0
  123. package/dist/types/src/lib/saved-diagram.d.ts +4 -0
  124. package/dist/types/src/lib/scene-cache.d.ts +4 -0
  125. package/dist/types/src/lib/source-hash.d.ts +7 -0
  126. package/dist/types/src/lib/svg-export.d.ts +15 -0
  127. package/dist/types/src/model/appearance.d.ts +209 -0
  128. package/dist/types/src/model/bounds.d.ts +19 -0
  129. package/dist/types/src/model/camera.d.ts +21 -0
  130. package/dist/types/src/model/candidates.d.ts +53 -0
  131. package/dist/types/src/model/colors.d.ts +22 -0
  132. package/dist/types/src/model/document.d.ts +24 -0
  133. package/dist/types/src/model/edits.d.ts +133 -0
  134. package/dist/types/src/model/embed.d.ts +17 -0
  135. package/dist/types/src/model/examples.d.ts +15 -0
  136. package/dist/types/src/model/font-faces.d.ts +24 -0
  137. package/dist/types/src/model/fonts.d.ts +47 -0
  138. package/dist/types/src/model/footnote.d.ts +34 -0
  139. package/dist/types/src/model/frame.d.ts +71 -0
  140. package/dist/types/src/model/geometry.d.ts +29 -0
  141. package/dist/types/src/model/graph.d.ts +53 -0
  142. package/dist/types/src/model/heading.d.ts +38 -0
  143. package/dist/types/src/model/icons.d.ts +2 -0
  144. package/dist/types/src/model/label-hits.d.ts +27 -0
  145. package/dist/types/src/model/labels.d.ts +88 -0
  146. package/dist/types/src/model/legend.d.ts +25 -0
  147. package/dist/types/src/model/link.d.ts +63 -0
  148. package/dist/types/src/model/markers.d.ts +47 -0
  149. package/dist/types/src/model/note.d.ts +75 -0
  150. package/dist/types/src/model/panels.d.ts +11 -0
  151. package/dist/types/src/model/rich-text.d.ts +24 -0
  152. package/dist/types/src/model/routes.d.ts +170 -0
  153. package/dist/types/src/model/samples.d.ts +11 -0
  154. package/dist/types/src/model/stack.d.ts +8 -0
  155. package/dist/types/src/model/static-scene.d.ts +15 -0
  156. package/dist/types/src/model/status.d.ts +84 -0
  157. package/dist/types/src/model/styles.d.ts +13 -0
  158. package/dist/types/src/model/surface.d.ts +31 -0
  159. package/dist/types/src/model/types.d.ts +277 -0
  160. package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
  161. package/dist/types/src/server/file-session.d.ts +19 -0
  162. package/dist/types/src/server/workspace.d.ts +21 -0
  163. package/dist/types/src/state/active-session.d.ts +479 -0
  164. package/dist/types/src/state/commands.d.ts +529 -0
  165. package/dist/types/src/state/comparison.d.ts +151 -0
  166. package/dist/types/src/state/files.d.ts +61 -0
  167. package/dist/types/src/state/keyboard.d.ts +6 -0
  168. package/dist/types/src/state/keys.d.ts +5 -0
  169. package/dist/types/src/state/launch.d.ts +61 -0
  170. package/dist/types/src/state/links.d.ts +11 -0
  171. package/dist/types/src/state/session/actions.d.ts +77 -0
  172. package/dist/types/src/state/session/canvas-text.d.ts +24 -0
  173. package/dist/types/src/state/session/document.d.ts +84 -0
  174. package/dist/types/src/state/session/editor.d.ts +81 -0
  175. package/dist/types/src/state/session/emphasis.d.ts +11 -0
  176. package/dist/types/src/state/session/file-session.d.ts +98 -0
  177. package/dist/types/src/state/session/index.d.ts +496 -0
  178. package/dist/types/src/state/session/layout.d.ts +79 -0
  179. package/dist/types/src/state/session/pointer.d.ts +19 -0
  180. package/dist/types/src/state/session/routing.d.ts +20 -0
  181. package/dist/types/src/state/session/scene.d.ts +144 -0
  182. package/dist/types/src/state/session/sculpt.d.ts +70 -0
  183. package/dist/types/src/state/toast.d.ts +14 -0
  184. package/dist/types/src/state/ui.d.ts +39 -0
  185. package/package.json +41 -3
@@ -0,0 +1,1058 @@
1
+ import { _ as o, L as pt, F as nt, C as Rt, a1 as Wt, a2 as Pt, a3 as Bt, c as ft, l as E, Q as Vt, V as Ft, a4 as yt, k as X, K as zt, a5 as Ot, A as Gt } from "./mermaid.core-DXv6D2Sm.js";
2
+ import { d as ct } from "./arc-rJj0TtXf.js";
3
+ var tt = (function() {
4
+ var e = /* @__PURE__ */ o(function(k, a, d, l) {
5
+ for (d = d || {}, l = k.length; l--; d[k[l]] = a) ;
6
+ return d;
7
+ }, "o"), t = [6, 11, 13, 14, 15, 17, 19, 20, 23, 24], s = [1, 12], r = [1, 13], n = [1, 14], h = [1, 15], c = [1, 16], i = [1, 19], y = [1, 20], p = {
8
+ trace: /* @__PURE__ */ o(function() {
9
+ }, "trace"),
10
+ yy: {},
11
+ symbols_: { error: 2, start: 3, timeline_header: 4, document: 5, EOF: 6, timeline: 7, timeline_lr: 8, timeline_td: 9, line: 10, SPACE: 11, statement: 12, NEWLINE: 13, title: 14, acc_title: 15, acc_title_value: 16, acc_descr: 17, acc_descr_value: 18, acc_descr_multiline_value: 19, section: 20, period_statement: 21, event_statement: 22, period: 23, event: 24, $accept: 0, $end: 1 },
12
+ terminals_: { 2: "error", 6: "EOF", 7: "timeline", 8: "timeline_lr", 9: "timeline_td", 11: "SPACE", 13: "NEWLINE", 14: "title", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 23: "period", 24: "event" },
13
+ productions_: [0, [3, 3], [4, 1], [4, 1], [4, 1], [5, 0], [5, 2], [10, 2], [10, 1], [10, 1], [10, 1], [12, 1], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [21, 1], [22, 1]],
14
+ performAction: /* @__PURE__ */ o(function(a, d, l, g, x, u, S) {
15
+ var v = u.length - 1;
16
+ switch (x) {
17
+ case 1:
18
+ return u[v - 1];
19
+ case 3:
20
+ g.setDirection("LR");
21
+ break;
22
+ case 4:
23
+ g.setDirection("TD");
24
+ break;
25
+ case 5:
26
+ this.$ = [];
27
+ break;
28
+ case 6:
29
+ u[v - 1].push(u[v]), this.$ = u[v - 1];
30
+ break;
31
+ case 7:
32
+ case 8:
33
+ this.$ = u[v];
34
+ break;
35
+ case 9:
36
+ case 10:
37
+ this.$ = [];
38
+ break;
39
+ case 11:
40
+ g.getCommonDb().setDiagramTitle(u[v].substr(6)), this.$ = u[v].substr(6);
41
+ break;
42
+ case 12:
43
+ this.$ = u[v].trim(), g.getCommonDb().setAccTitle(this.$);
44
+ break;
45
+ case 13:
46
+ case 14:
47
+ this.$ = u[v].trim(), g.getCommonDb().setAccDescription(this.$);
48
+ break;
49
+ case 15:
50
+ g.addSection(u[v].substr(8)), this.$ = u[v].substr(8);
51
+ break;
52
+ case 18:
53
+ g.addTask(u[v], 0, ""), this.$ = u[v];
54
+ break;
55
+ case 19:
56
+ g.addEvent(u[v].substr(2)), this.$ = u[v];
57
+ break;
58
+ }
59
+ }, "anonymous"),
60
+ table: [{ 3: 1, 4: 2, 7: [1, 3], 8: [1, 4], 9: [1, 5] }, { 1: [3] }, e(t, [2, 5], { 5: 6 }), e(t, [2, 2]), e(t, [2, 3]), e(t, [2, 4]), { 6: [1, 7], 10: 8, 11: [1, 9], 12: 10, 13: [1, 11], 14: s, 15: r, 17: n, 19: h, 20: c, 21: 17, 22: 18, 23: i, 24: y }, e(t, [2, 10], { 1: [2, 1] }), e(t, [2, 6]), { 12: 21, 14: s, 15: r, 17: n, 19: h, 20: c, 21: 17, 22: 18, 23: i, 24: y }, e(t, [2, 8]), e(t, [2, 9]), e(t, [2, 11]), { 16: [1, 22] }, { 18: [1, 23] }, e(t, [2, 14]), e(t, [2, 15]), e(t, [2, 16]), e(t, [2, 17]), e(t, [2, 18]), e(t, [2, 19]), e(t, [2, 7]), e(t, [2, 12]), e(t, [2, 13])],
61
+ defaultActions: {},
62
+ parseError: /* @__PURE__ */ o(function(a, d) {
63
+ if (d.recoverable)
64
+ this.trace(a);
65
+ else {
66
+ var l = new Error(a);
67
+ throw l.hash = d, l;
68
+ }
69
+ }, "parseError"),
70
+ parse: /* @__PURE__ */ o(function(a) {
71
+ var d = this, l = [0], g = [], x = [null], u = [], S = this.table, v = "", I = 0, C = 0, W = 2, O = 1, L = u.slice.call(arguments, 1), w = Object.create(this.lexer), H = { yy: {} };
72
+ for (var V in this.yy)
73
+ Object.prototype.hasOwnProperty.call(this.yy, V) && (H.yy[V] = this.yy[V]);
74
+ w.setInput(a, H.yy), H.yy.lexer = w, H.yy.parser = this, typeof w.yylloc > "u" && (w.yylloc = {});
75
+ var F = w.yylloc;
76
+ u.push(F);
77
+ var U = w.options && w.options.ranges;
78
+ typeof H.yy.parseError == "function" ? this.parseError = H.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
79
+ function N(A) {
80
+ l.length = l.length - 2 * A, x.length = x.length - A, u.length = u.length - A;
81
+ }
82
+ o(N, "popStack");
83
+ function b() {
84
+ var A;
85
+ return A = g.pop() || w.lex() || O, typeof A != "number" && (A instanceof Array && (g = A, A = g.pop()), A = d.symbols_[A] || A), A;
86
+ }
87
+ o(b, "lex");
88
+ for (var _, $, T, P, R = {}, G, B, Z, j; ; ) {
89
+ if ($ = l[l.length - 1], this.defaultActions[$] ? T = this.defaultActions[$] : ((_ === null || typeof _ > "u") && (_ = b()), T = S[$] && S[$][_]), typeof T > "u" || !T.length || !T[0]) {
90
+ var Y = "";
91
+ j = [];
92
+ for (G in S[$])
93
+ this.terminals_[G] && G > W && j.push("'" + this.terminals_[G] + "'");
94
+ w.showPosition ? Y = "Parse error on line " + (I + 1) + `:
95
+ ` + w.showPosition() + `
96
+ Expecting ` + j.join(", ") + ", got '" + (this.terminals_[_] || _) + "'" : Y = "Parse error on line " + (I + 1) + ": Unexpected " + (_ == O ? "end of input" : "'" + (this.terminals_[_] || _) + "'"), this.parseError(Y, {
97
+ text: w.match,
98
+ token: this.terminals_[_] || _,
99
+ line: w.yylineno,
100
+ loc: F,
101
+ expected: j
102
+ });
103
+ }
104
+ if (T[0] instanceof Array && T.length > 1)
105
+ throw new Error("Parse Error: multiple actions possible at state: " + $ + ", token: " + _);
106
+ switch (T[0]) {
107
+ case 1:
108
+ l.push(_), x.push(w.yytext), u.push(w.yylloc), l.push(T[1]), _ = null, C = w.yyleng, v = w.yytext, I = w.yylineno, F = w.yylloc;
109
+ break;
110
+ case 2:
111
+ if (B = this.productions_[T[1]][1], R.$ = x[x.length - B], R._$ = {
112
+ first_line: u[u.length - (B || 1)].first_line,
113
+ last_line: u[u.length - 1].last_line,
114
+ first_column: u[u.length - (B || 1)].first_column,
115
+ last_column: u[u.length - 1].last_column
116
+ }, U && (R._$.range = [
117
+ u[u.length - (B || 1)].range[0],
118
+ u[u.length - 1].range[1]
119
+ ]), P = this.performAction.apply(R, [
120
+ v,
121
+ C,
122
+ I,
123
+ H.yy,
124
+ T[1],
125
+ x,
126
+ u
127
+ ].concat(L)), typeof P < "u")
128
+ return P;
129
+ B && (l = l.slice(0, -1 * B * 2), x = x.slice(0, -1 * B), u = u.slice(0, -1 * B)), l.push(this.productions_[T[1]][0]), x.push(R.$), u.push(R._$), Z = S[l[l.length - 2]][l[l.length - 1]], l.push(Z);
130
+ break;
131
+ case 3:
132
+ return !0;
133
+ }
134
+ }
135
+ return !0;
136
+ }, "parse")
137
+ }, m = /* @__PURE__ */ (function() {
138
+ var k = {
139
+ EOF: 1,
140
+ parseError: /* @__PURE__ */ o(function(d, l) {
141
+ if (this.yy.parser)
142
+ this.yy.parser.parseError(d, l);
143
+ else
144
+ throw new Error(d);
145
+ }, "parseError"),
146
+ // resets the lexer, sets new input
147
+ setInput: /* @__PURE__ */ o(function(a, d) {
148
+ return this.yy = d || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
149
+ first_line: 1,
150
+ first_column: 0,
151
+ last_line: 1,
152
+ last_column: 0
153
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
154
+ }, "setInput"),
155
+ // consumes and returns one char from the input
156
+ input: /* @__PURE__ */ o(function() {
157
+ var a = this._input[0];
158
+ this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
159
+ var d = a.match(/(?:\r\n?|\n).*/g);
160
+ return d ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
161
+ }, "input"),
162
+ // unshifts one char (or a string) into the input
163
+ unput: /* @__PURE__ */ o(function(a) {
164
+ var d = a.length, l = a.split(/(?:\r\n?|\n)/g);
165
+ this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - d), this.offset -= d;
166
+ var g = this.match.split(/(?:\r\n?|\n)/g);
167
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), l.length - 1 && (this.yylineno -= l.length - 1);
168
+ var x = this.yylloc.range;
169
+ return this.yylloc = {
170
+ first_line: this.yylloc.first_line,
171
+ last_line: this.yylineno + 1,
172
+ first_column: this.yylloc.first_column,
173
+ last_column: l ? (l.length === g.length ? this.yylloc.first_column : 0) + g[g.length - l.length].length - l[0].length : this.yylloc.first_column - d
174
+ }, this.options.ranges && (this.yylloc.range = [x[0], x[0] + this.yyleng - d]), this.yyleng = this.yytext.length, this;
175
+ }, "unput"),
176
+ // When called from action, caches matched text and appends it on next action
177
+ more: /* @__PURE__ */ o(function() {
178
+ return this._more = !0, this;
179
+ }, "more"),
180
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
181
+ reject: /* @__PURE__ */ o(function() {
182
+ if (this.options.backtrack_lexer)
183
+ this._backtrack = !0;
184
+ else
185
+ 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).
186
+ ` + this.showPosition(), {
187
+ text: "",
188
+ token: null,
189
+ line: this.yylineno
190
+ });
191
+ return this;
192
+ }, "reject"),
193
+ // retain first n characters of the match
194
+ less: /* @__PURE__ */ o(function(a) {
195
+ this.unput(this.match.slice(a));
196
+ }, "less"),
197
+ // displays already matched input, i.e. for error messages
198
+ pastInput: /* @__PURE__ */ o(function() {
199
+ var a = this.matched.substr(0, this.matched.length - this.match.length);
200
+ return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
201
+ }, "pastInput"),
202
+ // displays upcoming input, i.e. for error messages
203
+ upcomingInput: /* @__PURE__ */ o(function() {
204
+ var a = this.match;
205
+ return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
206
+ }, "upcomingInput"),
207
+ // displays the character position where the lexing error occurred, i.e. for error messages
208
+ showPosition: /* @__PURE__ */ o(function() {
209
+ var a = this.pastInput(), d = new Array(a.length + 1).join("-");
210
+ return a + this.upcomingInput() + `
211
+ ` + d + "^";
212
+ }, "showPosition"),
213
+ // test the lexed token: return FALSE when not a match, otherwise return token
214
+ test_match: /* @__PURE__ */ o(function(a, d) {
215
+ var l, g, x;
216
+ if (this.options.backtrack_lexer && (x = {
217
+ yylineno: this.yylineno,
218
+ yylloc: {
219
+ first_line: this.yylloc.first_line,
220
+ last_line: this.last_line,
221
+ first_column: this.yylloc.first_column,
222
+ last_column: this.yylloc.last_column
223
+ },
224
+ yytext: this.yytext,
225
+ match: this.match,
226
+ matches: this.matches,
227
+ matched: this.matched,
228
+ yyleng: this.yyleng,
229
+ offset: this.offset,
230
+ _more: this._more,
231
+ _input: this._input,
232
+ yy: this.yy,
233
+ conditionStack: this.conditionStack.slice(0),
234
+ done: this.done
235
+ }, this.options.ranges && (x.yylloc.range = this.yylloc.range.slice(0))), g = a[0].match(/(?:\r\n?|\n).*/g), g && (this.yylineno += g.length), this.yylloc = {
236
+ first_line: this.yylloc.last_line,
237
+ last_line: this.yylineno + 1,
238
+ first_column: this.yylloc.last_column,
239
+ last_column: g ? g[g.length - 1].length - g[g.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
240
+ }, this.yytext += a[0], this.match += a[0], this.matches = a, 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(a[0].length), this.matched += a[0], l = this.performAction.call(this, this.yy, this, d, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), l)
241
+ return l;
242
+ if (this._backtrack) {
243
+ for (var u in x)
244
+ this[u] = x[u];
245
+ return !1;
246
+ }
247
+ return !1;
248
+ }, "test_match"),
249
+ // return next match in input
250
+ next: /* @__PURE__ */ o(function() {
251
+ if (this.done)
252
+ return this.EOF;
253
+ this._input || (this.done = !0);
254
+ var a, d, l, g;
255
+ this._more || (this.yytext = "", this.match = "");
256
+ for (var x = this._currentRules(), u = 0; u < x.length; u++)
257
+ if (l = this._input.match(this.rules[x[u]]), l && (!d || l[0].length > d[0].length)) {
258
+ if (d = l, g = u, this.options.backtrack_lexer) {
259
+ if (a = this.test_match(l, x[u]), a !== !1)
260
+ return a;
261
+ if (this._backtrack) {
262
+ d = !1;
263
+ continue;
264
+ } else
265
+ return !1;
266
+ } else if (!this.options.flex)
267
+ break;
268
+ }
269
+ return d ? (a = this.test_match(d, x[g]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
270
+ ` + this.showPosition(), {
271
+ text: "",
272
+ token: null,
273
+ line: this.yylineno
274
+ });
275
+ }, "next"),
276
+ // return next match that has a token
277
+ lex: /* @__PURE__ */ o(function() {
278
+ var d = this.next();
279
+ return d || this.lex();
280
+ }, "lex"),
281
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
282
+ begin: /* @__PURE__ */ o(function(d) {
283
+ this.conditionStack.push(d);
284
+ }, "begin"),
285
+ // pop the previously active lexer condition state off the condition stack
286
+ popState: /* @__PURE__ */ o(function() {
287
+ var d = this.conditionStack.length - 1;
288
+ return d > 0 ? this.conditionStack.pop() : this.conditionStack[0];
289
+ }, "popState"),
290
+ // produce the lexer rule set which is active for the currently active lexer condition state
291
+ _currentRules: /* @__PURE__ */ o(function() {
292
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
293
+ }, "_currentRules"),
294
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
295
+ topState: /* @__PURE__ */ o(function(d) {
296
+ return d = this.conditionStack.length - 1 - Math.abs(d || 0), d >= 0 ? this.conditionStack[d] : "INITIAL";
297
+ }, "topState"),
298
+ // alias for begin(condition)
299
+ pushState: /* @__PURE__ */ o(function(d) {
300
+ this.begin(d);
301
+ }, "pushState"),
302
+ // return the number of states currently on the stack
303
+ stateStackSize: /* @__PURE__ */ o(function() {
304
+ return this.conditionStack.length;
305
+ }, "stateStackSize"),
306
+ options: { "case-insensitive": !0 },
307
+ performAction: /* @__PURE__ */ o(function(d, l, g, x) {
308
+ switch (g) {
309
+ case 0:
310
+ break;
311
+ case 1:
312
+ break;
313
+ case 2:
314
+ return 13;
315
+ case 3:
316
+ break;
317
+ case 4:
318
+ break;
319
+ case 5:
320
+ return 8;
321
+ case 6:
322
+ return 9;
323
+ case 7:
324
+ return 7;
325
+ case 8:
326
+ return 14;
327
+ case 9:
328
+ return this.begin("acc_title"), 15;
329
+ case 10:
330
+ return this.popState(), "acc_title_value";
331
+ case 11:
332
+ return this.begin("acc_descr"), 17;
333
+ case 12:
334
+ return this.popState(), "acc_descr_value";
335
+ case 13:
336
+ this.begin("acc_descr_multiline");
337
+ break;
338
+ case 14:
339
+ this.popState();
340
+ break;
341
+ case 15:
342
+ return "acc_descr_multiline_value";
343
+ case 16:
344
+ return 20;
345
+ case 17:
346
+ return 24;
347
+ case 18:
348
+ return 23;
349
+ case 19:
350
+ return 6;
351
+ case 20:
352
+ return "INVALID";
353
+ }
354
+ }, "anonymous"),
355
+ rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline[ \t]+LR\b)/i, /^(?:timeline[ \t]+TD\b)/i, /^(?:timeline\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^:\n]+)/i, /^(?::\s(?:[^:\n]|:(?!\s))+)/i, /^(?:[^#:\n]+)/i, /^(?:$)/i, /^(?:.)/i],
356
+ conditions: { acc_descr_multiline: { rules: [14, 15], inclusive: !1 }, acc_descr: { rules: [12], inclusive: !1 }, acc_title: { rules: [10], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20], inclusive: !0 } }
357
+ };
358
+ return k;
359
+ })();
360
+ p.lexer = m;
361
+ function f() {
362
+ this.yy = {};
363
+ }
364
+ return o(f, "Parser"), f.prototype = p, p.Parser = f, new f();
365
+ })();
366
+ tt.parser = tt;
367
+ var Dt = tt, mt = {};
368
+ zt(mt, {
369
+ addEvent: () => $t,
370
+ addSection: () => wt,
371
+ addTask: () => Tt,
372
+ addTaskOrg: () => Nt,
373
+ clear: () => vt,
374
+ default: () => Kt,
375
+ getCommonDb: () => kt,
376
+ getDirection: () => _t,
377
+ getSections: () => St,
378
+ getTasks: () => Et,
379
+ setDirection: () => bt
380
+ });
381
+ var D = "", xt = 0, rt = "LR", st = [], q = [], K = [], kt = /* @__PURE__ */ o(() => Ot, "getCommonDb"), vt = /* @__PURE__ */ o(function() {
382
+ st.length = 0, q.length = 0, D = "", K.length = 0, rt = "LR", Gt();
383
+ }, "clear"), bt = /* @__PURE__ */ o(function(e) {
384
+ rt = e;
385
+ }, "setDirection"), _t = /* @__PURE__ */ o(function() {
386
+ return rt;
387
+ }, "getDirection"), wt = /* @__PURE__ */ o(function(e) {
388
+ D = e, st.push(e);
389
+ }, "addSection"), St = /* @__PURE__ */ o(function() {
390
+ return st;
391
+ }, "getSections"), Et = /* @__PURE__ */ o(function() {
392
+ let e = lt();
393
+ const t = 100;
394
+ let s = 0;
395
+ for (; !e && s < t; )
396
+ e = lt(), s++;
397
+ return q.push(...K), q;
398
+ }, "getTasks"), Tt = /* @__PURE__ */ o(function(e, t, s) {
399
+ const r = {
400
+ id: xt++,
401
+ section: D,
402
+ type: D,
403
+ task: e,
404
+ score: t || 0,
405
+ //if event is defined, then add it the events array
406
+ events: s ? [s] : []
407
+ };
408
+ K.push(r);
409
+ }, "addTask"), $t = /* @__PURE__ */ o(function(e) {
410
+ K.find((s) => s.id === xt - 1).events.push(e);
411
+ }, "addEvent"), Nt = /* @__PURE__ */ o(function(e) {
412
+ const t = {
413
+ section: D,
414
+ type: D,
415
+ description: e,
416
+ task: e,
417
+ classes: []
418
+ };
419
+ q.push(t);
420
+ }, "addTaskOrg"), lt = /* @__PURE__ */ o(function() {
421
+ const e = /* @__PURE__ */ o(function(s) {
422
+ return K[s].processed;
423
+ }, "compileTask");
424
+ let t = !0;
425
+ for (const [s, r] of K.entries())
426
+ e(s), t = t && r.processed;
427
+ return t;
428
+ }, "compileTasks"), Kt = {
429
+ clear: vt,
430
+ getCommonDb: kt,
431
+ getDirection: _t,
432
+ setDirection: bt,
433
+ addSection: wt,
434
+ getSections: St,
435
+ getTasks: Et,
436
+ addTask: Tt,
437
+ addTaskOrg: Nt,
438
+ addEvent: $t
439
+ }, It = 0, Q = /* @__PURE__ */ o(function(e, t) {
440
+ const s = e.append("rect");
441
+ return s.attr("x", t.x), s.attr("y", t.y), s.attr("fill", t.fill), s.attr("stroke", t.stroke), s.attr("width", t.width), s.attr("height", t.height), s.attr("rx", t.rx), s.attr("ry", t.ry), t.class !== void 0 && s.attr("class", t.class), s;
442
+ }, "drawRect"), Ut = /* @__PURE__ */ o(function(e, t) {
443
+ const r = e.append("circle").attr("cx", t.cx).attr("cy", t.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), n = e.append("g");
444
+ n.append("circle").attr("cx", t.cx - 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), n.append("circle").attr("cx", t.cx + 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
445
+ function h(y) {
446
+ const p = ct().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
447
+ y.append("path").attr("class", "mouth").attr("d", p).attr("transform", "translate(" + t.cx + "," + (t.cy + 2) + ")");
448
+ }
449
+ o(h, "smile");
450
+ function c(y) {
451
+ const p = ct().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
452
+ y.append("path").attr("class", "mouth").attr("d", p).attr("transform", "translate(" + t.cx + "," + (t.cy + 7) + ")");
453
+ }
454
+ o(c, "sad");
455
+ function i(y) {
456
+ y.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", t.cx - 5).attr("y1", t.cy + 7).attr("x2", t.cx + 5).attr("y2", t.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
457
+ }
458
+ return o(i, "ambivalent"), t.score > 3 ? h(n) : t.score < 3 ? c(n) : i(n), r;
459
+ }, "drawFace"), Xt = /* @__PURE__ */ o(function(e, t) {
460
+ const s = e.append("circle");
461
+ return s.attr("cx", t.cx), s.attr("cy", t.cy), s.attr("class", "actor-" + t.pos), s.attr("fill", t.fill), s.attr("stroke", t.stroke), s.attr("r", t.r), s.class !== void 0 && s.attr("class", s.class), t.title !== void 0 && s.append("title").text(t.title), s;
462
+ }, "drawCircle"), Ht = /* @__PURE__ */ o(function(e, t) {
463
+ const s = t.text.replace(/<br\s*\/?>/gi, " "), r = e.append("text");
464
+ r.attr("x", t.x), r.attr("y", t.y), r.attr("class", "legend"), r.style("text-anchor", t.anchor), t.class !== void 0 && r.attr("class", t.class);
465
+ const n = r.append("tspan");
466
+ return n.attr("x", t.x + t.textMargin * 2), n.text(s), r;
467
+ }, "drawText"), Zt = /* @__PURE__ */ o(function(e, t) {
468
+ function s(n, h, c, i, y) {
469
+ return n + "," + h + " " + (n + c) + "," + h + " " + (n + c) + "," + (h + i - y) + " " + (n + c - y * 1.2) + "," + (h + i) + " " + n + "," + (h + i);
470
+ }
471
+ o(s, "genPoints");
472
+ const r = e.append("polygon");
473
+ r.attr("points", s(t.x, t.y, 50, 20, 7)), r.attr("class", "labelBox"), t.y = t.y + t.labelMargin, t.x = t.x + 0.5 * t.labelMargin, Ht(e, t);
474
+ }, "drawLabel"), jt = /* @__PURE__ */ o(function(e, t, s) {
475
+ const r = e.append("g"), n = it();
476
+ n.x = t.x, n.y = t.y, n.fill = t.fill, n.width = s.width, n.height = s.height, n.class = "journey-section section-type-" + t.num, n.rx = 3, n.ry = 3, Q(r, n), Lt(s)(
477
+ t.text,
478
+ r,
479
+ n.x,
480
+ n.y,
481
+ n.width,
482
+ n.height,
483
+ { class: "journey-section section-type-" + t.num },
484
+ s,
485
+ t.colour
486
+ );
487
+ }, "drawSection"), et = -1, qt = /* @__PURE__ */ o(function(e, t, s, r) {
488
+ const n = t.x + s.width / 2, h = e.append("g");
489
+ et++, h.append("line").attr("id", r + "-task" + et).attr("x1", n).attr("y1", t.y).attr("x2", n).attr("y2", 450).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), Ut(h, {
490
+ cx: n,
491
+ cy: 300 + (5 - t.score) * 30,
492
+ score: t.score
493
+ });
494
+ const i = it();
495
+ i.x = t.x, i.y = t.y, i.fill = t.fill, i.width = s.width, i.height = s.height, i.class = "task task-type-" + t.num, i.rx = 3, i.ry = 3, Q(h, i), Lt(s)(
496
+ t.task,
497
+ h,
498
+ i.x,
499
+ i.y,
500
+ i.width,
501
+ i.height,
502
+ { class: "task" },
503
+ s,
504
+ t.colour
505
+ );
506
+ }, "drawTask"), Qt = /* @__PURE__ */ o(function(e, t) {
507
+ Q(e, {
508
+ x: t.startx,
509
+ y: t.starty,
510
+ width: t.stopx - t.startx,
511
+ height: t.stopy - t.starty,
512
+ fill: t.fill,
513
+ class: "rect"
514
+ }).lower();
515
+ }, "drawBackgroundRect"), Jt = /* @__PURE__ */ o(function() {
516
+ return {
517
+ x: 0,
518
+ y: 0,
519
+ fill: void 0,
520
+ "text-anchor": "start",
521
+ width: 100,
522
+ height: 100,
523
+ textMargin: 0,
524
+ rx: 0,
525
+ ry: 0
526
+ };
527
+ }, "getTextObj"), it = /* @__PURE__ */ o(function() {
528
+ return {
529
+ x: 0,
530
+ y: 0,
531
+ width: 100,
532
+ anchor: "start",
533
+ height: 100,
534
+ rx: 0,
535
+ ry: 0
536
+ };
537
+ }, "getNoteRect"), Lt = /* @__PURE__ */ (function() {
538
+ function e(n, h, c, i, y, p, m, f) {
539
+ const k = h.append("text").attr("x", c + y / 2).attr("y", i + p / 2 + 5).style("font-color", f).style("text-anchor", "middle").text(n);
540
+ r(k, m);
541
+ }
542
+ o(e, "byText");
543
+ function t(n, h, c, i, y, p, m, f, k) {
544
+ const { taskFontSize: a, taskFontFamily: d } = f, l = n.split(/<br\s*\/?>/gi);
545
+ for (let g = 0; g < l.length; g++) {
546
+ const x = g * a - a * (l.length - 1) / 2, u = h.append("text").attr("x", c + y / 2).attr("y", i).attr("fill", k).style("text-anchor", "middle").style("font-size", a).style("font-family", d);
547
+ u.append("tspan").attr("x", c + y / 2).attr("dy", x).text(l[g]), u.attr("y", i + p / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), r(u, m);
548
+ }
549
+ }
550
+ o(t, "byTspan");
551
+ function s(n, h, c, i, y, p, m, f) {
552
+ const k = h.append("switch"), d = k.append("foreignObject").attr("x", c).attr("y", i).attr("width", y).attr("height", p).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
553
+ d.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(n), t(n, k, c, i, y, p, m, f), r(d, m);
554
+ }
555
+ o(s, "byFo");
556
+ function r(n, h) {
557
+ for (const c in h)
558
+ c in h && n.attr(c, h[c]);
559
+ }
560
+ return o(r, "_setTextAttrs"), function(n) {
561
+ return n.textPlacement === "fo" ? s : n.textPlacement === "old" ? e : t;
562
+ };
563
+ })(), Yt = /* @__PURE__ */ o(function(e, t) {
564
+ It = 0, et = -1, e.append("defs").append("marker").attr("id", t + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
565
+ }, "initGraphics");
566
+ function at(e, t) {
567
+ e.each(function() {
568
+ var s = X(this), r = s.text().split(/(\s+|<br>)/).reverse(), n, h = [], c = 1.1, i = s.attr("y"), y = parseFloat(s.attr("dy")), p = s.text(null).append("tspan").attr("x", 0).attr("y", i).attr("dy", y + "em");
569
+ for (let m = 0; m < r.length; m++)
570
+ n = r[r.length - 1 - m], h.push(n), p.text(h.join(" ").trim()), (p.node().getComputedTextLength() > t || n === "<br>") && (h.pop(), p.text(h.join(" ").trim()), n === "<br>" ? h = [""] : h = [n], p = s.append("tspan").attr("x", 0).attr("y", i).attr("dy", c + "em").text(n));
571
+ });
572
+ }
573
+ o(at, "wrap");
574
+ var te = /* @__PURE__ */ o(function(e, t, s, r, n, h = !1) {
575
+ const { theme: c, look: i } = r, y = c?.includes("redux"), p = r?.themeVariables?.THEME_COLOR_LIMIT ?? 12, m = s % p - 1, f = e.append("g");
576
+ t.section = m, f.attr(
577
+ "class",
578
+ (t.class ? t.class + " " : "") + "timeline-node " + ("section-" + m)
579
+ );
580
+ const k = f.append("g"), a = f.append("g"), l = a.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(at, t.width).node().getBBox(), g = r.fontSize?.replace ? r.fontSize.replace("px", "") : r.fontSize;
581
+ if (t.height = l.height + g * 1.1 * 0.5 + t.padding, t.height = Math.max(t.height, t.maxHeight), t.width = t.width + 2 * t.padding, a.attr("transform", "translate(" + t.width / 2 + ", " + t.padding / 2 + ")"), y && a.attr(
582
+ "transform",
583
+ `translate(${t.width / 2}, ${h ? t.padding / 2 + 3 : t.padding})`
584
+ ), ne(k, t, m, n, r), i === "neo" && (f.attr("data-look", "neo"), y)) {
585
+ const x = c.includes("dark"), u = e.node()?.ownerSVGElement ?? e.node(), S = X(u), v = S.attr("id") ?? "", I = v ? `${v}-drop-shadow` : "drop-shadow";
586
+ if (S.select(`#${I}`).empty()) {
587
+ const C = S.select("defs");
588
+ (C.empty() ? S.append("defs") : C).append("filter").attr("id", I).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", x ? "0.2" : "0.06").attr("flood-color", x ? "#FFFFFF" : "#000000");
589
+ }
590
+ }
591
+ return t;
592
+ }, "drawNode"), ee = /* @__PURE__ */ o(function(e, t, s) {
593
+ const r = e.append("g"), h = r.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(at, t.width).node().getBBox(), c = s.fontSize?.replace ? s.fontSize.replace("px", "") : s.fontSize;
594
+ return r.remove(), h.height + c * 1.1 * 0.5 + t.padding;
595
+ }, "getVirtualNodeHeight"), ne = /* @__PURE__ */ o(function(e, t, s, r, n) {
596
+ const { theme: h } = n, c = h?.includes("redux") ? 0 : 5, i = 5, y = c > 0 ? `M0 ${t.height - i} v${-t.height + 2 * i} q0,-${c},${c},-${c} h${t.width - 2 * i} q${c},0,${c},${c} v${t.height - i} H0 Z` : `M0 ${t.height - i} v${-(t.height - i)} h${t.width} v${t.height} H0 Z`;
597
+ e.append("path").attr("id", r + "-node-" + It++).attr("class", "node-bkg node-" + t.type).attr("d", y), h?.includes("redux") || e.append("line").attr("class", "node-line-" + s).attr("x1", 0).attr("y1", t.height).attr("x2", t.width).attr("y2", t.height);
598
+ }, "defaultBkg"), M = {
599
+ drawRect: Q,
600
+ drawCircle: Xt,
601
+ drawSection: jt,
602
+ drawText: Ht,
603
+ drawLabel: Zt,
604
+ drawTask: qt,
605
+ drawBackgroundRect: Qt,
606
+ getTextObj: Jt,
607
+ getNoteRect: it,
608
+ initGraphics: Yt,
609
+ drawNode: te,
610
+ getVirtualNodeHeight: ee
611
+ }, re = /* @__PURE__ */ o(function(e, t, s, r) {
612
+ const n = ft(), { look: h, theme: c, themeVariables: i } = n, { useGradient: y, gradientStart: p, gradientStop: m } = i, f = n.timeline?.leftMargin ?? 50;
613
+ E.debug("timeline", r.db);
614
+ const k = n.securityLevel;
615
+ let a;
616
+ k === "sandbox" && (a = X("#i" + t));
617
+ const l = (k === "sandbox" ? X(a.nodes()[0].contentDocument.body) : X("body")).select("#" + t);
618
+ l.append("g");
619
+ const g = r.db.getTasks(), x = r.db.getCommonDb().getDiagramTitle();
620
+ E.debug("task", g), M.initGraphics(l, t);
621
+ const u = r.db.getSections();
622
+ E.debug("sections", u);
623
+ let S = 0, v = 0, I = 0, C = 0, W = 50 + f, O = 50;
624
+ C = 50;
625
+ let L = 0, w = !0;
626
+ u.forEach(function(N) {
627
+ const b = {
628
+ number: L,
629
+ descr: N,
630
+ section: L,
631
+ width: 150,
632
+ padding: 20,
633
+ maxHeight: S
634
+ }, _ = M.getVirtualNodeHeight(l, b, n);
635
+ E.debug("sectionHeight before draw", _), S = Math.max(S, _ + 20);
636
+ });
637
+ let H = 0, V = 0;
638
+ E.debug("tasks.length", g.length);
639
+ for (const [N, b] of g.entries()) {
640
+ const _ = {
641
+ number: N,
642
+ descr: b,
643
+ section: b.section,
644
+ width: 150,
645
+ padding: 20,
646
+ maxHeight: v
647
+ }, $ = M.getVirtualNodeHeight(l, _, n);
648
+ E.debug("taskHeight before draw", $), v = Math.max(v, $ + 20), H = Math.max(H, b.events.length);
649
+ let T = 0;
650
+ for (const P of b.events) {
651
+ const R = {
652
+ descr: P,
653
+ section: b.section,
654
+ number: b.section,
655
+ width: 150,
656
+ padding: 20,
657
+ maxHeight: 50
658
+ };
659
+ T += M.getVirtualNodeHeight(l, R, n);
660
+ }
661
+ b.events.length > 0 && (T += (b.events.length - 1) * 10), V = Math.max(V, T);
662
+ }
663
+ E.debug("maxSectionHeight before draw", S), E.debug("maxTaskHeight before draw", v), u && u.length > 0 ? u.forEach((N) => {
664
+ const b = g.filter((P) => P.section === N), _ = {
665
+ number: L,
666
+ descr: N,
667
+ section: L,
668
+ width: 200 * Math.max(b.length, 1) - 50,
669
+ padding: 20,
670
+ maxHeight: S
671
+ };
672
+ E.debug("sectionNode", _);
673
+ const $ = l.append("g"), T = M.drawNode($, _, L, n, t);
674
+ E.debug("sectionNode output", T), $.attr("transform", `translate(${W}, ${C})`), O += S + 50, b.length > 0 && ht(
675
+ l,
676
+ b,
677
+ L,
678
+ W,
679
+ O,
680
+ v,
681
+ n,
682
+ H,
683
+ V,
684
+ S,
685
+ !1,
686
+ t
687
+ ), W += 200 * Math.max(b.length, 1), O = C, L++;
688
+ }) : (w = !1, ht(
689
+ l,
690
+ g,
691
+ L,
692
+ W,
693
+ O,
694
+ v,
695
+ n,
696
+ H,
697
+ V,
698
+ S,
699
+ !0,
700
+ t
701
+ ));
702
+ const F = l.node().getBBox();
703
+ if (E.debug("bounds", F), x && l.append("text").text(x).attr("x", h === "neo" ? F.x * 2 + f : F.width / 2 - f).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), I = w ? S + v + 150 : v + 100, l.append("g").attr("class", "lineWrapper").append("line").attr("x1", f).attr("y1", I).attr("x2", F.width + 3 * f).attr("y2", I).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", `url(#${t}-arrowhead)`), h === "neo" && y && c !== "neutral") {
704
+ const N = l.select("defs"), _ = (N.empty() ? l.append("defs") : N).append("linearGradient").attr("id", l.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
705
+ _.append("stop").attr("offset", "0%").attr("stop-color", p).attr("stop-opacity", 1), _.append("stop").attr("offset", "100%").attr("stop-color", m).attr("stop-opacity", 1);
706
+ }
707
+ yt(
708
+ void 0,
709
+ l,
710
+ n.timeline?.padding ?? 50,
711
+ n.timeline?.useMaxWidth ?? !1
712
+ );
713
+ }, "draw"), ht = /* @__PURE__ */ o(function(e, t, s, r, n, h, c, i, y, p, m, f) {
714
+ for (const k of t) {
715
+ const a = {
716
+ descr: k.task,
717
+ section: s,
718
+ number: s,
719
+ width: 150,
720
+ padding: 20,
721
+ maxHeight: h
722
+ };
723
+ E.debug("taskNode", a);
724
+ const d = e.append("g").attr("class", "taskWrapper"), g = M.drawNode(d, a, s, c, f).height;
725
+ if (E.debug("taskHeight after draw", g), d.attr("transform", `translate(${r}, ${n})`), h = Math.max(h, g), k.events) {
726
+ const x = e.append("g").attr("class", "lineWrapper");
727
+ let u = h;
728
+ n += 100, u = u + se(e, k.events, s, r, n, c, f), n -= 100, x.append("line").attr("x1", r + 190 / 2).attr("y1", n + h).attr("x2", r + 190 / 2).attr("y2", n + h + 100 + y + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", `url(#${f}-arrowhead)`).attr("stroke-dasharray", "5,5");
729
+ }
730
+ r = r + 200, m && !c.timeline?.disableMulticolor && s++;
731
+ }
732
+ n = n - 10;
733
+ }, "drawTasks"), se = /* @__PURE__ */ o(function(e, t, s, r, n, h, c) {
734
+ let i = 0;
735
+ const y = n;
736
+ n = n + 100;
737
+ for (const p of t) {
738
+ const m = {
739
+ descr: p,
740
+ section: s,
741
+ number: s,
742
+ width: 150,
743
+ padding: 20,
744
+ maxHeight: 50
745
+ };
746
+ E.debug("eventNode", m);
747
+ const f = e.append("g").attr("class", "eventWrapper"), a = M.drawNode(f, m, s, h, c, !0).height;
748
+ i = i + a, f.attr("transform", `translate(${r}, ${n})`), n = n + 10 + a;
749
+ }
750
+ return n = y, i;
751
+ }, "drawEvents"), ie = {
752
+ setConf: /* @__PURE__ */ o(() => {
753
+ }, "setConf"),
754
+ draw: re
755
+ }, J = 200, z = 5, ae = J + z * 2, ot = J + 100, oe = ot + z * 2, Mt = 10, ce = 0, dt = 20, At = 20, ut = 30, Ct = 50, le = /* @__PURE__ */ o(function(e, t, s, r) {
756
+ const n = ft(), h = n.timeline?.leftMargin ?? 50;
757
+ E.debug("timeline", r.db);
758
+ const c = Vt(t);
759
+ c.append("g");
760
+ const i = r.db.getTasks(), y = r.db.getCommonDb().getDiagramTitle();
761
+ E.debug("task", i), M.initGraphics(c);
762
+ const p = r.db.getSections();
763
+ E.debug("sections", p);
764
+ let m = 0, f = 0;
765
+ const k = 50 + h;
766
+ let a = 50;
767
+ const d = a, l = k, g = ae + At, x = oe + Ct, u = l + g;
768
+ let S = 0;
769
+ const v = p && p.length > 0, I = v ? u : k + g, C = Math.max(50, g + x - z * 2);
770
+ p.forEach(function(N) {
771
+ const b = {
772
+ number: S,
773
+ descr: N,
774
+ section: S,
775
+ width: C,
776
+ padding: z,
777
+ maxHeight: m
778
+ }, _ = M.getVirtualNodeHeight(c, b, n);
779
+ E.debug("sectionHeight before draw", _), m = Math.max(m, _);
780
+ });
781
+ let W = 0;
782
+ E.debug("tasks.length", i.length);
783
+ for (const [N, b] of i.entries()) {
784
+ const _ = {
785
+ number: N,
786
+ descr: b,
787
+ section: b.section,
788
+ width: J,
789
+ padding: z,
790
+ maxHeight: f
791
+ }, $ = M.getVirtualNodeHeight(c, _, n);
792
+ E.debug("taskHeight before draw", $), f = Math.max(f, $);
793
+ let T = 0;
794
+ for (const P of b.events) {
795
+ const R = {
796
+ descr: P,
797
+ section: b.section,
798
+ number: b.section,
799
+ width: ot,
800
+ padding: z,
801
+ maxHeight: 50
802
+ };
803
+ T += M.getVirtualNodeHeight(c, R, n);
804
+ }
805
+ b.events.length > 0 && (T += (b.events.length - 1) * Mt), W = Math.max(W, T) + ce;
806
+ }
807
+ E.debug("maxSectionHeight before draw", m), E.debug("maxTaskHeight before draw", f);
808
+ const L = Math.max(f, W) + ut;
809
+ v ? p.forEach((N) => {
810
+ const b = i.filter((Z) => Z.section === N), _ = {
811
+ number: S,
812
+ descr: N,
813
+ section: S,
814
+ width: C,
815
+ padding: z,
816
+ maxHeight: m
817
+ };
818
+ E.debug("sectionNode", _);
819
+ const $ = c.append("g"), T = M.drawNode($, _, S, n);
820
+ E.debug("sectionNode output", T);
821
+ const P = I - g;
822
+ $.attr("transform", `translate(${P}, ${a})`);
823
+ const R = a + T.height + dt;
824
+ b.length > 0 && gt(
825
+ c,
826
+ b,
827
+ S,
828
+ I,
829
+ R,
830
+ f,
831
+ n,
832
+ L,
833
+ !1
834
+ );
835
+ const G = b.length, B = T.height + dt + L * Math.max(G, 1) - (G > 0 ? ut * 2 : 0);
836
+ a += B, S++;
837
+ }) : gt(
838
+ c,
839
+ i,
840
+ S,
841
+ I,
842
+ a,
843
+ f,
844
+ n,
845
+ L,
846
+ !0
847
+ );
848
+ let w = c.node()?.getBBox();
849
+ if (!w)
850
+ throw new Error("bbox not found");
851
+ if (E.debug("bounds", w), y) {
852
+ if (c.append("text").text(y).attr("x", w.width / 2 - h).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), w = c.node()?.getBBox(), !w)
853
+ throw new Error("bbox not found");
854
+ E.debug("bounds after title", w);
855
+ }
856
+ const [H] = Ft(n.fontSize), V = (H ?? 16) * 2, F = (H ?? 16) * 0.5 + 20, U = c.append("g").attr("class", "lineWrapper");
857
+ U.append("line").attr("x1", I).attr("y1", d - V).attr("x2", I).attr("y2", w.y + w.height + F).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), U.lower(), yt(
858
+ void 0,
859
+ c,
860
+ n.timeline?.padding ?? 50,
861
+ n.timeline?.useMaxWidth ?? !1
862
+ );
863
+ }, "draw"), gt = /* @__PURE__ */ o(function(e, t, s, r, n, h, c, i, y) {
864
+ for (const p of t) {
865
+ const m = {
866
+ descr: p.task,
867
+ section: s,
868
+ number: s,
869
+ width: J,
870
+ padding: z,
871
+ maxHeight: h
872
+ };
873
+ E.debug("taskNode", m);
874
+ const f = e.append("g").attr("class", "taskWrapper"), k = M.drawNode(f, m, s, c), a = k.height;
875
+ E.debug("taskHeight after draw", a);
876
+ const d = r - At - k.width;
877
+ if (f.attr("transform", `translate(${d}, ${n})`), h = Math.max(h, a), p.events && p.events.length > 0) {
878
+ const l = n, g = r + Ct;
879
+ he(e, p.events, s, r, g, l, c);
880
+ }
881
+ n = n + i, y && !c.timeline?.disableMulticolor && s++;
882
+ }
883
+ }, "drawTasks"), he = /* @__PURE__ */ o(function(e, t, s, r, n, h, c) {
884
+ let i = h;
885
+ for (const y of t) {
886
+ const p = {
887
+ descr: y,
888
+ section: s,
889
+ number: s,
890
+ width: ot,
891
+ padding: z,
892
+ maxHeight: 0
893
+ };
894
+ E.debug("eventNode", p);
895
+ const m = e.append("g").attr("class", "eventWrapper"), k = M.drawNode(m, p, s, c).height;
896
+ m.attr("transform", `translate(${n}, ${i})`);
897
+ const a = e.append("g").attr("class", "lineWrapper"), d = i + k / 2;
898
+ a.append("line").attr("x1", r).attr("y1", d).attr("x2", n).attr("y2", d).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5"), i = i + k + Mt;
899
+ }
900
+ return i - h;
901
+ }, "drawEvents"), de = {
902
+ setConf: /* @__PURE__ */ o(() => {
903
+ }, "setConf"),
904
+ draw: le
905
+ }, ue = /* @__PURE__ */ o((e) => {
906
+ const { theme: t } = pt(), s = t?.includes("dark"), r = Rt(t, e.borderColorArray), n = e.svgId?.replace(/^#/, "") ?? "", h = n ? `url(#${n}-drop-shadow)` : e.dropShadow ?? "none";
907
+ let c = "";
908
+ for (let i = 0; i < nt(e.THEME_COLOR_LIMIT); i++) {
909
+ const y = `${17 - 3 * i}`, p = r ? e.borderColorArray[i % e.borderColorArray.length] : void 0, m = p ?? e.mainBkg, f = p ?? e.nodeBorder;
910
+ c += `
911
+ .section-${i - 1} rect,
912
+ .section-${i - 1} path,
913
+ .section-${i - 1} circle {
914
+ fill: ${s && r ? e.mainBkg : m};
915
+ stroke: ${f};
916
+ stroke-width: ${e.strokeWidth};
917
+ filter: ${h};
918
+ }
919
+
920
+ .section-${i - 1} text {
921
+ fill: ${e.nodeBorder};
922
+ font-weight: ${e.fontWeight}
923
+ }
924
+
925
+ .node-icon-${i - 1} {
926
+ font-size: 40px;
927
+ color: ${e["cScaleLabel" + i]};
928
+ }
929
+
930
+ .section-edge-${i - 1} {
931
+ stroke: ${e["cScale" + i]};
932
+ }
933
+
934
+ .edge-depth-${i - 1} {
935
+ stroke-width: ${y};
936
+ }
937
+
938
+ .section-${i - 1} line {
939
+ stroke: ${e["cScaleInv" + i]};
940
+ stroke-width: 3;
941
+ }
942
+
943
+ .lineWrapper line {
944
+ stroke: ${e.nodeBorder};
945
+ stroke-width:${e.strokeWidth}
946
+ }
947
+
948
+ .disabled,
949
+ .disabled circle,
950
+ .disabled text {
951
+ fill: ${e.tertiaryColor ?? "lightgray"};
952
+ }
953
+
954
+ .disabled text {
955
+ fill: ${e.clusterBorder ?? "#efefef"};
956
+ }
957
+ `;
958
+ }
959
+ return c;
960
+ }, "genReduxSections"), ge = /* @__PURE__ */ o((e) => {
961
+ let t = "";
962
+ const s = nt(e.THEME_COLOR_LIMIT);
963
+ for (let r = 0; r < s; r++)
964
+ e["lineColor" + r] = e["lineColor" + r] ?? e["cScaleInv" + r], Wt(e["lineColor" + r]) ? e["lineColor" + r] = Pt(e["lineColor" + r], 20) : e["lineColor" + r] = Bt(e["lineColor" + r], 20);
965
+ for (let r = 0; r < s; r++) {
966
+ const n = "" + (17 - 3 * r);
967
+ t += `
968
+ .section-${r - 1} rect, .section-${r - 1} path, .section-${r - 1} circle, .section-${r - 1} path {
969
+ fill: ${e["cScale" + r]};
970
+ }
971
+ .section-${r - 1} text {
972
+ fill: ${e["cScaleLabel" + r]};
973
+ }
974
+ .node-icon-${r - 1} {
975
+ font-size: 40px;
976
+ color: ${e["cScaleLabel" + r]};
977
+ }
978
+ .section-edge-${r - 1}{
979
+ stroke: ${e["cScale" + r]};
980
+ }
981
+ .edge-depth-${r - 1}{
982
+ stroke-width: ${n};
983
+ }
984
+ .section-${r - 1} line {
985
+ stroke: ${e["cScaleInv" + r]} ;
986
+ stroke-width: 3;
987
+ }
988
+
989
+ .lineWrapper line{
990
+ stroke: ${e["cScaleLabel" + r]} ;
991
+ }
992
+
993
+ .disabled, .disabled circle, .disabled text {
994
+ fill: ${e.tertiaryColor ?? "lightgray"};
995
+ }
996
+ .disabled text {
997
+ fill: ${e.clusterBorder ?? "#efefef"};
998
+ }
999
+ `;
1000
+ }
1001
+ return t;
1002
+ }, "genSections"), pe = /* @__PURE__ */ o((e) => {
1003
+ const { theme: t } = pt(), s = t?.includes("redux"), r = t === "neutral", n = e.svgId?.replace(/^#/, "") ?? "";
1004
+ let h = "";
1005
+ if (e.useGradient && n && e.THEME_COLOR_LIMIT && !r) {
1006
+ const c = nt(e.THEME_COLOR_LIMIT);
1007
+ for (let i = 0; i < c; i++)
1008
+ h += `
1009
+ .section-${i - 1}[data-look="neo"] rect,
1010
+ .section-${i - 1}[data-look="neo"] path,
1011
+ .section-${i - 1}[data-look="neo"] circle {
1012
+ fill: ${e.mainBkg};
1013
+ stroke: url(#${n}-gradient);
1014
+ stroke-width: 2;
1015
+ }
1016
+ .section-${i - 1}[data-look="neo"] line {
1017
+ stroke: url(#${n}-gradient);
1018
+ stroke-width: 2;
1019
+ }`;
1020
+ }
1021
+ return `
1022
+ .edge {
1023
+ stroke-width: 3;
1024
+ }
1025
+ ${s ? ue(e) : ge(e)}
1026
+ ${h}
1027
+ .section-root rect, .section-root path, .section-root circle {
1028
+ fill: ${e.git0};
1029
+ }
1030
+ .section-root text {
1031
+ fill: ${e.gitBranchLabel0};
1032
+ }
1033
+ .icon-container {
1034
+ height:100%;
1035
+ display: flex;
1036
+ justify-content: center;
1037
+ align-items: center;
1038
+ }
1039
+ .edge {
1040
+ fill: none;
1041
+ }
1042
+ .eventWrapper {
1043
+ filter: brightness(120%);
1044
+ }
1045
+ `;
1046
+ }, "getStyles"), fe = pe, ye = {
1047
+ setConf: /* @__PURE__ */ o(() => {
1048
+ }, "setConf"),
1049
+ draw: /* @__PURE__ */ o((e, t, s, r) => (r?.db?.getDirection?.() ?? "LR") === "TD" ? de.draw(e, t, s, r) : ie.draw(e, t, s, r), "draw")
1050
+ }, ke = {
1051
+ db: mt,
1052
+ renderer: ye,
1053
+ parser: Dt,
1054
+ styles: fe
1055
+ };
1056
+ export {
1057
+ ke as diagram
1058
+ };