UNPKG

vue-mermaid-string

Version:

A Vue.js component that turns a Mermaid string into a diagram.

983 lines (982 loc) 129 kB
import { a as we, b as Xt, g as ct, d as ve, c as Jt, e as Qt } from "./chunk-TZMSLE5B-Bwm20wza.js"; import { _ as f, n as Ie, c as st, d as St, l as Q, j as re, e as Le, f as _e, k as I, b as se, s as Ae, p as ke, a as Pe, g as Ne, q as Se, t as Me, J as Re, y as De, i as Mt, u as W, L as z, M as _t, N as ie, Z as Ce, O as Oe, P as ne, E as Ht } from "./entry-B2VX-kxa.js"; import { I as Be } from "./chunk-QZHKN3VN-225O_scH.js"; var Ut = (function() { var e = /* @__PURE__ */ f(function(pt, v, A, L) { for (A = A || {}, L = pt.length; L--; A[pt[L]] = v) ; return A; }, "o"), t = [1, 2], n = [1, 3], s = [1, 4], r = [2, 4], i = [1, 9], c = [1, 11], h = [1, 13], o = [1, 14], a = [1, 16], p = [1, 17], g = [1, 18], x = [1, 24], y = [1, 25], m = [1, 26], w = [1, 27], k = [1, 28], N = [1, 29], S = [1, 30], O = [1, 31], B = [1, 32], q = [1, 33], H = [1, 34], Z = [1, 35], at = [1, 36], U = [1, 37], G = [1, 38], F = [1, 39], D = [1, 41], $ = [1, 42], K = [1, 43], j = [1, 44], rt = [1, 45], R = [1, 46], E = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 55, 60, 61, 62, 63, 71], _ = [2, 71], X = [4, 5, 16, 50, 52, 53], tt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 55, 60, 61, 62, 63, 71], M = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 55, 60, 61, 62, 63, 71], Vt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 55, 60, 61, 62, 63, 71], Zt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 55, 60, 61, 62, 63, 71], ot = [69, 70, 71], lt = [1, 127], Yt = { trace: /* @__PURE__ */ f(function() { }, "trace"), yy: {}, symbols_: { error: 2, start: 3, SPACE: 4, NEWLINE: 5, SD: 6, document: 7, line: 8, statement: 9, box_section: 10, box_line: 11, participant_statement: 12, create: 13, box: 14, restOfLine: 15, end: 16, signal: 17, autonumber: 18, NUM: 19, off: 20, activate: 21, actor: 22, deactivate: 23, note_statement: 24, links_statement: 25, link_statement: 26, properties_statement: 27, details_statement: 28, title: 29, legacy_title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, loop: 36, rect: 37, opt: 38, alt: 39, else_sections: 40, par: 41, par_sections: 42, par_over: 43, critical: 44, option_sections: 45, break: 46, option: 47, and: 48, else: 49, participant: 50, AS: 51, participant_actor: 52, destroy: 53, actor_with_config: 54, note: 55, placement: 56, text2: 57, over: 58, actor_pair: 59, links: 60, link: 61, properties: 62, details: 63, spaceList: 64, ",": 65, left_of: 66, right_of: 67, signaltype: 68, "+": 69, "-": 70, ACTOR: 71, config_object: 72, CONFIG_START: 73, CONFIG_CONTENT: 74, CONFIG_END: 75, SOLID_OPEN_ARROW: 76, DOTTED_OPEN_ARROW: 77, SOLID_ARROW: 78, BIDIRECTIONAL_SOLID_ARROW: 79, DOTTED_ARROW: 80, BIDIRECTIONAL_DOTTED_ARROW: 81, SOLID_CROSS: 82, DOTTED_CROSS: 83, SOLID_POINT: 84, DOTTED_POINT: 85, TXT: 86, $accept: 0, $end: 1 }, terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 29: "title", 30: "legacy_title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "loop", 37: "rect", 38: "opt", 39: "alt", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 55: "note", 58: "over", 60: "links", 61: "link", 62: "properties", 63: "details", 65: ",", 66: "left_of", 67: "right_of", 69: "+", 70: "-", 71: "ACTOR", 73: "CONFIG_START", 74: "CONFIG_CONTENT", 75: "CONFIG_END", 76: "SOLID_OPEN_ARROW", 77: "DOTTED_OPEN_ARROW", 78: "SOLID_ARROW", 79: "BIDIRECTIONAL_SOLID_ARROW", 80: "DOTTED_ARROW", 81: "BIDIRECTIONAL_DOTTED_ARROW", 82: "SOLID_CROSS", 83: "DOTTED_CROSS", 84: "SOLID_POINT", 85: "DOTTED_POINT", 86: "TXT" }, productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [64, 2], [64, 1], [59, 3], [59, 1], [56, 1], [56, 1], [17, 5], [17, 5], [17, 4], [54, 2], [72, 3], [22, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [57, 1]], performAction: /* @__PURE__ */ f(function(v, A, L, b, C, d, It) { var u = d.length - 1; switch (C) { case 3: return b.apply(d[u]), d[u]; case 4: case 9: this.$ = []; break; case 5: case 10: d[u - 1].push(d[u]), this.$ = d[u - 1]; break; case 6: case 7: case 11: case 12: this.$ = d[u]; break; case 8: case 13: this.$ = []; break; case 15: d[u].type = "createParticipant", this.$ = d[u]; break; case 16: d[u - 1].unshift({ type: "boxStart", boxData: b.parseBoxData(d[u - 2]) }), d[u - 1].push({ type: "boxEnd", boxText: d[u - 2] }), this.$ = d[u - 1]; break; case 18: this.$ = { type: "sequenceIndex", sequenceIndex: Number(d[u - 2]), sequenceIndexStep: Number(d[u - 1]), sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER }; break; case 19: this.$ = { type: "sequenceIndex", sequenceIndex: Number(d[u - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER }; break; case 20: this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: b.LINETYPE.AUTONUMBER }; break; case 21: this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER }; break; case 22: this.$ = { type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: d[u - 1].actor }; break; case 23: this.$ = { type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: d[u - 1].actor }; break; case 29: b.setDiagramTitle(d[u].substring(6)), this.$ = d[u].substring(6); break; case 30: b.setDiagramTitle(d[u].substring(7)), this.$ = d[u].substring(7); break; case 31: this.$ = d[u].trim(), b.setAccTitle(this.$); break; case 32: case 33: this.$ = d[u].trim(), b.setAccDescription(this.$); break; case 34: d[u - 1].unshift({ type: "loopStart", loopText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.LOOP_START }), d[u - 1].push({ type: "loopEnd", loopText: d[u - 2], signalType: b.LINETYPE.LOOP_END }), this.$ = d[u - 1]; break; case 35: d[u - 1].unshift({ type: "rectStart", color: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.RECT_START }), d[u - 1].push({ type: "rectEnd", color: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.RECT_END }), this.$ = d[u - 1]; break; case 36: d[u - 1].unshift({ type: "optStart", optText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.OPT_START }), d[u - 1].push({ type: "optEnd", optText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.OPT_END }), this.$ = d[u - 1]; break; case 37: d[u - 1].unshift({ type: "altStart", altText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.ALT_START }), d[u - 1].push({ type: "altEnd", signalType: b.LINETYPE.ALT_END }), this.$ = d[u - 1]; break; case 38: d[u - 1].unshift({ type: "parStart", parText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.PAR_START }), d[u - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = d[u - 1]; break; case 39: d[u - 1].unshift({ type: "parStart", parText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.PAR_OVER_START }), d[u - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = d[u - 1]; break; case 40: d[u - 1].unshift({ type: "criticalStart", criticalText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.CRITICAL_START }), d[u - 1].push({ type: "criticalEnd", signalType: b.LINETYPE.CRITICAL_END }), this.$ = d[u - 1]; break; case 41: d[u - 1].unshift({ type: "breakStart", breakText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.BREAK_START }), d[u - 1].push({ type: "breakEnd", optText: b.parseMessage(d[u - 2]), signalType: b.LINETYPE.BREAK_END }), this.$ = d[u - 1]; break; case 43: this.$ = d[u - 3].concat([{ type: "option", optionText: b.parseMessage(d[u - 1]), signalType: b.LINETYPE.CRITICAL_OPTION }, d[u]]); break; case 45: this.$ = d[u - 3].concat([{ type: "and", parText: b.parseMessage(d[u - 1]), signalType: b.LINETYPE.PAR_AND }, d[u]]); break; case 47: this.$ = d[u - 3].concat([{ type: "else", altText: b.parseMessage(d[u - 1]), signalType: b.LINETYPE.ALT_ELSE }, d[u]]); break; case 48: d[u - 3].draw = "participant", d[u - 3].type = "addParticipant", d[u - 3].description = b.parseMessage(d[u - 1]), this.$ = d[u - 3]; break; case 49: d[u - 1].draw = "participant", d[u - 1].type = "addParticipant", this.$ = d[u - 1]; break; case 50: d[u - 3].draw = "actor", d[u - 3].type = "addParticipant", d[u - 3].description = b.parseMessage(d[u - 1]), this.$ = d[u - 3]; break; case 51: d[u - 1].draw = "actor", d[u - 1].type = "addParticipant", this.$ = d[u - 1]; break; case 52: d[u - 1].type = "destroyParticipant", this.$ = d[u - 1]; break; case 53: d[u - 1].draw = "participant", d[u - 1].type = "addParticipant", this.$ = d[u - 1]; break; case 54: this.$ = [d[u - 1], { type: "addNote", placement: d[u - 2], actor: d[u - 1].actor, text: d[u] }]; break; case 55: d[u - 2] = [].concat(d[u - 1], d[u - 1]).slice(0, 2), d[u - 2][0] = d[u - 2][0].actor, d[u - 2][1] = d[u - 2][1].actor, this.$ = [d[u - 1], { type: "addNote", placement: b.PLACEMENT.OVER, actor: d[u - 2].slice(0, 2), text: d[u] }]; break; case 56: this.$ = [d[u - 1], { type: "addLinks", actor: d[u - 1].actor, text: d[u] }]; break; case 57: this.$ = [d[u - 1], { type: "addALink", actor: d[u - 1].actor, text: d[u] }]; break; case 58: this.$ = [d[u - 1], { type: "addProperties", actor: d[u - 1].actor, text: d[u] }]; break; case 59: this.$ = [d[u - 1], { type: "addDetails", actor: d[u - 1].actor, text: d[u] }]; break; case 62: this.$ = [d[u - 2], d[u]]; break; case 63: this.$ = d[u]; break; case 64: this.$ = b.PLACEMENT.LEFTOF; break; case 65: this.$ = b.PLACEMENT.RIGHTOF; break; case 66: this.$ = [ d[u - 4], d[u - 1], { type: "addMessage", from: d[u - 4].actor, to: d[u - 1].actor, signalType: d[u - 3], msg: d[u], activate: !0 }, { type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: d[u - 1].actor } ]; break; case 67: this.$ = [ d[u - 4], d[u - 1], { type: "addMessage", from: d[u - 4].actor, to: d[u - 1].actor, signalType: d[u - 3], msg: d[u] }, { type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: d[u - 4].actor } ]; break; case 68: this.$ = [d[u - 3], d[u - 1], { type: "addMessage", from: d[u - 3].actor, to: d[u - 1].actor, signalType: d[u - 2], msg: d[u] }]; break; case 69: this.$ = { type: "addParticipant", actor: d[u - 1], config: d[u] }; break; case 70: this.$ = d[u - 1].trim(); break; case 71: this.$ = { type: "addParticipant", actor: d[u] }; break; case 72: this.$ = b.LINETYPE.SOLID_OPEN; break; case 73: this.$ = b.LINETYPE.DOTTED_OPEN; break; case 74: this.$ = b.LINETYPE.SOLID; break; case 75: this.$ = b.LINETYPE.BIDIRECTIONAL_SOLID; break; case 76: this.$ = b.LINETYPE.DOTTED; break; case 77: this.$ = b.LINETYPE.BIDIRECTIONAL_DOTTED; break; case 78: this.$ = b.LINETYPE.SOLID_CROSS; break; case 79: this.$ = b.LINETYPE.DOTTED_CROSS; break; case 80: this.$ = b.LINETYPE.SOLID_POINT; break; case 81: this.$ = b.LINETYPE.DOTTED_POINT; break; case 82: this.$ = b.parseMessage(d[u].trim().substring(1)); break; } }, "anonymous"), table: [{ 3: 1, 4: t, 5: n, 6: s }, { 1: [3] }, { 3: 5, 4: t, 5: n, 6: s }, { 3: 6, 4: t, 5: n, 6: s }, e([1, 4, 5, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 55, 60, 61, 62, 63, 71], r, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, e(E, [2, 5]), { 9: 47, 12: 12, 13: h, 14: o, 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, e(E, [2, 7]), e(E, [2, 8]), e(E, [2, 14]), { 12: 48, 50: U, 52: G, 53: F }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 71: R }, { 22: 55, 71: R }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, e(E, [2, 29]), e(E, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, e(E, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 54: 72, 71: [1, 73] }, { 22: 74, 71: R }, { 22: 75, 71: R }, { 68: 76, 76: [1, 77], 77: [1, 78], 78: [1, 79], 79: [1, 80], 80: [1, 81], 81: [1, 82], 82: [1, 83], 83: [1, 84], 84: [1, 85], 85: [1, 86] }, { 56: 87, 58: [1, 88], 66: [1, 89], 67: [1, 90] }, { 22: 91, 71: R }, { 22: 92, 71: R }, { 22: 93, 71: R }, { 22: 94, 71: R }, e([5, 51, 65, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86], _), e(E, [2, 6]), e(E, [2, 15]), e(X, [2, 9], { 10: 95 }), e(E, [2, 17]), { 5: [1, 97], 19: [1, 96] }, { 5: [1, 98] }, e(E, [2, 21]), { 5: [1, 99] }, { 5: [1, 100] }, e(E, [2, 24]), e(E, [2, 25]), e(E, [2, 26]), e(E, [2, 27]), e(E, [2, 28]), e(E, [2, 31]), e(E, [2, 32]), e(tt, r, { 7: 101 }), e(tt, r, { 7: 102 }), e(tt, r, { 7: 103 }), e(M, r, { 40: 104, 7: 105 }), e(Vt, r, { 42: 106, 7: 107 }), e(Vt, r, { 7: 107, 42: 108 }), e(Zt, r, { 45: 109, 7: 110 }), e(tt, r, { 7: 111 }), { 5: [1, 113], 51: [1, 112] }, { 5: [1, 114] }, e([5, 51], _, { 72: 115, 73: [1, 116] }), { 5: [1, 118], 51: [1, 117] }, { 5: [1, 119] }, { 22: 122, 69: [1, 120], 70: [1, 121], 71: R }, e(ot, [2, 72]), e(ot, [2, 73]), e(ot, [2, 74]), e(ot, [2, 75]), e(ot, [2, 76]), e(ot, [2, 77]), e(ot, [2, 78]), e(ot, [2, 79]), e(ot, [2, 80]), e(ot, [2, 81]), { 22: 123, 71: R }, { 22: 125, 59: 124, 71: R }, { 71: [2, 64] }, { 71: [2, 65] }, { 57: 126, 86: lt }, { 57: 128, 86: lt }, { 57: 129, 86: lt }, { 57: 130, 86: lt }, { 4: [1, 133], 5: [1, 135], 11: 132, 12: 134, 16: [1, 131], 50: U, 52: G, 53: F }, { 5: [1, 136] }, e(E, [2, 19]), e(E, [2, 20]), e(E, [2, 22]), e(E, [2, 23]), { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [1, 137], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [1, 138], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [1, 139], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 16: [1, 140] }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [2, 46], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 49: [1, 141], 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 16: [1, 142] }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [2, 44], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 48: [1, 143], 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 16: [1, 144] }, { 16: [1, 145] }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [2, 42], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 47: [1, 146], 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 4: i, 5: c, 8: 8, 9: 10, 12: 12, 13: h, 14: o, 16: [1, 147], 17: 15, 18: a, 21: p, 22: 40, 23: g, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: x, 30: y, 31: m, 33: w, 35: k, 36: N, 37: S, 38: O, 39: B, 41: q, 43: H, 44: Z, 46: at, 50: U, 52: G, 53: F, 55: D, 60: $, 61: K, 62: j, 63: rt, 71: R }, { 15: [1, 148] }, e(E, [2, 49]), e(E, [2, 53]), { 5: [2, 69] }, { 74: [1, 149] }, { 15: [1, 150] }, e(E, [2, 51]), e(E, [2, 52]), { 22: 151, 71: R }, { 22: 152, 71: R }, { 57: 153, 86: lt }, { 57: 154, 86: lt }, { 57: 155, 86: lt }, { 65: [1, 156], 86: [2, 63] }, { 5: [2, 56] }, { 5: [2, 82] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: [2, 59] }, e(E, [2, 16]), e(X, [2, 10]), { 12: 157, 50: U, 52: G, 53: F }, e(X, [2, 12]), e(X, [2, 13]), e(E, [2, 18]), e(E, [2, 34]), e(E, [2, 35]), e(E, [2, 36]), e(E, [2, 37]), { 15: [1, 158] }, e(E, [2, 38]), { 15: [1, 159] }, e(E, [2, 39]), e(E, [2, 40]), { 15: [1, 160] }, e(E, [2, 41]), { 5: [1, 161] }, { 75: [1, 162] }, { 5: [1, 163] }, { 57: 164, 86: lt }, { 57: 165, 86: lt }, { 5: [2, 68] }, { 5: [2, 54] }, { 5: [2, 55] }, { 22: 166, 71: R }, e(X, [2, 11]), e(M, r, { 7: 105, 40: 167 }), e(Vt, r, { 7: 107, 42: 168 }), e(Zt, r, { 7: 110, 45: 169 }), e(E, [2, 48]), { 5: [2, 70] }, e(E, [2, 50]), { 5: [2, 66] }, { 5: [2, 67] }, { 86: [2, 62] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }], defaultActions: { 5: [2, 1], 6: [2, 2], 89: [2, 64], 90: [2, 65], 115: [2, 69], 126: [2, 56], 127: [2, 82], 128: [2, 57], 129: [2, 58], 130: [2, 59], 153: [2, 68], 154: [2, 54], 155: [2, 55], 162: [2, 70], 164: [2, 66], 165: [2, 67], 166: [2, 62], 167: [2, 47], 168: [2, 45], 169: [2, 43] }, parseError: /* @__PURE__ */ f(function(v, A) { if (A.recoverable) this.trace(v); else { var L = new Error(v); throw L.hash = A, L; } }, "parseError"), parse: /* @__PURE__ */ f(function(v) { var A = this, L = [0], b = [], C = [null], d = [], It = this.table, u = "", kt = 0, $t = 0, Te = 2, jt = 1, Ee = d.slice.call(arguments, 1), Y = Object.create(this.lexer), ft = { yy: {} }; for (var Wt in this.yy) Object.prototype.hasOwnProperty.call(this.yy, Wt) && (ft.yy[Wt] = this.yy[Wt]); Y.setInput(v, ft.yy), ft.yy.lexer = Y, ft.yy.parser = this, typeof Y.yylloc > "u" && (Y.yylloc = {}); var Ft = Y.yylloc; d.push(Ft); var be = Y.options && Y.options.ranges; typeof ft.yy.parseError == "function" ? this.parseError = ft.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; function me(et) { L.length = L.length - 2 * et, C.length = C.length - et, d.length = d.length - et; } f(me, "popStack"); function te() { var et; return et = b.pop() || Y.lex() || jt, typeof et != "number" && (et instanceof Array && (b = et, et = b.pop()), et = A.symbols_[et] || et), et; } f(te, "lex"); for (var J, yt, it, qt, bt = {}, Pt, ht, ee, Nt; ; ) { if (yt = L[L.length - 1], this.defaultActions[yt] ? it = this.defaultActions[yt] : ((J === null || typeof J > "u") && (J = te()), it = It[yt] && It[yt][J]), typeof it > "u" || !it.length || !it[0]) { var zt = ""; Nt = []; for (Pt in It[yt]) this.terminals_[Pt] && Pt > Te && Nt.push("'" + this.terminals_[Pt] + "'"); Y.showPosition ? zt = "Parse error on line " + (kt + 1) + `: ` + Y.showPosition() + ` Expecting ` + Nt.join(", ") + ", got '" + (this.terminals_[J] || J) + "'" : zt = "Parse error on line " + (kt + 1) + ": Unexpected " + (J == jt ? "end of input" : "'" + (this.terminals_[J] || J) + "'"), this.parseError(zt, { text: Y.match, token: this.terminals_[J] || J, line: Y.yylineno, loc: Ft, expected: Nt }); } if (it[0] instanceof Array && it.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + yt + ", token: " + J); switch (it[0]) { case 1: L.push(J), C.push(Y.yytext), d.push(Y.yylloc), L.push(it[1]), J = null, $t = Y.yyleng, u = Y.yytext, kt = Y.yylineno, Ft = Y.yylloc; break; case 2: if (ht = this.productions_[it[1]][1], bt.$ = C[C.length - ht], bt._$ = { first_line: d[d.length - (ht || 1)].first_line, last_line: d[d.length - 1].last_line, first_column: d[d.length - (ht || 1)].first_column, last_column: d[d.length - 1].last_column }, be && (bt._$.range = [ d[d.length - (ht || 1)].range[0], d[d.length - 1].range[1] ]), qt = this.performAction.apply(bt, [ u, $t, kt, ft.yy, it[1], C, d ].concat(Ee)), typeof qt < "u") return qt; ht && (L = L.slice(0, -1 * ht * 2), C = C.slice(0, -1 * ht), d = d.slice(0, -1 * ht)), L.push(this.productions_[it[1]][0]), C.push(bt.$), d.push(bt._$), ee = It[L[L.length - 2]][L[L.length - 1]], L.push(ee); break; case 3: return !0; } } return !0; }, "parse") }, ye = /* @__PURE__ */ (function() { var pt = { EOF: 1, parseError: /* @__PURE__ */ f(function(A, L) { if (this.yy.parser) this.yy.parser.parseError(A, L); else throw new Error(A); }, "parseError"), // resets the lexer, sets new input setInput: /* @__PURE__ */ f(function(v, A) { return this.yy = A || this.yy || {}, this._input = v, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; }, "setInput"), // consumes and returns one char from the input input: /* @__PURE__ */ f(function() { var v = this._input[0]; this.yytext += v, this.yyleng++, this.offset++, this.match += v, this.matched += v; var A = v.match(/(?:\r\n?|\n).*/g); return A ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), v; }, "input"), // unshifts one char (or a string) into the input unput: /* @__PURE__ */ f(function(v) { var A = v.length, L = v.split(/(?:\r\n?|\n)/g); this._input = v + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - A), this.offset -= A; var b = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), L.length - 1 && (this.yylineno -= L.length - 1); var C = this.yylloc.range; return this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: L ? (L.length === b.length ? this.yylloc.first_column : 0) + b[b.length - L.length].length - L[0].length : this.yylloc.first_column - A }, this.options.ranges && (this.yylloc.range = [C[0], C[0] + this.yyleng - A]), this.yyleng = this.yytext.length, this; }, "unput"), // When called from action, caches matched text and appends it on next action more: /* @__PURE__ */ f(function() { return this._more = !0, this; }, "more"), // 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. reject: /* @__PURE__ */ f(function() { if (this.options.backtrack_lexer) this._backtrack = !0; 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). ` + this.showPosition(), { text: "", token: null, line: this.yylineno }); return this; }, "reject"), // retain first n characters of the match less: /* @__PURE__ */ f(function(v) { this.unput(this.match.slice(v)); }, "less"), // displays already matched input, i.e. for error messages pastInput: /* @__PURE__ */ f(function() { var v = this.matched.substr(0, this.matched.length - this.match.length); return (v.length > 20 ? "..." : "") + v.substr(-20).replace(/\n/g, ""); }, "pastInput"), // displays upcoming input, i.e. for error messages upcomingInput: /* @__PURE__ */ f(function() { var v = this.match; return v.length < 20 && (v += this._input.substr(0, 20 - v.length)), (v.substr(0, 20) + (v.length > 20 ? "..." : "")).replace(/\n/g, ""); }, "upcomingInput"), // displays the character position where the lexing error occurred, i.e. for error messages showPosition: /* @__PURE__ */ f(function() { var v = this.pastInput(), A = new Array(v.length + 1).join("-"); return v + this.upcomingInput() + ` ` + A + "^"; }, "showPosition"), // test the lexed token: return FALSE when not a match, otherwise return token test_match: /* @__PURE__ */ f(function(v, A) { var L, b, C; if (this.options.backtrack_lexer && (C = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }, this.options.ranges && (C.yylloc.range = this.yylloc.range.slice(0))), b = v[0].match(/(?:\r\n?|\n).*/g), b && (this.yylineno += b.length), this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: b ? b[b.length - 1].length - b[b.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + v[0].length }, this.yytext += v[0], this.match += v[0], this.matches = v, 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(v[0].length), this.matched += v[0], L = this.performAction.call(this, this.yy, this, A, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), L) return L; if (this._backtrack) { for (var d in C) this[d] = C[d]; return !1; } return !1; }, "test_match"), // return next match in input next: /* @__PURE__ */ f(function() { if (this.done) return this.EOF; this._input || (this.done = !0); var v, A, L, b; this._more || (this.yytext = "", this.match = ""); for (var C = this._currentRules(), d = 0; d < C.length; d++) if (L = this._input.match(this.rules[C[d]]), L && (!A || L[0].length > A[0].length)) { if (A = L, b = d, this.options.backtrack_lexer) { if (v = this.test_match(L, C[d]), v !== !1) return v; if (this._backtrack) { A = !1; continue; } else return !1; } else if (!this.options.flex) break; } return A ? (v = this.test_match(A, C[b]), v !== !1 ? v : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. ` + this.showPosition(), { text: "", token: null, line: this.yylineno }); }, "next"), // return next match that has a token lex: /* @__PURE__ */ f(function() { var A = this.next(); return A || this.lex(); }, "lex"), // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin: /* @__PURE__ */ f(function(A) { this.conditionStack.push(A); }, "begin"), // pop the previously active lexer condition state off the condition stack popState: /* @__PURE__ */ f(function() { var A = this.conditionStack.length - 1; return A > 0 ? this.conditionStack.pop() : this.conditionStack[0]; }, "popState"), // produce the lexer rule set which is active for the currently active lexer condition state _currentRules: /* @__PURE__ */ f(function() { return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; }, "_currentRules"), // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState: /* @__PURE__ */ f(function(A) { return A = this.conditionStack.length - 1 - Math.abs(A || 0), A >= 0 ? this.conditionStack[A] : "INITIAL"; }, "topState"), // alias for begin(condition) pushState: /* @__PURE__ */ f(function(A) { this.begin(A); }, "pushState"), // return the number of states currently on the stack stateStackSize: /* @__PURE__ */ f(function() { return this.conditionStack.length; }, "stateStackSize"), options: { "case-insensitive": !0 }, performAction: /* @__PURE__ */ f(function(A, L, b, C) { switch (b) { case 0: return 5; case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: return 19; case 7: return this.begin("CONFIG"), 73; case 8: return 74; case 9: return this.popState(), this.popState(), 75; case 10: return L.yytext = L.yytext.trim(), 71; case 11: return L.yytext = L.yytext.trim(), this.begin("ALIAS"), 71; case 12: return this.begin("LINE"), 14; case 13: return this.begin("ID"), 50; case 14: return this.begin("ID"), 52; case 15: return 13; case 16: return this.begin("ID"), 53; case 17: return L.yytext = L.yytext.trim(), this.begin("ALIAS"), 71; case 18: return this.popState(), this.popState(), this.begin("LINE"), 51; case 19: return this.popState(), this.popState(), 5; case 20: return this.begin("LINE"), 36; case 21: return this.begin("LINE"), 37; case 22: return this.begin("LINE"), 38; case 23: return this.begin("LINE"), 39; case 24: return this.begin("LINE"), 49; case 25: return this.begin("LINE"), 41; case 26: return this.begin("LINE"), 43; case 27: return this.begin("LINE"), 48; case 28: return this.begin("LINE"), 44; case 29: return this.begin("LINE"), 47; case 30: return this.begin("LINE"), 46; case 31: return this.popState(), 15; case 32: return 16; case 33: return 66; case 34: return 67; case 35: return 60; case 36: return 61; case 37: return 62; case 38: return 63; case 39: return 58; case 40: return 55; case 41: return this.begin("ID"), 21; case 42: return this.begin("ID"), 23; case 43: return 29; case 44: return 30; case 45: return this.begin("acc_title"), 31; case 46: return this.popState(), "acc_title_value"; case 47: return this.begin("acc_descr"), 33; case 48: return this.popState(), "acc_descr_value"; case 49: this.begin("acc_descr_multiline"); break; case 50: this.popState(); break; case 51: return "acc_descr_multiline_value"; case 52: return 6; case 53: return 18; case 54: return 20; case 55: return 65; case 56: return 5; case 57: return L.yytext = L.yytext.trim(), 71; case 58: return 78; case 59: return 79; case 60: return 80; case 61: return 81; case 62: return 76; case 63: return 77; case 64: return 82; case 65: return 83; case 66: return 84; case 67: return 85; case 68: return 86; case 69: return 86; case 70: return 69; case 71: return 70; case 72: return 5; case 73: return "INVALID"; } }, "anonymous"), rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^\<->\->:\n,;@]+?([\-]*[^\<->\->:\n,;@]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:[^<\->\->:\n,;]+?([\-]*[^<\->\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/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, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+<\->\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:<<->>)/i, /^(?:-->>)/i, /^(?:<<-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i], conditions: { acc_descr_multiline: { rules: [50, 51], inclusive: !1 }, acc_descr: { rules: [48], inclusive: !1 }, acc_title: { rules: [46], inclusive: !1 }, ID: { rules: [2, 3, 7, 10, 11, 17], inclusive: !1 }, ALIAS: { rules: [2, 3, 18, 19], inclusive: !1 }, LINE: { rules: [2, 3, 31], inclusive: !1 }, CONFIG: { rules: [8, 9], inclusive: !1 }, CONFIG_DATA: { rules: [], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 4, 5, 6, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 49, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73], inclusive: !0 } } }; return pt; })(); Yt.lexer = ye; function At() { this.yy = {}; } return f(At, "Parser"), At.prototype = Yt, Yt.Parser = At, new At(); })(); Ut.parser = Ut; var Ve = Ut, Ye = { SOLID: 0, DOTTED: 1, NOTE: 2, SOLID_CROSS: 3, DOTTED_CROSS: 4, SOLID_OPEN: 5, DOTTED_OPEN: 6, LOOP_START: 10, LOOP_END: 11, ALT_START: 12, ALT_ELSE: 13, ALT_END: 14, OPT_START: 15, OPT_END: 16, ACTIVE_START: 17, ACTIVE_END: 18, PAR_START: 19, PAR_AND: 20, PAR_END: 21, RECT_START: 22, RECT_END: 23, SOLID_POINT: 24, DOTTED_POINT: 25, AUTONUMBER: 26, CRITICAL_START: 27, CRITICAL_OPTION: 28, CRITICAL_END: 29, BREAK_START: 30, BREAK_END: 31, PAR_OVER_START: 32, BIDIRECTIONAL_SOLID: 33, BIDIRECTIONAL_DOTTED: 34 }, We = { FILLED: 0, OPEN: 1 }, Fe = { LEFTOF: 0, RIGHTOF: 1, OVER: 2 }, Rt = { ACTOR: "actor", CONTROL: "control", DATABASE: "database", ENTITY: "entity" }, wt, qe = (wt = class { constructor() { this.state = new Be(() => ({ prevActor: void 0, actors: /* @__PURE__ */ new Map(), createdActors: /* @__PURE__ */ new Map(), destroyedActors: /* @__PURE__ */ new Map(), boxes: [], messages: [], notes: [], sequenceNumbersEnabled: !1, wrapEnabled: void 0, currentBox: void 0, lastCreated: void 0, lastDestroyed: void 0 })), this.setAccTitle = se, this.setAccDescription = Ae, this.setDiagramTitle = ke, this.getAccTitle = Pe, this.getAccDescription = Ne, this.getDiagramTitle = Se, this.apply = this.apply.bind(this), this.parseBoxData = this.parseBoxData.bind(this), this.parseMessage = this.parseMessage.bind(this), this.clear(), this.setWrap(st().wrap), this.LINETYPE = Ye, this.ARROWTYPE = We, this.PLACEMENT = Fe; } addBox(t) { this.state.records.boxes.push({ name: t.text, wrap: t.wrap ?? this.autoWrap(), fill: t.color, actorKeys: [] }), this.state.records.currentBox = this.state.records.boxes.slice(-1)[0]; } addActor(t, n, s, r, i) { let c = this.state.records.currentBox, h; if (i !== void 0) { let a; i.includes(` `) ? a = i + ` ` : a = `{ ` + i + ` }`, h = Me(a, { schema: Re }); } r = h?.type ?? r; const o = this.state.records.actors.get(t); if (o) { if (this.state.records.currentBox && o.box && this.state.records.currentBox !== o.box) throw new Error( `A same participant should only be defined in one Box: ${o.name} can't be in '${o.box.name}' and in '${this.state.records.currentBox.name}' at the same time.` ); if (c = o.box ? o.box : this.state.records.currentBox, o.box = c, o && n === o.name && s == null) return; } if (s?.text == null && (s = { text: n, type: r }), (r == null || s.text == null) && (s = { text: n, type: r }), this.state.records.actors.set(t, { box: c, name: n, description: s.text, wrap: s.wrap ?? this.autoWrap(), prevActor: this.state.records.prevActor, links: {}, properties: {}, actorCnt: null, rectData: null, type: r ?? "participant" }), this.state.records.prevActor) { const a = this.state.records.actors.get(this.state.records.prevActor); a && (a.nextActor = t); } this.state.records.currentBox && this.state.records.currentBox.actorKeys.push(t), this.state.records.prevActor = t; } activationCount(t) { let n, s = 0; if (!t) return 0; for (n = 0; n < this.state.records.messages.length; n++) this.state.records.messages[n].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[n].from === t && s++, this.state.records.messages[n].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[n].from === t && s--; return s; } addMessage(t, n, s, r) { this.state.records.messages.push({ id: this.state.records.messages.length.toString(), from: t, to: n, message: s.text, wrap: s.wrap ?? this.autoWrap(), answer: r }); } addSignal(t, n, s, r, i = !1) { if (r === this.LINETYPE.ACTIVE_END && this.activationCount(t ?? "") < 1) { const h = new Error("Trying to inactivate an inactive participant (" + t + ")"); throw h.hash = { text: "->>-", token: "->>-", line: "1", loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, expected: ["'ACTIVE_PARTICIPANT'"] }, h; } return this.state.records.messages.push({ id: this.state.records.messages.length.toString(), from: t, to: n, message: s?.text ?? "", wrap: s?.wrap ?? this.autoWrap(), type: r, activate: i }), !0; } hasAtLeastOneBox() { return this.state.records.boxes.length > 0; } hasAtLeastOneBoxWithTitle() { return this.state.records.boxes.some((t) => t.name); } getMessages() { return this.state.records.messages; } getBoxes() { return this.state.records.boxes; } getActors() { return this.state.records.actors; } getCreatedActors() { return this.state.records.createdActors; } getDestroyedActors() { return this.state.records.destroyedActors; } getActor(t) { return this.state.records.actors.get(t); } getActorKeys() { return [...this.state.records.actors.keys()]; } enableSequenceNumbers() { this.state.records.sequenceNumbersEnabled = !0; } disableSequenceNumbers() { this.state.records.sequenceNumbersEnabled = !1; } showSequenceNumbers() { return this.state.records.sequenceNumbersEnabled; } setWrap(t) { this.state.records.wrapEnabled = t; } extractWrap(t) { if (t === void 0) return {}; t = t.trim(); const n = /^:?wrap:/.exec(t) !== null ? !0 : /^:?nowrap:/.exec(t) !== null ? !1 : void 0; return { cleanedText: (n === void 0 ? t : t.replace(/^:?(?:no)?wrap:/, "")).trim(), wrap: n }; } autoWrap() { return this.state.records.wrapEnabled !== void 0 ? this.state.records.wrapEnabled : st().sequence?.wrap ?? !1; } clear() { this.state.reset(), De(); } parseMessage(t) { const n = t.trim(), { wrap: s, cleanedText: r } = this.extractWrap(n), i = { text: r, wrap: s }; return Q.debug(`parseMessage: ${JSON.stringify(i)}`), i; } // We expect the box statement to be color first then description // The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled // We extract first segment as color, the rest of the line is considered as text parseBoxData(t) { const n = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t); let s = n?.[1] ? n[1].trim() : "transparent", r = n?.[2] ? n[2].trim() : void 0; if (window?.CSS) window.CSS.supports("color", s) || (s = "transparent", r = t.trim()); else { const h = new Option().style; h.color = s, h.color !== s && (s = "transparent", r = t.trim()); } const { wrap: i, cleanedText: c } = this.extractWrap(r); return { text: c ? Mt(c, st()) : void 0, color: s, wrap: i }; } addNote(t, n, s) { const r = { actor: t, placement: n, message: s.text, wrap: s.wrap ?? this.autoWrap() }, i = [].concat(t, t); this.state.records.notes.push(r), this.state.records.messages.push({ id: this.state.records.messages.length.toString(), from: i[0], to: i[1], message: s.text, wrap: s.wrap ?? this.autoWrap(), type: this.LINETYPE.NOTE, placement: n }); } addLinks(t, n) { const s = this.getActor(t); try { let r = Mt(n.text, st()); r = r.replace(/&equals;/g, "="), r = r.replace(/&amp;/g, "&"); const i = JSON.parse(r); this.insertLinks(s, i); } catch (r) { Q.error("error while parsing actor link text", r); } } addALink(t, n) { const s = this.getActor(t); try { const r = {}; let i = Mt(n.text, st()); const c = i.indexOf("@"); i = i.replace(/&equals;/g, "="), i = i.replace(/&amp;/g, "&"); const h = i.slice(0, c - 1).trim(), o = i.slice(c + 1).trim(); r[h] = o, this.insertLinks(s, r); } catch (r) { Q.error("error while parsing actor link text", r); } } insertLinks(t, n) { if (t.links == null) t.links = n; else for (const s in n) t.links[s] = n[s]; } addProperties(t, n) { const s = this.getActor(t); try { const r = Mt(n.text, st()), i = JSON.parse(r); this.insertProperties(s, i); } catch (r) { Q.error("error while parsing actor properties text", r); } } insertProperties(t, n) { if (t.properties == null) t.properties = n; else for (const s in n) t.properties[s] = n[s]; } boxEnd() { this.state.records.currentBox = void 0; } addDetails(t, n) { const s = this.getActor(t), r = document.getElementById(n.text); try { const i = r.innerHTML, c = JSON.parse(i); c.properties && this.insertProperties(s, c.properties), c.links && this.insertLinks(s, c.links); } catch (i) { Q.error("error while parsing actor details text", i); } } getActorProperty(t, n) { if (t?.properties !== void 0) return t.properties[n]; } // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents apply(t) { if (Array.isArray(t)) t.forEach((n) => { this.apply(n); }); else switch (t.type) { case "sequenceIndex": this.state.records.messages.push({ id: this.state.records.messages.length.toString(), from: void 0, to: void 0, message: { start: t.sequenceIndex, step: t.sequenceIndexStep, visible: t.sequenceVisible }, wrap: !1, type: t.signalType }); break; case "addParticipant": this.addActor(t.actor, t.actor, t.description, t.draw, t.config); break; case "createParticipant": if (this.state.records.actors.has(t.actor)) throw new Error( "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior" ); this.state.records.lastCreated = t.actor, this.addActor(t.actor, t.actor, t.description, t.draw, t.config), this.state.records.createdActors.set(t.actor, this.state.records.messages.length); break; case "destroyParticipant": this.state.records.lastDestroyed = t.actor, this.state.records.destroyedActors.set(t.actor, this.state.records.messages.length); break; case "activeStart": this.addSignal(t.actor, void 0, void 0, t.signalType); break; case "activeEnd": this.addSignal(t.actor, void 0, void 0, t.signalType); break; case "addNote": this.addNote(t.actor, t.placement, t.text);