@uipath/rules-tool 0.0.0-stage → 1.204.0-preview.249

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 (139) hide show
  1. package/LICENSE.txt +3 -0
  2. package/README.md +80 -2
  3. package/dist/DmnFactory-SG3RP3T3-cr8e7mxz.js +8 -0
  4. package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +8 -0
  5. package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +8 -0
  6. package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +8 -0
  7. package/dist/business-rules-d51977r1.js +25 -0
  8. package/dist/business-rules-dekge24t.js +23 -0
  9. package/dist/business-rules-ew76mbwg.js +25 -0
  10. package/dist/business-rules-jmwx05k2.js +25 -0
  11. package/dist/business-rules-zpzqxyce.js +26 -0
  12. package/dist/constants-4r8pfr16.js +22 -0
  13. package/dist/constants-za5vbzp8.js +22 -0
  14. package/dist/embedded-file-reader-0228j82a.js +111 -0
  15. package/dist/embedded-file-reader-wmsg31a8.js +111 -0
  16. package/dist/first-party-service-1qa6cp4d.js +8 -0
  17. package/dist/first-party-service-28dkctkz.js +8 -0
  18. package/dist/first-party-service-4fsz3cnj.js +8 -0
  19. package/dist/first-party-service-ahcc6xc6.js +8 -0
  20. package/dist/first-party-service-y1ccmsvp.js +8 -0
  21. package/dist/first-party-service-zpr1q3nd.js +8 -0
  22. package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +12 -0
  23. package/dist/index-2zxy6zgp.js +23 -0
  24. package/dist/index-3nx77wfh.js +23 -0
  25. package/dist/index-43zg1wqe.js +19621 -0
  26. package/dist/index-47jera73.js +23 -0
  27. package/dist/index-70jn7cz1.js +19631 -0
  28. package/dist/index-7wc0g78k.js +14 -0
  29. package/dist/index-8kb5kc5y.js +24 -0
  30. package/dist/index-97yad7ms.js +8 -0
  31. package/dist/index-dfn83hxf.js +14 -0
  32. package/dist/index-e301h23h.js +24 -0
  33. package/dist/index-frd259yv.js +24 -0
  34. package/dist/index-gc7cw2jh.js +23 -0
  35. package/dist/index-gya2v502.js +8 -0
  36. package/dist/index-hb3gk1wf.js +24 -0
  37. package/dist/index-nsnfdqd5.js +24 -0
  38. package/dist/index-nzr4mx5p.js +614 -0
  39. package/dist/index-vffktc0w.js +166 -0
  40. package/dist/index-we6zjs66.js +164 -0
  41. package/dist/index-xymrydfw.js +3095 -0
  42. package/dist/index-z2qk2qn6.js +24 -0
  43. package/dist/index-zdwhfpt1.js +3071 -0
  44. package/dist/index-zecwgvg7.js +23 -0
  45. package/dist/index.js +16 -0
  46. package/dist/jmespath-ab6tdc42.js +1485 -0
  47. package/dist/js-yaml-a2bk27p6.js +3151 -0
  48. package/dist/rule-catalog-a5w86qns.js +43 -0
  49. package/dist/rule-catalog-etpf962f.js +69 -0
  50. package/dist/rule-catalog-q5cr17hf.js +58 -0
  51. package/dist/rule-catalog-vc98yg4n.js +43 -0
  52. package/dist/rule-catalog-z3h66kh5.js +56 -0
  53. package/dist/rules-command-error-10qmb5w7.js +13 -0
  54. package/dist/rules-command-error-5bdv4bcx.js +13 -0
  55. package/dist/rules-command-error-cmssf0w4.js +13 -0
  56. package/dist/rules-command-error-fsm3b1mv.js +13 -0
  57. package/dist/rules-debug-service-5rcdh3pj.js +192 -0
  58. package/dist/rules-debug-service-8q7mkd0r.js +199 -0
  59. package/dist/rules-debug-service-b9j29ejz.js +192 -0
  60. package/dist/rules-debug-service-h1ahd6p3.js +192 -0
  61. package/dist/rules-debug-service-v3jr3r1n.js +192 -0
  62. package/dist/rules-init-service-3c2yfa7p.js +687 -0
  63. package/dist/rules-init-service-3wgd9cqp.js +100 -0
  64. package/dist/rules-init-service-8fqytxq0.js +685 -0
  65. package/dist/rules-init-service-pspt7sje.js +100 -0
  66. package/dist/rules-init-service-sbtzw93j.js +102 -0
  67. package/dist/rules-init-service-x7paqa63.js +687 -0
  68. package/dist/rules-init-service-y678kjje.js +100 -0
  69. package/dist/rules-init-service-y7qzmxx0.js +102 -0
  70. package/dist/rules-refresh-service-4xxj6ex6.js +65 -0
  71. package/dist/rules-refresh-service-ba5jk1y9.js +65 -0
  72. package/dist/rules-refresh-service-btn64j8j.js +65 -0
  73. package/dist/rules-refresh-service-qkmphj53.js +65 -0
  74. package/dist/rules-validate-service-dmgnfne7.js +60 -0
  75. package/dist/rules-validate-service-hk2d006t.js +60 -0
  76. package/dist/rules-validate-service-sppr4x13.js +60 -0
  77. package/dist/rules-validate-service-xp05n2d9.js +60 -0
  78. package/dist/tool-0bthsb3x.js +55 -0
  79. package/dist/tool-1dycs173.js +4014 -0
  80. package/dist/tool-1pkqxwwd.js +17472 -0
  81. package/dist/tool-24mr6g8c.js +1556 -0
  82. package/dist/tool-2trg1fpx.js +40 -0
  83. package/dist/tool-39fmkx2d.js +611 -0
  84. package/dist/tool-3e2q1x2y.js +6578 -0
  85. package/dist/tool-3j0747gg.js +17077 -0
  86. package/dist/tool-4z7zcq4z.js +6058 -0
  87. package/dist/tool-56smnjrh.js +73 -0
  88. package/dist/tool-5qygptrc.js +6171 -0
  89. package/dist/tool-5xx6x8pe.js +6596 -0
  90. package/dist/tool-6rp0gx98.js +6578 -0
  91. package/dist/tool-6sqt4zrx.js +571 -0
  92. package/dist/tool-7fkrd618.js +1556 -0
  93. package/dist/tool-7xmarr97.js +17077 -0
  94. package/dist/tool-89xzeteg.js +361 -0
  95. package/dist/tool-8j9f6ns5.js +6396 -0
  96. package/dist/tool-911s9czz.js +570 -0
  97. package/dist/tool-97x3zjcm.js +709 -0
  98. package/dist/tool-9bz2x04j.js +40 -0
  99. package/dist/tool-akh7nnqs.js +704 -0
  100. package/dist/tool-axfzew45.js +1555 -0
  101. package/dist/tool-b71jq9pt.js +389 -0
  102. package/dist/tool-bfj846v8.js +141 -0
  103. package/dist/tool-bvmc017m.js +96 -0
  104. package/dist/tool-bykz5ryf.js +454 -0
  105. package/dist/tool-c76qb8ap.js +17052 -0
  106. package/dist/tool-ca15515v.js +570 -0
  107. package/dist/tool-e1mmqsjr.js +11048 -0
  108. package/dist/tool-epsr41wx.js +48 -0
  109. package/dist/tool-f9qs255w.js +70 -0
  110. package/dist/tool-fbqnqf9k.js +10 -0
  111. package/dist/tool-ga79rety.js +389 -0
  112. package/dist/tool-gb547mcn.js +141 -0
  113. package/dist/tool-gta9rr4h.js +68 -0
  114. package/dist/tool-h2dfnxdq.js +6486 -0
  115. package/dist/tool-hg6vr5y9.js +3769 -0
  116. package/dist/tool-hgvnm4vh.js +1843 -0
  117. package/dist/tool-hjbf9aay.js +571 -0
  118. package/dist/tool-k2s349kn.js +108 -0
  119. package/dist/tool-k5jm64n3.js +5650 -0
  120. package/dist/tool-ketztpgf.js +73 -0
  121. package/dist/tool-mm1x18d6.js +537 -0
  122. package/dist/tool-n1d88ryb.js +6396 -0
  123. package/dist/tool-nmqpwh9m.js +6166 -0
  124. package/dist/tool-pb80pswx.js +73 -0
  125. package/dist/tool-pcsgwpfw.js +40 -0
  126. package/dist/tool-q3c1bjyb.js +454 -0
  127. package/dist/tool-rwp1skmf.js +40 -0
  128. package/dist/tool-s3fbt22r.js +454 -0
  129. package/dist/tool-tmbst1r8.js +68 -0
  130. package/dist/tool-v6w109p0.js +455 -0
  131. package/dist/tool-vyx8fpft.js +46 -0
  132. package/dist/tool-w2js05qv.js +389 -0
  133. package/dist/tool-x67kek1m.js +1838 -0
  134. package/dist/tool-x89947ah.js +17052 -0
  135. package/dist/tool-xhksjdka.js +4005 -0
  136. package/dist/tool-yv3t4gg5.js +108 -0
  137. package/dist/tool-zbyb1ttx.js +5650 -0
  138. package/dist/tool.js +11 -0
  139. package/package.json +43 -5
