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