UNPKG

37 kBJavaScriptView Raw
1import { c as xe, s as Fe, g as Me, b as Pe, a as Ye, m as Ue, l as ve, B as Be, j as oe, k as Qe, f as Te } from "./mermaid-9357f3d0.js";
2import { G as He, l as We } from "./layout-816c0a3e.js";
3import { l as Ke } from "./line-a77fdd5a.js";
4import "./array-2ff2c7a6.js";
5import "./constant-2fe7eae5.js";
6var he = function() {
7 var e = function(q, r, s, l) {
8 for (s = s || {}, l = q.length; l--; s[q[l]] = r)
9 ;
10 return s;
11 }, t = [1, 3], a = [1, 5], c = [1, 6], d = [1, 7], u = [1, 8], p = [5, 6, 8, 14, 16, 18, 19, 40, 41, 42, 43, 44, 45, 53, 71, 72], h = [1, 22], o = [2, 13], g = [1, 26], R = [1, 27], x = [1, 28], S = [1, 29], T = [1, 30], v = [1, 31], A = [1, 24], N = [1, 32], w = [1, 33], pe = [1, 36], F = [71, 72], fe = [5, 8, 14, 16, 18, 19, 40, 41, 42, 43, 44, 45, 53, 60, 62, 71, 72], _e = [1, 56], ye = [1, 57], ge = [1, 58], Ee = [1, 59], Re = [1, 60], me = [1, 61], Ie = [1, 62], O = [62, 63], M = [1, 74], P = [1, 70], Y = [1, 71], U = [1, 72], B = [1, 73], Q = [1, 75], j = [1, 79], X = [1, 80], J = [1, 77], Z = [1, 78], m = [5, 8, 14, 16, 18, 19, 40, 41, 42, 43, 44, 45, 53, 71, 72], re = {
12 trace: function() {
13 },
14 yy: {},
15 symbols_: { error: 2, start: 3, directive: 4, NEWLINE: 5, RD: 6, diagram: 7, EOF: 8, openDirective: 9, typeDirective: 10, closeDirective: 11, ":": 12, argDirective: 13, acc_title: 14, acc_title_value: 15, acc_descr: 16, acc_descr_value: 17, acc_descr_multiline_value: 18, open_directive: 19, type_directive: 20, arg_directive: 21, close_directive: 22, requirementDef: 23, elementDef: 24, relationshipDef: 25, requirementType: 26, requirementName: 27, STRUCT_START: 28, requirementBody: 29, ID: 30, COLONSEP: 31, id: 32, TEXT: 33, text: 34, RISK: 35, riskLevel: 36, VERIFYMTHD: 37, verifyType: 38, STRUCT_STOP: 39, REQUIREMENT: 40, FUNCTIONAL_REQUIREMENT: 41, INTERFACE_REQUIREMENT: 42, PERFORMANCE_REQUIREMENT: 43, PHYSICAL_REQUIREMENT: 44, DESIGN_CONSTRAINT: 45, LOW_RISK: 46, MED_RISK: 47, HIGH_RISK: 48, VERIFY_ANALYSIS: 49, VERIFY_DEMONSTRATION: 50, VERIFY_INSPECTION: 51, VERIFY_TEST: 52, ELEMENT: 53, elementName: 54, elementBody: 55, TYPE: 56, type: 57, DOCREF: 58, ref: 59, END_ARROW_L: 60, relationship: 61, LINE: 62, END_ARROW_R: 63, CONTAINS: 64, COPIES: 65, DERIVES: 66, SATISFIES: 67, VERIFIES: 68, REFINES: 69, TRACES: 70, unqString: 71, qString: 72, $accept: 0, $end: 1 },
16 terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 12: ":", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "open_directive", 20: "type_directive", 21: "arg_directive", 22: "close_directive", 28: "STRUCT_START", 30: "ID", 31: "COLONSEP", 33: "TEXT", 35: "RISK", 37: "VERIFYMTHD", 39: "STRUCT_STOP", 40: "REQUIREMENT", 41: "FUNCTIONAL_REQUIREMENT", 42: "INTERFACE_REQUIREMENT", 43: "PERFORMANCE_REQUIREMENT", 44: "PHYSICAL_REQUIREMENT", 45: "DESIGN_CONSTRAINT", 46: "LOW_RISK", 47: "MED_RISK", 48: "HIGH_RISK", 49: "VERIFY_ANALYSIS", 50: "VERIFY_DEMONSTRATION", 51: "VERIFY_INSPECTION", 52: "VERIFY_TEST", 53: "ELEMENT", 56: "TYPE", 58: "DOCREF", 60: "END_ARROW_L", 62: "LINE", 63: "END_ARROW_R", 64: "CONTAINS", 65: "COPIES", 66: "DERIVES", 67: "SATISFIES", 68: "VERIFIES", 69: "REFINES", 70: "TRACES", 71: "unqString", 72: "qString" },
17 productions_: [0, [3, 3], [3, 2], [3, 4], [4, 3], [4, 5], [4, 2], [4, 2], [4, 1], [9, 1], [10, 1], [13, 1], [11, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [23, 5], [29, 5], [29, 5], [29, 5], [29, 5], [29, 2], [29, 1], [26, 1], [26, 1], [26, 1], [26, 1], [26, 1], [26, 1], [36, 1], [36, 1], [36, 1], [38, 1], [38, 1], [38, 1], [38, 1], [24, 5], [55, 5], [55, 5], [55, 2], [55, 1], [25, 5], [25, 5], [61, 1], [61, 1], [61, 1], [61, 1], [61, 1], [61, 1], [61, 1], [27, 1], [27, 1], [32, 1], [32, 1], [34, 1], [34, 1], [54, 1], [54, 1], [57, 1], [57, 1], [59, 1], [59, 1]],
18 performAction: function(r, s, l, i, _, n, K) {
19 var f = n.length - 1;
20 switch (_) {
21 case 6:
22 this.$ = n[f].trim(), i.setAccTitle(this.$);
23 break;
24 case 7:
25 case 8:
26 this.$ = n[f].trim(), i.setAccDescription(this.$);
27 break;
28 case 9:
29 i.parseDirective("%%{", "open_directive");
30 break;
31 case 10:
32 i.parseDirective(n[f], "type_directive");
33 break;
34 case 11:
35 n[f] = n[f].trim().replace(/'/g, '"'), i.parseDirective(n[f], "arg_directive");
36 break;
37 case 12:
38 i.parseDirective("}%%", "close_directive", "pie");
39 break;
40 case 13:
41 this.$ = [];
42 break;
43 case 19:
44 i.addRequirement(n[f - 3], n[f - 4]);
45 break;
46 case 20:
47 i.setNewReqId(n[f - 2]);
48 break;
49 case 21:
50 i.setNewReqText(n[f - 2]);
51 break;
52 case 22:
53 i.setNewReqRisk(n[f - 2]);
54 break;
55 case 23:
56 i.setNewReqVerifyMethod(n[f - 2]);
57 break;
58 case 26:
59 this.$ = i.RequirementType.REQUIREMENT;
60 break;
61 case 27:
62 this.$ = i.RequirementType.FUNCTIONAL_REQUIREMENT;
63 break;
64 case 28:
65 this.$ = i.RequirementType.INTERFACE_REQUIREMENT;
66 break;
67 case 29:
68 this.$ = i.RequirementType.PERFORMANCE_REQUIREMENT;
69 break;
70 case 30:
71 this.$ = i.RequirementType.PHYSICAL_REQUIREMENT;
72 break;
73 case 31:
74 this.$ = i.RequirementType.DESIGN_CONSTRAINT;
75 break;
76 case 32:
77 this.$ = i.RiskLevel.LOW_RISK;
78 break;
79 case 33:
80 this.$ = i.RiskLevel.MED_RISK;
81 break;
82 case 34:
83 this.$ = i.RiskLevel.HIGH_RISK;
84 break;
85 case 35:
86 this.$ = i.VerifyType.VERIFY_ANALYSIS;
87 break;
88 case 36:
89 this.$ = i.VerifyType.VERIFY_DEMONSTRATION;
90 break;
91 case 37:
92 this.$ = i.VerifyType.VERIFY_INSPECTION;
93 break;
94 case 38:
95 this.$ = i.VerifyType.VERIFY_TEST;
96 break;
97 case 39:
98 i.addElement(n[f - 3]);
99 break;
100 case 40:
101 i.setNewElementType(n[f - 2]);
102 break;
103 case 41:
104 i.setNewElementDocRef(n[f - 2]);
105 break;
106 case 44:
107 i.addRelationship(n[f - 2], n[f], n[f - 4]);
108 break;
109 case 45:
110 i.addRelationship(n[f - 2], n[f - 4], n[f]);
111 break;
112 case 46:
113 this.$ = i.Relationships.CONTAINS;
114 break;
115 case 47:
116 this.$ = i.Relationships.COPIES;
117 break;
118 case 48:
119 this.$ = i.Relationships.DERIVES;
120 break;
121 case 49:
122 this.$ = i.Relationships.SATISFIES;
123 break;
124 case 50:
125 this.$ = i.Relationships.VERIFIES;
126 break;
127 case 51:
128 this.$ = i.Relationships.REFINES;
129 break;
130 case 52:
131 this.$ = i.Relationships.TRACES;
132 break;
133 }
134 },
135 table: [{ 3: 1, 4: 2, 6: t, 9: 4, 14: a, 16: c, 18: d, 19: u }, { 1: [3] }, { 3: 10, 4: 2, 5: [1, 9], 6: t, 9: 4, 14: a, 16: c, 18: d, 19: u }, { 5: [1, 11] }, { 10: 12, 20: [1, 13] }, { 15: [1, 14] }, { 17: [1, 15] }, e(p, [2, 8]), { 20: [2, 9] }, { 3: 16, 4: 2, 6: t, 9: 4, 14: a, 16: c, 18: d, 19: u }, { 1: [2, 2] }, { 4: 21, 5: h, 7: 17, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 11: 34, 12: [1, 35], 22: pe }, e([12, 22], [2, 10]), e(p, [2, 6]), e(p, [2, 7]), { 1: [2, 1] }, { 8: [1, 37] }, { 4: 21, 5: h, 7: 38, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 4: 21, 5: h, 7: 39, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 4: 21, 5: h, 7: 40, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 4: 21, 5: h, 7: 41, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 4: 21, 5: h, 7: 42, 8: o, 9: 4, 14: a, 16: c, 18: d, 19: u, 23: 18, 24: 19, 25: 20, 26: 23, 32: 25, 40: g, 41: R, 42: x, 43: S, 44: T, 45: v, 53: A, 71: N, 72: w }, { 27: 43, 71: [1, 44], 72: [1, 45] }, { 54: 46, 71: [1, 47], 72: [1, 48] }, { 60: [1, 49], 62: [1, 50] }, e(F, [2, 26]), e(F, [2, 27]), e(F, [2, 28]), e(F, [2, 29]), e(F, [2, 30]), e(F, [2, 31]), e(fe, [2, 55]), e(fe, [2, 56]), e(p, [2, 4]), { 13: 51, 21: [1, 52] }, e(p, [2, 12]), { 1: [2, 3] }, { 8: [2, 14] }, { 8: [2, 15] }, { 8: [2, 16] }, { 8: [2, 17] }, { 8: [2, 18] }, { 28: [1, 53] }, { 28: [2, 53] }, { 28: [2, 54] }, { 28: [1, 54] }, { 28: [2, 59] }, { 28: [2, 60] }, { 61: 55, 64: _e, 65: ye, 66: ge, 67: Ee, 68: Re, 69: me, 70: Ie }, { 61: 63, 64: _e, 65: ye, 66: ge, 67: Ee, 68: Re, 69: me, 70: Ie }, { 11: 64, 22: pe }, { 22: [2, 11] }, { 5: [1, 65] }, { 5: [1, 66] }, { 62: [1, 67] }, e(O, [2, 46]), e(O, [2, 47]), e(O, [2, 48]), e(O, [2, 49]), e(O, [2, 50]), e(O, [2, 51]), e(O, [2, 52]), { 63: [1, 68] }, e(p, [2, 5]), { 5: M, 29: 69, 30: P, 33: Y, 35: U, 37: B, 39: Q }, { 5: j, 39: X, 55: 76, 56: J, 58: Z }, { 32: 81, 71: N, 72: w }, { 32: 82, 71: N, 72: w }, e(m, [2, 19]), { 31: [1, 83] }, { 31: [1, 84] }, { 31: [1, 85] }, { 31: [1, 86] }, { 5: M, 29: 87, 30: P, 33: Y, 35: U, 37: B, 39: Q }, e(m, [2, 25]), e(m, [2, 39]), { 31: [1, 88] }, { 31: [1, 89] }, { 5: j, 39: X, 55: 90, 56: J, 58: Z }, e(m, [2, 43]), e(m, [2, 44]), e(m, [2, 45]), { 32: 91, 71: N, 72: w }, { 34: 92, 71: [1, 93], 72: [1, 94] }, { 36: 95, 46: [1, 96], 47: [1, 97], 48: [1, 98] }, { 38: 99, 49: [1, 100], 50: [1, 101], 51: [1, 102], 52: [1, 103] }, e(m, [2, 24]), { 57: 104, 71: [1, 105], 72: [1, 106] }, { 59: 107, 71: [1, 108], 72: [1, 109] }, e(m, [2, 42]), { 5: [1, 110] }, { 5: [1, 111] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: [1, 112] }, { 5: [2, 32] }, { 5: [2, 33] }, { 5: [2, 34] }, { 5: [1, 113] }, { 5: [2, 35] }, { 5: [2, 36] }, { 5: [2, 37] }, { 5: [2, 38] }, { 5: [1, 114] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [1, 115] }, { 5: [2, 63] }, { 5: [2, 64] }, { 5: M, 29: 116, 30: P, 33: Y, 35: U, 37: B, 39: Q }, { 5: M, 29: 117, 30: P, 33: Y, 35: U, 37: B, 39: Q }, { 5: M, 29: 118, 30: P, 33: Y, 35: U, 37: B, 39: Q }, { 5: M, 29: 119, 30: P, 33: Y, 35: U, 37: B, 39: Q }, { 5: j, 39: X, 55: 120, 56: J, 58: Z }, { 5: j, 39: X, 55: 121, 56: J, 58: Z }, e(m, [2, 20]), e(m, [2, 21]), e(m, [2, 22]), e(m, [2, 23]), e(m, [2, 40]), e(m, [2, 41])],
136 defaultActions: { 8: [2, 9], 10: [2, 2], 16: [2, 1], 37: [2, 3], 38: [2, 14], 39: [2, 15], 40: [2, 16], 41: [2, 17], 42: [2, 18], 44: [2, 53], 45: [2, 54], 47: [2, 59], 48: [2, 60], 52: [2, 11], 93: [2, 57], 94: [2, 58], 96: [2, 32], 97: [2, 33], 98: [2, 34], 100: [2, 35], 101: [2, 36], 102: [2, 37], 103: [2, 38], 105: [2, 61], 106: [2, 62], 108: [2, 63], 109: [2, 64] },
137 parseError: function(r, s) {
138 if (s.recoverable)
139 this.trace(r);
140 else {
141 var l = new Error(r);
142 throw l.hash = s, l;
143 }
144 },
145 parse: function(r) {
146 var s = this, l = [0], i = [], _ = [null], n = [], K = this.table, f = "", ee = 0, be = 0, Le = 2, ke = 1, Oe = n.slice.call(arguments, 1), E = Object.create(this.lexer), C = { yy: {} };
147 for (var se in this.yy)
148 Object.prototype.hasOwnProperty.call(this.yy, se) && (C.yy[se] = this.yy[se]);
149 E.setInput(r, C.yy), C.yy.lexer = E, C.yy.parser = this, typeof E.yylloc > "u" && (E.yylloc = {});
150 var ae = E.yylloc;
151 n.push(ae);
152 var Ce = E.options && E.options.ranges;
153 typeof C.yy.parseError == "function" ? this.parseError = C.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
154 function De() {
155 var $;
156 return $ = i.pop() || E.lex() || ke, typeof $ != "number" && ($ instanceof Array && (i = $, $ = i.pop()), $ = s.symbols_[$] || $), $;
157 }
158 for (var I, D, k, le, H = {}, te, V, Se, ie; ; ) {
159 if (D = l[l.length - 1], this.defaultActions[D] ? k = this.defaultActions[D] : ((I === null || typeof I > "u") && (I = De()), k = K[D] && K[D][I]), typeof k > "u" || !k.length || !k[0]) {
160 var ce = "";
161 ie = [];
162 for (te in K[D])
163 this.terminals_[te] && te > Le && ie.push("'" + this.terminals_[te] + "'");
164 E.showPosition ? ce = "Parse error on line " + (ee + 1) + `:
165` + E.showPosition() + `
166Expecting ` + ie.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : ce = "Parse error on line " + (ee + 1) + ": Unexpected " + (I == ke ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(ce, {
167 text: E.match,
168 token: this.terminals_[I] || I,
169 line: E.yylineno,
170 loc: ae,
171 expected: ie
172 });
173 }
174 if (k[0] instanceof Array && k.length > 1)
175 throw new Error("Parse Error: multiple actions possible at state: " + D + ", token: " + I);
176 switch (k[0]) {
177 case 1:
178 l.push(I), _.push(E.yytext), n.push(E.yylloc), l.push(k[1]), I = null, be = E.yyleng, f = E.yytext, ee = E.yylineno, ae = E.yylloc;
179 break;
180 case 2:
181 if (V = this.productions_[k[1]][1], H.$ = _[_.length - V], H._$ = {
182 first_line: n[n.length - (V || 1)].first_line,
183 last_line: n[n.length - 1].last_line,
184 first_column: n[n.length - (V || 1)].first_column,
185 last_column: n[n.length - 1].last_column
186 }, Ce && (H._$.range = [
187 n[n.length - (V || 1)].range[0],
188 n[n.length - 1].range[1]
189 ]), le = this.performAction.apply(H, [
190 f,
191 be,
192 ee,
193 C.yy,
194 k[1],
195 _,
196 n
197 ].concat(Oe)), typeof le < "u")
198 return le;
199 V && (l = l.slice(0, -1 * V * 2), _ = _.slice(0, -1 * V), n = n.slice(0, -1 * V)), l.push(this.productions_[k[1]][0]), _.push(H.$), n.push(H._$), Se = K[l[l.length - 2]][l[l.length - 1]], l.push(Se);
200 break;
201 case 3:
202 return !0;
203 }
204 }
205 return !0;
206 }
207 }, qe = function() {
208 var q = {
209 EOF: 1,
210 parseError: function(s, l) {
211 if (this.yy.parser)
212 this.yy.parser.parseError(s, l);
213 else
214 throw new Error(s);
215 },
216 // resets the lexer, sets new input
217 setInput: function(r, s) {
218 return this.yy = s || this.yy || {}, this._input = r, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
219 first_line: 1,
220 first_column: 0,
221 last_line: 1,
222 last_column: 0
223 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
224 },
225 // consumes and returns one char from the input
226 input: function() {
227 var r = this._input[0];
228 this.yytext += r, this.yyleng++, this.offset++, this.match += r, this.matched += r;
229 var s = r.match(/(?:\r\n?|\n).*/g);
230 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), r;
231 },
232 // unshifts one char (or a string) into the input
233 unput: function(r) {
234 var s = r.length, l = r.split(/(?:\r\n?|\n)/g);
235 this._input = r + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - s), this.offset -= s;
236 var i = this.match.split(/(?:\r\n?|\n)/g);
237 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);
238 var _ = this.yylloc.range;
239 return this.yylloc = {
240 first_line: this.yylloc.first_line,
241 last_line: this.yylineno + 1,
242 first_column: this.yylloc.first_column,
243 last_column: l ? (l.length === i.length ? this.yylloc.first_column : 0) + i[i.length - l.length].length - l[0].length : this.yylloc.first_column - s
244 }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - s]), this.yyleng = this.yytext.length, this;
245 },
246 // When called from action, caches matched text and appends it on next action
247 more: function() {
248 return this._more = !0, this;
249 },
250 // 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.
251 reject: function() {
252 if (this.options.backtrack_lexer)
253 this._backtrack = !0;
254 else
255 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).
256` + this.showPosition(), {
257 text: "",
258 token: null,
259 line: this.yylineno
260 });
261 return this;
262 },
263 // retain first n characters of the match
264 less: function(r) {
265 this.unput(this.match.slice(r));
266 },
267 // displays already matched input, i.e. for error messages
268 pastInput: function() {
269 var r = this.matched.substr(0, this.matched.length - this.match.length);
270 return (r.length > 20 ? "..." : "") + r.substr(-20).replace(/\n/g, "");
271 },
272 // displays upcoming input, i.e. for error messages
273 upcomingInput: function() {
274 var r = this.match;
275 return r.length < 20 && (r += this._input.substr(0, 20 - r.length)), (r.substr(0, 20) + (r.length > 20 ? "..." : "")).replace(/\n/g, "");
276 },
277 // displays the character position where the lexing error occurred, i.e. for error messages
278 showPosition: function() {
279 var r = this.pastInput(), s = new Array(r.length + 1).join("-");
280 return r + this.upcomingInput() + `
281` + s + "^";
282 },
283 // test the lexed token: return FALSE when not a match, otherwise return token
284 test_match: function(r, s) {
285 var l, i, _;
286 if (this.options.backtrack_lexer && (_ = {
287 yylineno: this.yylineno,
288 yylloc: {
289 first_line: this.yylloc.first_line,
290 last_line: this.last_line,
291 first_column: this.yylloc.first_column,
292 last_column: this.yylloc.last_column
293 },
294 yytext: this.yytext,
295 match: this.match,
296 matches: this.matches,
297 matched: this.matched,
298 yyleng: this.yyleng,
299 offset: this.offset,
300 _more: this._more,
301 _input: this._input,
302 yy: this.yy,
303 conditionStack: this.conditionStack.slice(0),
304 done: this.done
305 }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), i = r[0].match(/(?:\r\n?|\n).*/g), i && (this.yylineno += i.length), this.yylloc = {
306 first_line: this.yylloc.last_line,
307 last_line: this.yylineno + 1,
308 first_column: this.yylloc.last_column,
309 last_column: i ? i[i.length - 1].length - i[i.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + r[0].length
310 }, this.yytext += r[0], this.match += r[0], this.matches = r, 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(r[0].length), this.matched += r[0], l = this.performAction.call(this, this.yy, this, s, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), l)
311 return l;
312 if (this._backtrack) {
313 for (var n in _)
314 this[n] = _[n];
315 return !1;
316 }
317 return !1;
318 },
319 // return next match in input
320 next: function() {
321 if (this.done)
322 return this.EOF;
323 this._input || (this.done = !0);
324 var r, s, l, i;
325 this._more || (this.yytext = "", this.match = "");
326 for (var _ = this._currentRules(), n = 0; n < _.length; n++)
327 if (l = this._input.match(this.rules[_[n]]), l && (!s || l[0].length > s[0].length)) {
328 if (s = l, i = n, this.options.backtrack_lexer) {
329 if (r = this.test_match(l, _[n]), r !== !1)
330 return r;
331 if (this._backtrack) {
332 s = !1;
333 continue;
334 } else
335 return !1;
336 } else if (!this.options.flex)
337 break;
338 }
339 return s ? (r = this.test_match(s, _[i]), r !== !1 ? r : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
340` + this.showPosition(), {
341 text: "",
342 token: null,
343 line: this.yylineno
344 });
345 },
346 // return next match that has a token
347 lex: function() {
348 var s = this.next();
349 return s || this.lex();
350 },
351 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
352 begin: function(s) {
353 this.conditionStack.push(s);
354 },
355 // pop the previously active lexer condition state off the condition stack
356 popState: function() {
357 var s = this.conditionStack.length - 1;
358 return s > 0 ? this.conditionStack.pop() : this.conditionStack[0];
359 },
360 // produce the lexer rule set which is active for the currently active lexer condition state
361 _currentRules: function() {
362 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
363 },
364 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
365 topState: function(s) {
366 return s = this.conditionStack.length - 1 - Math.abs(s || 0), s >= 0 ? this.conditionStack[s] : "INITIAL";
367 },
368 // alias for begin(condition)
369 pushState: function(s) {
370 this.begin(s);
371 },
372 // return the number of states currently on the stack
373 stateStackSize: function() {
374 return this.conditionStack.length;
375 },
376 options: { "case-insensitive": !0 },
377 performAction: function(s, l, i, _) {
378 switch (i) {
379 case 0:
380 return this.begin("open_directive"), 19;
381 case 1:
382 return this.begin("type_directive"), 20;
383 case 2:
384 return this.popState(), this.begin("arg_directive"), 12;
385 case 3:
386 return this.popState(), this.popState(), 22;
387 case 4:
388 return 21;
389 case 5:
390 return "title";
391 case 6:
392 return this.begin("acc_title"), 14;
393 case 7:
394 return this.popState(), "acc_title_value";
395 case 8:
396 return this.begin("acc_descr"), 16;
397 case 9:
398 return this.popState(), "acc_descr_value";
399 case 10:
400 this.begin("acc_descr_multiline");
401 break;
402 case 11:
403 this.popState();
404 break;
405 case 12:
406 return "acc_descr_multiline_value";
407 case 13:
408 return 5;
409 case 14:
410 break;
411 case 15:
412 break;
413 case 16:
414 break;
415 case 17:
416 return 8;
417 case 18:
418 return 6;
419 case 19:
420 return 28;
421 case 20:
422 return 39;
423 case 21:
424 return 31;
425 case 22:
426 return 30;
427 case 23:
428 return 33;
429 case 24:
430 return 35;
431 case 25:
432 return 37;
433 case 26:
434 return 40;
435 case 27:
436 return 41;
437 case 28:
438 return 42;
439 case 29:
440 return 43;
441 case 30:
442 return 44;
443 case 31:
444 return 45;
445 case 32:
446 return 46;
447 case 33:
448 return 47;
449 case 34:
450 return 48;
451 case 35:
452 return 49;
453 case 36:
454 return 50;
455 case 37:
456 return 51;
457 case 38:
458 return 52;
459 case 39:
460 return 53;
461 case 40:
462 return 64;
463 case 41:
464 return 65;
465 case 42:
466 return 66;
467 case 43:
468 return 67;
469 case 44:
470 return 68;
471 case 45:
472 return 69;
473 case 46:
474 return 70;
475 case 47:
476 return 56;
477 case 48:
478 return 58;
479 case 49:
480 return 60;
481 case 50:
482 return 63;
483 case 51:
484 return 62;
485 case 52:
486 this.begin("string");
487 break;
488 case 53:
489 this.popState();
490 break;
491 case 54:
492 return "qString";
493 case 55:
494 return l.yytext = l.yytext.trim(), 71;
495 }
496 },
497 rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\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, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
498 conditions: { acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, close_directive: { rules: [], inclusive: !1 }, arg_directive: { rules: [3, 4], inclusive: !1 }, type_directive: { rules: [2, 3], inclusive: !1 }, open_directive: { rules: [1], inclusive: !1 }, unqString: { rules: [], inclusive: !1 }, token: { rules: [], inclusive: !1 }, string: { rules: [53, 54], inclusive: !1 }, INITIAL: { rules: [0, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55], inclusive: !0 } }
499 };
500 return q;
501 }();
502 re.lexer = qe;
503 function ne() {
504 this.yy = {};
505 }
506 return ne.prototype = re, re.Parser = ne, new ne();
507}();
508he.parser = he;
509const Ge = he;
510let de = [], b = {}, G = {}, L = {}, z = {};
511const ze = {
512 REQUIREMENT: "Requirement",
513 FUNCTIONAL_REQUIREMENT: "Functional Requirement",
514 INTERFACE_REQUIREMENT: "Interface Requirement",
515 PERFORMANCE_REQUIREMENT: "Performance Requirement",
516 PHYSICAL_REQUIREMENT: "Physical Requirement",
517 DESIGN_CONSTRAINT: "Design Constraint"
518}, je = {
519 LOW_RISK: "Low",
520 MED_RISK: "Medium",
521 HIGH_RISK: "High"
522}, Xe = {
523 VERIFY_ANALYSIS: "Analysis",
524 VERIFY_DEMONSTRATION: "Demonstration",
525 VERIFY_INSPECTION: "Inspection",
526 VERIFY_TEST: "Test"
527}, Je = {
528 CONTAINS: "contains",
529 COPIES: "copies",
530 DERIVES: "derives",
531 SATISFIES: "satisfies",
532 VERIFIES: "verifies",
533 REFINES: "refines",
534 TRACES: "traces"
535}, Ze = function(e, t, a) {
536 Ue.parseDirective(this, e, t, a);
537}, et = (e, t) => (G[e] === void 0 && (G[e] = {
538 name: e,
539 type: t,
540 id: b.id,
541 text: b.text,
542 risk: b.risk,
543 verifyMethod: b.verifyMethod
544}), b = {}, G[e]), tt = () => G, it = (e) => {
545 b !== void 0 && (b.id = e);
546}, rt = (e) => {
547 b !== void 0 && (b.text = e);
548}, nt = (e) => {
549 b !== void 0 && (b.risk = e);
550}, st = (e) => {
551 b !== void 0 && (b.verifyMethod = e);
552}, at = (e) => (z[e] === void 0 && (z[e] = {
553 name: e,
554 type: L.type,
555 docRef: L.docRef
556}, ve.info("Added new requirement: ", e)), L = {}, z[e]), lt = () => z, ct = (e) => {
557 L !== void 0 && (L.type = e);
558}, ot = (e) => {
559 L !== void 0 && (L.docRef = e);
560}, ht = (e, t, a) => {
561 de.push({
562 type: e,
563 src: t,
564 dst: a
565 });
566}, ut = () => de, dt = () => {
567 de = [], b = {}, G = {}, L = {}, z = {}, Be();
568}, pt = {
569 RequirementType: ze,
570 RiskLevel: je,
571 VerifyType: Xe,
572 Relationships: Je,
573 parseDirective: Ze,
574 getConfig: () => xe().req,
575 addRequirement: et,
576 getRequirements: tt,
577 setNewReqId: it,
578 setNewReqText: rt,
579 setNewReqRisk: nt,
580 setNewReqVerifyMethod: st,
581 setAccTitle: Fe,
582 getAccTitle: Me,
583 setAccDescription: Pe,
584 getAccDescription: Ye,
585 addElement: at,
586 getElements: lt,
587 setNewElementType: ct,
588 setNewElementDocRef: ot,
589 addRelationship: ht,
590 getRelationships: ut,
591 clear: dt
592}, ft = (e) => `
593
594 marker {
595 fill: ${e.relationColor};
596 stroke: ${e.relationColor};
597 }
598
599 marker.cross {
600 stroke: ${e.lineColor};
601 }
602
603 svg {
604 font-family: ${e.fontFamily};
605 font-size: ${e.fontSize};
606 }
607
608 .reqBox {
609 fill: ${e.requirementBackground};
610 fill-opacity: 1.0;
611 stroke: ${e.requirementBorderColor};
612 stroke-width: ${e.requirementBorderSize};
613 }
614
615 .reqTitle, .reqLabel{
616 fill: ${e.requirementTextColor};
617 }
618 .reqLabelBox {
619 fill: ${e.relationLabelBackground};
620 fill-opacity: 1.0;
621 }
622
623 .req-title-line {
624 stroke: ${e.requirementBorderColor};
625 stroke-width: ${e.requirementBorderSize};
626 }
627 .relationshipLine {
628 stroke: ${e.relationColor};
629 stroke-width: 1;
630 }
631 .relationshipLabel {
632 fill: ${e.relationLabelColor};
633 }
634
635`, _t = ft, ue = {
636 CONTAINS: "contains",
637 ARROW: "arrow"
638}, yt = (e, t) => {
639 let a = e.append("defs").append("marker").attr("id", ue.CONTAINS + "_line_ending").attr("refX", 0).attr("refY", t.line_height / 2).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("g");
640 a.append("circle").attr("cx", t.line_height / 2).attr("cy", t.line_height / 2).attr("r", t.line_height / 2).attr("fill", "none"), a.append("line").attr("x1", 0).attr("x2", t.line_height).attr("y1", t.line_height / 2).attr("y2", t.line_height / 2).attr("stroke-width", 1), a.append("line").attr("y1", 0).attr("y2", t.line_height).attr("x1", t.line_height / 2).attr("x2", t.line_height / 2).attr("stroke-width", 1), e.append("defs").append("marker").attr("id", ue.ARROW + "_line_ending").attr("refX", t.line_height).attr("refY", 0.5 * t.line_height).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("path").attr(
641 "d",
642 `M0,0
643 L${t.line_height},${t.line_height / 2}
644 M${t.line_height},${t.line_height / 2}
645 L0,${t.line_height}`
646 ).attr("stroke-width", 1);
647}, Ae = {
648 ReqMarkers: ue,
649 insertLineEndings: yt
650};
651let y = {}, Ne = 0;
652const we = (e, t) => e.insert("rect", "#" + t).attr("class", "req reqBox").attr("x", 0).attr("y", 0).attr("width", y.rect_min_width + "px").attr("height", y.rect_min_height + "px"), Ve = (e, t, a) => {
653 let c = y.rect_min_width / 2, d = e.append("text").attr("class", "req reqLabel reqTitle").attr("id", t).attr("x", c).attr("y", y.rect_padding).attr("dominant-baseline", "hanging"), u = 0;
654 a.forEach((g) => {
655 u == 0 ? d.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", 0).text(g) : d.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", y.line_height * 0.75).text(g), u++;
656 });
657 let p = 1.5 * y.rect_padding, h = u * y.line_height * 0.75, o = p + h;
658 return e.append("line").attr("class", "req-title-line").attr("x1", "0").attr("x2", y.rect_min_width).attr("y1", o).attr("y2", o), {
659 titleNode: d,
660 y: o
661 };
662}, $e = (e, t, a, c) => {
663 let d = e.append("text").attr("class", "req reqLabel").attr("id", t).attr("x", y.rect_padding).attr("y", c).attr("dominant-baseline", "hanging"), u = 0;
664 const p = 30;
665 let h = [];
666 return a.forEach((o) => {
667 let g = o.length;
668 for (; g > p && u < 3; ) {
669 let R = o.substring(0, p);
670 o = o.substring(p, o.length), g = o.length, h[h.length] = R, u++;
671 }
672 if (u == 3) {
673 let R = h[h.length - 1];
674 h[h.length - 1] = R.substring(0, R.length - 4) + "...";
675 } else
676 h[h.length] = o;
677 u = 0;
678 }), h.forEach((o) => {
679 d.append("tspan").attr("x", y.rect_padding).attr("dy", y.line_height).text(o);
680 }), d;
681}, gt = (e, t, a, c) => {
682 const d = t.node().getTotalLength(), u = t.node().getPointAtLength(d * 0.5), p = "rel" + Ne;
683 Ne++;
684 const o = e.append("text").attr("class", "req relationshipLabel").attr("id", p).attr("x", u.x).attr("y", u.y).attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(c).node().getBBox();
685 e.insert("rect", "#" + p).attr("class", "req reqLabelBox").attr("x", u.x - o.width / 2).attr("y", u.y - o.height / 2).attr("width", o.width).attr("height", o.height).attr("fill", "white").attr("fill-opacity", "85%");
686}, Et = function(e, t, a, c, d) {
687 const u = a.edge(W(t.src), W(t.dst)), p = Ke().x(function(o) {
688 return o.x;
689 }).y(function(o) {
690 return o.y;
691 }), h = e.insert("path", "#" + c).attr("class", "er relationshipLine").attr("d", p(u.points)).attr("fill", "none");
692 t.type == d.db.Relationships.CONTAINS ? h.attr(
693 "marker-start",
694 "url(" + Te.getUrl(y.arrowMarkerAbsolute) + "#" + t.type + "_line_ending)"
695 ) : (h.attr("stroke-dasharray", "10,7"), h.attr(
696 "marker-end",
697 "url(" + Te.getUrl(y.arrowMarkerAbsolute) + "#" + Ae.ReqMarkers.ARROW + "_line_ending)"
698 )), gt(e, h, y, `<<${t.type}>>`);
699}, Rt = (e, t, a) => {
700 Object.keys(e).forEach((c) => {
701 let d = e[c];
702 c = W(c), ve.info("Added new requirement: ", c);
703 const u = a.append("g").attr("id", c), p = "req-" + c, h = we(u, p);
704 let o = Ve(u, c + "_title", [
705 `<<${d.type}>>`,
706 `${d.name}`
707 ]);
708 $e(
709 u,
710 c + "_body",
711 [
712 `Id: ${d.id}`,
713 `Text: ${d.text}`,
714 `Risk: ${d.risk}`,
715 `Verification: ${d.verifyMethod}`
716 ],
717 o.y
718 );
719 const g = h.node().getBBox();
720 t.setNode(c, {
721 width: g.width,
722 height: g.height,
723 shape: "rect",
724 id: c
725 });
726 });
727}, mt = (e, t, a) => {
728 Object.keys(e).forEach((c) => {
729 let d = e[c];
730 const u = W(c), p = a.append("g").attr("id", u), h = "element-" + u, o = we(p, h);
731 let g = Ve(p, h + "_title", ["<<Element>>", `${c}`]);
732 $e(
733 p,
734 h + "_body",
735 [`Type: ${d.type || "Not Specified"}`, `Doc Ref: ${d.docRef || "None"}`],
736 g.y
737 );
738 const R = o.node().getBBox();
739 t.setNode(u, {
740 width: R.width,
741 height: R.height,
742 shape: "rect",
743 id: u
744 });
745 });
746}, It = (e, t) => (e.forEach(function(a) {
747 let c = W(a.src), d = W(a.dst);
748 t.setEdge(c, d, { relationship: a });
749}), e), bt = function(e, t) {
750 t.nodes().forEach(function(a) {
751 a !== void 0 && t.node(a) !== void 0 && (e.select("#" + a), e.select("#" + a).attr(
752 "transform",
753 "translate(" + (t.node(a).x - t.node(a).width / 2) + "," + (t.node(a).y - t.node(a).height / 2) + " )"
754 ));
755 });
756}, W = (e) => e.replace(/\s/g, "").replace(/\./g, "_"), kt = (e, t, a, c) => {
757 y = xe().requirement, c.db.clear(), c.parser.parse(e);
758 const d = y.securityLevel;
759 let u;
760 d === "sandbox" && (u = oe("#i" + t));
761 const h = (d === "sandbox" ? oe(u.nodes()[0].contentDocument.body) : oe("body")).select(`[id='${t}']`);
762 Ae.insertLineEndings(h, y);
763 const o = new He({
764 multigraph: !1,
765 compound: !1,
766 directed: !0
767 }).setGraph({
768 rankdir: y.layoutDirection,
769 marginx: 20,
770 marginy: 20,
771 nodesep: 100,
772 edgesep: 100,
773 ranksep: 100
774 }).setDefaultEdgeLabel(function() {
775 return {};
776 });
777 let g = c.db.getRequirements(), R = c.db.getElements(), x = c.db.getRelationships();
778 Rt(g, o, h), mt(R, o, h), It(x, o), We(o), bt(h, o), x.forEach(function(N) {
779 Et(h, N, o, t, c);
780 });
781 const S = y.rect_padding, T = h.node().getBBox(), v = T.width + S * 2, A = T.height + S * 2;
782 Qe(h, A, v, y.useMaxWidth), h.attr("viewBox", `${T.x - S} ${T.y - S} ${v} ${A}`);
783}, St = {
784 draw: kt
785}, wt = {
786 parser: Ge,
787 db: pt,
788 renderer: St,
789 styles: _t
790};
791export {
792 wt as diagram
793};
794
\No newline at end of file