@@ -0,0 +1,704 @@
1
+ import {
2
+ m,
3
+ _t,
4
+ Is,
5
+ Ft,
6
+ bs,
7
+ Ot,
8
+ hs
9
+ } from "./tool-e1mmqsjr.js";
10
+ import {
11
+ V,
12
+ H,
13
+ K,
14
+ s,
15
+ C,
16
+ v,
17
+ W,
18
+ B
19
+ } from "./tool-xhksjdka.js";
20
+
21
+ // ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-AYVRFIAU.js
22
+ function M(e) {
23
+ return ("variable" in e ? e.variable?.["@_name"] : undefined) || e["@_name"];
24
+ }
25
+ function ie(e) {
26
+ let [n = "", ...r] = e.split(/[^\p{L}\p{N}_]+/u).filter(Boolean), t = [n.charAt(0).toLowerCase() + n.slice(1), ...r.map((o) => o.charAt(0).toUpperCase() + o.slice(1))].join("") || "element";
27
+ return /^[\p{L}_]/u.test(t) ? t : `_${t}`;
28
+ }
29
+ function P(e, n) {
30
+ let r = new Set((e.drgElement ?? []).map(M)), i = ie(n);
31
+ if (!r.has(i))
32
+ return i;
33
+ for (let t = 2;; t++) {
34
+ let o = `${i}${t}`;
35
+ if (!r.has(o))
36
+ return o;
37
+ }
38
+ }
39
+ function re(e, n) {
40
+ if (n.length === 0)
41
+ return;
42
+ let r = "expression" in e ? e.expression : undefined, i = (t, o) => {
43
+ if (t === undefined)
44
+ return;
45
+ let s = n.reduce((a, [l, f, c]) => c === "callee" ? V(a, l, f, o) : K(a, l, f, o), t);
46
+ return s === t ? undefined : s;
47
+ };
48
+ if (r?.__$$element === "literalExpression") {
49
+ let t = i(r.text?.__$$text, "expression");
50
+ t !== undefined && (r.text = { ...r.text, __$$text: t });
51
+ return;
52
+ }
53
+ if (r?.__$$element === "decisionTable") {
54
+ for (let t of r.input ?? []) {
55
+ let o = i(t.inputExpression.text?.__$$text, "expression");
56
+ o !== undefined && (t.inputExpression.text = { ...t.inputExpression.text, __$$text: o });
57
+ let s = t.inputValues && i(t.inputValues.text?.__$$text, "unaryTests");
58
+ t.inputValues && s !== undefined && (t.inputValues.text = { ...t.inputValues.text, __$$text: s });
59
+ }
60
+ for (let t of r.output ?? []) {
61
+ let o = t.outputValues && i(t.outputValues.text?.__$$text, "unaryTests");
62
+ t.outputValues && o !== undefined && (t.outputValues.text = { ...t.outputValues.text, __$$text: o });
63
+ }
64
+ for (let t of r.rule ?? []) {
65
+ for (let o of t.inputEntry ?? []) {
66
+ let s = i(o.text?.__$$text, "unaryTests");
67
+ s !== undefined && (o.text = { ...o.text, __$$text: s });
68
+ }
69
+ for (let o of t.outputEntry ?? []) {
70
+ let s = i(o.text?.__$$text, "expression");
71
+ s !== undefined && (o.text = { ...o.text, __$$text: s });
72
+ }
73
+ }
74
+ }
75
+ }
76
+ var oe = "http://uipath.com/schema/1.0/business-rules/uninitialized";
77
+ var se = "business-rule-uninitialized";
78
+ var it = `<?xml version="1.0" encoding="UTF-8"?>
79
+ <definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" id="${se}" name="" namespace="${oe}" />
80
+ `;
81
+ var Se = `<?xml version="1.0" encoding="UTF-8"?>
82
+ <definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:kie="https://kie.org/dmn/extensions/1.0" id="definitions_1" name="definitions" namespace="http://uipath.com/schema/1.0/dmn">
83
+ <decision id="decision_1" name="">
84
+ <decisionTable id="decisionTable_1">
85
+ <input id="input1" label="">
86
+ <inputExpression id="inputExpression1" typeRef="string">
87
+ <text></text>
88
+ </inputExpression>
89
+ </input>
90
+ <output id="output1" label="" name="" typeRef="string" />
91
+ </decisionTable>
92
+ </decision>
93
+ <dmndi:DMNDI>
94
+ <dmndi:DMNDiagram id="DMNDiagram_1">
95
+ <dmndi:DMNShape id="DMNShape_1" dmnElementRef="decision_1">
96
+ <dc:Bounds height="80" width="180" x="0" y="0" />
97
+ </dmndi:DMNShape>
98
+ </dmndi:DMNDiagram>
99
+ </dmndi:DMNDI>
100
+ </definitions>
101
+ `;
102
+ var Ae = ["FIRST", "UNIQUE", "PRIORITY", "ANY", "COLLECT", "RULE ORDER", "OUTPUT ORDER"];
103
+ var ve = ["SUM", "MIN", "MAX", "COUNT"];
104
+ var ot = ["string", "number", "boolean", "Any", "date", "time", "date and time", "dayTimeDuration", "yearMonthDuration"];
105
+ var ae = "http://uipath.com/schema/1.0/dmn/authoring";
106
+ var Le = "uipath";
107
+ var q = "authoring";
108
+ var sn = ["condition-rule", "decision-table", "decision-graph"];
109
+ var an = ["condition-rule", "decision-table", "literal-expression"];
110
+ var Pe = new Set(sn);
111
+ var dn = new Set(an);
112
+ function qe(e) {
113
+ return Object.entries(e.definitions).flatMap(([n, r]) => r === ae && (n === "@_xmlns" || n.startsWith("@_xmlns:")) ? [n === "@_xmlns" ? "" : `${n.slice(8)}:`] : []);
114
+ }
115
+ function O(e, n) {
116
+ let r = e?.[n === "" ? "@_xmlns" : `@_xmlns:${n.slice(0, -1)}`];
117
+ return r !== undefined && r !== ae;
118
+ }
119
+ function Oe(e, n) {
120
+ let r = n.extensionElements;
121
+ for (let i of qe(e)) {
122
+ if (O(r, i))
123
+ continue;
124
+ let t = `${i}${q}`, o = r?.[t];
125
+ if (o && !O(Array.isArray(o) ? o[0] : o, i))
126
+ return { key: t, entry: o };
127
+ }
128
+ }
129
+ function de(e, n) {
130
+ let r = Oe(e, n)?.entry;
131
+ return Array.isArray(r) ? r[0] : r;
132
+ }
133
+ function un(e, n) {
134
+ let { definitions: r } = e, i = Le, t = 2;
135
+ for (;r[`@_xmlns:${i}`] || O(n, `${i}:`) || n[`${i}:${q}`] !== undefined; )
136
+ i = `${Le}${t++}`;
137
+ return r[`@_xmlns:${i}`] = ae, `${i}:`;
138
+ }
139
+ function cn(e, n) {
140
+ return qe(e).filter((i) => !O(n, i)).map((i) => `${i}${q}`).find((i) => n[i] === undefined) ?? `${un(e, n)}${q}`;
141
+ }
142
+ function Ce(e, n, r, i) {
143
+ let t = Oe(e, n), o = n.extensionElements ?? {};
144
+ n.extensionElements = o;
145
+ let s = t?.key ?? cn(e, o), a = o[s], f = { ...Array.isArray(a) ? a[0] : a, [r]: i };
146
+ Array.isArray(a) ? a[0] = f : o[s] = f;
147
+ }
148
+ function ke(e) {
149
+ let n = de(e, e.definitions)?.["@_surface"];
150
+ return typeof n == "string" && Pe.has(n) ? n : undefined;
151
+ }
152
+ function Ve(e) {
153
+ let n = de(e, e.definitions)?.["@_surface"];
154
+ return typeof n != "string" || Pe.has(n);
155
+ }
156
+ function Ue(e, n) {
157
+ let r = de(e, n)?.["@_editor"];
158
+ return typeof r != "string" || dn.has(r);
159
+ }
160
+ function Be(e, n) {
161
+ Ce(e, e.definitions, "@_surface", n);
162
+ }
163
+ function Fe(e, n, r) {
164
+ Ce(e, n, "@_editor", r);
165
+ }
166
+ var x = { nodeWidth: 288, nodeHeight: 96, horizontalGap: 48, verticalGap: 72 };
167
+ var ue = x.nodeHeight + x.verticalGap;
168
+ var C2 = x.nodeWidth + x.horizontalGap;
169
+ var je = x.nodeWidth * 0.75;
170
+ function ln(e, n) {
171
+ return !(e.x + e.width + x.horizontalGap <= n.x || n.x + n.width + x.horizontalGap <= e.x || e.y + e.height + x.verticalGap <= n.y || n.y + n.height + x.verticalGap <= e.y);
172
+ }
173
+ function mn(e, n) {
174
+ let r = ({ x: o, y: s }) => [Math.abs(o) + Math.abs(s), Math.abs(s), -o, -s], [i, t] = [r(e), r(n)];
175
+ for (let [o, s] of i.entries())
176
+ if (s !== t[o])
177
+ return s - t[o];
178
+ return 0;
179
+ }
180
+ function fn(e) {
181
+ let n = [];
182
+ for (let r = -e;r <= e; r++)
183
+ for (let i = -e;i <= e; i++)
184
+ (Math.abs(r) === e || Math.abs(i) === e) && n.push({ x: r, y: i });
185
+ return n.sort(mn);
186
+ }
187
+ function ze(e, n) {
188
+ let r = ({ x: i, y: t }) => !n.some((o) => ln({ x: i, y: t, width: x.nodeWidth, height: x.nodeHeight }, o));
189
+ if (r(e))
190
+ return e;
191
+ for (let i = 1;i <= n.length; i++)
192
+ for (let t of fn(i)) {
193
+ let o = { x: e.x + t.x * C2, y: e.y + t.y * ue };
194
+ if (r(o))
195
+ return o;
196
+ }
197
+ return { x: Math.max(...n.map((i) => i.x + i.width)) + x.horizontalGap, y: e.y };
198
+ }
199
+ var pn = "https://www.omg.org/spec/DMN/20230324/MODEL/";
200
+ function Dn(e) {
201
+ return e.__$$element === "decision";
202
+ }
203
+ function R(e) {
204
+ return (e.drgElement ?? []).filter(Dn);
205
+ }
206
+ function g(e) {
207
+ return e["@_id"] ?? "";
208
+ }
209
+ function D(e, n) {
210
+ return e["@_id"] || (e["@_id"] = s(n)), e["@_id"];
211
+ }
212
+ function h(e) {
213
+ if (e)
214
+ return e.startsWith("#") ? e.slice(1) : e.includes("#") || e.includes(":") || e.includes("/") ? undefined : e;
215
+ }
216
+ function ce(e, n, r) {
217
+ if (!e)
218
+ return;
219
+ if (!e.includes(":"))
220
+ return e.includes("#") || e.includes("/") ? undefined : e;
221
+ let [i, t, ...o] = e.split(":");
222
+ if (!i || !t || o.length > 0)
223
+ return;
224
+ let s = `@_xmlns:${i}`, a = r.map((l) => l[s]).find((l) => typeof l == "string");
225
+ return a === pn || a === n["@_namespace"] ? t : undefined;
226
+ }
227
+ function gn(e, n, r) {
228
+ let i = r.indexOf(":");
229
+ if (i >= 0)
230
+ return `${r.slice(0, i)}:${e}`;
231
+ let t = n["@_namespace"];
232
+ if (!t || n["@_xmlns"] === t)
233
+ return e;
234
+ let o = Object.entries(n).find(([l, f]) => l.startsWith("@_xmlns:") && f === t)?.[0];
235
+ if (o)
236
+ return `${o.slice(8)}:${e}`;
237
+ let s = "tns", a = 2;
238
+ for (;n[`@_xmlns:${s}`]; )
239
+ s = `tns${a++}`;
240
+ return n[`@_xmlns:${s}`] = t, `${s}:${e}`;
241
+ }
242
+ function He(e, n, r) {
243
+ let i = e["dmndi:DMNDI"];
244
+ if (i)
245
+ for (let t of i["dmndi:DMNDiagram"] ?? [])
246
+ t["dmndi:DMNDiagramElement"] = t["dmndi:DMNDiagramElement"]?.flatMap((o) => {
247
+ let s = o["@_dmnElementRef"], a = ce(s, e, [o, t, i, e]);
248
+ if (!a)
249
+ return [o];
250
+ let l = r?.get(a);
251
+ return l ? [{ ...o, "@_dmnElementRef": gn(l, e, s ?? "") }] : n.has(a) ? [] : [o];
252
+ });
253
+ }
254
+ function Ge(e, n) {
255
+ return e.drgElement?.find((i) => i["@_id"] === n)?.__$$element === "inputData" ? je : x.nodeWidth;
256
+ }
257
+ function _n(e, n, r) {
258
+ return { __$$element: "dmndi:DMNShape", "@_id": s("DMNShape"), "@_dmnElementRef": n, "dc:Bounds": { "@_x": r.x, "@_y": r.y, "@_width": Ge(e, n), "@_height": x.nodeHeight } };
259
+ }
260
+ function Ke(e, n) {
261
+ return e.drgElement?.find((r) => r["@_id"] === n)?.__$$element;
262
+ }
263
+ function xn(e) {
264
+ return e["dc:Bounds"];
265
+ }
266
+ function En(e, n) {
267
+ let r = e["dmndi:DMNDI"];
268
+ return r ? (r["dmndi:DMNDiagram"] ?? []).flatMap((i) => (i["dmndi:DMNDiagramElement"] ?? []).flatMap((t) => {
269
+ let o = xn(t), s = ce(t["@_dmnElementRef"], e, [t, i, r, e]);
270
+ return !o || n && s === n ? [] : [{ x: o["@_x"], y: o["@_y"], width: Ge(e, s ?? ""), height: Math.max(o["@_height"] ?? 0, x.nodeHeight), kind: s ? Ke(e, s) : undefined }];
271
+ })) : [];
272
+ }
273
+ function yn(e, n) {
274
+ let r = En(e);
275
+ return r.length === 0 ? { x: 0, y: 0 } : ze(bn(e, r, n), r);
276
+ }
277
+ function bn(e, n, r) {
278
+ if (r && Ke(e, r) === "inputData") {
279
+ let i = n.filter((t) => t.kind === "inputData");
280
+ if (i.length > 0) {
281
+ let t = i.reduce((o, s) => s.x > o.x ? s : o, i[0]);
282
+ return { x: t.x + C2, y: t.y };
283
+ }
284
+ return { x: Math.min(...n.map((t) => t.x)), y: Math.max(...n.map((t) => t.y)) + ue };
285
+ }
286
+ return { x: Math.max(...n.map((i) => i.x)) + C2, y: Math.min(...n.map((i) => i.y)) };
287
+ }
288
+ function We(e, n) {
289
+ let r = e["dmndi:DMNDI"]?.["dmndi:DMNDiagram"]?.[0]?.["dmndi:DMNDiagramElement"];
290
+ r?.length && r.push(_n(e, n, yn(e, n)));
291
+ }
292
+ var hn = "FIRST";
293
+ function $n(e = "string") {
294
+ return { __$$element: "decisionTable", "@_id": s("decisionTable"), "@_hitPolicy": hn, input: [{ "@_id": s("input"), "@_label": "Input 1", inputExpression: { "@_id": s("inputExpression"), "@_typeRef": "string", text: { __$$text: "" } } }], output: [{ "@_id": s("output"), "@_label": "Output 1", "@_name": "output1", "@_typeRef": e }], rule: [{ "@_id": s("rule"), inputEntry: [{ "@_id": s("inputEntry"), text: { __$$text: "-" } }], outputEntry: [{ "@_id": s("outputEntry"), text: { __$$text: "" } }] }] };
295
+ }
296
+ function Rn(e) {
297
+ return { __$$element: "literalExpression", "@_id": s("literalExpression"), ...e ? { "@_typeRef": e } : {}, text: { __$$text: "" } };
298
+ }
299
+ var In = { decisionTable: { editor: "decision-table", create: $n, labelKey: "drd_logic_decision_table", icon: "table" }, literalExpression: { editor: "literal-expression", create: Rn, labelKey: "drd_logic_literal_expression", icon: "braces" } };
300
+ var Dt = Object.keys(In);
301
+ function le(e, n, r) {
302
+ let i = Mn(r);
303
+ for (let t of e.drgElement ?? [])
304
+ t["@_id"] !== n && re(t, i);
305
+ }
306
+ function Mn(e) {
307
+ let n = new Map(e), r = [];
308
+ for (;n.size > 0; ) {
309
+ let i = [...n].find(([, t]) => !n.has(t));
310
+ if (!i)
311
+ return [...r, ...n];
312
+ r.push(i), n.delete(i[0]);
313
+ }
314
+ return r;
315
+ }
316
+ var Ye = ["informationRequirement", "knowledgeRequirement", "authorityRequirement"];
317
+ function Qe(e, n) {
318
+ let r = new Map((e.drgElement ?? []).map((o) => [o["@_id"] ?? "", o])), i = new Set, t = [n];
319
+ for (;t.length > 0; ) {
320
+ let o = r.get(t.shift() ?? "");
321
+ if (!o)
322
+ continue;
323
+ let s = [...o.informationRequirement ?? [], ...o.knowledgeRequirement ?? [], ...o.authorityRequirement ?? []];
324
+ for (let a of s) {
325
+ let l = a.requiredInput?.["@_href"] ?? a.requiredDecision?.["@_href"] ?? a.requiredKnowledge?.["@_href"] ?? a.requiredAuthority?.["@_href"], f = h(l);
326
+ !f || i.has(f) || (i.add(f), t.push(f));
327
+ }
328
+ }
329
+ return i;
330
+ }
331
+ var wn = new Set([..._t.map((e) => m[e]), "feel"]);
332
+ function T(e) {
333
+ return !!e && !wn.has(e);
334
+ }
335
+ function I(e) {
336
+ return e?.__$$text ?? "";
337
+ }
338
+ function y2(e, n) {
339
+ return { ...e, __$$text: n };
340
+ }
341
+ function V2(e, n, r) {
342
+ let i = D(n, r);
343
+ return e.has(i) && (n["@_id"] = s(r), i = n["@_id"]), e.add(i), i;
344
+ }
345
+ function N(e) {
346
+ return !(e.import?.length || e.elementCollection?.length || e.businessContextElement?.length || [e["@_expressionLanguage"], e["@_typeLanguage"]].some(T));
347
+ }
348
+ function U(e) {
349
+ return !(e.supportedObjective?.length || e.impactedPerformanceIndicator?.length || e.decisionMaker?.length || e.decisionOwner?.length || e.usingProcess?.length || e.usingTask?.length);
350
+ }
351
+ function Tn(e) {
352
+ let n = "expression" in e ? e.expression : undefined, r = n?.__$$element === "decisionTable" ? n.output ?? [] : [];
353
+ if (W(r.length))
354
+ return r.map((i, t) => ({ name: v({ id: i["@_id"] ?? "", label: i["@_label"], name: i["@_name"] }, t), typeRef: i["@_typeRef"] }));
355
+ }
356
+ function B2(e, n) {
357
+ let r = new Set([...(n.informationRequirement ?? []).map((t) => t.requiredDecision?.["@_href"]), ...(n.knowledgeRequirement ?? []).map((t) => t.requiredKnowledge?.["@_href"])].flatMap((t) => {
358
+ let o = h(t);
359
+ return o ? [o] : [];
360
+ })), i = g(n);
361
+ return (e.drgElement ?? []).flatMap((t) => {
362
+ let o = g(t), s = !r.has(o) && o !== i && t.__$$element === "decision" && !Qe(e, o).has(i);
363
+ if (!r.has(o) && !s)
364
+ return [];
365
+ let a = t.variable, l = a?.["@_name"] ?? t["@_name"];
366
+ return l ? [{ name: l, ...t["@_label"] && t["@_label"] !== l ? { label: t["@_label"] } : {}, typeRef: a?.["@_typeRef"], ...s ? { requirableId: o } : {}, members: Tn(t) }] : [];
367
+ });
368
+ }
369
+ function S2(e) {
370
+ let n = new Set;
371
+ for (let [r, i] of e)
372
+ if (r)
373
+ for (let t of H(r, i))
374
+ n.add(t.split(".")[0]);
375
+ return n;
376
+ }
377
+ function k(e) {
378
+ return e.variable?.["@_name"] ?? e["@_name"];
379
+ }
380
+ function F(e, n, r) {
381
+ return e.map((i) => {
382
+ let t = D(i, "inputData"), o = n.get(t), s2 = i.variable?.["@_name"] ?? i["@_name"];
383
+ return { id: t, name: i["@_name"], label: i["@_label"], variableId: i.variable ? D(i.variable, "variable") : s("variable"), variableName: i.variable?.["@_name"], typeRef: i.variable?.["@_typeRef"], requirementId: o ? D(o, "informationRequirement") : undefined, requirementFromSource: !!o && !r.has(s2) };
384
+ });
385
+ }
386
+ function A(e) {
387
+ let n = new Map;
388
+ for (let r of e.informationRequirement ?? []) {
389
+ let i = h(r.requiredInput?.["@_href"]);
390
+ i && n.set(i, r);
391
+ }
392
+ return n;
393
+ }
394
+ function Nn(e, n) {
395
+ let r = e?.variable || n.variableId || n.variableName !== undefined || n.typeRef !== undefined ? { ...e?.variable, "@_id": n.variableId, "@_name": n.variableName ?? n.name, "@_typeRef": n.typeRef } : undefined;
396
+ return { ...e ?? { __$$element: "inputData", "@_name": n.name }, __$$element: "inputData", "@_id": n.id, "@_name": n.name, "@_label": n.label, variable: r };
397
+ }
398
+ function j(e, n) {
399
+ return e.variable || n.variableId || n.variableName !== undefined || n.variableTypeRef !== undefined ? { ...e.variable, "@_id": n.variableId, "@_name": n.variableName ?? n.name, "@_typeRef": n.variableTypeRef } : undefined;
400
+ }
401
+ function z(e, n, r) {
402
+ let i = new Map(e.informationRequirement?.map((u) => [g(u), u]) ?? []), t = A(e), o = (e.informationRequirement ?? []).filter((u) => u.requiredDecision), s2 = (n.scopeVariables ?? []).filter((u) => u.requirableId), a = s2.length > 0 ? r() : new Set, l = new Set(o.flatMap((u) => h(u.requiredDecision?.["@_href"]) ?? [])), f = s2.flatMap((u) => a.has(u.name) && !l.has(u.requirableId ?? "") ? [{ "@_id": s("informationRequirement"), requiredDecision: { "@_href": `#${u.requirableId}` } }] : []), c = n.inputData.flatMap((u) => {
403
+ if (!u.requirementId)
404
+ return [];
405
+ let m = i.get(u.requirementId) ?? t.get(u.id);
406
+ return [{ ...m, "@_id": u.requirementId, requiredDecision: undefined, requiredInput: { ...m?.requiredInput, "@_href": `#${u.id}` } }];
407
+ });
408
+ return [...o, ...f, ...c];
409
+ }
410
+ function H2(e) {
411
+ let n = new Map;
412
+ for (let r of e.drgElement ?? []) {
413
+ let i = r, t = i["@_name"];
414
+ if (!t || i["@_label"] || !/\s/.test(t))
415
+ continue;
416
+ let o = i.variable?.["@_name"], s = o && !/\s/.test(o) ? o : P(e, t);
417
+ i["@_label"] = t, i["@_name"] = s, i.variable && (i.variable["@_name"] = s), t !== s && n.set(t, s);
418
+ }
419
+ for (let r of e.drgElement ?? []) {
420
+ let i = r, t = i["@_name"], o = i.variable?.["@_name"];
421
+ !t || !o || o === t || o !== t.replace(/\s+/g, "") || (n.set(o, t), i.variable && (i.variable["@_name"] = t));
422
+ }
423
+ n.size > 0 && le(e, "", n);
424
+ }
425
+ function Sn(e, n, r, i) {
426
+ let t = [];
427
+ if (r.size === 0 && i.size === 0 || (i.size > 0 && le(e, n, i), r.size === 0))
428
+ return t;
429
+ for (let o of e.drgElement ?? [])
430
+ o.__$$element !== "decision" || g(o) === n || !o.informationRequirement || (o.informationRequirement = o.informationRequirement.filter((s) => {
431
+ let a = h(s.requiredInput?.["@_href"]);
432
+ return !a || !r.has(a) ? true : (t.push(g(s)), false);
433
+ }));
434
+ return t;
435
+ }
436
+ function G(e, n, r) {
437
+ let i = structuredClone(e.document), t = i.definitions, o = t.drgElement?.find((d) => d.__$$element === "decision" && g(d) === e.sourceDecisionId);
438
+ if (!o)
439
+ throw new Error("Business rule decision is missing");
440
+ let s = new Set(e.sourceInputDataIds), a = t.drgElement?.filter((d) => d.__$$element === "inputData" && s.has(g(d))) ?? [], l = new Map(a.map((d) => [g(d), d])), f = new Map(a.flatMap((d) => d.variable?.["@_id"] ? [[d.variable["@_id"], d]] : [])), c = n.inputData.map((d) => {
441
+ let E = l.get(d.id) ?? (d.variableId ? f.get(d.variableId) : undefined);
442
+ return { current: E, inputId: d.id, updated: Nn(E, d) };
443
+ }), u = new Map(c.flatMap(({ current: d, updated: E }) => d?.["@_id"] ? [[d["@_id"], E]] : [])), m = c.flatMap(({ current: d, updated: E }) => d ? [] : [E]), b = r(o, n), L = new Set((o.informationRequirement ?? []).filter((d) => !d.requiredDecision).map(g)), fe = new Set(n.inputData.map((d) => d.requirementId).filter((d) => !!d)), pe = new Set([...[...L].filter((d) => !fe.has(d)), ...a.map(g).filter((d) => !u.has(d))]), p = new Map;
444
+ o["@_id"] && o["@_id"] !== n.decision.id && p.set(o["@_id"], n.decision.id);
445
+ for (let { current: d, inputId: E } of c)
446
+ d?.["@_id"] && d["@_id"] !== E && p.set(d["@_id"], E);
447
+ t["@_id"] = n.id, t["@_name"] = n.name, t["@_namespace"] = n.namespace, t["@_exporter"] = n.exporter, t["@_exporterVersion"] = n.exporterVersion;
448
+ let $ = new Set(a.map(g).filter((d) => !u.has(d))), De = new Map(c.flatMap(({ current: d, updated: E }) => {
449
+ let w = d && k(d), Q = k(E);
450
+ return w && Q && w !== Q ? [[w, Q]] : [];
451
+ })), W = k(o), Y = k(b);
452
+ W && Y && W !== Y && De.set(W, Y), t.drgElement = t.drgElement?.flatMap((d) => {
453
+ let E = g(d);
454
+ if (E === e.sourceDecisionId)
455
+ return [...m, b];
456
+ if (s.has(E)) {
457
+ let w = u.get(E);
458
+ return w ? [w] : [];
459
+ }
460
+ return [d];
461
+ });
462
+ let rn = Sn(t, e.sourceDecisionId, $, De);
463
+ He(t, new Set([...pe, ...rn]), p);
464
+ for (let d of m)
465
+ We(t, g(d));
466
+ return i;
467
+ }
468
+ function An(e) {
469
+ return Ae.includes(e);
470
+ }
471
+ function Je(e) {
472
+ return !!e && ve.includes(e);
473
+ }
474
+ function Ze(e, n) {
475
+ return e ? { id: D(e, n), text: I(e.text) } : undefined;
476
+ }
477
+ var vn = new Set(["decision", "inputData", "businessKnowledgeModel", "knowledgeSource"]);
478
+ var Ln = new Set(["textAnnotation", "association"]);
479
+ function me(e) {
480
+ let n = e.definitions;
481
+ return N(n) ? (n.drgElement ?? []).every((i) => vn.has(i.__$$element)) && (n.artifact ?? []).every((i) => Ln.has(i.__$$element)) : false;
482
+ }
483
+ function Pn(e, n) {
484
+ let r = e.definitions;
485
+ R(r).length > 1 && H2(r);
486
+ let i = n !== undefined;
487
+ if (!N(r) || !i && r.artifact?.length)
488
+ return;
489
+ let t = R(r), o = r.drgElement?.filter((p) => p.__$$element === "inputData") ?? [];
490
+ if (!i && (t.length !== 1 || t.length + o.length !== (r.drgElement?.length ?? 0)))
491
+ return;
492
+ let s = i ? t.find((p) => g(p) === n) : t[0];
493
+ if (!s)
494
+ return;
495
+ let a = s.expression?.__$$element === "decisionTable" ? s.expression : undefined, l = new Set(o.map(g)), f = new Set;
496
+ if (!a || !i && (s.knowledgeRequirement?.length || s.authorityRequirement?.length) || !U(s) || s.informationRequirement?.some((p) => {
497
+ if (p.requiredDecision)
498
+ return !i;
499
+ let $ = h(p.requiredInput?.["@_href"]);
500
+ return !$ || !l.has($) || f.has($) ? true : (f.add($), false);
501
+ }))
502
+ return;
503
+ let c = a["@_hitPolicy"] ?? "UNIQUE", u = a["@_aggregation"], m = a.input?.length ?? 0, b = a.output.length, L = a.annotation?.length ?? 0;
504
+ if (!(!An(c) || u !== undefined && (c !== "COLLECT" || !Je(u)) || b === 0 || a.output.some((p) => p.defaultOutputEntry) || L > 1 || a.rule?.some((p) => (p.inputEntry?.length ?? 0) !== m || p.outputEntry.length !== b || (p.annotationEntry?.length ?? 0) !== L) || [...(a.input ?? []).flatMap((p) => [p.inputExpression["@_expressionLanguage"], p.inputValues?.["@_expressionLanguage"]]), ...a.output.map((p) => p.outputValues?.["@_expressionLanguage"]), ...a.rule?.flatMap((p) => [...p.inputEntry?.map(($) => $["@_expressionLanguage"]) ?? [], ...p.outputEntry.map(($) => $["@_expressionLanguage"])]) ?? []].some(T) || [...(a.input ?? []).map((p) => p.inputValues), ...a.output.map((p) => p.outputValues)].some((p) => p?.extensionElements !== undefined)))
505
+ return { definitions: r, decision: s, table: a, inputData: o, scopeVariables: i ? B2(r, s) : [], hitPolicy: c };
506
+ }
507
+ function qn(e) {
508
+ let n = e.decision.decisionTable, r = [...n.inputs.flatMap((i) => [[i.expressionText, "expression"], [i.allowedValues?.text, "unaryTests"]]), ...n.outputs.map((i) => [i.allowedValues?.text, "unaryTests"]), ...n.rules.flatMap((i) => [...i.inputEntries.map((t) => [t.text, "unaryTests"]), ...i.outputEntries.map((t) => [t.text, "expression"])])];
509
+ return S2(r);
510
+ }
511
+ function On(e, n) {
512
+ let r = Pn(e, n);
513
+ if (!r)
514
+ return;
515
+ let { definitions: i, decision: t, table: o, inputData: s2, hitPolicy: a } = r, l = new Set, f = new Set, c = o.input?.map((m) => ({ id: V2(l, m, "input"), label: m["@_label"], expressionId: D(m.inputExpression, "inputExpression"), expressionText: I(m.inputExpression.text), typeRef: m.inputExpression["@_typeRef"], allowedValues: Ze(m.inputValues, "inputValues") })) ?? [], u = B(c);
516
+ return { id: D(i, "definitions"), name: i["@_name"], ...r.scopeVariables.length ? { scopeVariables: r.scopeVariables } : {}, namespace: i["@_namespace"], exporter: i["@_exporter"], exporterVersion: i["@_exporterVersion"], itemDefinitions: i.itemDefinition?.map((m) => ({ name: m["@_name"], isCollection: m["@_isCollection"] === true, typeRef: m.typeRef?.__$$text, allowedValues: m.allowedValues?.text?.__$$text })), inputData: F(s2, A(t), u), decision: { id: D(t, "decision"), name: t["@_name"] ?? "", label: t["@_label"], variableId: t.variable ? D(t.variable, "variable") : s("variable"), variableName: t.variable?.["@_name"], variableTypeRef: t.variable?.["@_typeRef"], description: t.description?.__$$text, question: t.question?.__$$text, allowedAnswers: t.allowedAnswers?.__$$text, decisionTable: { id: D(o, "decisionTable"), label: o["@_label"], typeRef: o["@_typeRef"], outputLabel: o["@_outputLabel"], preferredOrientation: o["@_preferredOrientation"], hitPolicy: a, aggregation: Je(o["@_aggregation"]) ? o["@_aggregation"] : undefined, inputs: c, outputs: o.output.map((m) => ({ id: V2(l, m, "output"), label: m["@_label"], name: m["@_name"], typeRef: m["@_typeRef"], allowedValues: Ze(m.outputValues, "outputValues") })), annotations: o.annotation?.length ? o.annotation.map((m) => ({ name: m["@_name"] })) : [{ name: C }], rules: o.rule?.map((m) => ({ id: V2(f, m, "rule"), description: m.description?.__$$text, inputEntries: m.inputEntry?.map((b) => ({ id: D(b, "inputEntry"), text: I(b.text) })) ?? [], outputEntries: m.outputEntry.map((b) => ({ id: D(b, "outputEntry"), text: I(b.text) })), annotationEntries: o.annotation?.length ? m.annotationEntry?.map((b) => I(b.text)) ?? [] : [""] })) ?? [] } } };
517
+ }
518
+ function Cn(e, n) {
519
+ let r = structuredClone(e), i = On(r, n);
520
+ return i ? { document: r, model: i, sourceDecisionId: i.decision.id, sourceInputDataIds: i.inputData.map((t) => t.id) } : undefined;
521
+ }
522
+ function Xe(e, n) {
523
+ return n ? { ...e, "@_id": n.id, text: y2(e?.text, n.text) } : undefined;
524
+ }
525
+ function kn(e) {
526
+ switch (e) {
527
+ case "Rule-as-Row":
528
+ case "Rule-as-Column":
529
+ case "CrossTable":
530
+ return e;
531
+ default:
532
+ return;
533
+ }
534
+ }
535
+ function Vn(e, n) {
536
+ let r = !e.annotation?.length && n.annotations.length === 1 && n.annotations[0].name === C && n.rules.every((s) => s.annotationEntries.length === 1 && s.annotationEntries[0] === ""), i = new Map(e.input?.map((s) => [s["@_id"], s]) ?? []), t = new Map(e.output.map((s) => [s["@_id"], s])), o = new Map(e.rule?.map((s) => [s["@_id"], s]) ?? []);
537
+ return { ...e, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_outputLabel": n.outputLabel, "@_preferredOrientation": kn(n.preferredOrientation), "@_hitPolicy": n.hitPolicy === "UNIQUE" ? undefined : n.hitPolicy, "@_aggregation": n.hitPolicy === "COLLECT" ? n.aggregation : undefined, input: n.inputs.map((s) => {
538
+ let a = i.get(s.id);
539
+ return { ...a, "@_id": s.id, "@_label": s.label, inputExpression: { ...a?.inputExpression, "@_id": s.expressionId, "@_typeRef": s.typeRef, text: y2(a?.inputExpression.text, s.expressionText) }, inputValues: Xe(a?.inputValues, s.allowedValues) };
540
+ }), output: n.outputs.map((s) => {
541
+ let a = t.get(s.id);
542
+ return { ...a, "@_id": s.id, "@_label": s.label, "@_name": s.name, "@_typeRef": s.typeRef, outputValues: Xe(a?.outputValues, s.allowedValues) };
543
+ }), annotation: r ? undefined : n.annotations.map((s, a) => ({ ...e.annotation?.[a], "@_name": s.name })), rule: n.rules.map((s) => {
544
+ let a = o.get(s.id), l = new Map(a?.inputEntry?.map((c) => [c["@_id"], c]) ?? []), f = new Map(a?.outputEntry.map((c) => [c["@_id"], c]) ?? []);
545
+ return { ...a, "@_id": s.id, description: s.description === undefined ? undefined : y2(a?.description, s.description), inputEntry: s.inputEntries.map((c) => {
546
+ let u = l.get(c.id);
547
+ return { ...u, "@_id": c.id, text: y2(u?.text, c.text) };
548
+ }), outputEntry: s.outputEntries.map((c) => {
549
+ let u = f.get(c.id);
550
+ return { ...u, "@_id": c.id, text: y2(u?.text, c.text) };
551
+ }), annotationEntry: r ? undefined : s.annotationEntries.map((c, u) => ({ ...a?.annotationEntry?.[u], text: y2(a?.annotationEntry?.[u]?.text, c) })) };
552
+ }) };
553
+ }
554
+ function Un(e, n) {
555
+ let r = e.expression?.__$$element === "decisionTable" ? e.expression : undefined;
556
+ if (!r)
557
+ throw new Error("Business rule decision table is missing");
558
+ return { ...e, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : y2(e.description, n.decision.description), question: n.decision.question === undefined ? undefined : y2(e.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : y2(e.allowedAnswers, n.decision.allowedAnswers), variable: j(e, n.decision), informationRequirement: z(e, n, () => qn(n)), expression: Vn(r, n.decision.decisionTable) };
559
+ }
560
+ function Bn(e, n) {
561
+ return G(e, n, Un);
562
+ }
563
+ var K2 = { createEditorProjection: Cn, updateDmnDocument: Bn };
564
+ function Fn(e, n) {
565
+ let r = e.definitions;
566
+ R(r).length > 1 && H2(r);
567
+ let i = n !== undefined;
568
+ if (!N(r) || !i && r.artifact?.length)
569
+ return;
570
+ let t = R(r), o = r.drgElement?.filter((c) => c.__$$element === "inputData") ?? [];
571
+ if (!i && (t.length !== 1 || t.length + o.length !== (r.drgElement?.length ?? 0)))
572
+ return;
573
+ let s = i ? t.find((c) => g(c) === n) : t[0];
574
+ if (!s || !U(s))
575
+ return;
576
+ let a = new Set(o.map(g)), l = new Set;
577
+ if (!i && (s.knowledgeRequirement?.length || s.authorityRequirement?.length) || s.informationRequirement?.some((c) => {
578
+ if (c.requiredDecision)
579
+ return !i;
580
+ let u = h(c.requiredInput?.["@_href"]);
581
+ return !u || !a.has(u) || l.has(u) ? true : (l.add(u), false);
582
+ }))
583
+ return;
584
+ let f = s.expression?.__$$element === "literalExpression" ? s.expression : undefined;
585
+ if (f && f.importedValues === undefined && !T(f["@_expressionLanguage"]))
586
+ return { definitions: r, decision: s, expression: f, inputData: o, scopeVariables: B2(r, s) };
587
+ }
588
+ function jn(e, n) {
589
+ let r = Fn(e, n);
590
+ if (!r)
591
+ return;
592
+ let { definitions: i, decision: t, expression: o, inputData: s2 } = r;
593
+ return { id: D(i, "definitions"), name: i["@_name"], ...r.scopeVariables.length ? { scopeVariables: r.scopeVariables } : {}, namespace: i["@_namespace"], exporter: i["@_exporter"], exporterVersion: i["@_exporterVersion"], inputData: F(s2, A(t), new Set), decision: { id: D(t, "decision"), name: t["@_name"] ?? "", label: t["@_label"], variableId: t.variable ? D(t.variable, "variable") : s("variable"), variableName: t.variable?.["@_name"], variableTypeRef: t.variable?.["@_typeRef"], description: t.description?.__$$text, question: t.question?.__$$text, allowedAnswers: t.allowedAnswers?.__$$text, literalExpression: { id: D(o, "literalExpression"), label: o["@_label"], typeRef: o["@_typeRef"], text: I(o.text), expressionLanguage: o["@_expressionLanguage"] } } };
594
+ }
595
+ function zn(e, n) {
596
+ let r = structuredClone(e), i = jn(r, n);
597
+ return i ? { document: r, model: i, sourceDecisionId: i.decision.id, sourceInputDataIds: i.inputData.map((t) => t.id) } : undefined;
598
+ }
599
+ function Hn(e, n) {
600
+ return { ...e, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_expressionLanguage": n.expressionLanguage, text: y2(e.text, n.text) };
601
+ }
602
+ function Gn(e, n) {
603
+ let r = e.expression?.__$$element === "literalExpression" ? e.expression : undefined;
604
+ if (!r)
605
+ throw new Error("Business rule literal expression is missing");
606
+ return { ...e, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : y2(e.description, n.decision.description), question: n.decision.question === undefined ? undefined : y2(e.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : y2(e.allowedAnswers, n.decision.allowedAnswers), variable: j(e, n.decision), informationRequirement: z(e, n, () => S2([[n.decision.literalExpression.text, "expression"]])), expression: Hn(r, n.decision.literalExpression) };
607
+ }
608
+ function Kn(e) {
609
+ if (e.inputData.every((i) => i.requirementId))
610
+ return e;
611
+ let n = S2([[e.decision.literalExpression.text, "expression"]]), r = e.inputData.map((i) => i.requirementId || !n.has(i.variableName ?? i.name ?? "") ? i : { ...i, requirementId: s("informationRequirement") });
612
+ return { ...e, inputData: r };
613
+ }
614
+ function Wn(e, n) {
615
+ return G(e, Kn(n), Gn);
616
+ }
617
+ var en = { createEditorProjection: zn, updateDmnDocument: Wn };
618
+ var v2;
619
+ function nn(e) {
620
+ let n = e.definitions;
621
+ for (let r of n.drgElement ?? []) {
622
+ D(r, r.__$$element);
623
+ for (let i of Ye) {
624
+ let t = r[i];
625
+ if (Array.isArray(t))
626
+ for (let o of t)
627
+ D(o, i);
628
+ }
629
+ }
630
+ for (let r of n.artifact ?? [])
631
+ D(r, r.__$$element);
632
+ return { kind: "drd", document: e };
633
+ }
634
+ var Yn = { "condition-rule": true, "decision-table": true, "decision-graph": false };
635
+ function Qn(e) {
636
+ let n = ke(e);
637
+ return n === undefined || Yn[n];
638
+ }
639
+ function tn(e, { allowDrdDocuments: n = false }) {
640
+ let r = e.definitions;
641
+ if (r["@_namespace"] === oe && r["@_id"] === se && r["@_name"] === "" && Object.keys(r).every((t) => t.startsWith("@_xmlns") || t === "@_id" || t === "@_name" || t === "@_namespace"))
642
+ return { kind: "uninitialized" };
643
+ if (n && !Qn(e))
644
+ return me(e) ? nn(e) : { kind: "unsupported", reason: "unsupported-profile" };
645
+ let i = K2.createEditorProjection(e);
646
+ return i ? { kind: "decision-table", model: i.model, context: { document: i.document, sourceDecisionId: i.sourceDecisionId, sourceInputDataIds: i.sourceInputDataIds } } : n && me(e) ? nn(e) : { kind: "unsupported", reason: "unsupported-profile" };
647
+ }
648
+ function Zn(e, n = {}) {
649
+ if (v2?.xml === e && v2.allowDrdDocuments === !!n.allowDrdDocuments) {
650
+ let { result: t } = v2;
651
+ return v2 = undefined, t;
652
+ }
653
+ if (!e.trim())
654
+ return { kind: "uninitialized" };
655
+ let r = Ft(e);
656
+ if (r.status === "error")
657
+ return { kind: "unsupported", reason: r.reason };
658
+ let i = Is(r.losses);
659
+ if (i)
660
+ return { kind: "unsupported", reason: i };
661
+ if (r.originalVersion !== "1.1")
662
+ try {
663
+ return tn(Ot(e), n);
664
+ } catch (t) {
665
+ return console.error("DMN: could not project a well-formed document", t), { kind: "unsupported", reason: "invalid-xml" };
666
+ }
667
+ }
668
+ async function Xn(e, n = {}) {
669
+ let r = Zn(e, n);
670
+ if (r)
671
+ return r;
672
+ let i = await bs(e);
673
+ if (i.status === "error")
674
+ return { kind: "unsupported", reason: i.reason };
675
+ try {
676
+ return tn(i.document, n);
677
+ } catch (t) {
678
+ return console.error("DMN: could not project a well-formed document", t), { kind: "unsupported", reason: "invalid-xml" };
679
+ }
680
+ }
681
+ function Jn(e, n, r) {
682
+ let i = R(e.definitions).find((t) => g(t) === n);
683
+ i && Ue(e, i) && Fe(e, i, r);
684
+ }
685
+ function zt(e) {
686
+ return en.createEditorProjection(e)?.model;
687
+ }
688
+ function Ht() {
689
+ let e = K2.createEditorProjection(Ot(Se));
690
+ if (!e)
691
+ throw new Error("Default business rule is not a decision table");
692
+ return { document: e.document, sourceDecisionId: e.sourceDecisionId, sourceInputDataIds: e.sourceInputDataIds };
693
+ }
694
+ function Gt(e) {
695
+ return hs(e);
696
+ }
697
+ function Kt(e, n, r = "decision-table") {
698
+ let i = K2.updateDmnDocument(n, e);
699
+ return Ve(i) && Be(i, r), Jn(i, e.decision.id, "decision-table"), { document: i, xml: hs(i) };
700
+ }
701
+
702
+ export { ot, R, g, h, Xn, zt, Ht, Gt, Kt };
703
+
704
+ //# debugId=AA471D2A4359250864756E2164756E21