@draftably/editor 0.1.0 → 0.2.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 (97) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/{engine.worker-DmHew5f6.js → engine.worker-DwN9io_m.js} +2765 -2722
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +19553 -2
  5. package/dist/types/src/components/controls.d.ts +8 -5
  6. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  7. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  8. package/dist/types/src/state/links.d.ts +4 -1
  9. package/dist/types/src/state/workspace.d.ts +3 -0
  10. package/package.json +1 -1
  11. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  12. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  13. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  14. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  15. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  16. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  17. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  18. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  19. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  20. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  21. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  22. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  23. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  24. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  25. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  26. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  27. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  28. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  29. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  30. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  31. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  32. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  33. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  34. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  35. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  36. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  37. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  38. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  39. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  40. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  41. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  42. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  43. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  44. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  45. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  46. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  47. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  48. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  49. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  50. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  51. package/dist/chunks/init-DjUOC4st.js +0 -16
  52. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  53. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  54. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  55. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  56. package/dist/chunks/linear-4t7D_ros.js +0 -259
  57. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  58. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  59. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  60. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  61. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  62. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  63. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  64. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  65. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  66. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  67. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  68. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  69. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  70. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  71. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  72. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  73. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  74. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  75. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  76. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  77. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  78. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  79. package/dist/types/src/import/browser.d.ts +0 -3
  80. package/dist/types/src/import/detect.d.ts +0 -31
  81. package/dist/types/src/import/dot-importer.d.ts +0 -3
  82. package/dist/types/src/import/import-core.d.ts +0 -105
  83. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  84. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  85. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  86. package/dist/types/src/import/scratch.d.ts +0 -3
  87. package/dist/types/src/lib/source-hash.d.ts +0 -7
  88. package/dist/types/src/model/candidates.d.ts +0 -53
  89. package/dist/types/src/model/examples.d.ts +0 -15
  90. package/dist/types/src/model/label-hits.d.ts +0 -27
  91. package/dist/types/src/model/static-scene.d.ts +0 -15
  92. package/dist/types/src/state/commands.d.ts +0 -529
  93. package/dist/types/src/state/comparison.d.ts +0 -151
  94. package/dist/types/src/state/files.d.ts +0 -61
  95. package/dist/types/src/state/keyboard.d.ts +0 -6
  96. package/dist/types/src/state/launch.d.ts +0 -61
  97. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,624 +0,0 @@
1
- import { _ as l, c as lt, V as ct, Q as ut, at as dt, A as yt, m as ft, q as et, a as pt, b as gt, g as kt, s as mt, t as wt, d as _t } from "./mermaid.core-DXv6D2Sm.js";
2
- var Q = (function() {
3
- var t = /* @__PURE__ */ l(function(T, e, s, i) {
4
- for (s = s || {}, i = T.length; i--; s[T[i]] = e) ;
5
- return s;
6
- }, "o"), d = [1, 4], n = [1, 14], a = [1, 12], o = [1, 13], y = [6, 7, 8], p = [1, 20], u = [1, 18], m = [1, 19], c = [6, 7, 11], k = [1, 6, 13, 14], g = [1, 23], _ = [1, 24], x = [1, 6, 7, 11, 13, 14], D = {
7
- trace: /* @__PURE__ */ l(function() {
8
- }, "trace"),
9
- yy: {},
10
- symbols_: { error: 2, start: 3, ishikawa: 4, spaceLines: 5, SPACELINE: 6, NL: 7, ISHIKAWA: 8, document: 9, stop: 10, EOF: 11, statement: 12, SPACELIST: 13, TEXT: 14, $accept: 0, $end: 1 },
11
- terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "ISHIKAWA", 11: "EOF", 13: "SPACELIST", 14: "TEXT" },
12
- productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 1], [12, 1], [12, 1]],
13
- performAction: /* @__PURE__ */ l(function(e, s, i, h, f, r, v) {
14
- var w = r.length - 1;
15
- switch (f) {
16
- case 6:
17
- case 7:
18
- return h;
19
- case 15:
20
- h.addNode(r[w - 1].length, r[w].trim());
21
- break;
22
- case 16:
23
- h.addNode(0, r[w].trim());
24
- break;
25
- }
26
- }, "anonymous"),
27
- table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: d }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: d }, { 6: n, 7: [1, 10], 9: 9, 12: 11, 13: a, 14: o }, t(y, [2, 3]), { 1: [2, 2] }, t(y, [2, 4]), t(y, [2, 5]), { 1: [2, 6], 6: n, 12: 15, 13: a, 14: o }, { 6: n, 9: 16, 12: 11, 13: a, 14: o }, { 6: p, 7: u, 10: 17, 11: m }, t(c, [2, 18], { 14: [1, 21] }), t(c, [2, 16]), t(c, [2, 17]), { 6: p, 7: u, 10: 22, 11: m }, { 1: [2, 7], 6: n, 12: 15, 13: a, 14: o }, t(k, [2, 14], { 7: g, 11: _ }), t(x, [2, 8]), t(x, [2, 9]), t(x, [2, 10]), t(c, [2, 15]), t(k, [2, 13], { 7: g, 11: _ }), t(x, [2, 11]), t(x, [2, 12])],
28
- defaultActions: { 2: [2, 1], 6: [2, 2] },
29
- parseError: /* @__PURE__ */ l(function(e, s) {
30
- if (s.recoverable)
31
- this.trace(e);
32
- else {
33
- var i = new Error(e);
34
- throw i.hash = s, i;
35
- }
36
- }, "parseError"),
37
- parse: /* @__PURE__ */ l(function(e) {
38
- var s = this, i = [0], h = [], f = [null], r = [], v = this.table, w = "", I = 0, $ = 0, L = 2, A = 1, V = r.slice.call(arguments, 1), b = Object.create(this.lexer), S = { yy: {} };
39
- for (var P in this.yy)
40
- Object.prototype.hasOwnProperty.call(this.yy, P) && (S.yy[P] = this.yy[P]);
41
- b.setInput(e, S.yy), S.yy.lexer = b, S.yy.parser = this, typeof b.yylloc > "u" && (b.yylloc = {});
42
- var R = b.yylloc;
43
- r.push(R);
44
- var H = b.options && b.options.ranges;
45
- typeof S.yy.parseError == "function" ? this.parseError = S.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
46
- function X(B) {
47
- i.length = i.length - 2 * B, f.length = f.length - B, r.length = r.length - B;
48
- }
49
- l(X, "popStack");
50
- function J() {
51
- var B;
52
- return B = h.pop() || b.lex() || A, typeof B != "number" && (B instanceof Array && (h = B, B = h.pop()), B = s.symbols_[B] || B), B;
53
- }
54
- l(J, "lex");
55
- for (var M, W, N, Y, F = {}, G, C, tt, U; ; ) {
56
- if (W = i[i.length - 1], this.defaultActions[W] ? N = this.defaultActions[W] : ((M === null || typeof M > "u") && (M = J()), N = v[W] && v[W][M]), typeof N > "u" || !N.length || !N[0]) {
57
- var q = "";
58
- U = [];
59
- for (G in v[W])
60
- this.terminals_[G] && G > L && U.push("'" + this.terminals_[G] + "'");
61
- b.showPosition ? q = "Parse error on line " + (I + 1) + `:
62
- ` + b.showPosition() + `
63
- Expecting ` + U.join(", ") + ", got '" + (this.terminals_[M] || M) + "'" : q = "Parse error on line " + (I + 1) + ": Unexpected " + (M == A ? "end of input" : "'" + (this.terminals_[M] || M) + "'"), this.parseError(q, {
64
- text: b.match,
65
- token: this.terminals_[M] || M,
66
- line: b.yylineno,
67
- loc: R,
68
- expected: U
69
- });
70
- }
71
- if (N[0] instanceof Array && N.length > 1)
72
- throw new Error("Parse Error: multiple actions possible at state: " + W + ", token: " + M);
73
- switch (N[0]) {
74
- case 1:
75
- i.push(M), f.push(b.yytext), r.push(b.yylloc), i.push(N[1]), M = null, $ = b.yyleng, w = b.yytext, I = b.yylineno, R = b.yylloc;
76
- break;
77
- case 2:
78
- if (C = this.productions_[N[1]][1], F.$ = f[f.length - C], F._$ = {
79
- first_line: r[r.length - (C || 1)].first_line,
80
- last_line: r[r.length - 1].last_line,
81
- first_column: r[r.length - (C || 1)].first_column,
82
- last_column: r[r.length - 1].last_column
83
- }, H && (F._$.range = [
84
- r[r.length - (C || 1)].range[0],
85
- r[r.length - 1].range[1]
86
- ]), Y = this.performAction.apply(F, [
87
- w,
88
- $,
89
- I,
90
- S.yy,
91
- N[1],
92
- f,
93
- r
94
- ].concat(V)), typeof Y < "u")
95
- return Y;
96
- C && (i = i.slice(0, -1 * C * 2), f = f.slice(0, -1 * C), r = r.slice(0, -1 * C)), i.push(this.productions_[N[1]][0]), f.push(F.$), r.push(F._$), tt = v[i[i.length - 2]][i[i.length - 1]], i.push(tt);
97
- break;
98
- case 3:
99
- return !0;
100
- }
101
- }
102
- return !0;
103
- }, "parse")
104
- }, O = /* @__PURE__ */ (function() {
105
- var T = {
106
- EOF: 1,
107
- parseError: /* @__PURE__ */ l(function(s, i) {
108
- if (this.yy.parser)
109
- this.yy.parser.parseError(s, i);
110
- else
111
- throw new Error(s);
112
- }, "parseError"),
113
- // resets the lexer, sets new input
114
- setInput: /* @__PURE__ */ l(function(e, s) {
115
- return this.yy = s || 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 = {
116
- first_line: 1,
117
- first_column: 0,
118
- last_line: 1,
119
- last_column: 0
120
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
121
- }, "setInput"),
122
- // consumes and returns one char from the input
123
- input: /* @__PURE__ */ l(function() {
124
- var e = this._input[0];
125
- this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e;
126
- var s = e.match(/(?:\r\n?|\n).*/g);
127
- return s ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e;
128
- }, "input"),
129
- // unshifts one char (or a string) into the input
130
- unput: /* @__PURE__ */ l(function(e) {
131
- var s = e.length, i = e.split(/(?:\r\n?|\n)/g);
132
- this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - s), this.offset -= s;
133
- var h = this.match.split(/(?:\r\n?|\n)/g);
134
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
135
- var f = this.yylloc.range;
136
- return this.yylloc = {
137
- first_line: this.yylloc.first_line,
138
- last_line: this.yylineno + 1,
139
- first_column: this.yylloc.first_column,
140
- last_column: i ? (i.length === h.length ? this.yylloc.first_column : 0) + h[h.length - i.length].length - i[0].length : this.yylloc.first_column - s
141
- }, this.options.ranges && (this.yylloc.range = [f[0], f[0] + this.yyleng - s]), this.yyleng = this.yytext.length, this;
142
- }, "unput"),
143
- // When called from action, caches matched text and appends it on next action
144
- more: /* @__PURE__ */ l(function() {
145
- return this._more = !0, this;
146
- }, "more"),
147
- // 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.
148
- reject: /* @__PURE__ */ l(function() {
149
- if (this.options.backtrack_lexer)
150
- this._backtrack = !0;
151
- else
152
- 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).
153
- ` + this.showPosition(), {
154
- text: "",
155
- token: null,
156
- line: this.yylineno
157
- });
158
- return this;
159
- }, "reject"),
160
- // retain first n characters of the match
161
- less: /* @__PURE__ */ l(function(e) {
162
- this.unput(this.match.slice(e));
163
- }, "less"),
164
- // displays already matched input, i.e. for error messages
165
- pastInput: /* @__PURE__ */ l(function() {
166
- var e = this.matched.substr(0, this.matched.length - this.match.length);
167
- return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
168
- }, "pastInput"),
169
- // displays upcoming input, i.e. for error messages
170
- upcomingInput: /* @__PURE__ */ l(function() {
171
- var e = this.match;
172
- return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
173
- }, "upcomingInput"),
174
- // displays the character position where the lexing error occurred, i.e. for error messages
175
- showPosition: /* @__PURE__ */ l(function() {
176
- var e = this.pastInput(), s = new Array(e.length + 1).join("-");
177
- return e + this.upcomingInput() + `
178
- ` + s + "^";
179
- }, "showPosition"),
180
- // test the lexed token: return FALSE when not a match, otherwise return token
181
- test_match: /* @__PURE__ */ l(function(e, s) {
182
- var i, h, f;
183
- if (this.options.backtrack_lexer && (f = {
184
- yylineno: this.yylineno,
185
- yylloc: {
186
- first_line: this.yylloc.first_line,
187
- last_line: this.last_line,
188
- first_column: this.yylloc.first_column,
189
- last_column: this.yylloc.last_column
190
- },
191
- yytext: this.yytext,
192
- match: this.match,
193
- matches: this.matches,
194
- matched: this.matched,
195
- yyleng: this.yyleng,
196
- offset: this.offset,
197
- _more: this._more,
198
- _input: this._input,
199
- yy: this.yy,
200
- conditionStack: this.conditionStack.slice(0),
201
- done: this.done
202
- }, this.options.ranges && (f.yylloc.range = this.yylloc.range.slice(0))), h = e[0].match(/(?:\r\n?|\n).*/g), h && (this.yylineno += h.length), this.yylloc = {
203
- first_line: this.yylloc.last_line,
204
- last_line: this.yylineno + 1,
205
- first_column: this.yylloc.last_column,
206
- last_column: h ? h[h.length - 1].length - h[h.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
207
- }, 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], i = this.performAction.call(this, this.yy, this, s, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i)
208
- return i;
209
- if (this._backtrack) {
210
- for (var r in f)
211
- this[r] = f[r];
212
- return !1;
213
- }
214
- return !1;
215
- }, "test_match"),
216
- // return next match in input
217
- next: /* @__PURE__ */ l(function() {
218
- if (this.done)
219
- return this.EOF;
220
- this._input || (this.done = !0);
221
- var e, s, i, h;
222
- this._more || (this.yytext = "", this.match = "");
223
- for (var f = this._currentRules(), r = 0; r < f.length; r++)
224
- if (i = this._input.match(this.rules[f[r]]), i && (!s || i[0].length > s[0].length)) {
225
- if (s = i, h = r, this.options.backtrack_lexer) {
226
- if (e = this.test_match(i, f[r]), e !== !1)
227
- return e;
228
- if (this._backtrack) {
229
- s = !1;
230
- continue;
231
- } else
232
- return !1;
233
- } else if (!this.options.flex)
234
- break;
235
- }
236
- return s ? (e = this.test_match(s, f[h]), e !== !1 ? e : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
237
- ` + this.showPosition(), {
238
- text: "",
239
- token: null,
240
- line: this.yylineno
241
- });
242
- }, "next"),
243
- // return next match that has a token
244
- lex: /* @__PURE__ */ l(function() {
245
- var s = this.next();
246
- return s || this.lex();
247
- }, "lex"),
248
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
249
- begin: /* @__PURE__ */ l(function(s) {
250
- this.conditionStack.push(s);
251
- }, "begin"),
252
- // pop the previously active lexer condition state off the condition stack
253
- popState: /* @__PURE__ */ l(function() {
254
- var s = this.conditionStack.length - 1;
255
- return s > 0 ? this.conditionStack.pop() : this.conditionStack[0];
256
- }, "popState"),
257
- // produce the lexer rule set which is active for the currently active lexer condition state
258
- _currentRules: /* @__PURE__ */ l(function() {
259
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
260
- }, "_currentRules"),
261
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
262
- topState: /* @__PURE__ */ l(function(s) {
263
- return s = this.conditionStack.length - 1 - Math.abs(s || 0), s >= 0 ? this.conditionStack[s] : "INITIAL";
264
- }, "topState"),
265
- // alias for begin(condition)
266
- pushState: /* @__PURE__ */ l(function(s) {
267
- this.begin(s);
268
- }, "pushState"),
269
- // return the number of states currently on the stack
270
- stateStackSize: /* @__PURE__ */ l(function() {
271
- return this.conditionStack.length;
272
- }, "stateStackSize"),
273
- options: { "case-insensitive": !0 },
274
- performAction: /* @__PURE__ */ l(function(s, i, h, f) {
275
- switch (h) {
276
- case 0:
277
- return 6;
278
- case 1:
279
- return 8;
280
- case 2:
281
- return 8;
282
- case 3:
283
- return 6;
284
- case 4:
285
- return 7;
286
- case 5:
287
- return 13;
288
- case 6:
289
- return 14;
290
- case 7:
291
- return 11;
292
- }
293
- }, "anonymous"),
294
- rules: [/^(?:\s*%%.*)/i, /^(?:ishikawa-beta\b)/i, /^(?:ishikawa\b)/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:[^\n]+)/i, /^(?:$)/i],
295
- conditions: { INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7], inclusive: !0 } }
296
- };
297
- return T;
298
- })();
299
- D.lexer = O;
300
- function E() {
301
- this.yy = {};
302
- }
303
- return l(E, "Parser"), E.prototype = D, D.Parser = E, new E();
304
- })();
305
- Q.parser = Q;
306
- var bt = Q, xt = class {
307
- constructor() {
308
- this.stack = [], this.clear = this.clear.bind(this), this.addNode = this.addNode.bind(this), this.getRoot = this.getRoot.bind(this);
309
- }
310
- static {
311
- l(this, "IshikawaDB");
312
- }
313
- clear() {
314
- this.root = void 0, this.stack = [], this.baseLevel = void 0, yt();
315
- }
316
- getRoot() {
317
- return this.root;
318
- }
319
- addNode(t, d) {
320
- const n = ft.sanitizeText(d, lt());
321
- if (!this.root) {
322
- this.root = { text: n, children: [] }, this.stack = [{ level: 0, node: this.root }], et(n);
323
- return;
324
- }
325
- this.baseLevel ??= t;
326
- let a = t - this.baseLevel + 1;
327
- for (a <= 0 && (a = 1); this.stack.length > 1 && this.stack[this.stack.length - 1].level >= a; )
328
- this.stack.pop();
329
- const o = this.stack[this.stack.length - 1].node, y = { text: n, children: [] };
330
- o.children.push(y), this.stack.push({ level: a, node: y });
331
- }
332
- getAccTitle() {
333
- return pt();
334
- }
335
- setAccTitle(t) {
336
- gt(t);
337
- }
338
- getAccDescription() {
339
- return kt();
340
- }
341
- setAccDescription(t) {
342
- mt(t);
343
- }
344
- getDiagramTitle() {
345
- return wt();
346
- }
347
- setDiagramTitle(t) {
348
- et(t);
349
- }
350
- }, vt = 14, j = 250, St = 30, $t = 60, Et = 5, ot = 82 * Math.PI / 180, it = Math.cos(ot), st = Math.sin(ot), nt = /* @__PURE__ */ l((t, d, n) => {
351
- const a = t.node().getBBox(), o = a.width + d * 2, y = a.height + d * 2;
352
- _t(t, y, o, n), t.attr("viewBox", `${a.x - d} ${a.y - d} ${o} ${y}`);
353
- }, "applyPaddedViewBox"), At = /* @__PURE__ */ l((t, d, n, a) => {
354
- const y = a.db.getRoot();
355
- if (!y)
356
- return;
357
- const p = lt(), { look: u, handDrawnSeed: m, themeVariables: c } = p, k = ct(p.fontSize)[0] ?? vt, g = u === "handDrawn", _ = y.children ?? [], x = p.ishikawa?.diagramPadding ?? 20, D = p.ishikawa?.useMaxWidth ?? !1, O = ut(d), E = O.append("g").attr("class", "ishikawa"), T = g ? dt.svg(O.node()) : void 0, e = T ? {
358
- roughSvg: T,
359
- seed: m ?? 0,
360
- lineColor: c?.lineColor ?? "#333",
361
- fillColor: c?.mainBkg ?? "#fff"
362
- } : void 0, s = `ishikawa-arrow-${d}`;
363
- g || E.append("defs").append("marker").attr("id", s).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");
364
- let i = 0, h = j;
365
- const f = g ? void 0 : z(E, i, h, i, h, "ishikawa-spine");
366
- if (It(E, i, h, y.text, k, e), !_.length) {
367
- g && z(E, i, h, i, h, "ishikawa-spine", e), nt(O, x, D);
368
- return;
369
- }
370
- i -= 20;
371
- const r = _.filter((S, P) => P % 2 === 0), v = _.filter((S, P) => P % 2 === 1), w = at(r), I = at(v), $ = w.total + I.total;
372
- let L = j, A = j;
373
- if ($ > 0) {
374
- const S = j * 2, P = j * 0.3;
375
- L = Math.max(P, S * (w.total / $)), A = Math.max(P, S * (I.total / $));
376
- }
377
- const V = k * 2;
378
- L = Math.max(L, w.max * V), A = Math.max(A, I.max * V), h = Math.max(L, j), f && f.attr("y1", h).attr("y2", h), E.select(".ishikawa-head-group").attr("transform", `translate(0,${h})`);
379
- const b = Math.ceil(_.length / 2);
380
- for (let S = 0; S < b; S++) {
381
- const P = E.append("g").attr("class", "ishikawa-pair");
382
- for (const [R, H, X] of [
383
- [_[S * 2], -1, L],
384
- [_[S * 2 + 1], 1, A]
385
- ])
386
- R && Mt(P, R, i, h, H, X, k, e);
387
- i = P.selectAll("text").nodes().reduce((R, H) => Math.min(R, H.getBBox().x), 1 / 0);
388
- }
389
- if (g)
390
- z(E, i, h, 0, h, "ishikawa-spine", e);
391
- else {
392
- f.attr("x1", i);
393
- const S = `url(#${s})`;
394
- E.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", S);
395
- }
396
- nt(O, x, D);
397
- }, "draw"), at = /* @__PURE__ */ l((t) => {
398
- const d = /* @__PURE__ */ l((n) => n.children.reduce((a, o) => a + 1 + d(o), 0), "countDescendants");
399
- return t.reduce(
400
- (n, a) => {
401
- const o = d(a);
402
- return n.total += o, n.max = Math.max(n.max, o), n;
403
- },
404
- { total: 0, max: 0 }
405
- );
406
- }, "sideStats"), It = /* @__PURE__ */ l((t, d, n, a, o, y) => {
407
- const p = Math.max(6, Math.floor(110 / (o * 0.6))), u = t.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${d},${n})`), m = Z(
408
- u,
409
- ht(a, p),
410
- 0,
411
- 0,
412
- "ishikawa-head-label",
413
- "start",
414
- o
415
- ), c = m.node().getBBox(), k = Math.max(60, c.width + 6), g = Math.max(40, c.height * 2 + 40), _ = `M 0 ${-g / 2} L 0 ${g / 2} Q ${k * 2.4} 0 0 ${-g / 2} Z`;
416
- if (y) {
417
- const x = y.roughSvg.path(_, {
418
- roughness: 1.5,
419
- seed: y.seed,
420
- fill: y.fillColor,
421
- fillStyle: "hachure",
422
- fillWeight: 2.5,
423
- hachureGap: 5,
424
- stroke: y.lineColor,
425
- strokeWidth: 2
426
- });
427
- u.insert(() => x, ":first-child").attr("class", "ishikawa-head");
428
- } else
429
- u.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", _);
430
- m.attr("transform", `translate(${(k - c.width) / 2 - c.x + 3},${-c.y - c.height / 2})`);
431
- }, "drawHead"), Lt = /* @__PURE__ */ l((t, d) => {
432
- const n = [], a = [], o = /* @__PURE__ */ l((y, p, u) => {
433
- const m = d === -1 ? [...y].reverse() : y;
434
- for (const c of m) {
435
- const k = n.length, g = c.children ?? [];
436
- n.push({
437
- depth: u,
438
- text: ht(c.text, 15),
439
- parentIndex: p,
440
- childCount: g.length
441
- }), u % 2 === 0 ? (a.push(k), g.length && o(g, k, u + 1)) : (g.length && o(g, k, u + 1), a.push(k));
442
- }
443
- }, "walk");
444
- return o(t, -1, 2), { entries: n, yOrder: a };
445
- }, "flattenTree"), Tt = /* @__PURE__ */ l((t, d, n, a, o, y, p) => {
446
- const u = t.append("g").attr("class", "ishikawa-label-group"), c = Z(
447
- u,
448
- d,
449
- n,
450
- a + 11 * o,
451
- "ishikawa-label cause",
452
- "middle",
453
- y
454
- ).node().getBBox();
455
- if (p) {
456
- const k = p.roughSvg.rectangle(
457
- c.x - 20,
458
- c.y - 2,
459
- c.width + 40,
460
- c.height + 4,
461
- {
462
- roughness: 1.5,
463
- seed: p.seed,
464
- fill: p.fillColor,
465
- fillStyle: "hachure",
466
- fillWeight: 2.5,
467
- hachureGap: 5,
468
- stroke: p.lineColor,
469
- strokeWidth: 2
470
- }
471
- );
472
- u.insert(() => k, ":first-child").attr("class", "ishikawa-label-box");
473
- } else
474
- u.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", c.x - 20).attr("y", c.y - 2).attr("width", c.width + 40).attr("height", c.height + 4);
475
- }, "drawCauseLabel"), K = /* @__PURE__ */ l((t, d, n, a, o, y) => {
476
- const p = Math.sqrt(a * a + o * o);
477
- if (p === 0)
478
- return;
479
- const u = a / p, m = o / p, c = 6, k = -m * c, g = u * c, _ = d, x = n, D = `M ${_} ${x} L ${_ - u * c * 2 + k} ${x - m * c * 2 + g} L ${_ - u * c * 2 - k} ${x - m * c * 2 - g} Z`, O = y.roughSvg.path(D, {
480
- roughness: 1,
481
- seed: y.seed,
482
- fill: y.lineColor,
483
- fillStyle: "solid",
484
- stroke: y.lineColor,
485
- strokeWidth: 1
486
- });
487
- t.append(() => O);
488
- }, "drawArrowMarker"), Mt = /* @__PURE__ */ l((t, d, n, a, o, y, p, u) => {
489
- const m = d.children ?? [], c = y * (m.length ? 1 : 0.2), k = -it * c, g = st * c * o, _ = n + k, x = a + g;
490
- if (z(t, n, a, _, x, "ishikawa-branch", u), u && K(t, n, a, n - _, a - x, u), Tt(t, d.text, _, x, o, p, u), !m.length)
491
- return;
492
- const { entries: D, yOrder: O } = Lt(m, o), E = D.length, T = new Array(E);
493
- for (const [f, r] of O.entries())
494
- T[r] = a + g * ((f + 1) / (E + 1));
495
- const e = /* @__PURE__ */ new Map();
496
- e.set(-1, {
497
- x0: n,
498
- y0: a,
499
- x1: _,
500
- y1: x,
501
- childCount: m.length,
502
- childrenDrawn: 0
503
- });
504
- const s = -it, i = st * o, h = o < 0 ? "ishikawa-label up" : "ishikawa-label down";
505
- for (const [f, r] of D.entries()) {
506
- const v = T[f], w = e.get(r.parentIndex), I = t.append("g").attr("class", "ishikawa-sub-group");
507
- let $ = 0, L = 0, A = 0;
508
- if (r.depth % 2 === 0) {
509
- const V = w.y1 - w.y0;
510
- $ = rt(w.x0, w.x1, V ? (v - w.y0) / V : 0.5), L = v, A = $ - (r.childCount > 0 ? $t + r.childCount * Et : St), z(I, $, v, A, v, "ishikawa-sub-branch", u), u && K(I, $, v, 1, 0, u), Z(I, r.text, A, v, "ishikawa-label align", "end", p);
511
- } else {
512
- const V = w.childrenDrawn++;
513
- $ = rt(w.x0, w.x1, (w.childCount - V) / (w.childCount + 1)), L = w.y0, A = $ + s * ((v - L) / i), z(I, $, L, A, v, "ishikawa-sub-branch", u), u && K(I, $, L, $ - A, L - v, u), Z(I, r.text, A, v, h, "end", p);
514
- }
515
- r.childCount > 0 && e.set(f, {
516
- x0: $,
517
- y0: L,
518
- x1: A,
519
- y1: v,
520
- childCount: r.childCount,
521
- childrenDrawn: 0
522
- });
523
- }
524
- }, "drawBranch"), Pt = /* @__PURE__ */ l((t) => t.split(/<br\s*\/?>|\n/), "splitLines"), ht = /* @__PURE__ */ l((t, d) => {
525
- if (t.length <= d)
526
- return t;
527
- const n = [];
528
- for (const a of t.split(/\s+/)) {
529
- const o = n.length - 1;
530
- o >= 0 && n[o].length + 1 + a.length <= d ? n[o] += " " + a : n.push(a);
531
- }
532
- return n.join(`
533
- `);
534
- }, "wrapText"), Z = /* @__PURE__ */ l((t, d, n, a, o, y, p) => {
535
- const u = Pt(d), m = p * 1.05, c = t.append("text").attr("class", o).attr("text-anchor", y).attr("x", n).attr("y", a - (u.length - 1) * m / 2);
536
- for (const [k, g] of u.entries())
537
- c.append("tspan").attr("x", n).attr("dy", k === 0 ? 0 : m).text(g);
538
- return c;
539
- }, "drawMultilineText"), rt = /* @__PURE__ */ l((t, d, n) => t + (d - t) * n, "lerp"), z = /* @__PURE__ */ l((t, d, n, a, o, y, p) => {
540
- if (p) {
541
- const u = p.roughSvg.line(d, n, a, o, {
542
- roughness: 1.5,
543
- seed: p.seed,
544
- stroke: p.lineColor,
545
- strokeWidth: 2
546
- });
547
- t.append(() => u).attr("class", y);
548
- return;
549
- }
550
- return t.append("line").attr("class", y).attr("x1", d).attr("y1", n).attr("x2", a).attr("y2", o);
551
- }, "drawLine"), Bt = { draw: At }, Nt = /* @__PURE__ */ l((t) => `
552
- .ishikawa .ishikawa-spine,
553
- .ishikawa .ishikawa-branch,
554
- .ishikawa .ishikawa-sub-branch {
555
- stroke: ${t.lineColor};
556
- stroke-width: 2;
557
- fill: none;
558
- }
559
-
560
- .ishikawa .ishikawa-sub-branch {
561
- stroke-width: 1;
562
- }
563
-
564
- .ishikawa .ishikawa-arrow {
565
- fill: ${t.lineColor};
566
- }
567
-
568
- .ishikawa .ishikawa-head {
569
- fill: ${t.mainBkg};
570
- stroke: ${t.lineColor};
571
- stroke-width: 2;
572
- }
573
-
574
- .ishikawa .ishikawa-label-box {
575
- fill: ${t.mainBkg};
576
- stroke: ${t.lineColor};
577
- stroke-width: 2;
578
- }
579
-
580
- .ishikawa text {
581
- font-family: ${t.fontFamily};
582
- font-size: ${t.fontSize};
583
- fill: ${t.textColor};
584
- }
585
-
586
- .ishikawa .ishikawa-head-label {
587
- font-weight: 600;
588
- text-anchor: middle;
589
- dominant-baseline: middle;
590
- font-size: 14px;
591
- }
592
-
593
- .ishikawa .ishikawa-label {
594
- text-anchor: end;
595
- }
596
-
597
- .ishikawa .ishikawa-label.cause {
598
- text-anchor: middle;
599
- dominant-baseline: middle;
600
- }
601
-
602
- .ishikawa .ishikawa-label.align {
603
- text-anchor: end;
604
- dominant-baseline: middle;
605
- }
606
-
607
- .ishikawa .ishikawa-label.up {
608
- dominant-baseline: baseline;
609
- }
610
-
611
- .ishikawa .ishikawa-label.down {
612
- dominant-baseline: hanging;
613
- }
614
- `, "getStyles"), Dt = Nt, Vt = {
615
- parser: bt,
616
- get db() {
617
- return new xt();
618
- },
619
- renderer: Bt,
620
- styles: Dt
621
- };
622
- export {
623
- Vt as diagram
624
- };