@camunda/copilot-chat 0.5.12-alpha.4 → 0.5.12-alpha.5

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.
@@ -1,8 +1,8 @@
1
- const Le = Object.prototype.toString, un = Object.prototype.hasOwnProperty;
1
+ const Le = Object.prototype.toString, dn = Object.prototype.hasOwnProperty;
2
2
  function Je(e) {
3
3
  return e === void 0;
4
4
  }
5
- function dn(e) {
5
+ function mn(e) {
6
6
  return e !== void 0;
7
7
  }
8
8
  function St(e) {
@@ -11,7 +11,7 @@ function St(e) {
11
11
  function Ot(e) {
12
12
  return Le.call(e) === "[object Array]";
13
13
  }
14
- function mn(e) {
14
+ function fn(e) {
15
15
  return Le.call(e) === "[object Object]";
16
16
  }
17
17
  function Ft(e) {
@@ -22,9 +22,9 @@ function be(e) {
22
22
  return Le.call(e) === "[object String]";
23
23
  }
24
24
  function kt(e, t) {
25
- return !St(e) && un.call(e, t);
25
+ return !St(e) && dn.call(e, t);
26
26
  }
27
- function Nt(e, t) {
27
+ function xt(e, t) {
28
28
  const r = lt(t);
29
29
  let n;
30
30
  return R(e, function(i, a) {
@@ -32,7 +32,7 @@ function Nt(e, t) {
32
32
  return n = i, !1;
33
33
  }), n;
34
34
  }
35
- function fn(e, t) {
35
+ function yn(e, t) {
36
36
  const r = lt(t);
37
37
  let n = Ot(e) ? -1 : void 0;
38
38
  return R(e, function(i, a) {
@@ -51,12 +51,12 @@ function R(e, t) {
51
51
  let r, n;
52
52
  if (Je(e))
53
53
  return;
54
- const i = Ot(e) ? hn : gn;
54
+ const i = Ot(e) ? bn : hn;
55
55
  for (let a in e)
56
56
  if (kt(e, a) && (r = e[a], n = t(r, i(a)), n === !1))
57
57
  return r;
58
58
  }
59
- function yn(e, t) {
59
+ function gn(e, t) {
60
60
  let r = [];
61
61
  return R(e, function(n, i) {
62
62
  r.push(t(n, i));
@@ -65,19 +65,19 @@ function yn(e, t) {
65
65
  function lt(e) {
66
66
  return Ft(e) ? e : (t) => t === e;
67
67
  }
68
- function gn(e) {
68
+ function hn(e) {
69
69
  return e;
70
70
  }
71
- function hn(e) {
71
+ function bn(e) {
72
72
  return Number(e);
73
73
  }
74
- function xe(e, t) {
74
+ function Ne(e, t) {
75
75
  return e.bind(t);
76
76
  }
77
77
  function F(e, ...t) {
78
78
  return Object.assign(e, ...t);
79
79
  }
80
- function bn(e, t, r) {
80
+ function En(e, t, r) {
81
81
  let n = e;
82
82
  return R(t, function(i, a) {
83
83
  if (typeof i != "number" && typeof i != "string")
@@ -87,7 +87,7 @@ function bn(e, t, r) {
87
87
  if (i === "__proto__")
88
88
  throw new Error("illegal key: __proto__");
89
89
  let o = t[a + 1], s = n[i];
90
- dn(o) && St(s) && (s = n[i] = isNaN(+o) ? {} : []), Je(o) ? Je(r) ? delete n[i] : n[i] = r : n = s;
90
+ mn(o) && St(s) && (s = n[i] = isNaN(+o) ? {} : []), Je(o) ? Je(r) ? delete n[i] : n[i] = r : n = s;
91
91
  }), e;
92
92
  }
93
93
  function $t(e, t) {
@@ -114,13 +114,13 @@ qt.prototype.createType = function(e) {
114
114
  }), r.defineModel(n, t), r.defineDescriptor(n, e);
115
115
  var i = e.ns.name;
116
116
  function a(o) {
117
- r.define(this, "$type", { value: i, enumerable: !0 }), r.define(this, "$attrs", { value: {} }), r.define(this, "$parent", { writable: !0 }), R(o, xe(function(s, p) {
117
+ r.define(this, "$type", { value: i, enumerable: !0 }), r.define(this, "$attrs", { value: {} }), r.define(this, "$parent", { writable: !0 }), R(o, Ne(function(s, p) {
118
118
  this.set(p, s);
119
119
  }, this));
120
120
  }
121
121
  return a.prototype = n, a.hasType = n.$instanceOf = this.model.hasType, r.defineModel(a, t), r.defineDescriptor(a, e), a;
122
122
  };
123
- var En = {
123
+ var wn = {
124
124
  String: !0,
125
125
  Boolean: !0,
126
126
  Integer: !0,
@@ -145,7 +145,7 @@ function ut(e, t) {
145
145
  return r ? r(t) : t;
146
146
  }
147
147
  function Ye(e) {
148
- return !!En[e];
148
+ return !!wn[e];
149
149
  }
150
150
  function Gt(e) {
151
151
  return !!Lt[e];
@@ -254,7 +254,7 @@ H.prototype.hasProperty = function(e) {
254
254
  H.prototype.addTrait = function(e, t) {
255
255
  t && this.assertNotTrait(e);
256
256
  var r = this.allTypesByName, n = this.allTypes, i = e.name;
257
- i in r || (R(e.properties, xe(function(a) {
257
+ i in r || (R(e.properties, Ne(function(a) {
258
258
  a = F({}, a, {
259
259
  name: a.ns.localName,
260
260
  inherited: t
@@ -266,7 +266,7 @@ H.prototype.addTrait = function(e, t) {
266
266
  }, this)), n.push(e), r[i] = e);
267
267
  };
268
268
  function ce(e, t) {
269
- this.packageMap = {}, this.typeMap = {}, this.packages = [], this.properties = t, R(e, xe(this.registerPackage, this));
269
+ this.packageMap = {}, this.typeMap = {}, this.packages = [], this.properties = t, R(e, Ne(this.registerPackage, this));
270
270
  }
271
271
  ce.prototype.getPackage = function(e) {
272
272
  return this.packageMap[e];
@@ -277,7 +277,7 @@ ce.prototype.getPackages = function() {
277
277
  ce.prototype.registerPackage = function(e) {
278
278
  e = F({}, e);
279
279
  var t = this.packageMap;
280
- xt(t, e, "prefix"), xt(t, e, "uri"), R(e.types, xe(function(r) {
280
+ Nt(t, e, "prefix"), Nt(t, e, "uri"), R(e.types, Ne(function(r) {
281
281
  this.registerType(r, e);
282
282
  }, this)), t[e.uri] = t[e.prefix] = e, this.packages.push(e);
283
283
  };
@@ -289,7 +289,7 @@ ce.prototype.registerType = function(e, t) {
289
289
  meta: F(e.meta || {})
290
290
  });
291
291
  var r = j(e.name, t.prefix), n = r.name, i = {};
292
- R(e.properties, xe(function(a) {
292
+ R(e.properties, Ne(function(a) {
293
293
  var o = j(a.name, r.prefix), s = o.name;
294
294
  Ye(a.type) || (a.type = j(a.type, o.prefix).name), F(a, {
295
295
  ns: o,
@@ -299,7 +299,7 @@ ce.prototype.registerType = function(e, t) {
299
299
  ns: r,
300
300
  name: n,
301
301
  propertiesByName: i
302
- }), R(e.extends, xe(function(a) {
302
+ }), R(e.extends, Ne(function(a) {
303
303
  var o = j(a, r.prefix), s = this.typeMap[o.name];
304
304
  s.traits = s.traits || [], s.traits.push(n);
305
305
  }, this)), this.definePackage(e, t), this.typeMap[n] = e;
@@ -331,7 +331,7 @@ ce.prototype.getEffectiveDescriptor = function(e) {
331
331
  ce.prototype.definePackage = function(e, t) {
332
332
  this.properties.define(e, "$pkg", { value: t });
333
333
  };
334
- function xt(e, t, r) {
334
+ function Nt(e, t, r) {
335
335
  var n = t[r];
336
336
  if (n in e)
337
337
  throw new Error("package with " + r + " <" + n + "> already defined");
@@ -343,7 +343,7 @@ Ee.prototype.set = function(e, t, r) {
343
343
  if (!be(t) || !t.length)
344
344
  throw new TypeError("property name must be a non-empty string");
345
345
  var n = this.getProperty(e, t), i = n && n.name;
346
- wn(r) ? n ? delete e[i] : delete e.$attrs[Qe(t)] : n ? i in e ? e[i] = r : jt(e, n, r) : e.$attrs[Qe(t)] = r;
346
+ vn(r) ? n ? delete e[i] : delete e.$attrs[Qe(t)] : n ? i in e ? e[i] = r : jt(e, n, r) : e.$attrs[Qe(t)] = r;
347
347
  };
348
348
  Ee.prototype.get = function(e, t) {
349
349
  var r = this.getProperty(e, t);
@@ -384,7 +384,7 @@ Ee.prototype.getProperty = function(e, t) {
384
384
  }
385
385
  return null;
386
386
  };
387
- function wn(e) {
387
+ function vn(e) {
388
388
  return typeof e > "u";
389
389
  }
390
390
  function jt(e, t, r) {
@@ -421,7 +421,7 @@ K.prototype.createAny = function(e, t, r) {
421
421
  return this[o];
422
422
  },
423
423
  set: function(o, s) {
424
- bn(this, [o], s);
424
+ En(this, [o], s);
425
425
  }
426
426
  }, a = {
427
427
  name: e,
@@ -433,7 +433,7 @@ K.prototype.createAny = function(e, t, r) {
433
433
  }
434
434
  };
435
435
  return this.properties.defineDescriptor(i, a), this.properties.defineModel(i, this), this.properties.define(i, "get", { enumerable: !1, writable: !0 }), this.properties.define(i, "set", { enumerable: !1, writable: !0 }), this.properties.define(i, "$parent", { enumerable: !1, writable: !0 }), this.properties.define(i, "$instanceOf", { enumerable: !1, writable: !0 }), R(r, function(o, s) {
436
- mn(o) && o.value !== void 0 ? i[o.name] = o.value : i[s] = o;
436
+ fn(o) && o.value !== void 0 ? i[o.name] = o.value : i[s] = o;
437
437
  }), i;
438
438
  };
439
439
  K.prototype.getPackage = function(e) {
@@ -456,7 +456,7 @@ K.prototype.getPropertyDescriptor = function(e, t) {
456
456
  K.prototype.getTypeDescriptor = function(e) {
457
457
  return this.registry.typeMap[e];
458
458
  };
459
- var Rt = String.fromCharCode, vn = Object.prototype.hasOwnProperty, In = /&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig, _e = {
459
+ var Rt = String.fromCharCode, In = Object.prototype.hasOwnProperty, Tn = /&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig, _e = {
460
460
  amp: "&",
461
461
  apos: "'",
462
462
  gt: ">",
@@ -466,14 +466,14 @@ var Rt = String.fromCharCode, vn = Object.prototype.hasOwnProperty, In = /&#(\d+
466
466
  Object.keys(_e).forEach(function(e) {
467
467
  _e[e.toUpperCase()] = _e[e];
468
468
  });
469
- function Tn(e, t, r, n) {
470
- return n ? vn.call(_e, n) ? _e[n] : "&" + n + ";" : Rt(t || parseInt(r, 16));
469
+ function xn(e, t, r, n) {
470
+ return n ? In.call(_e, n) ? _e[n] : "&" + n + ";" : Rt(t || parseInt(r, 16));
471
471
  }
472
472
  function ye(e) {
473
- return e.length > 3 && e.indexOf("&") !== -1 ? e.replace(In, Tn) : e;
473
+ return e.length > 3 && e.indexOf("&") !== -1 ? e.replace(Tn, xn) : e;
474
474
  }
475
475
  var At = "non-whitespace outside of root node";
476
- function Ne(e) {
476
+ function xe(e) {
477
477
  return new Error(e);
478
478
  }
479
479
  function Mt(e) {
@@ -494,7 +494,7 @@ function Nn(e) {
494
494
  function Ze(e) {
495
495
  return e + "$uri";
496
496
  }
497
- function xn(e) {
497
+ function Rn(e) {
498
498
  var t = {}, r, n;
499
499
  for (r in e)
500
500
  n = e[r], t[n] = n, t[Ze(n)] = r;
@@ -503,22 +503,22 @@ function xn(e) {
503
503
  function Ct() {
504
504
  return { line: 0, column: 0 };
505
505
  }
506
- function Rn(e) {
506
+ function An(e) {
507
507
  throw e;
508
508
  }
509
509
  function Ut(e) {
510
510
  if (!this)
511
511
  return new Ut(e);
512
- var t = e && e.proxy, r, n, i, a, o = Rn, s, p, l, c, u = Ct, d = !1, f = !1, P = null, D = !1, J;
512
+ var t = e && e.proxy, r, n, i, a, o = An, s, p, l, c, u = Ct, d = !1, f = !1, M = null, P = !1, J;
513
513
  function E(m) {
514
- m instanceof Error || (m = Ne(m)), P = m, o(m, u);
514
+ m instanceof Error || (m = xe(m)), M = m, o(m, u);
515
515
  }
516
- function N(m) {
517
- s && (m instanceof Error || (m = Ne(m)), s(m, u));
516
+ function x(m) {
517
+ s && (m instanceof Error || (m = xe(m)), s(m, u));
518
518
  }
519
519
  this.on = function(m, y) {
520
520
  if (typeof y != "function")
521
- throw Ne("required args <name, cb>");
521
+ throw xe("required args <name, cb>");
522
522
  switch (m) {
523
523
  case "openTag":
524
524
  n = y;
@@ -550,25 +550,25 @@ function Ut(e) {
550
550
  p = y;
551
551
  break;
552
552
  default:
553
- throw Ne("unsupported event: " + m);
553
+ throw xe("unsupported event: " + m);
554
554
  }
555
555
  return this;
556
556
  }, this.ns = function(m) {
557
557
  if (typeof m > "u" && (m = {}), typeof m != "object")
558
- throw Ne("required args <nsMap={}>");
558
+ throw xe("required args <nsMap={}>");
559
559
  var y = {}, g;
560
560
  for (g in m)
561
561
  y[g] = m[g];
562
562
  return f = !0, J = y, this;
563
563
  }, this.parse = function(m) {
564
564
  if (typeof m != "string")
565
- throw Ne("required args <xml=string>");
566
- return P = null, W(m), u = Ct, D = !1, P;
565
+ throw xe("required args <xml=string>");
566
+ return M = null, W(m), u = Ct, P = !1, M;
567
567
  }, this.stop = function() {
568
- D = !0;
568
+ P = !0;
569
569
  };
570
570
  function W(m) {
571
- var y = f ? [] : null, g = f ? xn(J) : null, x, M = [], z = 0, q = !1, _ = !1, w = 0, b = 0, S, vt, O, I, De, Pe, X, Xe, Ve, ze = "", He = 0, Ie;
571
+ var y = f ? [] : null, g = f ? Rn(J) : null, N, C = [], z = 0, q = !1, _ = !1, w = 0, b = 0, S, vt, O, I, De, Pe, X, Xe, Ve, ze = "", He = 0, Ie;
572
572
  function We() {
573
573
  if (Ie !== null)
574
574
  return Ie;
@@ -576,31 +576,31 @@ function Ut(e) {
576
576
  e:
577
577
  for (; B < fe; B++)
578
578
  if (Y = !1, h = L.charCodeAt(B), !(h === 32 || h < 14 && h > 8)) {
579
- for ((h < 65 || h > 122 || h > 90 && h < 97) && h !== 95 && h !== 58 && (N("illegal first char attribute name"), Y = !0), T = B + 1; T < fe; T++)
579
+ for ((h < 65 || h > 122 || h > 90 && h < 97) && h !== 95 && h !== 58 && (x("illegal first char attribute name"), Y = !0), T = B + 1; T < fe; T++)
580
580
  if (h = L.charCodeAt(T), !(h > 96 && h < 123 || h > 64 && h < 91 || h > 47 && h < 59 || h === 46 || // '.'
581
581
  h === 45 || // '-'
582
582
  h === 95)) {
583
583
  if (h === 32 || h < 14 && h > 8) {
584
- N("missing attribute value"), B = T;
584
+ x("missing attribute value"), B = T;
585
585
  continue e;
586
586
  }
587
587
  if (h === 61)
588
588
  break;
589
- N("illegal attribute name char"), Y = !0;
589
+ x("illegal attribute name char"), Y = !0;
590
590
  }
591
- if (A = L.substring(B, T), A === "xmlns:xmlns" && (N("illegal declaration of xmlns"), Y = !0), h = L.charCodeAt(T + 1), h === 34)
592
- T = L.indexOf('"', B = T + 2), T === -1 && (T = L.indexOf("'", B), T !== -1 && (N("attribute value quote missmatch"), Y = !0));
591
+ if (A = L.substring(B, T), A === "xmlns:xmlns" && (x("illegal declaration of xmlns"), Y = !0), h = L.charCodeAt(T + 1), h === 34)
592
+ T = L.indexOf('"', B = T + 2), T === -1 && (T = L.indexOf("'", B), T !== -1 && (x("attribute value quote missmatch"), Y = !0));
593
593
  else if (h === 39)
594
- T = L.indexOf("'", B = T + 2), T === -1 && (T = L.indexOf('"', B), T !== -1 && (N("attribute value quote missmatch"), Y = !0));
594
+ T = L.indexOf("'", B = T + 2), T === -1 && (T = L.indexOf('"', B), T !== -1 && (x("attribute value quote missmatch"), Y = !0));
595
595
  else
596
- for (N("missing attribute value quotes"), Y = !0, T = T + 1; T < fe && (h = L.charCodeAt(T + 1), !(h === 32 || h < 14 && h > 8)); T++)
596
+ for (x("missing attribute value quotes"), Y = !0, T = T + 1; T < fe && (h = L.charCodeAt(T + 1), !(h === 32 || h < 14 && h > 8)); T++)
597
597
  ;
598
- for (T === -1 && (N("missing closing quotes"), T = fe, Y = !0), Y || (ne = L.substring(B, T)), B = T; T + 1 < fe && (h = L.charCodeAt(T + 1), !(h === 32 || h < 14 && h > 8)); T++)
599
- B === T && (N("illegal character after attribute end"), Y = !0);
598
+ for (T === -1 && (x("missing closing quotes"), T = fe, Y = !0), Y || (ne = L.substring(B, T)), B = T; T + 1 < fe && (h = L.charCodeAt(T + 1), !(h === 32 || h < 14 && h > 8)); T++)
599
+ B === T && (x("illegal character after attribute end"), Y = !0);
600
600
  if (B = T + 1, Y)
601
601
  continue e;
602
602
  if (A in Tt) {
603
- N("attribute <" + A + "> already defined");
603
+ x("attribute <" + A + "> already defined");
604
604
  continue;
605
605
  }
606
606
  if (Tt[A] = !0, !f) {
@@ -629,7 +629,7 @@ function Ut(e) {
629
629
  continue;
630
630
  }
631
631
  if (!(Q = g[A.substring(0, h)])) {
632
- N(Mt(A.substring(0, h)));
632
+ x(Mt(A.substring(0, h)));
633
633
  continue;
634
634
  }
635
635
  A = me === Q ? A.substr(h + 1) : Q + A.substr(h), Te[A] = ne;
@@ -638,7 +638,7 @@ function Ut(e) {
638
638
  for (B = 0, fe = te.length; B < fe; B++) {
639
639
  if (A = te[B++], ne = te[B], h = A.indexOf(":"), h !== -1) {
640
640
  if (!(Q = g[A.substring(0, h)])) {
641
- N(Mt(A.substring(0, h)));
641
+ x(Mt(A.substring(0, h)));
642
642
  continue;
643
643
  }
644
644
  A = me === Q ? A.substr(h + 1) : Q + A.substr(h);
@@ -647,7 +647,7 @@ function Ut(e) {
647
647
  }
648
648
  return Ie = Te;
649
649
  }
650
- function cn() {
650
+ function un() {
651
651
  for (var oe = /(\r\n|\r|\n)/g, de = 0, Q = 0, me = 0, te = b, B, L; w >= me && (B = oe.exec(m), !(!B || (te = B[0].length + B.index, te > w))); )
652
652
  de += 1, me = te;
653
653
  return w == -1 ? (Q = te, L = m.substring(b)) : b === 0 ? L = m.substring(b, w) : (Q = w - me, L = b == -1 ? m.substring(w) : m.substring(w, b + 1)), {
@@ -656,7 +656,7 @@ function Ut(e) {
656
656
  column: Q
657
657
  };
658
658
  }
659
- for (u = cn, t && (Ve = Object.create({}, {
659
+ for (u = un, t && (Ve = Object.create({}, {
660
660
  name: ke(function() {
661
661
  return X;
662
662
  }),
@@ -669,25 +669,25 @@ function Ut(e) {
669
669
  })
670
670
  })); b !== -1; ) {
671
671
  if (m.charCodeAt(b) === 60 ? w = b : w = m.indexOf("<", b), w === -1) {
672
- if (M.length)
672
+ if (C.length)
673
673
  return E("unexpected end of file");
674
674
  if (b === 0)
675
675
  return E("missing start tag");
676
- b < m.length && m.substring(b).trim() && N(At);
676
+ b < m.length && m.substring(b).trim() && x(At);
677
677
  return;
678
678
  }
679
679
  if (b !== w) {
680
- if (M.length) {
681
- if (r && (r(m.substring(b, w), ye, u), D))
680
+ if (C.length) {
681
+ if (r && (r(m.substring(b, w), ye, u), P))
682
682
  return;
683
- } else if (m.substring(b, w).trim() && (N(At), D))
683
+ } else if (m.substring(b, w).trim() && (x(At), P))
684
684
  return;
685
685
  }
686
686
  if (I = m.charCodeAt(w + 1), I === 33) {
687
687
  if (O = m.charCodeAt(w + 2), O === 91 && m.substr(w + 3, 6) === "CDATA[") {
688
688
  if (b = m.indexOf("]]>", w), b === -1)
689
689
  return E("unclosed cdata");
690
- if (a && (a(m.substring(w + 9, b), u), D))
690
+ if (a && (a(m.substring(w + 9, b), u), P))
691
691
  return;
692
692
  b += 3;
693
693
  continue;
@@ -695,7 +695,7 @@ function Ut(e) {
695
695
  if (O === 45 && m.charCodeAt(w + 3) === 45) {
696
696
  if (b = m.indexOf("-->", w), b === -1)
697
697
  return E("unclosed comment");
698
- if (p && (p(m.substring(w + 4, b), ye, u), D))
698
+ if (p && (p(m.substring(w + 4, b), ye, u), P))
699
699
  return;
700
700
  b += 3;
701
701
  continue;
@@ -704,7 +704,7 @@ function Ut(e) {
704
704
  if (I === 63) {
705
705
  if (b = m.indexOf("?>", w), b === -1)
706
706
  return E("unclosed question");
707
- if (l && (l(m.substring(w, b + 2), u), D))
707
+ if (l && (l(m.substring(w, b + 2), u), P))
708
708
  return;
709
709
  b += 2;
710
710
  continue;
@@ -722,15 +722,15 @@ function Ut(e) {
722
722
  }
723
723
  }
724
724
  if (I === 33) {
725
- if (c && (c(m.substring(w, b + 1), ye, u), D))
725
+ if (c && (c(m.substring(w, b + 1), ye, u), P))
726
726
  return;
727
727
  b += 1;
728
728
  continue;
729
729
  }
730
730
  if (Ie = {}, I === 47) {
731
- if (q = !1, _ = !0, !M.length)
731
+ if (q = !1, _ = !0, !C.length)
732
732
  return E("missing open tag");
733
- if (S = X = M.pop(), O = w + 2 + S.length, m.substring(w + 2, O) !== S)
733
+ if (S = X = C.pop(), O = w + 2 + S.length, m.substring(w + 2, O) !== S)
734
734
  return E("closing tag mismatch");
735
735
  for (; O < b; O++)
736
736
  if (I = m.charCodeAt(O), !(I === 32 || I > 8 && I < 14))
@@ -746,10 +746,10 @@ function Ut(e) {
746
746
  }
747
747
  return E("invalid nodeName");
748
748
  }
749
- _ || M.push(X);
749
+ _ || C.push(X);
750
750
  }
751
751
  if (f) {
752
- if (x = g, q && (_ || y.push(x), Ie === null && (d = S.indexOf("xmlns", O) !== -1) && (He = O, ze = S, We(), d = !1)), Xe = X, I = X.indexOf(":"), I !== -1) {
752
+ if (N = g, q && (_ || y.push(N), Ie === null && (d = S.indexOf("xmlns", O) !== -1) && (He = O, ze = S, We(), d = !1)), Xe = X, I = X.indexOf(":"), I !== -1) {
753
753
  if (Pe = g[X.substring(0, I)], !Pe)
754
754
  return E("missing namespace on <" + Xe + ">");
755
755
  X = X.substr(I + 1);
@@ -757,12 +757,12 @@ function Ut(e) {
757
757
  Pe = g.xmlns;
758
758
  Pe && (X = Pe + ":" + X);
759
759
  }
760
- if (q && (He = O, ze = S, n && (t ? n(Ve, ye, _, u) : n(X, We, ye, _, u), D)))
760
+ if (q && (He = O, ze = S, n && (t ? n(Ve, ye, _, u) : n(X, We, ye, _, u), P)))
761
761
  return;
762
762
  if (_) {
763
- if (i && (i(t ? Ve : X, ye, q, u), D))
763
+ if (i && (i(t ? Ve : X, ye, q, u), P))
764
764
  return;
765
- f && (q ? g = x : g = y.pop());
765
+ f && (q ? g = N : g = y.pop());
766
766
  }
767
767
  b += 1;
768
768
  }
@@ -778,24 +778,24 @@ var et = {
778
778
  function zt(e) {
779
779
  return e.xml && e.xml.serialize;
780
780
  }
781
- function An(e) {
781
+ function Mn(e) {
782
782
  const t = zt(e);
783
783
  return t !== Vt && (t || null);
784
784
  }
785
- function Mn(e) {
785
+ function Cn(e) {
786
786
  return e.charAt(0).toUpperCase() + e.slice(1);
787
787
  }
788
788
  function Ht(e, t) {
789
- return Xt(t) ? e.prefix + ":" + Mn(e.localName) : e.name;
789
+ return Xt(t) ? e.prefix + ":" + Cn(e.localName) : e.name;
790
790
  }
791
- function Cn(e, t) {
791
+ function Dn(e, t) {
792
792
  var r = e.name, n = e.localName, i = t && t.xml && t.xml.typePrefix;
793
793
  return i && n.indexOf(i) === 0 ? e.prefix + ":" + n.slice(i.length) : r;
794
794
  }
795
- function Dn(e, t, r) {
795
+ function Pn(e, t, r) {
796
796
  const n = j(e, t.xmlns), i = `${t[n.prefix] || n.prefix}:${n.localName}`, a = j(i);
797
797
  var o = r.getPackage(a.prefix);
798
- return Cn(a, o);
798
+ return Dn(a, o);
799
799
  }
800
800
  function le(e) {
801
801
  return new Error(e);
@@ -803,7 +803,7 @@ function le(e) {
803
803
  function re(e) {
804
804
  return e.$descriptor;
805
805
  }
806
- function Pn(e) {
806
+ function _n(e) {
807
807
  F(this, e), this.elementsById = {}, this.references = [], this.warnings = [], this.addReference = function(t) {
808
808
  this.references.push(t);
809
809
  }, this.addElement = function(t) {
@@ -916,11 +916,11 @@ U.prototype.createElement = function(e) {
916
916
  U.prototype.getPropertyForNode = function(e) {
917
917
  var t = e.name, r = j(t), n = this.type, i = this.model, a = re(n), o = r.name, s = a.propertiesByName[o];
918
918
  if (s && !s.isAttr) {
919
- const l = An(s);
919
+ const l = Mn(s);
920
920
  if (l) {
921
921
  const c = e.attributes[l];
922
922
  if (c) {
923
- const u = Dn(c, e.ns, i), d = i.getType(u);
923
+ const u = Pn(c, e.ns, i), d = i.getType(u);
924
924
  return F({}, s, {
925
925
  effectiveType: re(d).name
926
926
  });
@@ -931,13 +931,13 @@ U.prototype.getPropertyForNode = function(e) {
931
931
  var p = i.getPackage(r.prefix);
932
932
  if (p) {
933
933
  const l = Ht(r, p), c = i.getType(l);
934
- if (s = Nt(a.properties, function(u) {
934
+ if (s = xt(a.properties, function(u) {
935
935
  return !u.isVirtual && !u.isReference && !u.isAttribute && c.hasType(u.type);
936
936
  }), s)
937
937
  return F({}, s, {
938
938
  effectiveType: re(c).name
939
939
  });
940
- } else if (s = Nt(a.properties, function(l) {
940
+ } else if (s = xt(a.properties, function(l) {
941
941
  return !l.isReference && !l.isAttribute && l.type === "Element";
942
942
  }), s)
943
943
  return s;
@@ -998,16 +998,16 @@ function yt(e) {
998
998
  yt.prototype.fromXML = function(e, t, r) {
999
999
  var n = t.rootHandler;
1000
1000
  t instanceof U ? (n = t, t = {}) : typeof t == "string" ? (n = this.handler(t), t = {}) : typeof n == "string" && (n = this.handler(n));
1001
- var i = this.model, a = this.lax, o = new Pn(F({}, t, { rootHandler: n })), s = new Ut({ proxy: !0 }), p = _n();
1001
+ var i = this.model, a = this.lax, o = new _n(F({}, t, { rootHandler: n })), s = new Ut({ proxy: !0 }), p = Bn();
1002
1002
  n.context = o, p.push(n);
1003
- function l(y, g, x) {
1004
- var M = g(), z = M.line, q = M.column, _ = M.data;
1003
+ function l(y, g, N) {
1004
+ var C = g(), z = C.line, q = C.column, _ = C.data;
1005
1005
  _.charAt(0) === "<" && _.indexOf(" ") !== -1 && (_ = _.slice(0, _.indexOf(" ")) + ">");
1006
1006
  var w = "unparsable content " + (_ ? _ + " " : "") + `detected
1007
1007
  line: ` + z + `
1008
1008
  column: ` + q + `
1009
1009
  nested error: ` + y.message;
1010
- if (x)
1010
+ if (N)
1011
1011
  return o.addWarning({
1012
1012
  message: w,
1013
1013
  error: y
@@ -1018,16 +1018,16 @@ yt.prototype.fromXML = function(e, t, r) {
1018
1018
  return l(y, g, !0);
1019
1019
  }
1020
1020
  function u() {
1021
- var y = o.elementsById, g = o.references, x, M;
1022
- for (x = 0; M = g[x]; x++) {
1023
- var z = M.element, q = y[M.id], _ = re(z).propertiesByName[M.property];
1021
+ var y = o.elementsById, g = o.references, N, C;
1022
+ for (N = 0; C = g[N]; N++) {
1023
+ var z = C.element, q = y[C.id], _ = re(z).propertiesByName[C.property];
1024
1024
  if (q || o.addWarning({
1025
- message: "unresolved reference <" + M.id + ">",
1026
- element: M.element,
1027
- property: M.property,
1028
- value: M.id
1025
+ message: "unresolved reference <" + C.id + ">",
1026
+ element: C.element,
1027
+ property: C.property,
1028
+ value: C.id
1029
1029
  }), _.isMany) {
1030
- var w = z.get(_.name), b = w.indexOf(M);
1030
+ var w = z.get(_.name), b = w.indexOf(C);
1031
1031
  b === -1 && (b = w.length), q ? w[b] = q : w.splice(b, 1);
1032
1032
  } else
1033
1033
  z.set(_.name, q);
@@ -1036,39 +1036,39 @@ yt.prototype.fromXML = function(e, t, r) {
1036
1036
  function d() {
1037
1037
  p.pop().handleEnd();
1038
1038
  }
1039
- var f = /^<\?xml /i, P = / encoding="([^"]+)"/i, D = /^utf-8$/i;
1039
+ var f = /^<\?xml /i, M = / encoding="([^"]+)"/i, P = /^utf-8$/i;
1040
1040
  function J(y) {
1041
1041
  if (f.test(y)) {
1042
- var g = P.exec(y), x = g && g[1];
1043
- !x || D.test(x) || o.addWarning({
1044
- message: "unsupported document encoding <" + x + ">, falling back to UTF-8"
1042
+ var g = M.exec(y), N = g && g[1];
1043
+ !N || P.test(N) || o.addWarning({
1044
+ message: "unsupported document encoding <" + N + ">, falling back to UTF-8"
1045
1045
  });
1046
1046
  }
1047
1047
  }
1048
1048
  function E(y, g) {
1049
- var x = p.peek();
1049
+ var N = p.peek();
1050
1050
  try {
1051
- p.push(x.handleNode(y));
1052
- } catch (M) {
1053
- l(M, g, a) && p.push(new dt());
1051
+ p.push(N.handleNode(y));
1052
+ } catch (C) {
1053
+ l(C, g, a) && p.push(new dt());
1054
1054
  }
1055
1055
  }
1056
- function N(y, g) {
1056
+ function x(y, g) {
1057
1057
  try {
1058
1058
  p.peek().handleText(y);
1059
- } catch (x) {
1060
- c(x, g);
1059
+ } catch (N) {
1060
+ c(N, g);
1061
1061
  }
1062
1062
  }
1063
1063
  function W(y, g) {
1064
- y.trim() && N(y, g);
1064
+ y.trim() && x(y, g);
1065
1065
  }
1066
1066
  var m = i.getPackages().reduce(function(y, g) {
1067
1067
  return y[g.uri] = g.prefix, y;
1068
- }, Object.entries(et).reduce(function(y, [g, x]) {
1069
- return y[x] = g, y;
1068
+ }, Object.entries(et).reduce(function(y, [g, N]) {
1069
+ return y[N] = g, y;
1070
1070
  }, i.config && i.config.nsMap || {}));
1071
- return s.ns(m).on("openTag", function(y, g, x, M) {
1071
+ return s.ns(m).on("openTag", function(y, g, N, C) {
1072
1072
  var z = y.attrs || {}, q = Object.keys(z).reduce(function(w, b) {
1073
1073
  var S = g(z[b]);
1074
1074
  return w[b] = S, w;
@@ -1078,21 +1078,21 @@ yt.prototype.fromXML = function(e, t, r) {
1078
1078
  attributes: q,
1079
1079
  ns: y.ns
1080
1080
  };
1081
- E(_, M);
1082
- }).on("question", J).on("closeTag", d).on("cdata", N).on("text", function(y, g, x) {
1083
- W(g(y), x);
1081
+ E(_, C);
1082
+ }).on("question", J).on("closeTag", d).on("cdata", x).on("text", function(y, g, N) {
1083
+ W(g(y), N);
1084
1084
  }).on("error", l).on("warn", c), new Promise(function(y, g) {
1085
- var x;
1085
+ var N;
1086
1086
  try {
1087
1087
  s.parse(e), u();
1088
1088
  } catch (w) {
1089
- x = w;
1089
+ N = w;
1090
1090
  }
1091
- var M = n.element;
1092
- !x && !M && (x = le("failed to parse document as <" + n.type.$descriptor.name + ">"));
1091
+ var C = n.element;
1092
+ !N && !C && (N = le("failed to parse document as <" + n.type.$descriptor.name + ">"));
1093
1093
  var z = o.warnings, q = o.references, _ = o.elementsById;
1094
- return x ? (x.warnings = z, g(x)) : y({
1095
- rootElement: M,
1094
+ return N ? (N.warnings = z, g(N)) : y({
1095
+ rootElement: C,
1096
1096
  elementsById: _,
1097
1097
  references: q,
1098
1098
  warnings: z
@@ -1102,7 +1102,7 @@ yt.prototype.fromXML = function(e, t, r) {
1102
1102
  yt.prototype.handler = function(e) {
1103
1103
  return new ft(this.model, e);
1104
1104
  };
1105
- function _n() {
1105
+ function Bn() {
1106
1106
  var e = [];
1107
1107
  return Object.defineProperty(e, "peek", {
1108
1108
  value: function() {
@@ -1110,8 +1110,8 @@ function _n() {
1110
1110
  }
1111
1111
  }), e;
1112
1112
  }
1113
- var Bn = `<?xml version="1.0" encoding="UTF-8"?>
1114
- `, Sn = /<|>|'|"|&|\n\r|\n/g, Wt = /<|>|&/g;
1113
+ var Sn = `<?xml version="1.0" encoding="UTF-8"?>
1114
+ `, On = /<|>|'|"|&|\n\r|\n/g, Wt = /<|>|&/g;
1115
1115
  function ee(e) {
1116
1116
  this.prefixMap = {}, this.uriMap = {}, this.used = {}, this.wellknown = [], this.custom = [], this.parent = e, this.defaultPrefixMap = e && e.defaultPrefixMap || {};
1117
1117
  }
@@ -1147,11 +1147,11 @@ ee.prototype.getUsed = function(e) {
1147
1147
  return this.used[n];
1148
1148
  });
1149
1149
  };
1150
- function On(e) {
1150
+ function Fn(e) {
1151
1151
  return e.charAt(0).toLowerCase() + e.slice(1);
1152
1152
  }
1153
- function Fn(e, t) {
1154
- return Xt(t) ? On(e) : e;
1153
+ function kn(e, t) {
1154
+ return Xt(t) ? Fn(e) : e;
1155
1155
  }
1156
1156
  function Kt(e, t) {
1157
1157
  e.super_ = t, e.prototype = Object.create(t.prototype, {
@@ -1166,7 +1166,7 @@ function Kt(e, t) {
1166
1166
  function Jt(e) {
1167
1167
  return be(e) ? e : (e.prefix ? e.prefix + ":" : "") + e.localName;
1168
1168
  }
1169
- function kn(e) {
1169
+ function $n(e) {
1170
1170
  return e.getUsed().filter(function(t) {
1171
1171
  return t.prefix !== "xml";
1172
1172
  }).map(function(t) {
@@ -1174,13 +1174,13 @@ function kn(e) {
1174
1174
  return { name: r, value: t.uri };
1175
1175
  });
1176
1176
  }
1177
- function $n(e, t) {
1178
- return t.isGeneric ? F({ localName: t.ns.localName }, e) : F({ localName: Fn(t.ns.localName, t.$pkg) }, e);
1179
- }
1180
1177
  function qn(e, t) {
1178
+ return t.isGeneric ? F({ localName: t.ns.localName }, e) : F({ localName: kn(t.ns.localName, t.$pkg) }, e);
1179
+ }
1180
+ function Ln(e, t) {
1181
1181
  return F({ localName: t.ns.localName }, e);
1182
1182
  }
1183
- function Ln(e) {
1183
+ function Gn(e) {
1184
1184
  var t = e.$descriptor;
1185
1185
  return pt(t.properties, function(r) {
1186
1186
  var n = r.name;
@@ -1190,7 +1190,7 @@ function Ln(e) {
1190
1190
  return i === r.default || i === null ? !1 : r.isMany ? i.length : !0;
1191
1191
  });
1192
1192
  }
1193
- var Gn = {
1193
+ var jn = {
1194
1194
  "\n": "#10",
1195
1195
  "\n\r": "#10",
1196
1196
  '"': "#34",
@@ -1198,7 +1198,7 @@ var Gn = {
1198
1198
  "<": "#60",
1199
1199
  ">": "#62",
1200
1200
  "&": "#38"
1201
- }, jn = {
1201
+ }, Un = {
1202
1202
  "<": "lt",
1203
1203
  ">": "gt",
1204
1204
  "&": "amp"
@@ -1208,18 +1208,18 @@ function Yt(e, t, r) {
1208
1208
  return "&" + r[n] + ";";
1209
1209
  });
1210
1210
  }
1211
- function Un(e) {
1212
- return Yt(e, Sn, Gn);
1213
- }
1214
1211
  function Xn(e) {
1215
- return Yt(e, Wt, jn);
1212
+ return Yt(e, On, jn);
1216
1213
  }
1217
1214
  function Vn(e) {
1215
+ return Yt(e, Wt, Un);
1216
+ }
1217
+ function zn(e) {
1218
1218
  return pt(e, function(t) {
1219
1219
  return t.isAttr;
1220
1220
  });
1221
1221
  }
1222
- function zn(e) {
1222
+ function Hn(e) {
1223
1223
  return pt(e, function(t) {
1224
1224
  return !t.isAttr;
1225
1225
  });
@@ -1237,7 +1237,7 @@ function ge() {
1237
1237
  }
1238
1238
  ge.prototype.serializeValue = ge.prototype.serializeTo = function(e) {
1239
1239
  e.append(
1240
- this.escape ? Xn(this.value) : this.value
1240
+ this.escape ? Vn(this.value) : this.value
1241
1241
  );
1242
1242
  };
1243
1243
  ge.prototype.build = function(e, t) {
@@ -1250,48 +1250,48 @@ Kt(ht, ge);
1250
1250
  ht.prototype.serializeTo = function(e) {
1251
1251
  e.appendIndent().append("<" + this.tagName + ">"), this.serializeValue(e), e.append("</" + this.tagName + ">").appendNewLine();
1252
1252
  };
1253
- function C(e, t) {
1253
+ function D(e, t) {
1254
1254
  this.body = [], this.attrs = [], this.parent = e, this.propertyDescriptor = t;
1255
1255
  }
1256
- C.prototype.build = function(e) {
1256
+ D.prototype.build = function(e) {
1257
1257
  this.element = e;
1258
1258
  var t = e.$descriptor, r = this.propertyDescriptor, n, i, a = t.isGeneric;
1259
- return a ? n = this.parseGenericNsAttributes(e) : n = this.parseNsAttributes(e), r ? this.ns = this.nsPropertyTagName(r) : this.ns = this.nsTagName(t), this.tagName = this.addTagName(this.ns), a ? this.parseGenericContainments(e) : (i = Ln(e), this.parseAttributes(Vn(i)), this.parseContainments(zn(i))), this.parseGenericAttributes(e, n), this;
1259
+ return a ? n = this.parseGenericNsAttributes(e) : n = this.parseNsAttributes(e), r ? this.ns = this.nsPropertyTagName(r) : this.ns = this.nsTagName(t), this.tagName = this.addTagName(this.ns), a ? this.parseGenericContainments(e) : (i = Gn(e), this.parseAttributes(zn(i)), this.parseContainments(Hn(i))), this.parseGenericAttributes(e, n), this;
1260
1260
  };
1261
- C.prototype.nsTagName = function(e) {
1261
+ D.prototype.nsTagName = function(e) {
1262
1262
  var t = this.logNamespaceUsed(e.ns);
1263
- return $n(t, e);
1263
+ return qn(t, e);
1264
1264
  };
1265
- C.prototype.nsPropertyTagName = function(e) {
1265
+ D.prototype.nsPropertyTagName = function(e) {
1266
1266
  var t = this.logNamespaceUsed(e.ns);
1267
- return qn(t, e);
1267
+ return Ln(t, e);
1268
1268
  };
1269
- C.prototype.isLocalNs = function(e) {
1269
+ D.prototype.isLocalNs = function(e) {
1270
1270
  return e.uri === this.ns.uri;
1271
1271
  };
1272
- C.prototype.nsAttributeName = function(e) {
1272
+ D.prototype.nsAttributeName = function(e) {
1273
1273
  var t;
1274
1274
  if (be(e) ? t = j(e) : t = e.ns, e.inherited)
1275
1275
  return { localName: t.localName };
1276
1276
  var r = this.logNamespaceUsed(t);
1277
1277
  return this.getNamespaces().logUsed(r), this.isLocalNs(r) ? { localName: t.localName } : F({ localName: t.localName }, r);
1278
1278
  };
1279
- C.prototype.parseGenericNsAttributes = function(e) {
1279
+ D.prototype.parseGenericNsAttributes = function(e) {
1280
1280
  return Object.entries(e).filter(
1281
1281
  ([t, r]) => !t.startsWith("$") && this.parseNsAttribute(e, t, r)
1282
1282
  ).map(
1283
1283
  ([t, r]) => ({ name: t, value: r })
1284
1284
  );
1285
1285
  };
1286
- C.prototype.parseGenericContainments = function(e) {
1286
+ D.prototype.parseGenericContainments = function(e) {
1287
1287
  var t = e.$body;
1288
1288
  t && this.body.push(new ge().build({ type: "String" }, t));
1289
1289
  var r = e.$children;
1290
1290
  r && R(r, (n) => {
1291
- this.body.push(new C(this).build(n));
1291
+ this.body.push(new D(this).build(n));
1292
1292
  });
1293
1293
  };
1294
- C.prototype.parseNsAttribute = function(e, t, r) {
1294
+ D.prototype.parseNsAttribute = function(e, t, r) {
1295
1295
  var n = e.$model, i = j(t), a;
1296
1296
  if (i.prefix === "xmlns" && (a = { prefix: i.localName, uri: r }), !i.prefix && i.localName === "xmlns" && (a = { uri: r }), !a)
1297
1297
  return {
@@ -1305,14 +1305,14 @@ C.prototype.parseNsAttribute = function(e, t, r) {
1305
1305
  this.getNamespaces().logUsed(o);
1306
1306
  }
1307
1307
  };
1308
- C.prototype.parseNsAttributes = function(e) {
1308
+ D.prototype.parseNsAttributes = function(e) {
1309
1309
  var t = this, r = e.$attrs, n = [];
1310
1310
  return R(r, function(i, a) {
1311
1311
  var o = t.parseNsAttribute(e, a, i);
1312
1312
  o && n.push(o);
1313
1313
  }), n;
1314
1314
  };
1315
- C.prototype.parseGenericAttributes = function(e, t) {
1315
+ D.prototype.parseGenericAttributes = function(e, t) {
1316
1316
  var r = this;
1317
1317
  R(t, function(n) {
1318
1318
  try {
@@ -1326,7 +1326,7 @@ C.prototype.parseGenericAttributes = function(e, t) {
1326
1326
  }
1327
1327
  });
1328
1328
  };
1329
- C.prototype.parseContainments = function(e) {
1329
+ D.prototype.parseContainments = function(e) {
1330
1330
  var t = this, r = this.body, n = this.element;
1331
1331
  R(e, function(i) {
1332
1332
  var a = n.get(i.name), o = i.isReference, s = i.isMany;
@@ -1344,20 +1344,20 @@ C.prototype.parseContainments = function(e) {
1344
1344
  var p = zt(i);
1345
1345
  R(a, function(l) {
1346
1346
  var c;
1347
- p ? p === Vt ? c = new C(t, i) : c = new je(t, i, p) : c = new C(t), r.push(c.build(l));
1347
+ p ? p === Vt ? c = new D(t, i) : c = new je(t, i, p) : c = new D(t), r.push(c.build(l));
1348
1348
  });
1349
1349
  }
1350
1350
  });
1351
1351
  };
1352
- C.prototype.getNamespaces = function(e) {
1352
+ D.prototype.getNamespaces = function(e) {
1353
1353
  var t = this.namespaces, r = this.parent, n;
1354
1354
  return t || (n = r && r.getNamespaces(), e || !n ? this.namespaces = t = new ee(n) : t = n), t;
1355
1355
  };
1356
- C.prototype.logNamespace = function(e, t, r) {
1356
+ D.prototype.logNamespace = function(e, t, r) {
1357
1357
  var n = this.getNamespaces(r), i = e.uri, a = e.prefix, o = n.byUri(i);
1358
1358
  return (!o || r) && n.add(e, t), n.mapPrefix(a, i), e;
1359
1359
  };
1360
- C.prototype.logNamespaceUsed = function(e, t) {
1360
+ D.prototype.logNamespaceUsed = function(e, t) {
1361
1361
  var r = this.getNamespaces(t), n = e.prefix, i = e.uri, a, o, s;
1362
1362
  if (!n && !i)
1363
1363
  return { localName: e.localName };
@@ -1370,7 +1370,7 @@ C.prototype.logNamespaceUsed = function(e, t) {
1370
1370
  }
1371
1371
  return n && r.mapPrefix(n, i), e;
1372
1372
  };
1373
- C.prototype.parseAttributes = function(e) {
1373
+ D.prototype.parseAttributes = function(e) {
1374
1374
  var t = this, r = this.element;
1375
1375
  R(e, function(n) {
1376
1376
  var i = r.get(n.name);
@@ -1386,36 +1386,36 @@ C.prototype.parseAttributes = function(e) {
1386
1386
  t.addAttribute(t.nsAttributeName(n), i);
1387
1387
  });
1388
1388
  };
1389
- C.prototype.addTagName = function(e) {
1389
+ D.prototype.addTagName = function(e) {
1390
1390
  var t = this.logNamespaceUsed(e);
1391
1391
  return this.getNamespaces().logUsed(t), Jt(e);
1392
1392
  };
1393
- C.prototype.addAttribute = function(e, t) {
1393
+ D.prototype.addAttribute = function(e, t) {
1394
1394
  var r = this.attrs;
1395
- be(t) && (t = Un(t));
1396
- var n = fn(r, function(a) {
1395
+ be(t) && (t = Xn(t));
1396
+ var n = yn(r, function(a) {
1397
1397
  return a.name.localName === e.localName && a.name.uri === e.uri && a.name.prefix === e.prefix;
1398
1398
  }), i = { name: e, value: t };
1399
1399
  n !== -1 ? r.splice(n, 1, i) : r.push(i);
1400
1400
  };
1401
- C.prototype.serializeAttributes = function(e) {
1401
+ D.prototype.serializeAttributes = function(e) {
1402
1402
  var t = this.attrs, r = this.namespaces;
1403
- r && (t = kn(r).concat(t)), R(t, function(n) {
1403
+ r && (t = $n(r).concat(t)), R(t, function(n) {
1404
1404
  e.append(" ").append(Jt(n.name)).append('="').append(n.value).append('"');
1405
1405
  });
1406
1406
  };
1407
- C.prototype.serializeTo = function(e) {
1407
+ D.prototype.serializeTo = function(e) {
1408
1408
  var t = this.body[0], r = t && t.constructor !== ge;
1409
1409
  e.appendIndent().append("<" + this.tagName), this.serializeAttributes(e), e.append(t ? ">" : " />"), t && (r && e.appendNewLine().indent(), R(this.body, function(n) {
1410
1410
  n.serializeTo(e);
1411
1411
  }), r && e.unindent().appendIndent(), e.append("</" + this.tagName + ">")), e.appendNewLine();
1412
1412
  };
1413
1413
  function je(e, t, r) {
1414
- C.call(this, e, t), this.serialization = r;
1414
+ D.call(this, e, t), this.serialization = r;
1415
1415
  }
1416
- Kt(je, C);
1416
+ Kt(je, D);
1417
1417
  je.prototype.parseNsAttributes = function(e) {
1418
- var t = C.prototype.parseNsAttributes.call(this, e).filter(
1418
+ var t = D.prototype.parseNsAttributes.call(this, e).filter(
1419
1419
  (o) => o.name !== this.serialization
1420
1420
  ), r = e.$descriptor;
1421
1421
  if (r.name === this.propertyDescriptor.type)
@@ -1431,12 +1431,12 @@ je.prototype.parseNsAttributes = function(e) {
1431
1431
  je.prototype.isLocalNs = function(e) {
1432
1432
  return e.uri === (this.typeNs || this.ns).uri;
1433
1433
  };
1434
- function Hn() {
1434
+ function Wn() {
1435
1435
  this.value = "", this.write = function(e) {
1436
1436
  this.value += e;
1437
1437
  };
1438
1438
  }
1439
- function Wn(e, t) {
1439
+ function Kn(e, t) {
1440
1440
  var r = [""];
1441
1441
  this.append = function(n) {
1442
1442
  return e.write(n), this;
@@ -1451,20 +1451,20 @@ function Wn(e, t) {
1451
1451
  return r.pop(), this;
1452
1452
  };
1453
1453
  }
1454
- function Kn(e) {
1454
+ function Jn(e) {
1455
1455
  e = F({ format: !1, preamble: !0 }, e || {});
1456
1456
  function t(r, n) {
1457
- var i = n || new Hn(), a = new Wn(i, e.format);
1458
- e.preamble && a.append(Bn);
1459
- var o = new C(), s = r.$model;
1460
- if (o.getNamespaces().mapDefaultPrefixes(Jn(s)), o.build(r).serializeTo(a), !n)
1457
+ var i = n || new Wn(), a = new Kn(i, e.format);
1458
+ e.preamble && a.append(Sn);
1459
+ var o = new D(), s = r.$model;
1460
+ if (o.getNamespaces().mapDefaultPrefixes(Yn(s)), o.build(r).serializeTo(a), !n)
1461
1461
  return i.value;
1462
1462
  }
1463
1463
  return {
1464
1464
  toXML: t
1465
1465
  };
1466
1466
  }
1467
- function Jn(e) {
1467
+ function Yn(e) {
1468
1468
  const t = e.config && e.config.nsMap || {}, r = {};
1469
1469
  for (const n in et)
1470
1470
  r[n] = et[n];
@@ -1486,7 +1486,7 @@ Ue.prototype.fromXML = function(e, t, r) {
1486
1486
  return n.fromXML(e, i);
1487
1487
  };
1488
1488
  Ue.prototype.toXML = function(e, t) {
1489
- var r = new Kn(t);
1489
+ var r = new Jn(t);
1490
1490
  return new Promise(function(n, i) {
1491
1491
  try {
1492
1492
  var a = r.toXML(e);
@@ -1498,7 +1498,7 @@ Ue.prototype.toXML = function(e, t) {
1498
1498
  }
1499
1499
  });
1500
1500
  };
1501
- var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpmn", er = [], tr = [
1501
+ var Qn = "BPMN20", Zn = "http://www.omg.org/spec/BPMN/20100524/MODEL", er = "bpmn", tr = [], nr = [
1502
1502
  {
1503
1503
  name: "Interface",
1504
1504
  superClass: [
@@ -4313,7 +4313,7 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4313
4313
  }
4314
4314
  ]
4315
4315
  }
4316
- ], nr = [
4316
+ ], rr = [
4317
4317
  {
4318
4318
  name: "ProcessType",
4319
4319
  literalValues: [
@@ -4443,18 +4443,18 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4443
4443
  }
4444
4444
  ]
4445
4445
  }
4446
- ], rr = {
4446
+ ], ir = {
4447
4447
  tagAlias: "lowerCase",
4448
4448
  typePrefix: "t"
4449
- }, ir = {
4450
- name: Yn,
4451
- uri: Qn,
4452
- prefix: Zn,
4453
- associations: er,
4454
- types: tr,
4455
- enumerations: nr,
4456
- xml: rr
4457
- }, ar = "BPMNDI", sr = "http://www.omg.org/spec/BPMN/20100524/DI", or = "bpmndi", pr = [
4449
+ }, ar = {
4450
+ name: Qn,
4451
+ uri: Zn,
4452
+ prefix: er,
4453
+ associations: tr,
4454
+ types: nr,
4455
+ enumerations: rr,
4456
+ xml: ir
4457
+ }, sr = "BPMNDI", or = "http://www.omg.org/spec/BPMN/20100524/DI", pr = "bpmndi", lr = [
4458
4458
  {
4459
4459
  name: "BPMNDiagram",
4460
4460
  properties: [
@@ -4604,7 +4604,7 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4604
4604
  "di:Style"
4605
4605
  ]
4606
4606
  }
4607
- ], lr = [
4607
+ ], cr = [
4608
4608
  {
4609
4609
  name: "ParticipantBandKind",
4610
4610
  literalValues: [
@@ -4639,14 +4639,14 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4639
4639
  }
4640
4640
  ]
4641
4641
  }
4642
- ], cr = [], ur = {
4643
- name: ar,
4644
- uri: sr,
4645
- prefix: or,
4646
- types: pr,
4647
- enumerations: lr,
4648
- associations: cr
4649
- }, dr = "DC", mr = "http://www.omg.org/spec/DD/20100524/DC", fr = "dc", yr = [
4642
+ ], ur = [], dr = {
4643
+ name: sr,
4644
+ uri: or,
4645
+ prefix: pr,
4646
+ types: lr,
4647
+ enumerations: cr,
4648
+ associations: ur
4649
+ }, mr = "DC", fr = "http://www.omg.org/spec/DD/20100524/DC", yr = "dc", gr = [
4650
4650
  {
4651
4651
  name: "Boolean"
4652
4652
  },
@@ -4738,13 +4738,13 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4738
4738
  }
4739
4739
  ]
4740
4740
  }
4741
- ], gr = [], hr = {
4742
- name: dr,
4743
- uri: mr,
4744
- prefix: fr,
4745
- types: yr,
4746
- associations: gr
4747
- }, br = "DI", Er = "http://www.omg.org/spec/DD/20100524/DI", wr = "di", vr = [
4741
+ ], hr = [], br = {
4742
+ name: mr,
4743
+ uri: fr,
4744
+ prefix: yr,
4745
+ types: gr,
4746
+ associations: hr
4747
+ }, Er = "DI", wr = "http://www.omg.org/spec/DD/20100524/DI", vr = "di", Ir = [
4748
4748
  {
4749
4749
  name: "DiagramElement",
4750
4750
  isAbstract: !0,
@@ -4972,16 +4972,16 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
4972
4972
  }
4973
4973
  ]
4974
4974
  }
4975
- ], Ir = [], Tr = {
4975
+ ], Tr = [], xr = {
4976
4976
  tagAlias: "lowerCase"
4977
4977
  }, Nr = {
4978
- name: br,
4979
- uri: Er,
4980
- prefix: wr,
4981
- types: vr,
4982
- associations: Ir,
4983
- xml: Tr
4984
- }, xr = "bpmn.io colors for BPMN", Rr = "http://bpmn.io/schema/bpmn/biocolor/1.0", Ar = "bioc", Mr = [
4978
+ name: Er,
4979
+ uri: wr,
4980
+ prefix: vr,
4981
+ types: Ir,
4982
+ associations: Tr,
4983
+ xml: xr
4984
+ }, Rr = "bpmn.io colors for BPMN", Ar = "http://bpmn.io/schema/bpmn/biocolor/1.0", Mr = "bioc", Cr = [
4985
4985
  {
4986
4986
  name: "ColoredShape",
4987
4987
  extends: [
@@ -5018,14 +5018,14 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
5018
5018
  }
5019
5019
  ]
5020
5020
  }
5021
- ], Cr = [], Dr = [], Pr = {
5022
- name: xr,
5023
- uri: Rr,
5024
- prefix: Ar,
5025
- types: Mr,
5026
- enumerations: Cr,
5027
- associations: Dr
5028
- }, _r = "BPMN in Color", Br = "http://www.omg.org/spec/BPMN/non-normative/color/1.0", Sr = "color", Or = [
5021
+ ], Dr = [], Pr = [], _r = {
5022
+ name: Rr,
5023
+ uri: Ar,
5024
+ prefix: Mr,
5025
+ types: Cr,
5026
+ enumerations: Dr,
5027
+ associations: Pr
5028
+ }, Br = "BPMN in Color", Sr = "http://www.omg.org/spec/BPMN/non-normative/color/1.0", Or = "color", Fr = [
5029
5029
  {
5030
5030
  name: "ColoredLabel",
5031
5031
  extends: [
@@ -5070,27 +5070,27 @@ var Yn = "BPMN20", Qn = "http://www.omg.org/spec/BPMN/20100524/MODEL", Zn = "bpm
5070
5070
  }
5071
5071
  ]
5072
5072
  }
5073
- ], Fr = [], kr = [], $r = {
5074
- name: _r,
5075
- uri: Br,
5076
- prefix: Sr,
5077
- types: Or,
5078
- enumerations: Fr,
5079
- associations: kr
5073
+ ], kr = [], $r = [], qr = {
5074
+ name: Br,
5075
+ uri: Sr,
5076
+ prefix: Or,
5077
+ types: Fr,
5078
+ enumerations: kr,
5079
+ associations: $r
5080
5080
  };
5081
- const qr = {
5082
- bpmn: ir,
5083
- bpmndi: ur,
5084
- dc: hr,
5081
+ const Lr = {
5082
+ bpmn: ar,
5083
+ bpmndi: dr,
5084
+ dc: br,
5085
5085
  di: Nr,
5086
- bioc: Pr,
5087
- color: $r
5086
+ bioc: _r,
5087
+ color: qr
5088
5088
  };
5089
- function Lr(e, t) {
5090
- const r = F({}, qr, e);
5089
+ function Gr(e, t) {
5090
+ const r = F({}, Lr, e);
5091
5091
  return new Ue(r, t);
5092
5092
  }
5093
- function Gr(e) {
5093
+ function jr(e) {
5094
5094
  return !!e.sourceRef;
5095
5095
  }
5096
5096
  function tt(e) {
@@ -5130,21 +5130,21 @@ function k(e, t, r = "r", n = "top-left") {
5130
5130
  throw new Error("unexpected dockingDirection: <" + r + ">");
5131
5131
  }
5132
5132
  function en(e, t, r) {
5133
- const n = e.di, i = t.di, a = n.get("bounds"), o = i.get("bounds"), s = nt(a), p = nt(o), l = t.gridPosition.col - e.gridPosition.col, c = t.gridPosition.row - e.gridPosition.row, u = `${c > 0 ? "bottom" : "top"}-${l > 0 ? "right" : "left"}`, d = `${c > 0 ? "top" : "bottom"}-${l > 0 ? "left" : "right"}`, f = e.grid || e.attachedToRef?.grid, P = t.grid;
5133
+ const n = e.di, i = t.di, a = n.get("bounds"), o = i.get("bounds"), s = nt(a), p = nt(o), l = t.gridPosition.col - e.gridPosition.col, c = t.gridPosition.row - e.gridPosition.row, u = `${c > 0 ? "bottom" : "top"}-${l > 0 ? "right" : "left"}`, d = `${c > 0 ? "top" : "bottom"}-${l > 0 ? "left" : "right"}`, f = e.grid || e.attachedToRef?.grid, M = t.grid;
5134
5134
  if (l === 0 && c === 0) {
5135
- const { x: E, y: N } = Ke(e.gridPosition.row, e.gridPosition.col);
5135
+ const { x: E, y: x } = Ke(e.gridPosition.row, e.gridPosition.col);
5136
5136
  return [
5137
5137
  k(s, a, "r", u),
5138
5138
  { x: f ? E + (f.getGridDimensions()[1] + 1) * $ : E + $, y: s.y },
5139
- { x: f ? E + (f.getGridDimensions()[1] + 1) * $ : E + $, y: N },
5140
- { x: p.x, y: N },
5139
+ { x: f ? E + (f.getGridDimensions()[1] + 1) * $ : E + $, y: x },
5140
+ { x: p.x, y: x },
5141
5141
  k(p, o, "t", d)
5142
5142
  ];
5143
5143
  }
5144
5144
  if (l < 0) {
5145
- const { y: E } = Ke(e.gridPosition.row, e.gridPosition.col), N = v / 2;
5145
+ const { y: E } = Ke(e.gridPosition.row, e.gridPosition.col), x = v / 2;
5146
5146
  if (s.y >= p.y) {
5147
- const W = Ur(e, t, r);
5147
+ const W = Xr(e, t, r);
5148
5148
  return W ? [
5149
5149
  k(s, a, "b"),
5150
5150
  { x: s.x, y: f ? E + (f.getGridDimensions()[0] + 1) * v : E + v + W * v },
@@ -5157,7 +5157,7 @@ function en(e, t, r) {
5157
5157
  k(p, o, "b")
5158
5158
  ];
5159
5159
  } else {
5160
- const W = s.y - N;
5160
+ const W = s.y - x;
5161
5161
  return [
5162
5162
  k(s, a, "t"),
5163
5163
  { x: s.x, y: W },
@@ -5176,10 +5176,10 @@ function en(e, t, r) {
5176
5176
  k(p, o, "b")
5177
5177
  ];
5178
5178
  } else {
5179
- const E = k(s, a, "h", u), N = k(p, o, "h", d);
5180
- return f && (E.y = a.y + Be / 2), P && (N.y = o.y + Be / 2), [
5179
+ const E = k(s, a, "h", u), x = k(p, o, "h", d);
5180
+ return f && (E.y = a.y + Be / 2), M && (x.y = o.y + Be / 2), [
5181
5181
  E,
5182
- N
5182
+ x
5183
5183
  ];
5184
5184
  }
5185
5185
  if (l === 0)
@@ -5198,13 +5198,13 @@ function en(e, t, r) {
5198
5198
  k(s, a, "v", u),
5199
5199
  k(p, o, "v", d)
5200
5200
  ];
5201
- const D = jr(e, t, r);
5202
- if (D) {
5203
- const E = k(s, a, D[0], u), N = k(p, o, D[1], d), W = D[0] === "h" ? { x: N.x, y: E.y } : { x: E.x, y: N.y };
5201
+ const P = Ur(e, t, r);
5202
+ if (P) {
5203
+ const E = k(s, a, P[0], u), x = k(p, o, P[1], d), W = P[0] === "h" ? { x: x.x, y: E.y } : { x: E.x, y: x.y };
5204
5204
  return [
5205
5205
  E,
5206
5206
  W,
5207
- N
5207
+ x
5208
5208
  ];
5209
5209
  }
5210
5210
  const J = -Math.sign(c) * v / 2;
@@ -5252,7 +5252,7 @@ function Dt(e, t, r) {
5252
5252
  let l = 0;
5253
5253
  return s && (l += r.getElementsInRange({ row: n, col: i }, { row: n, col: o }).length), p && (l += r.getElementsInRange({ row: n, col: o }, { row: a, col: o }).length), l > 2;
5254
5254
  }
5255
- function jr(e, t, r) {
5255
+ function Ur(e, t, r) {
5256
5256
  const { row: n, col: i } = e.gridPosition, { row: a, col: o } = t.gridPosition, s = o - i, p = a - n;
5257
5257
  if (s > 0 && p !== 0)
5258
5258
  if (p > 0) {
@@ -5265,13 +5265,13 @@ function jr(e, t, r) {
5265
5265
  return l += r.getElementsInRange({ row: n, col: i }, c).length, l += r.getElementsInRange(c, { row: a, col: o }).length, l > 2 ? !1 : ["h", "v"];
5266
5266
  }
5267
5267
  }
5268
- function Ur(e, t, r) {
5268
+ function Xr(e, t, r) {
5269
5269
  const n = e.attachedToRef ? e.attachedToRef : e, i = t.attachedToRef ? t.attachedToRef : t, [a, o] = r.find(n), [, s] = r.find(i), p = o < s ? o : s, l = o < s ? s : o;
5270
5270
  return r.getAllElements().filter((u) => u.gridPosition.row === a && u.gridPosition.col > p && u.gridPosition.col < l).reduce((u, d) => {
5271
5271
  if (d.grid?.getGridDimensions()[0] > u) return d.grid?.getGridDimensions()[0];
5272
5272
  }, 0);
5273
5273
  }
5274
- class Xr {
5274
+ class Vr {
5275
5275
  constructor() {
5276
5276
  this.grid = [];
5277
5277
  }
@@ -5388,7 +5388,7 @@ class Xr {
5388
5388
  !r && !Number.isInteger(r) ? a.splice(a.length, 0, ...i) : a.splice(r + 1, 0, ...i);
5389
5389
  }
5390
5390
  }
5391
- class Vr {
5391
+ class zr {
5392
5392
  constructor(t) {
5393
5393
  this.moddle = t;
5394
5394
  }
@@ -5411,7 +5411,7 @@ class Vr {
5411
5411
  }
5412
5412
  createDiWaypoints(t) {
5413
5413
  var r = this;
5414
- return yn(t, function(n) {
5414
+ return gn(t, function(n) {
5415
5415
  return r.createDiWaypoint(n);
5416
5416
  });
5417
5417
  }
@@ -5431,11 +5431,11 @@ class Vr {
5431
5431
  return this.create("bpmndi:BPMNDiagram", t);
5432
5432
  }
5433
5433
  }
5434
- var zr = {
5434
+ var Hr = {
5435
5435
  addToGrid: ({ element: e, grid: t, visited: r }) => {
5436
5436
  const n = [];
5437
5437
  return (e.attachers || []).map((a) => (a.outgoing || []).reverse()).flat().map((a) => a.targetRef).forEach((a, o, s) => {
5438
- r.has(a) || (Hr(a, e, t), n.push(a), r.add(a));
5438
+ r.has(a) || (Wr(a, e, t), n.push(a), r.add(a));
5439
5439
  }), n;
5440
5440
  },
5441
5441
  createElementDi: ({ element: e, row: t, col: r, diFactory: n, shift: i }) => {
@@ -5452,16 +5452,16 @@ var zr = {
5452
5452
  },
5453
5453
  createConnectionDi: ({ element: e, row: t, col: r, layoutGrid: n, diFactory: i, shift: a }) => (e.attachers || []).flatMap((s) => (s.outgoing || []).map((l) => {
5454
5454
  const c = l.targetRef, u = en(s, c, n);
5455
- return Wr(s, u, [t, r]), i.createDiEdge(l, u, {
5455
+ return Kr(s, u, [t, r]), i.createDiEdge(l, u, {
5456
5456
  id: l.id + "_di"
5457
5457
  });
5458
5458
  }))
5459
5459
  };
5460
- function Hr(e, t, r) {
5460
+ function Wr(e, t, r) {
5461
5461
  const [n, i] = r.find(t);
5462
5462
  (r.get(n + 1, i) || r.get(n + 1, i + 1)) && r.createRow(n), r.add(e, [n + 1, i + 1]);
5463
5463
  }
5464
- function Wr(e, t, [r, n]) {
5464
+ function Kr(e, t, [r, n]) {
5465
5465
  const a = e.di.get("bounds"), o = nt(a), s = k(o, a, "b");
5466
5466
  if (t[0].x === s.x && t[0].y === s.y)
5467
5467
  return;
@@ -5483,7 +5483,7 @@ function Wr(e, t, [r, n]) {
5483
5483
  ];
5484
5484
  t.splice(0, 1, ...l);
5485
5485
  }
5486
- var Kr = {
5486
+ var Jr = {
5487
5487
  createElementDi: ({ element: e, row: t, col: r, diFactory: n, shift: i }) => {
5488
5488
  const a = rt(e, t, r, i), o = {
5489
5489
  id: e.id + "_di"
@@ -5492,14 +5492,14 @@ var Kr = {
5492
5492
  const s = n.createDiShape(e, a, o);
5493
5493
  return e.di = s, e.gridPosition = { row: t, col: r }, s;
5494
5494
  }
5495
- }, Jr = {
5495
+ }, Yr = {
5496
5496
  addToGrid: ({ element: e, grid: t, visited: r, stack: n }) => {
5497
5497
  let i = [];
5498
5498
  const a = (e.outgoing || []).map((s) => s.targetRef).filter((s) => s);
5499
5499
  let o = null;
5500
- return a.length > 1 && ei(a) && t.adjustGridPosition(e), a.forEach((s, p, l) => {
5501
- r.has(s) || (o || n.length > 0) && Zr(s, r) && !Qr(s, r) || (o ? G(e, "bpmn:ExclusiveGateway") && G(s, "bpmn:ExclusiveGateway") ? t.addAfter(o, s) : t.addBelow(l[p - 1], s) : t.addAfter(e, s), s !== e && (o = s), i.unshift(s), r.add(s));
5502
- }), i = Yr(i, "bpmn:ExclusiveGateway"), i;
5500
+ return a.length > 1 && ti(a) && t.adjustGridPosition(e), a.forEach((s, p, l) => {
5501
+ r.has(s) || (o || n.length > 0) && ei(s, r) && !Zr(s, r) || (o ? G(e, "bpmn:ExclusiveGateway") && G(s, "bpmn:ExclusiveGateway") ? t.addAfter(o, s) : t.addBelow(l[p - 1], s) : t.addAfter(e, s), s !== e && (o = s), i.unshift(s), r.add(s));
5502
+ }), i = Qr(i, "bpmn:ExclusiveGateway"), i;
5503
5503
  },
5504
5504
  createConnectionDi: ({ element: e, row: t, col: r, layoutGrid: n, diFactory: i }) => (e.outgoing || []).map((o) => {
5505
5505
  const s = o.targetRef, p = en(e, s, n);
@@ -5508,16 +5508,16 @@ var Kr = {
5508
5508
  });
5509
5509
  })
5510
5510
  };
5511
- function Yr(e, t) {
5511
+ function Qr(e, t) {
5512
5512
  const r = e.filter((i) => !G(i, t));
5513
5513
  return [...e.filter((i) => G(i, t)), ...r];
5514
5514
  }
5515
- function Qr(e, t) {
5515
+ function Zr(e, t) {
5516
5516
  for (const r of e.incoming)
5517
5517
  if (!t.has(r.sourceRef))
5518
5518
  return Qt(e, r.sourceRef);
5519
5519
  }
5520
- function Zr(e, t) {
5520
+ function ei(e, t) {
5521
5521
  if (e.incoming.length > 1) {
5522
5522
  for (const r of e.incoming)
5523
5523
  if (!t.has(r.sourceRef))
@@ -5525,19 +5525,19 @@ function Zr(e, t) {
5525
5525
  }
5526
5526
  return !1;
5527
5527
  }
5528
- function ei(e) {
5528
+ function ti(e) {
5529
5529
  return e.every((t) => G(t, "bpmn:Task"));
5530
5530
  }
5531
- var ti = {
5531
+ var ni = {
5532
5532
  addToGrid: ({ element: e, grid: t, visited: r }) => {
5533
5533
  const n = [], i = (e.incoming || []).map((a) => a.sourceRef).filter((a) => a);
5534
5534
  return i.length > 1 && (t.adjustColumnForMultipleIncoming(i, e), t.adjustRowForMultipleIncoming(i, e)), n;
5535
5535
  }
5536
5536
  };
5537
- const ni = [Kr, ti, Jr, zr];
5538
- class ri {
5537
+ const ri = [Jr, ni, Yr, Hr];
5538
+ class ii {
5539
5539
  constructor() {
5540
- this.moddle = new Lr(), this.diFactory = new Vr(this.moddle), this._handlers = ni;
5540
+ this.moddle = new Gr(), this.diFactory = new zr(this.moddle), this._handlers = ri;
5541
5541
  }
5542
5542
  handle(t, r) {
5543
5543
  return this._handlers.filter((n) => Ft(n[t])).map((n) => n[t](r));
@@ -5551,7 +5551,7 @@ class ri {
5551
5551
  createGridsForProcesses() {
5552
5552
  const t = this.layoutedProcesses.sort((r, n) => n.level - r.level);
5553
5553
  for (const r of t)
5554
- if (r.grid = this.createGridLayout(r), ai(r.grid), si(r.grid), r.isExpanded) {
5554
+ if (r.grid = this.createGridLayout(r), si(r.grid), oi(r.grid), r.isExpanded) {
5555
5555
  const [n, i] = r.grid.getGridDimensions();
5556
5556
  n === 0 && r.grid.createRow(), i === 0 && r.grid.createCol();
5557
5557
  }
@@ -5576,13 +5576,13 @@ class ri {
5576
5576
  this.diagram.diagrams = [];
5577
5577
  }
5578
5578
  createGridLayout(t) {
5579
- const r = new Xr(), n = t.flowElements || [], i = n.filter((o) => !G(o, "bpmn:SequenceFlow"));
5579
+ const r = new Vr(), n = t.flowElements || [], i = n.filter((o) => !G(o, "bpmn:SequenceFlow"));
5580
5580
  if (!n)
5581
5581
  return r;
5582
- ii(n);
5582
+ ai(n);
5583
5583
  const a = /* @__PURE__ */ new Set();
5584
5584
  for (; a.size < i.filter((o) => !o.attachedToRef).length; ) {
5585
- const o = n.filter((p) => !Gr(p) && !tt(p) && (!p.incoming || !oi(p)) && !a.has(p)), s = [...o];
5585
+ const o = n.filter((p) => !jr(p) && !tt(p) && (!p.incoming || !pi(p)) && !a.has(p)), s = [...o];
5586
5586
  if (o.forEach((p) => {
5587
5587
  r.add(p), a.add(p);
5588
5588
  }), this.handleGrid(r, a, s), r.getElementsTotal() !== i.length) {
@@ -5651,13 +5651,13 @@ class ri {
5651
5651
  return this.diagram.diagrams.find((r) => r.plane.planeElement.includes(t));
5652
5652
  }
5653
5653
  }
5654
- function ii(e) {
5654
+ function ai(e) {
5655
5655
  e.filter((r) => tt(r)).forEach((r) => {
5656
5656
  const n = r.attachedToRef, i = n.attachers || [];
5657
5657
  i.push(r), n.attachers = i;
5658
5658
  });
5659
5659
  }
5660
- function ai(e) {
5660
+ function si(e) {
5661
5661
  const [t, r] = e.getGridDimensions();
5662
5662
  for (let n = r - 1; n >= 0; n--) {
5663
5663
  const i = [];
@@ -5673,7 +5673,7 @@ function ai(e) {
5673
5673
  e.createCol(n, o);
5674
5674
  }
5675
5675
  }
5676
- function si(e) {
5676
+ function oi(e) {
5677
5677
  const [t, r] = e.getGridDimensions();
5678
5678
  for (let n = t - 1; n >= 0; n--) {
5679
5679
  const i = [];
@@ -5690,14 +5690,14 @@ function si(e) {
5690
5690
  e.createRow(n);
5691
5691
  }
5692
5692
  }
5693
- function oi(e) {
5693
+ function pi(e) {
5694
5694
  const t = e.incoming?.filter((n) => n.sourceRef !== e && n.sourceRef.attachedToRef === void 0) || [], r = e.incoming?.filter((n) => n.sourceRef !== e && n.sourceRef.attachedToRef !== e);
5695
5695
  return t?.length > 0 || r?.length > 0;
5696
5696
  }
5697
5697
  function tn(e) {
5698
- return new ri().layoutProcess(e);
5698
+ return new ii().layoutProcess(e);
5699
5699
  }
5700
- const pi = (e) => ({
5700
+ const li = (e) => ({
5701
5701
  name: "get_selected_element",
5702
5702
  description: "Gets the currently selected BPMN element on the canvas. Returns the element ID, type, and name, or null if nothing is selected. Use this to understand which element the user is referring to.",
5703
5703
  parameters: {},
@@ -5723,7 +5723,7 @@ const pi = (e) => ({
5723
5723
  throw r("get_selected_element", n), n;
5724
5724
  }
5725
5725
  }
5726
- }), li = (e) => e.includes(":") ? e : `bpmn:${e[0].toUpperCase()}${e.slice(1)}`, ci = (e) => ({
5726
+ }), ci = (e) => e.includes(":") ? e : `bpmn:${e[0].toUpperCase()}${e.slice(1)}`, ui = (e) => ({
5727
5727
  name: "find_elements_by_type",
5728
5728
  description: "Finds all BPMN elements of a specific type in the current diagram. Returns a compact list with id, type, and name for each match. Supported types: userTask, serviceTask, startEvent, endEvent, exclusiveGateway, parallelGateway, subProcess, sequenceFlow, etc.",
5729
5729
  parameters: {
@@ -5743,7 +5743,7 @@ const pi = (e) => ({
5743
5743
  descriptionFormatter: () => "Searching elements",
5744
5744
  handler: async (t, r) => {
5745
5745
  try {
5746
- const n = li(t.bpmnType);
5746
+ const n = ci(t.bpmnType);
5747
5747
  return e.modeler.getElementRegistry().filter((i) => e.modeler.is(i, n)).map((i) => ({
5748
5748
  id: i.id,
5749
5749
  type: i.type,
@@ -5753,7 +5753,7 @@ const pi = (e) => ({
5753
5753
  throw r("find_elements_by_type", n), n;
5754
5754
  }
5755
5755
  }
5756
- }), ui = (e, t) => {
5756
+ }), di = (e, t) => {
5757
5757
  const r = t(e);
5758
5758
  return {
5759
5759
  id: e.id,
@@ -5762,7 +5762,7 @@ const pi = (e) => ({
5762
5762
  incoming: (e.incoming ?? []).map((n) => n.id),
5763
5763
  outgoing: (e.outgoing ?? []).map((n) => n.id)
5764
5764
  };
5765
- }, di = (e) => ({
5765
+ }, mi = (e) => ({
5766
5766
  name: "get_process_summary",
5767
5767
  description: "Gets a comprehensive summary of the current BPMN process including process ID, name, whether it is executable, counts of flow nodes/tasks/sequence flows, and a list of all flow nodes with their ID, type, name, and connections. Use this to understand the overall structure of the process.",
5768
5768
  parameters: {},
@@ -5781,7 +5781,7 @@ const pi = (e) => ({
5781
5781
  flowNodeCount: l.length,
5782
5782
  taskCount: c.length,
5783
5783
  flowCount: u.length,
5784
- flowNodes: l.map((d) => ui(d, i))
5784
+ flowNodes: l.map((d) => di(d, i))
5785
5785
  };
5786
5786
  } catch (n) {
5787
5787
  throw r("get_process_summary", n), n;
@@ -5793,7 +5793,7 @@ const pi = (e) => ({
5793
5793
  flowId: e.id,
5794
5794
  condition: r ? r.body ?? r.text ?? "" : null
5795
5795
  };
5796
- }, mi = (e) => ({
5796
+ }, fi = (e) => ({
5797
5797
  name: "get_element_connections",
5798
5798
  description: "Gets all incoming and outgoing sequence flow connections for a specific BPMN element. Returns flow IDs, connected element IDs/names, and condition expressions if present.",
5799
5799
  parameters: {
@@ -5848,7 +5848,7 @@ const pi = (e) => ({
5848
5848
  return;
5849
5849
  }
5850
5850
  o.updateModdleProperties(e, c, r);
5851
- }, fi = (e, t) => {
5851
+ }, yi = (e, t) => {
5852
5852
  const r = ue(e, "zeebe:IoMapping", t);
5853
5853
  if (!r)
5854
5854
  return { inputs: [], outputs: [] };
@@ -5860,26 +5860,26 @@ const pi = (e) => ({
5860
5860
  inputs: (r.inputParameters ?? []).map(n),
5861
5861
  outputs: (r.outputParameters ?? []).map(n)
5862
5862
  };
5863
- }, yi = (e, t) => {
5863
+ }, gi = (e, t) => {
5864
5864
  const r = ue(e, "zeebe:TaskDefinition", t);
5865
5865
  return r ? {
5866
5866
  type: r.type ?? "",
5867
5867
  retries: r.retries ?? ""
5868
5868
  } : null;
5869
- }, gi = (e, t) => {
5869
+ }, hi = (e, t) => {
5870
5870
  const r = ue(e, "zeebe:FormDefinition", t);
5871
5871
  return r ? {
5872
5872
  formId: r.formId ?? null,
5873
5873
  formKey: r.formKey ?? null,
5874
5874
  bindingType: r.bindingType ?? "latest"
5875
5875
  } : null;
5876
- }, hi = (e, t) => {
5876
+ }, bi = (e, t) => {
5877
5877
  const r = ue(e, "zeebe:Properties", t);
5878
5878
  return r ? (r.properties ?? []).reduce((n, i) => {
5879
5879
  const a = i;
5880
5880
  return { ...n, [a.name]: a.value };
5881
5881
  }, {}) : {};
5882
- }, bi = (e) => e.documentation?.[0]?.text ?? "", Ei = (e) => ({
5882
+ }, Ei = (e) => e.documentation?.[0]?.text ?? "", wi = (e) => ({
5883
5883
  name: "get_element_details",
5884
5884
  description: "Gets detailed information about a specific BPMN element including ID, type, name, description, I/O mappings, Zeebe properties, task definition, and form binding. Use this to inspect a specific element in the process.",
5885
5885
  parameters: {
@@ -5904,13 +5904,13 @@ const pi = (e) => ({
5904
5904
  id: o.id,
5905
5905
  type: o.type,
5906
5906
  name: s.name ?? "",
5907
- description: bi(s),
5907
+ description: Ei(s),
5908
5908
  ...n(o, "bpmn:Activity") ? {
5909
- ioMappings: fi(s, n),
5910
- zeebeProperties: hi(s, n),
5911
- taskDefinition: yi(s, n)
5909
+ ioMappings: yi(s, n),
5910
+ zeebeProperties: bi(s, n),
5911
+ taskDefinition: gi(s, n)
5912
5912
  } : {},
5913
- ...n(o, "bpmn:UserTask") ? { formBinding: gi(s, n) } : {},
5913
+ ...n(o, "bpmn:UserTask") ? { formBinding: hi(s, n) } : {},
5914
5914
  ...n(o, "bpmn:SequenceFlow") ? {
5915
5915
  sourceId: s.sourceRef?.id ?? null,
5916
5916
  targetId: s.targetRef?.id ?? null,
@@ -5921,7 +5921,7 @@ const pi = (e) => ({
5921
5921
  throw r("get_element_details", n), n;
5922
5922
  }
5923
5923
  }
5924
- }), wi = (e, t, r, n) => {
5924
+ }), vi = (e, t, r, n) => {
5925
5925
  const i = /* @__PURE__ */ new Set(), a = [[e]];
5926
5926
  for (; a.length > 0; ) {
5927
5927
  const o = a.shift();
@@ -5937,7 +5937,7 @@ const pi = (e) => ({
5937
5937
  p && (p.outgoing ?? []).filter((l) => n(l, "bpmn:SequenceFlow")).map((l) => l.target?.id).filter((l) => l !== void 0 && !i.has(l)).forEach((l) => a.push([...o, l]));
5938
5938
  }
5939
5939
  return [];
5940
- }, vi = (e) => ({
5940
+ }, Ii = (e) => ({
5941
5941
  name: "get_path_between_elements",
5942
5942
  description: "Finds the shortest path between two BPMN elements following sequence flows. Returns an ordered list of elements on the path with their IDs, types, and names. Returns an empty path if no route exists.",
5943
5943
  parameters: {
@@ -5963,7 +5963,7 @@ const pi = (e) => ({
5963
5963
  try {
5964
5964
  const { is: n, getElementById: i, getElementRegistry: a } = e.modeler;
5965
5965
  i(t.sourceId), i(t.targetId);
5966
- const o = a(), s = wi(t.sourceId, t.targetId, o, n);
5966
+ const o = a(), s = vi(t.sourceId, t.targetId, o, n);
5967
5967
  return {
5968
5968
  path: s.map((p) => {
5969
5969
  const l = o.get(p);
@@ -6021,7 +6021,7 @@ const pi = (e) => ({
6021
6021
  if (!t)
6022
6022
  throw new Error(`Unsupported element type: ${e}. Supported types: ${Object.keys(it).join(", ")}`);
6023
6023
  return t;
6024
- }, Ii = 100, Ti = {
6024
+ }, Ti = 100, xi = {
6025
6025
  task: "Generic task activity.",
6026
6026
  userTask: "Human interaction task.",
6027
6027
  serviceTask: "Automated service work.",
@@ -6056,13 +6056,13 @@ const pi = (e) => ({
6056
6056
  conditional: "Conditional event definition.",
6057
6057
  link: "Link event definition.",
6058
6058
  terminate: "Terminate event definition."
6059
- }, xi = (e) => {
6059
+ }, Ri = (e) => {
6060
6060
  const t = e.reduce((r, n) => {
6061
6061
  const i = r.get(n.id);
6062
6062
  return !i || (n.version ?? 0) > (i.version ?? 0) ? new Map(r).set(n.id, n) : r;
6063
6063
  }, /* @__PURE__ */ new Map());
6064
6064
  return Array.from(t.values());
6065
- }, Ri = (e) => ({
6065
+ }, Ai = (e) => ({
6066
6066
  name: "list_available_bpmn_elements",
6067
6067
  displayName: "Listing available BPMN elements",
6068
6068
  description: "Lists standard BPMN element types, event definitions, and available connector/element templates including custom organization templates.",
@@ -6079,14 +6079,14 @@ const pi = (e) => ({
6079
6079
  const n = e.templates.getOotbConnectors(), i = e.templates.getCustom(), a = [
6080
6080
  ...n.map((p) => ({ ...p, _source: "ootb" })),
6081
6081
  ...i.map((p) => ({ ...p, _source: "custom" }))
6082
- ], o = [...xi(a)].sort(
6082
+ ], o = [...Ri(a)].sort(
6083
6083
  (p, l) => (p.name || p.id || "").localeCompare(l.name || l.id || "")
6084
- ), s = o.slice(0, Ii);
6084
+ ), s = o.slice(0, Ti);
6085
6085
  return {
6086
6086
  standardElements: Object.entries(it).map(([p, l]) => ({
6087
6087
  type: p,
6088
6088
  bpmnType: l,
6089
- description: Ti[p] ?? "Standard BPMN element."
6089
+ description: xi[p] ?? "Standard BPMN element."
6090
6090
  })),
6091
6091
  eventDefinitions: Object.entries(he).map(([p, l]) => ({
6092
6092
  type: p,
@@ -6108,7 +6108,7 @@ const pi = (e) => ({
6108
6108
  throw r("list_available_bpmn_elements", n), new Error(`Failed to list available BPMN elements: ${n.message}`);
6109
6109
  }
6110
6110
  }
6111
- }), Ai = {
6111
+ }), Mi = {
6112
6112
  userTask: "user task",
6113
6113
  serviceTask: "service task",
6114
6114
  sendTask: "send task",
@@ -6133,14 +6133,14 @@ const pi = (e) => ({
6133
6133
  dataObjectReference: "data object",
6134
6134
  dataStoreReference: "data store",
6135
6135
  participant: "pool"
6136
- }, Mi = (e) => Ai[e] ?? e?.replace(/([A-Z])/g, " $1").toLowerCase().trim() ?? "element", ie = (e) => typeof e == "string" ? e : "", Ci = (e, t) => {
6136
+ }, Ci = (e) => Mi[e] ?? e?.replace(/([A-Z])/g, " $1").toLowerCase().trim() ?? "element", ie = (e) => typeof e == "string" ? e : "", Di = (e, t) => {
6137
6137
  if (!e)
6138
6138
  return t.modeler.getCanvas().getRootElement();
6139
6139
  const r = t.modeler.getElementById(e);
6140
6140
  if (!(t.modeler.is(r, "bpmn:SubProcess") || t.modeler.is(r, "bpmn:AdHocSubProcess") || t.modeler.is(r, "bpmn:Process") || t.modeler.is(r, "bpmn:Participant")))
6141
6141
  throw new Error(`Parent element ${e} must be a SubProcess, AdHocSubProcess, Process, or Participant`);
6142
6142
  return r;
6143
- }, Di = (e, t, r) => {
6143
+ }, Pi = (e, t, r) => {
6144
6144
  const n = (a) => a;
6145
6145
  if (t) {
6146
6146
  const a = n(t);
@@ -6152,7 +6152,7 @@ const pi = (e) => ({
6152
6152
  }
6153
6153
  const i = n(e);
6154
6154
  return { x: (i.x ?? 0) + 200, y: (i.y ?? 0) + 100 };
6155
- }, Pi = (e, t, r) => ({
6155
+ }, _i = (e, t, r) => ({
6156
6156
  type: t,
6157
6157
  ...e.eventDefinition && he[e.eventDefinition] ? { eventDefinitionType: he[e.eventDefinition] } : {},
6158
6158
  ...t === "bpmn:BoundaryEvent" && e.attachedToRef ? {
@@ -6161,9 +6161,9 @@ const pi = (e) => ({
6161
6161
  } : {},
6162
6162
  ...t === "bpmn:SubProcess" && e.triggeredByEvent ? { triggeredByEvent: !0, isExpanded: !0 } : {},
6163
6163
  ...t === "bpmn:AdHocSubProcess" ? { isExpanded: !0 } : {}
6164
- }), _i = (e) => ({
6164
+ }), Bi = (e) => ({
6165
6165
  name: "add_bpmn_element",
6166
- description: "Adds a new BPMN element to the diagram. Optionally connects it to existing elements using afterElementId (incoming flow) and/or beforeElementId (outgoing flow). IMPORTANT: To insert a step between two elements that are ALREADY connected by a sequence flow, use 'insert_bpmn_element_between' instead - it splits the existing flow atomically. This tool does NOT remove any pre-existing flow between afterElementId and beforeElementId, so using both arguments when that flow already exists would create a branching diagram. Returns validation errors after applying the change. Supported types: userTask, serviceTask, sendTask, receiveTask, businessRuleTask, manualTask, scriptTask, startEvent, endEvent, intermediateThrowEvent, intermediateCatchEvent, boundaryEvent, exclusiveGateway, inclusiveGateway, parallelGateway, eventBasedGateway, subProcess, adHocSubProcess, callActivity, textAnnotation.",
6166
+ description: "Adds a new BPMN element to the diagram. Optionally connects it to existing elements using afterElementId (incoming flow) and/or beforeElementId (outgoing flow). IMPORTANT: To insert a step between two elements that are ALREADY connected by a sequence flow, use 'insert_bpmn_element_between' instead - it splits the existing flow atomically. When both afterElementId and beforeElementId are provided and a direct sequence flow already exists between them, the existing flow is automatically removed to prevent duplicates. Returns validation errors after applying the change. Supported types: userTask, serviceTask, sendTask, receiveTask, businessRuleTask, manualTask, scriptTask, startEvent, endEvent, intermediateThrowEvent, intermediateCatchEvent, boundaryEvent, exclusiveGateway, inclusiveGateway, parallelGateway, eventBasedGateway, subProcess, adHocSubProcess, callActivity, textAnnotation.",
6167
6167
  parameters: {
6168
6168
  type: "object",
6169
6169
  properties: {
@@ -6211,31 +6211,38 @@ const pi = (e) => ({
6211
6211
  const r = ie(t.label) || ie(t.name);
6212
6212
  if (r) return `Adding ${r}`;
6213
6213
  const n = ie(t.type);
6214
- return n ? `Adding ${Mi(n)}` : "Adding element";
6214
+ return n ? `Adding ${Ci(n)}` : "Adding element";
6215
6215
  },
6216
6216
  handler: async (t, r) => {
6217
6217
  try {
6218
- const n = e.modeler.getModeling(), i = e.modeler.getElementFactory(), a = nn(t.type), o = Ci(t.parentElementId, e), s = t.afterElementId ? e.modeler.getElementById(t.afterElementId) : null, p = t.beforeElementId ? e.modeler.getElementById(t.beforeElementId) : null, l = Di(o, s, p), c = Pi(t, a, e), u = i.createShape(c), d = n.createShape(u, l, o);
6218
+ const n = e.modeler.getModeling(), i = e.modeler.getElementFactory(), a = nn(t.type), o = Di(t.parentElementId, e), s = t.afterElementId ? e.modeler.getElementById(t.afterElementId) : null, p = t.beforeElementId ? e.modeler.getElementById(t.beforeElementId) : null, l = Pi(o, s, p), c = _i(t, a, e), u = i.createShape(c), d = n.createShape(u, l, o);
6219
+ if (s && p) {
6220
+ const f = (s.outgoing ?? []).find(
6221
+ (M) => e.modeler.is(M, "bpmn:SequenceFlow") && M.target?.id === p.id
6222
+ );
6223
+ f && n.removeElements([f]);
6224
+ }
6219
6225
  return s && e.modeler.is(s, "bpmn:FlowNode") && n.connect(s, d), t.label && n.updateProperties(d, { name: t.label }), p && e.modeler.is(p, "bpmn:FlowNode") && n.connect(d, p), {
6220
6226
  elementId: d.id,
6221
6227
  type: d.type,
6222
- label: t.label ?? ""
6228
+ label: t.label ?? "",
6229
+ ...a === "bpmn:BoundaryEvent" ? { skipAutoLayout: !0 } : {}
6223
6230
  };
6224
6231
  } catch (n) {
6225
6232
  throw r("add_bpmn_element", n), new Error(`Failed to add BPMN element: ${n.message}`);
6226
6233
  }
6227
6234
  }
6228
- }), Bi = async (e, t, r) => {
6235
+ }), Si = async (e, t, r) => {
6229
6236
  const { xml: n } = await e.saveXML({ format: !0 }), i = await r(n), { error: a } = await t.importContent(i);
6230
6237
  if (a)
6231
6238
  throw new Error(`Auto-layout failed: ${a instanceof Error ? a.message : String(a)}`);
6232
6239
  t.ensureExecutionPlatform();
6233
- }, Si = (e, t) => async (r) => {
6240
+ }, Oi = (e, t) => async (r) => {
6234
6241
  const n = e.modeler.getModeler(), i = await r(n);
6235
- await Bi(n, e.diagram, t), await e.diagram.saveContent();
6242
+ await Si(n, e.diagram, t), await e.diagram.saveContent();
6236
6243
  const a = await e.diagram.getLintErrors();
6237
6244
  return { ...i, validationErrors: a };
6238
- }, Oi = (e, t) => {
6245
+ }, Fi = (e, t) => {
6239
6246
  if (e.sequenceFlowId) {
6240
6247
  const a = t.modeler.getElementById(e.sequenceFlowId);
6241
6248
  if (!t.modeler.is(a, "bpmn:SequenceFlow"))
@@ -6252,7 +6259,7 @@ const pi = (e) => ({
6252
6259
  `No sequence flow exists from ${e.sourceElementId} to ${e.targetElementId}. Use add_bpmn_element to create a new element with connections, or verify the element IDs.`
6253
6260
  );
6254
6261
  return i;
6255
- }, Fi = (e) => {
6262
+ }, ki = (e) => {
6256
6263
  const t = e.waypoints ?? [];
6257
6264
  if (t.length === 0) {
6258
6265
  const i = e.source, a = e.target;
@@ -6268,11 +6275,11 @@ const pi = (e) => ({
6268
6275
  x: (r.x + n.x) / 2,
6269
6276
  y: (r.y + n.y) / 2
6270
6277
  };
6271
- }, ki = (e, t) => ({
6278
+ }, $i = (e, t) => ({
6272
6279
  type: t,
6273
6280
  ...e.eventDefinition && he[e.eventDefinition] ? { eventDefinitionType: he[e.eventDefinition] } : {}
6274
- }), $i = (e, t) => {
6275
- const r = Si(e, t);
6281
+ }), qi = (e, t) => {
6282
+ const r = Oi(e, t);
6276
6283
  return {
6277
6284
  name: "insert_bpmn_element_between",
6278
6285
  description: "Inserts a new BPMN element on an existing sequence flow, splitting it in place. Prefer this tool over deleting + recreating flows when the intent is to add a step between two elements that are already connected. Specify the target flow either by sequenceFlowId, or by giving sourceElementId + targetElementId (the tool finds the flow between them). The original flow is reconnected as source -> newElement and a new flow newElement -> target is created; any condition expression on the original flow is preserved on the source -> newElement segment. Returns validation errors after applying the change. Supported types (flow nodes only): userTask, serviceTask, sendTask, receiveTask, businessRuleTask, manualTask, scriptTask, intermediateThrowEvent, intermediateCatchEvent, exclusiveGateway, inclusiveGateway, parallelGateway, eventBasedGateway, subProcess, adHocSubProcess, callActivity. startEvent, endEvent, and boundaryEvent cannot be inserted on a flow.",
@@ -6313,20 +6320,20 @@ const pi = (e) => ({
6313
6320
  handler: async (n, i) => {
6314
6321
  try {
6315
6322
  return await r((a) => {
6316
- const o = e.modeler.getModeling(), s = e.modeler.getElementFactory(), p = a.get("bpmnRules"), l = nn(n.type), c = Oi(n, e), u = ki(n, l), d = s.createShape(u), f = Fi(c);
6323
+ const o = e.modeler.getModeling(), s = e.modeler.getElementFactory(), p = a.get("bpmnRules"), l = nn(n.type), c = Fi(n, e), u = $i(n, l), d = s.createShape(u), f = ki(c);
6317
6324
  if (!p.canInsert(d, c, f))
6318
6325
  throw new Error(
6319
6326
  `Cannot insert '${n.type}' on flow ${c.id}. Only flow nodes (tasks, gateways, intermediate events, subprocesses) can be inserted on a sequence flow.`
6320
6327
  );
6321
- const P = o.createShape(d, f, c);
6322
- n.label && o.updateProperties(P, { name: n.label });
6323
- const D = c.source?.id, J = c.target?.id;
6328
+ const M = o.createShape(d, f, c);
6329
+ n.label && o.updateProperties(M, { name: n.label });
6330
+ const P = c.source?.id, J = c.target?.id;
6324
6331
  return {
6325
- elementId: P.id,
6326
- type: P.type,
6332
+ elementId: M.id,
6333
+ type: M.type,
6327
6334
  label: n.label ?? "",
6328
6335
  splitSequenceFlowId: c.id,
6329
- sourceElementId: D,
6336
+ sourceElementId: P,
6330
6337
  targetElementId: J
6331
6338
  };
6332
6339
  });
@@ -6335,14 +6342,14 @@ const pi = (e) => ({
6335
6342
  }
6336
6343
  }
6337
6344
  };
6338
- }, qi = Object.keys(he), Li = (e, t, r, n) => {
6345
+ }, Li = Object.keys(he), Gi = (e, t, r, n) => {
6339
6346
  if (!n.modeler.is(e, "bpmn:Event"))
6340
6347
  throw new Error(`eventDefinition is only valid on bpmn:Event elements, got ${e.type}`);
6341
6348
  const i = r.get("moddle"), a = r.get("modeling"), o = n.modeler.getBusinessObject(e), s = t === null || t === "" ? [] : (() => {
6342
6349
  const p = he[t];
6343
6350
  if (!p)
6344
6351
  throw new Error(
6345
- `Unsupported eventDefinition: '${t}'. Expected one of: ${qi.join(
6352
+ `Unsupported eventDefinition: '${t}'. Expected one of: ${Li.join(
6346
6353
  ", "
6347
6354
  )} (or null to clear).`
6348
6355
  );
@@ -6350,12 +6357,12 @@ const pi = (e) => ({
6350
6357
  return l.$parent = o, [l];
6351
6358
  })();
6352
6359
  a.updateProperties(e, { eventDefinitions: s });
6353
- }, Gi = (e, t, r, n) => {
6360
+ }, ji = (e, t, r, n) => {
6354
6361
  if (!n.modeler.is(e, "bpmn:Event"))
6355
6362
  return;
6356
6363
  const i = (n.modeler.getBusinessObject(e).get("eventDefinitions") ?? []).find((a) => n.modeler.is(a, "bpmn:LinkEventDefinition"));
6357
6364
  i && r.get("modeling").updateModdleProperties(e, i, { name: t });
6358
- }, ji = (e) => ({
6365
+ }, Ui = (e) => ({
6359
6366
  name: "update_bpmn_element",
6360
6367
  description: "Updates properties of an existing BPMN element: name (display label) and/or eventDefinition (for bpmn:Event elements only — replaces any existing event definitions with a single new one, or pass null to strip them). For link events, setting name also cascades into the LinkEventDefinition name so the `link-event` bpmnlint rule can resolve a throw/catch pair via name matching. For Zeebe extension properties (task definition, I/O mappings, headers, timer time-definitions, conditional-event condition), use set_element_properties. Returns validation errors after applying the change.",
6361
6368
  parameters: {
@@ -6387,7 +6394,7 @@ const pi = (e) => ({
6387
6394
  handler: async (t, r) => {
6388
6395
  try {
6389
6396
  const n = e.modeler.getModeler(), i = n.get("modeling"), a = e.modeler.getElementById(t.elementId);
6390
- t.name !== void 0 && (i.updateProperties(a, { name: t.name }), Gi(a, t.name, n, e)), t.eventDefinition !== void 0 && Li(a, t.eventDefinition, n, e);
6397
+ t.name !== void 0 && (i.updateProperties(a, { name: t.name }), ji(a, t.name, n, e)), t.eventDefinition !== void 0 && Gi(a, t.eventDefinition, n, e);
6391
6398
  const o = e.modeler.getBusinessObject(a), s = {};
6392
6399
  if (t.name !== void 0 && (s.name = o.get("name")), t.eventDefinition !== void 0) {
6393
6400
  const p = o.get("eventDefinitions") ?? [];
@@ -6398,7 +6405,7 @@ const pi = (e) => ({
6398
6405
  throw r("update_bpmn_element", n), new Error(`Failed to update BPMN element: ${n.message}`);
6399
6406
  }
6400
6407
  }
6401
- }), Ui = (e, t) => {
6408
+ }), Xi = (e, t) => {
6402
6409
  const r = t.modeler.getElementRegistry(), n = e.id;
6403
6410
  return r.filter((i) => {
6404
6411
  if (!t.modeler.is(i, "bpmn:BoundaryEvent"))
@@ -6409,7 +6416,7 @@ const pi = (e) => ({
6409
6416
  const o = t.modeler.getBusinessObject(i);
6410
6417
  return (typeof o.get == "function" ? o.get("attachedToRef") : o.attachedToRef)?.id === n;
6411
6418
  });
6412
- }, Xi = (e) => ({
6419
+ }, Vi = (e) => ({
6413
6420
  name: "delete_bpmn_element",
6414
6421
  description: "Deletes a BPMN element from the diagram. If the element has exactly one incoming and one outgoing sequence flow, the surrounding elements are automatically reconnected. If the element has boundary events attached to it, those boundary events are deleted first so the XML never contains boundary events pointing at a removed host (the deleted IDs are returned in `cascadedBoundaryEventIds`). Returns validation errors after applying the change.",
6415
6422
  parameters: {
@@ -6429,9 +6436,9 @@ const pi = (e) => ({
6429
6436
  descriptionFormatter: () => "Removing element",
6430
6437
  handler: async (t, r) => {
6431
6438
  try {
6432
- const n = e.modeler.getModeling(), i = e.modeler.getElementById(t.elementId), a = i.id, o = Ui(i, e), s = o.map((P) => P.id);
6439
+ const n = e.modeler.getModeling(), i = e.modeler.getElementById(t.elementId), a = i.id, o = Xi(i, e), s = o.map((M) => M.id);
6433
6440
  o.length > 0 && n.removeElements(o);
6434
- const p = (i.incoming ?? []).filter((P) => e.modeler.is(P, "bpmn:SequenceFlow")), l = (i.outgoing ?? []).filter((P) => e.modeler.is(P, "bpmn:SequenceFlow")), c = p.length === 1 && l.length === 1, u = c ? p[0].source : void 0, d = c ? l[0].target : void 0;
6441
+ const p = (i.incoming ?? []).filter((M) => e.modeler.is(M, "bpmn:SequenceFlow")), l = (i.outgoing ?? []).filter((M) => e.modeler.is(M, "bpmn:SequenceFlow")), c = p.length === 1 && l.length === 1, u = c ? p[0].source : void 0, d = c ? l[0].target : void 0;
6435
6442
  n.removeElements([i]);
6436
6443
  const f = !!(c && u && d);
6437
6444
  return f && n.connect(u, d), { elementId: a, reconnected: f, cascadedBoundaryEventIds: s };
@@ -6439,7 +6446,7 @@ const pi = (e) => ({
6439
6446
  throw r("delete_bpmn_element", n), new Error(`Failed to delete BPMN element: ${n.message}`);
6440
6447
  }
6441
6448
  }
6442
- }), Vi = (e) => ({
6449
+ }), zi = (e) => ({
6443
6450
  name: "move_bpmn_element",
6444
6451
  description: "Moves a BPMN element to a new position in the process flow by reconnecting sequence flows. The element is disconnected from its current neighbors (which are reconnected to each other) and connected at the new position. At least one of afterElementId or beforeElementId is required. Returns validation errors after applying the change.",
6445
6452
  parameters: {
@@ -6490,7 +6497,7 @@ const pi = (e) => ({
6490
6497
  throw r("move_bpmn_element", n), new Error(`Failed to move BPMN element: ${n.message}`);
6491
6498
  }
6492
6499
  }
6493
- }), zi = (e) => ({
6500
+ }), Hi = (e) => ({
6494
6501
  name: "add_sequence_flow",
6495
6502
  description: "Creates a new sequence flow connection between two BPMN elements. Optionally sets a label and/or condition expression. Returns validation errors after applying the change.",
6496
6503
  parameters: {
@@ -6522,15 +6529,22 @@ const pi = (e) => ({
6522
6529
  descriptionFormatter: () => "Connecting elements",
6523
6530
  handler: async (t, r) => {
6524
6531
  try {
6525
- const n = e.modeler.getModeling(), i = e.modeler.getModdle(), a = e.modeler.getElementById(t.sourceId), o = e.modeler.getElementById(t.targetId), s = n.connect(a, o);
6526
- if (t.label && n.updateProperties(s, { name: t.label }), t.conditionExpression) {
6527
- const p = i.create("bpmn:FormalExpression", {
6532
+ const n = e.modeler.getModeling(), i = e.modeler.getModdle(), a = e.modeler.getElementById(t.sourceId), o = e.modeler.getElementById(t.targetId), s = (a.outgoing ?? []).find(
6533
+ (l) => e.modeler.is(l, "bpmn:SequenceFlow") && l.target?.id === o.id
6534
+ );
6535
+ if (s)
6536
+ throw new Error(
6537
+ `A sequence flow already exists from ${t.sourceId} to ${t.targetId} (${s.id}). Use set_element_properties to update its label or condition instead of creating a duplicate.`
6538
+ );
6539
+ const p = n.connect(a, o);
6540
+ if (t.label && n.updateProperties(p, { name: t.label }), t.conditionExpression) {
6541
+ const l = i.create("bpmn:FormalExpression", {
6528
6542
  body: t.conditionExpression
6529
6543
  });
6530
- n.updateProperties(s, { conditionExpression: p });
6544
+ n.updateProperties(p, { conditionExpression: l });
6531
6545
  }
6532
6546
  return {
6533
- flowId: s.id,
6547
+ flowId: p.id,
6534
6548
  sourceId: t.sourceId,
6535
6549
  targetId: t.targetId
6536
6550
  };
@@ -6538,7 +6552,7 @@ const pi = (e) => ({
6538
6552
  throw r("add_sequence_flow", n), new Error(`Failed to add sequence flow: ${n.message}`);
6539
6553
  }
6540
6554
  }
6541
- }), Hi = (e) => ({
6555
+ }), Wi = (e) => ({
6542
6556
  name: "update_sequence_flow",
6543
6557
  description: "Updates properties of an existing sequence flow (label and/or condition expression). Returns validation errors after applying the change.",
6544
6558
  parameters: {
@@ -6592,7 +6606,7 @@ const pi = (e) => ({
6592
6606
  throw r("update_sequence_flow", n), new Error(`Failed to update sequence flow: ${n.message}`);
6593
6607
  }
6594
6608
  }
6595
- }), Wi = (e) => ({
6609
+ }), Ki = (e) => ({
6596
6610
  name: "delete_sequence_flow",
6597
6611
  description: "Deletes a sequence flow connection from the diagram. Returns validation errors after applying the change.",
6598
6612
  parameters: {
@@ -6621,7 +6635,7 @@ const pi = (e) => ({
6621
6635
  throw r("delete_sequence_flow", n), new Error(`Failed to delete sequence flow: ${n.message}`);
6622
6636
  }
6623
6637
  }
6624
- }), Ki = (e) => ({
6638
+ }), Ji = (e) => ({
6625
6639
  name: "bind_form_to_task",
6626
6640
  description: "Binds a Camunda form to a user task using the zeebe:formDefinition extension. Provide formId (the form schema ID from the formSchemaId field of the create_file_in_project result, NOT the file UUID) or formKey (for external/embedded forms). Returns validation errors after applying the change.",
6627
6641
  parameters: {
@@ -6680,19 +6694,19 @@ const pi = (e) => ({
6680
6694
  throw r("bind_form_to_task", n), new Error(`Failed to bind form to task: ${n.message}`);
6681
6695
  }
6682
6696
  }
6683
- }), Ji = {
6684
- timeDuration: "bpmn:TimeDuration",
6685
- timeCycle: "bpmn:TimeCycle",
6686
- timeDate: "bpmn:TimeDate"
6697
+ }), Yi = {
6698
+ timeDuration: "bpmn:FormalExpression",
6699
+ timeCycle: "bpmn:FormalExpression",
6700
+ timeDate: "bpmn:FormalExpression"
6687
6701
  }, ae = (e, t) => {
6688
6702
  const r = e;
6689
6703
  return typeof r.get == "function" ? r.get(t) : r[t];
6690
- }, Yi = (e, t, r, n) => {
6704
+ }, Qi = (e, t, r, n) => {
6691
6705
  if (!n.modeler.is(e, "bpmn:Event"))
6692
6706
  throw new Error(
6693
6707
  `timerDefinition is only valid on bpmn:Event elements (start, intermediate, boundary), got ${e.type}`
6694
6708
  );
6695
- const { type: i, expression: a } = t, o = Ji[i];
6709
+ const { type: i, expression: a } = t, o = Yi[i];
6696
6710
  if (!o)
6697
6711
  throw new Error(`Unsupported timerDefinition.type: '${i}'. Expected one of: timeDuration, timeCycle, timeDate.`);
6698
6712
  if (a == null || a === "")
@@ -6717,21 +6731,21 @@ const pi = (e) => ({
6717
6731
  }), t.forEach((a) => {
6718
6732
  i.set(a.target, r.create(n, { source: a.source, target: a.target }));
6719
6733
  }), Array.from(i.values());
6720
- }, Qi = (e, t, r) => {
6734
+ }, Zi = (e, t, r) => {
6721
6735
  const n = /* @__PURE__ */ new Map();
6722
6736
  return e.forEach((i) => {
6723
6737
  n.set(ae(i, "key"), i);
6724
6738
  }), Object.entries(t).forEach(([i, a]) => {
6725
6739
  n.set(i, r.create("zeebe:Header", { key: i, value: a }));
6726
6740
  }), Array.from(n.values());
6727
- }, Zi = (e, t, r) => {
6741
+ }, ea = (e, t, r) => {
6728
6742
  const n = /* @__PURE__ */ new Map();
6729
6743
  return e.forEach((i) => {
6730
6744
  n.set(ae(i, "name"), i);
6731
6745
  }), Object.entries(t).forEach(([i, a]) => {
6732
6746
  n.set(i, r.create("zeebe:Property", { name: i, value: a }));
6733
6747
  }), Array.from(n.values());
6734
- }, ea = (e, t, r, n, i) => {
6748
+ }, ta = (e, t, r, n, i) => {
6735
6749
  const a = n.get("moddle"), o = i.modeler.getBusinessObject(e), s = r ? null : ue(o, "zeebe:IoMapping", i.modeler.is), p = (s && ae(s, "inputParameters")) ?? [], l = (s && ae(s, "outputParameters")) ?? [], c = {
6736
6750
  ...t.inputs ? { inputParameters: _t(p, t.inputs, a, "zeebe:Input") } : {},
6737
6751
  ...t.outputs ? { outputParameters: _t(l, t.outputs, a, "zeebe:Output") } : {}
@@ -6744,8 +6758,8 @@ const pi = (e) => ({
6744
6758
  i.modeler.getBusinessObject,
6745
6759
  i.modeler.is
6746
6760
  );
6747
- }, ta = (e, t, r, n, i) => {
6748
- const a = n.get("moddle"), o = i.modeler.getBusinessObject(e), s = r ? null : ue(o, "zeebe:TaskHeaders", i.modeler.is), p = (s && ae(s, "values")) ?? [], l = Qi(p, t, a);
6761
+ }, na = (e, t, r, n, i) => {
6762
+ const a = n.get("moddle"), o = i.modeler.getBusinessObject(e), s = r ? null : ue(o, "zeebe:TaskHeaders", i.modeler.is), p = (s && ae(s, "values")) ?? [], l = Zi(p, t, a);
6749
6763
  Fe(
6750
6764
  e,
6751
6765
  "zeebe:TaskHeaders",
@@ -6754,8 +6768,8 @@ const pi = (e) => ({
6754
6768
  i.modeler.getBusinessObject,
6755
6769
  i.modeler.is
6756
6770
  );
6757
- }, na = (e, t, r, n, i) => {
6758
- const a = n.get("moddle"), o = i.modeler.getBusinessObject(e), s = r ? null : ue(o, "zeebe:Properties", i.modeler.is), p = (s && ae(s, "properties")) ?? [], l = Zi(p, t, a);
6771
+ }, ra = (e, t, r, n, i) => {
6772
+ const a = n.get("moddle"), o = i.modeler.getBusinessObject(e), s = r ? null : ue(o, "zeebe:Properties", i.modeler.is), p = (s && ae(s, "properties")) ?? [], l = ea(p, t, a);
6759
6773
  Fe(
6760
6774
  e,
6761
6775
  "zeebe:Properties",
@@ -6764,7 +6778,7 @@ const pi = (e) => ({
6764
6778
  i.modeler.getBusinessObject,
6765
6779
  i.modeler.is
6766
6780
  );
6767
- }, ra = (e, t, r, n) => {
6781
+ }, ia = (e, t, r, n) => {
6768
6782
  if (!n.modeler.is(e, "bpmn:Event"))
6769
6783
  throw new Error(
6770
6784
  `conditionExpression on set_element_properties targets bpmn:ConditionalEventDefinition on events; got ${e.type}. For sequence flows, use update_sequence_flow(flowId, conditionExpression).`
@@ -6779,7 +6793,7 @@ const pi = (e) => ({
6779
6793
  return l.$parent = s, l;
6780
6794
  })();
6781
6795
  a.updateModdleProperties(e, s, { condition: p });
6782
- }, ia = (e) => ({
6796
+ }, aa = (e) => ({
6783
6797
  name: "set_element_properties",
6784
6798
  description: "Sets Zeebe extension properties and BPMN structural properties on a BPMN element: task definition (type/retries), I/O mappings (inputs/outputs), task headers, custom Zeebe properties, timer event definitions, and conditional-event conditions. I/O mappings, task headers, and Zeebe properties are MERGED by key by default (target for I/O, key for headers, name for properties) — pass replaceIoMappings / replaceTaskHeaders / replaceZeebeProperties = true to clobber instead. For sequence-flow conditions, use update_sequence_flow; this tool targets events and activities. Returns validation errors after applying the change.",
6785
6799
  parameters: {
@@ -6884,19 +6898,19 @@ const pi = (e) => ({
6884
6898
  n,
6885
6899
  e.modeler.getBusinessObject,
6886
6900
  e.modeler.is
6887
- ), t.ioMappings && ea(i, t.ioMappings, t.replaceIoMappings === !0, n, e), t.taskHeaders && ta(
6901
+ ), t.ioMappings && ta(i, t.ioMappings, t.replaceIoMappings === !0, n, e), t.taskHeaders && na(
6888
6902
  i,
6889
6903
  t.taskHeaders,
6890
6904
  t.replaceTaskHeaders === !0,
6891
6905
  n,
6892
6906
  e
6893
- ), t.zeebeProperties && na(
6907
+ ), t.zeebeProperties && ra(
6894
6908
  i,
6895
6909
  t.zeebeProperties,
6896
6910
  t.replaceZeebeProperties === !0,
6897
6911
  n,
6898
6912
  e
6899
- ), t.timerDefinition && Yi(i, t.timerDefinition, n, e), t.conditionExpression !== void 0 && ra(i, t.conditionExpression, n, e), { elementId: i.id };
6913
+ ), t.timerDefinition && Qi(i, t.timerDefinition, n, e), t.conditionExpression !== void 0 && ia(i, t.conditionExpression, n, e), { elementId: i.id };
6900
6914
  } catch (n) {
6901
6915
  throw r("set_element_properties", n), new Error(`Failed to set element properties: ${n.message}`);
6902
6916
  }
@@ -6906,7 +6920,7 @@ const pi = (e) => ({
6906
6920
  await e.diagram.saveContent();
6907
6921
  const i = await e.diagram.getLintErrors();
6908
6922
  return { ...n, validationErrors: i };
6909
- }, aa = (e) => {
6923
+ }, sa = (e) => {
6910
6924
  const t = rn(e);
6911
6925
  return {
6912
6926
  name: "undo",
@@ -6928,7 +6942,7 @@ const pi = (e) => ({
6928
6942
  }
6929
6943
  }
6930
6944
  };
6931
- }, sa = (e) => {
6945
+ }, oa = (e) => {
6932
6946
  const t = rn(e);
6933
6947
  return {
6934
6948
  name: "redo",
@@ -6950,7 +6964,7 @@ const pi = (e) => ({
6950
6964
  }
6951
6965
  }
6952
6966
  };
6953
- }, oa = (e) => ({
6967
+ }, pa = (e) => ({
6954
6968
  name: "read_artifact",
6955
6969
  description: "Reads the current artifact content. Returns form JSON if a form editor is active, BPMN XML if a BPMN diagram is open, or DMN XML if a DMN diagram is open.",
6956
6970
  parameters: {},
@@ -6971,20 +6985,25 @@ const pi = (e) => ({
6971
6985
  throw r("read_artifact", n), n;
6972
6986
  }
6973
6987
  }
6974
- }), pa = async (e, t) => {
6988
+ }), an = (e) => {
6989
+ if (!e.diagram.canEdit())
6990
+ throw new Error("Cannot edit: the current diagram is read-only.");
6991
+ }, la = async (e, t) => {
6992
+ an(e);
6975
6993
  const { error: r } = await e.diagram.importContent(t);
6976
6994
  if (r)
6977
6995
  throw new Error(`Failed to import BPMN: ${r instanceof Error ? r.message : String(r)}`);
6978
6996
  return await e.diagram.saveContent(), { validationErrors: await e.diagram.getLintErrors() };
6979
- }, la = async (e, t) => {
6997
+ }, ca = async (e, t) => {
6980
6998
  const r = e.form.getParsedContent(t);
6981
6999
  return e.form.importSchema(r), await e.form.update(), { validationErrors: await e.form.getLintErrors() };
6982
- }, ca = async (e, t) => {
7000
+ }, ua = async (e, t) => {
7001
+ an(e);
6983
7002
  const { error: r } = await e.diagram.importContent(t);
6984
7003
  if (r)
6985
7004
  throw new Error(`Failed to import DMN: ${r instanceof Error ? r.message : String(r)}`);
6986
7005
  return await e.diagram.saveContent(), {};
6987
- }, ua = (e) => ({
7006
+ }, da = (e) => ({
6988
7007
  name: "write_artifact",
6989
7008
  description: "Writes content to the current artifact. Accepts bpmnXml, formJson, or dmnXml. Validates the content after writing and returns any validation errors.",
6990
7009
  parameters: {
@@ -6998,24 +7017,21 @@ const pi = (e) => ({
6998
7017
  type: "frontend",
6999
7018
  contentType: "TEXT",
7000
7019
  category: "FILE_OPERATION",
7001
- requiredCapabilities: ["BPMN_EDITING"],
7002
7020
  descriptionFormatter: () => "Writing changes",
7003
7021
  handler: async (t, r) => {
7004
7022
  try {
7005
- if (!e.diagram.canEdit())
7006
- throw new Error("Cannot edit: the current diagram is read-only.");
7007
7023
  if (t.bpmnXml)
7008
- return await pa(e, t.bpmnXml);
7024
+ return await la(e, t.bpmnXml);
7009
7025
  if (t.formJson)
7010
- return await la(e, t.formJson);
7026
+ return await ca(e, t.formJson);
7011
7027
  if (t.dmnXml)
7012
- return await ca(e, t.dmnXml);
7028
+ return await ua(e, t.dmnXml);
7013
7029
  throw new Error("No content provided. Pass bpmnXml, formJson, or dmnXml.");
7014
7030
  } catch (n) {
7015
7031
  throw r("write_artifact", n), n;
7016
7032
  }
7017
7033
  }
7018
- }), da = (e) => ({
7034
+ }), ma = (e) => ({
7019
7035
  name: "sync_artifact_state_ui",
7020
7036
  description: "Saves the current diagram state to persist any pending changes in the UI.",
7021
7037
  parameters: {},
@@ -7031,7 +7047,7 @@ const pi = (e) => ({
7031
7047
  throw r("sync_artifact_state_ui", n), n;
7032
7048
  }
7033
7049
  }
7034
- }), ma = (e) => ({
7050
+ }), fa = (e) => ({
7035
7051
  name: "create_file_in_project",
7036
7052
  description: "Creates a new file in the current project. Supports BPMN, DMN, Form, and Connector Template file types.",
7037
7053
  parameters: {
@@ -7072,7 +7088,7 @@ const pi = (e) => ({
7072
7088
  throw r("create_file_in_project", n), n;
7073
7089
  }
7074
7090
  }
7075
- }), fa = (e) => ({
7091
+ }), ya = (e) => ({
7076
7092
  name: "get_file_content_from_file_id",
7077
7093
  description: "Retrieves the content of a file by its ID from the project.",
7078
7094
  parameters: {
@@ -7094,7 +7110,7 @@ const pi = (e) => ({
7094
7110
  throw r("get_file_content_from_file_id", n), n;
7095
7111
  }
7096
7112
  }
7097
- }), ya = 8e3, ga = (e, t, r) => new Promise((n, i) => {
7113
+ }), ga = 8e3, ha = (e, t, r) => new Promise((n, i) => {
7098
7114
  const a = setTimeout(() => {
7099
7115
  i(new Error(r));
7100
7116
  }, t);
@@ -7103,7 +7119,7 @@ const pi = (e) => ({
7103
7119
  }).catch((o) => {
7104
7120
  clearTimeout(a), i(o);
7105
7121
  });
7106
- }), ha = (e) => ({
7122
+ }), ba = (e) => ({
7107
7123
  name: "list_files_in_project",
7108
7124
  description: "Lists all files in the current project.",
7109
7125
  parameters: {},
@@ -7114,9 +7130,9 @@ const pi = (e) => ({
7114
7130
  descriptionFormatter: () => "Listing project files",
7115
7131
  handler: async (t, r) => {
7116
7132
  try {
7117
- const { id: n } = e.project.resolve(), i = await ga(
7133
+ const { id: n } = e.project.resolve(), i = await ha(
7118
7134
  e.files.list(n),
7119
- ya,
7135
+ ga,
7120
7136
  "Timed out while listing project files"
7121
7137
  );
7122
7138
  return { files: i, totalCount: i.length };
@@ -7124,15 +7140,15 @@ const pi = (e) => ({
7124
7140
  throw r("list_files_in_project", n), n;
7125
7141
  }
7126
7142
  }
7127
- }), Bt = (e, t) => e.map((r) => ({ ...r, source: t })), ba = (e) => Array.from(
7143
+ }), Bt = (e, t) => e.map((r) => ({ ...r, source: t })), Ea = (e) => Array.from(
7128
7144
  e.reduce((t, r) => {
7129
7145
  const n = t.get(r.id);
7130
7146
  return n && n.version >= r.version ? t : new Map([...t, [r.id, r]]);
7131
7147
  }, /* @__PURE__ */ new Map()).values()
7132
- ), Ea = (e, t) => {
7148
+ ), wa = (e, t) => {
7133
7149
  const r = t.toLowerCase(), n = (e.name ?? "").toLowerCase(), i = (e.description ?? "").toLowerCase();
7134
7150
  return n.includes(r) || i.includes(r);
7135
- }, wa = (e, t) => !t || e.appliesTo.some((r) => r.toLowerCase().includes(t.toLowerCase())), va = (e) => ({
7151
+ }, va = (e, t) => !t || e.appliesTo.some((r) => r.toLowerCase().includes(t.toLowerCase())), Ia = (e) => ({
7136
7152
  name: "search_element_templates",
7137
7153
  description: "Searches available element templates (connectors and custom templates) by name or description. Returns matching templates with their metadata. Use this to discover available integrations and connector types that can be applied to BPMN elements.",
7138
7154
  parameters: {
@@ -7156,7 +7172,7 @@ const pi = (e) => ({
7156
7172
  descriptionFormatter: (t) => ie(t.searchTerm) ? `Searching templates for "${ie(t.searchTerm)}"` : "Browsing templates",
7157
7173
  handler: async (t, r) => {
7158
7174
  try {
7159
- const n = Bt(e.templates.getOotbConnectors(), "ootb"), i = Bt(e.templates.getCustom(), "custom"), a = [...n, ...i], o = ba(a).filter((s) => Ea(s, t.searchTerm)).filter((s) => wa(s, t.elementType)).map((s) => ({
7175
+ const n = Bt(e.templates.getOotbConnectors(), "ootb"), i = Bt(e.templates.getCustom(), "custom"), a = [...n, ...i], o = Ea(a).filter((s) => wa(s, t.searchTerm)).filter((s) => va(s, t.elementType)).map((s) => ({
7160
7176
  id: s.id,
7161
7177
  name: s.name,
7162
7178
  description: s.description ?? "",
@@ -7170,10 +7186,10 @@ const pi = (e) => ({
7170
7186
  throw r("search_element_templates", n), new Error(`Failed to search element templates: ${n.message}`);
7171
7187
  }
7172
7188
  }
7173
- }), Ia = (e) => e.reduce(
7189
+ }), Ta = (e) => e.reduce(
7174
7190
  (t, r) => !t || r.version > t.version ? r : t,
7175
7191
  void 0
7176
- ), Ta = (e, t) => e.find((r) => r.version === t), Na = (e) => ({
7192
+ ), xa = (e, t) => e.find((r) => r.version === t), Na = (e) => ({
7177
7193
  name: "get_element_template_details",
7178
7194
  description: "Gets detailed information about a specific element template, including its properties, groups, and configuration. Use this after searching templates to understand what a template configures before applying it.",
7179
7195
  parameters: {
@@ -7200,7 +7216,7 @@ const pi = (e) => ({
7200
7216
  const n = [...e.templates.getOotbConnectors(), ...e.templates.getCustom()].filter((a) => a.id === t.templateId);
7201
7217
  if (n.length === 0)
7202
7218
  throw new Error(`Template with ID "${t.templateId}" not found`);
7203
- const i = t.version !== void 0 ? Ta(n, t.version) : Ia(n);
7219
+ const i = t.version !== void 0 ? xa(n, t.version) : Ta(n);
7204
7220
  if (!i)
7205
7221
  throw new Error(`Template "${t.templateId}" version ${t.version} not found`);
7206
7222
  return {
@@ -7217,7 +7233,7 @@ const pi = (e) => ({
7217
7233
  throw r("get_element_template_details", n), new Error(`Failed to get template details: ${n.message}`);
7218
7234
  }
7219
7235
  }
7220
- }), xa = (e) => ({
7236
+ }), Ra = (e) => ({
7221
7237
  name: "apply_element_template",
7222
7238
  description: "Applies an element template (connector or custom template) to a BPMN element. The element must exist in the diagram and the template must be available. Use search_element_templates first to find the template ID.",
7223
7239
  parameters: {
@@ -7256,7 +7272,7 @@ const pi = (e) => ({
7256
7272
  throw r("apply_element_template", n), new Error(`Failed to apply element template: ${n.message}`);
7257
7273
  }
7258
7274
  }
7259
- }), Ra = (e) => ({
7275
+ }), Aa = (e) => ({
7260
7276
  name: "get_diagram_errors",
7261
7277
  description: "Gets all validation errors for the current BPMN diagram, including lint errors and deployment errors. Use this to check if the diagram is valid and identify issues that need to be fixed.",
7262
7278
  parameters: {},
@@ -7277,7 +7293,7 @@ const pi = (e) => ({
7277
7293
  throw r("get_diagram_errors", n), new Error(`Failed to get diagram errors: ${n.message}`);
7278
7294
  }
7279
7295
  }
7280
- }), Aa = (e) => ({
7296
+ }), Ma = (e) => ({
7281
7297
  name: "get_form_errors",
7282
7298
  description: "Gets all validation errors for the current form. Returns lint errors that indicate issues with form field configuration. Only available when a form is open.",
7283
7299
  parameters: {},
@@ -7299,7 +7315,7 @@ const pi = (e) => ({
7299
7315
  throw r("get_form_errors", n), new Error(`Failed to get form errors: ${n.message}`);
7300
7316
  }
7301
7317
  }
7302
- }), Ma = (e) => ({
7318
+ }), Ca = (e) => ({
7303
7319
  name: "layout_bpmn_xml",
7304
7320
  description: "Auto-layouts the current BPMN diagram to improve visual clarity and readability.",
7305
7321
  parameters: {},
@@ -7326,7 +7342,7 @@ const pi = (e) => ({
7326
7342
  return !0;
7327
7343
  const n = e[r];
7328
7344
  return Array.isArray(n) ? n.every((i) => at(i) ? st(i, t) : !0) : at(n) ? st(n, t) : !0;
7329
- }), an = (e, t) => {
7345
+ }), sn = (e, t) => {
7330
7346
  at(e) && st(e, t);
7331
7347
  }, Ae = (e) => `${e}_${Math.random().toString(36).slice(2, 10)}`, se = async (e, t) => {
7332
7348
  const { rootElement: r } = await e.fromXML(t);
@@ -7344,7 +7360,7 @@ const pi = (e) => ({
7344
7360
  if (!t || t.$type !== "dmn:DecisionTable")
7345
7361
  throw new Error(`Decision ${e.id} does not have a decision table`);
7346
7362
  return t;
7347
- }, Ca = (e, t, r, n) => {
7363
+ }, Da = (e, t, r, n) => {
7348
7364
  const i = e.name ?? null;
7349
7365
  if (e.$type === "dmn:Decision") {
7350
7366
  const a = e.decisionLogic;
@@ -7360,11 +7376,11 @@ const pi = (e) => ({
7360
7376
  return;
7361
7377
  }
7362
7378
  e.$type === "dmn:BusinessKnowledgeModel" && n.push({ id: e.id, name: i });
7363
- }, Da = (e) => {
7379
+ }, Pa = (e) => {
7364
7380
  const t = [], r = [], n = [];
7365
- return an(
7381
+ return sn(
7366
7382
  e,
7367
- (i) => Ca(i, t, r, n)
7383
+ (i) => Da(i, t, r, n)
7368
7384
  ), {
7369
7385
  definitionsId: e.id ?? null,
7370
7386
  decisionsCount: t.length,
@@ -7374,7 +7390,7 @@ const pi = (e) => ({
7374
7390
  inputData: r,
7375
7391
  businessKnowledgeModels: n
7376
7392
  };
7377
- }, Pa = (e) => ({
7393
+ }, _a = (e) => ({
7378
7394
  name: "get_dmn_summary",
7379
7395
  displayName: "Reading DMN summary",
7380
7396
  description: "Returns an overview of the current DMN model including decisions, input data, and business knowledge models.",
@@ -7386,12 +7402,12 @@ const pi = (e) => ({
7386
7402
  handler: async (t, r) => {
7387
7403
  try {
7388
7404
  const n = await e.diagram.exportXml(), i = e.dmn.createModdle(), { definitions: a } = await se(i, n);
7389
- return Da(a);
7405
+ return Pa(a);
7390
7406
  } catch (n) {
7391
7407
  throw r("get_dmn_summary", n), new Error(`Failed to get DMN summary: ${n.message}`);
7392
7408
  }
7393
7409
  }
7394
- }), _a = (e) => ({
7410
+ }), Ba = (e) => ({
7395
7411
  name: "get_dmn_element_details",
7396
7412
  displayName: "Reading DMN element",
7397
7413
  description: "Returns metadata for a DMN element by id.",
@@ -7412,7 +7428,7 @@ const pi = (e) => ({
7412
7428
  handler: async (t, r) => {
7413
7429
  try {
7414
7430
  const { elementId: n } = t, i = await e.diagram.exportXml(), a = e.dmn.createModdle(), { definitions: o } = await se(a, i), s = [];
7415
- an(o, (l) => {
7431
+ sn(o, (l) => {
7416
7432
  if (l.id === n)
7417
7433
  return s.push(l), !1;
7418
7434
  });
@@ -7429,7 +7445,7 @@ const pi = (e) => ({
7429
7445
  throw r("get_dmn_element_details", n), new Error(`Failed to get DMN element details: ${n.message}`);
7430
7446
  }
7431
7447
  }
7432
- }), Ba = (e) => e.map((t) => {
7448
+ }), Sa = (e) => e.map((t) => {
7433
7449
  const r = t.inputExpression;
7434
7450
  return {
7435
7451
  id: t.id,
@@ -7437,12 +7453,12 @@ const pi = (e) => ({
7437
7453
  expression: r?.text ?? "",
7438
7454
  typeRef: r?.typeRef ?? null
7439
7455
  };
7440
- }), Sa = (e) => e.map((t) => ({
7456
+ }), Oa = (e) => e.map((t) => ({
7441
7457
  id: t.id,
7442
7458
  label: t.label ?? null,
7443
7459
  name: t.name ?? null,
7444
7460
  typeRef: t.typeRef ?? null
7445
- })), Oa = (e) => e.map((t) => ({
7461
+ })), Fa = (e) => e.map((t) => ({
7446
7462
  id: t.id,
7447
7463
  inputEntries: (t.inputEntry ?? []).map(
7448
7464
  (r) => r.text ?? ""
@@ -7450,7 +7466,7 @@ const pi = (e) => ({
7450
7466
  outputEntries: (t.outputEntry ?? []).map(
7451
7467
  (r) => r.text ?? ""
7452
7468
  )
7453
- })), Fa = (e) => ({
7469
+ })), ka = (e) => ({
7454
7470
  name: "get_decision_table",
7455
7471
  displayName: "Reading decision table",
7456
7472
  description: "Returns the full decision table structure for a decision, including inputs, outputs, hit policy, and rules.",
@@ -7475,15 +7491,15 @@ const pi = (e) => ({
7475
7491
  decisionName: s.name ?? null,
7476
7492
  tableId: p.id,
7477
7493
  hitPolicy: p.hitPolicy ?? "UNIQUE",
7478
- inputs: Ba(l),
7479
- outputs: Sa(c),
7480
- rules: Oa(u)
7494
+ inputs: Sa(l),
7495
+ outputs: Oa(c),
7496
+ rules: Fa(u)
7481
7497
  };
7482
7498
  } catch (n) {
7483
7499
  throw r("get_decision_table", n), new Error(`Failed to get decision table: ${n.message}`);
7484
7500
  }
7485
7501
  }
7486
- }), ka = /* @__PURE__ */ new Set(["UNIQUE", "FIRST", "PRIORITY", "ANY", "COLLECT", "RULE ORDER", "OUTPUT ORDER"]), $a = (e) => ({
7502
+ }), $a = /* @__PURE__ */ new Set(["UNIQUE", "FIRST", "PRIORITY", "ANY", "COLLECT", "RULE ORDER", "OUTPUT ORDER"]), qa = (e) => ({
7487
7503
  name: "set_hit_policy",
7488
7504
  displayName: "Setting hit policy",
7489
7505
  description: "Sets the hit policy of a DMN decision table.",
@@ -7508,7 +7524,7 @@ const pi = (e) => ({
7508
7524
  handler: async (t, r) => {
7509
7525
  try {
7510
7526
  const { decisionId: n, hitPolicy: i } = t;
7511
- if (!ka.has(i))
7527
+ if (!$a.has(i))
7512
7528
  throw new Error(`Unsupported hit policy: ${i}`);
7513
7529
  const a = await e.diagram.exportXml(), o = e.dmn.createModdle(), { definitions: s } = await se(o, a), p = we(s, n), l = ve(p);
7514
7530
  l.hitPolicy = i;
@@ -7524,7 +7540,7 @@ const pi = (e) => ({
7524
7540
  throw r("set_hit_policy", n), new Error(`Failed to set hit policy: ${n.message}`);
7525
7541
  }
7526
7542
  }
7527
- }), qa = (e) => ({
7543
+ }), La = (e) => ({
7528
7544
  name: "update_dmn_xml",
7529
7545
  displayName: "Updating DMN XML",
7530
7546
  description: "Imports and saves full DMN XML content for advanced edits.",
@@ -7558,7 +7574,7 @@ const pi = (e) => ({
7558
7574
  throw r("update_dmn_xml", n), new Error(`Failed to update DMN XML: ${n.message}`);
7559
7575
  }
7560
7576
  }
7561
- }), La = (e, { label: t, expression: r, typeRef: n }) => e.create("dmn:Input", {
7577
+ }), Ga = (e, { label: t, expression: r, typeRef: n }) => e.create("dmn:Input", {
7562
7578
  id: Ae("Input"),
7563
7579
  label: t ?? null,
7564
7580
  inputExpression: e.create("dmn:LiteralExpression", {
@@ -7566,38 +7582,38 @@ const pi = (e) => ({
7566
7582
  text: r ?? "",
7567
7583
  typeRef: n ?? "string"
7568
7584
  })
7569
- }), Ga = (e, { label: t, expression: r, typeRef: n }) => e.create("dmn:OutputClause", {
7585
+ }), ja = (e, { label: t, expression: r, typeRef: n }) => e.create("dmn:OutputClause", {
7570
7586
  id: Ae("Output"),
7571
7587
  label: t ?? null,
7572
7588
  name: r ?? null,
7573
7589
  typeRef: n ?? "string"
7574
- }), ja = (e, t, r) => {
7590
+ }), Ua = (e, t, r) => {
7575
7591
  if (r.type === "input") {
7576
- const n = La(e, r), i = t.input ?? [];
7592
+ const n = Ga(e, r), i = t.input ?? [];
7577
7593
  return t.input = [...i, n], n;
7578
7594
  }
7579
7595
  if (r.type === "output") {
7580
- const n = Ga(e, r), i = t.output ?? [];
7596
+ const n = ja(e, r), i = t.output ?? [];
7581
7597
  return t.output = [...i, n], n;
7582
7598
  }
7583
7599
  throw new Error("Column type must be either 'input' or 'output'");
7584
- }, Ua = (e, { label: t, expression: r, typeRef: n }) => {
7600
+ }, Xa = (e, { label: t, expression: r, typeRef: n }) => {
7585
7601
  const i = e;
7586
7602
  t !== void 0 && (i.label = t);
7587
7603
  const a = e.inputExpression;
7588
7604
  r !== void 0 && a && (a.text = r), n !== void 0 && a && (a.typeRef = n);
7589
- }, Xa = (e, { label: t, expression: r, typeRef: n }) => {
7605
+ }, Va = (e, { label: t, expression: r, typeRef: n }) => {
7590
7606
  const i = e;
7591
7607
  t !== void 0 && (i.label = t), r !== void 0 && (i.name = r), n !== void 0 && (i.typeRef = n);
7592
- }, Va = (e, t) => {
7608
+ }, za = (e, t) => {
7593
7609
  const r = (e.input ?? []).find((i) => i.id === t.columnId);
7594
7610
  if (r)
7595
- return Ua(r, t), { type: "input", column: r };
7611
+ return Xa(r, t), { type: "input", column: r };
7596
7612
  const n = (e.output ?? []).find((i) => i.id === t.columnId);
7597
7613
  if (n)
7598
- return Xa(n, t), { type: "output", column: n };
7614
+ return Va(n, t), { type: "output", column: n };
7599
7615
  throw new Error(`Column not found: ${t.columnId}`);
7600
- }, za = (e) => ({
7616
+ }, Ha = (e) => ({
7601
7617
  name: "add_decision_table_column",
7602
7618
  displayName: "Adding decision table column",
7603
7619
  description: "Adds an input or output column to a DMN decision table.",
@@ -7633,9 +7649,9 @@ const pi = (e) => ({
7633
7649
  requiredCapabilities: ["DMN_EDITING"],
7634
7650
  handler: async (t, r) => {
7635
7651
  try {
7636
- const { decisionId: n, type: i, label: a, expression: o, typeRef: s } = t, p = await e.diagram.exportXml(), l = e.dmn.createModdle(), { definitions: c } = await se(l, p), u = we(c, n), d = ve(u), f = ja(l, d, { type: i, label: a, expression: o, typeRef: s }), P = await Ce(c), { error: D } = await e.diagram.importContent(P);
7637
- if (D)
7638
- throw new Error(`Failed to import DMN: ${String(D)}`);
7652
+ const { decisionId: n, type: i, label: a, expression: o, typeRef: s } = t, p = await e.diagram.exportXml(), l = e.dmn.createModdle(), { definitions: c } = await se(l, p), u = we(c, n), d = ve(u), f = Ua(l, d, { type: i, label: a, expression: o, typeRef: s }), M = await Ce(c), { error: P } = await e.diagram.importContent(M);
7653
+ if (P)
7654
+ throw new Error(`Failed to import DMN: ${String(P)}`);
7639
7655
  return await e.diagram.saveContent(), {
7640
7656
  decisionId: u.id,
7641
7657
  tableId: d.id,
@@ -7646,30 +7662,30 @@ const pi = (e) => ({
7646
7662
  throw r("add_decision_table_column", n), new Error(`Failed to add decision table column: ${n.message}`);
7647
7663
  }
7648
7664
  }
7649
- }), sn = (e, t) => e.create("dmn:UnaryTests", {
7665
+ }), on = (e, t) => e.create("dmn:UnaryTests", {
7650
7666
  id: Ae("InputEntry"),
7651
7667
  text: t
7652
- }), on = (e, t) => e.create("dmn:LiteralExpression", {
7668
+ }), pn = (e, t) => e.create("dmn:LiteralExpression", {
7653
7669
  id: Ae("OutputEntry"),
7654
7670
  text: t
7655
- }), Ha = (e, t, r = [], n = []) => {
7671
+ }), Wa = (e, t, r = [], n = []) => {
7656
7672
  const i = e.create("dmn:DecisionRule", {
7657
7673
  id: Ae("Rule"),
7658
- inputEntry: r.map((o) => sn(e, o ?? "")),
7659
- outputEntry: n.map((o) => on(e, o ?? ""))
7674
+ inputEntry: r.map((o) => on(e, o ?? "")),
7675
+ outputEntry: n.map((o) => pn(e, o ?? ""))
7660
7676
  }), a = t.rule ?? [];
7661
7677
  return t.rule = [...a, i], i;
7662
- }, Wa = (e, t, r, n = [], i = []) => {
7678
+ }, Ka = (e, t, r, n = [], i = []) => {
7663
7679
  const a = (t.rule ?? []).find((o) => o.id === r);
7664
7680
  if (!a)
7665
7681
  throw new Error(`Rule not found: ${r}`);
7666
- return n.length > 0 && (a.inputEntry = n.map((o) => sn(e, o ?? ""))), i.length > 0 && (a.outputEntry = i.map((o) => on(e, o ?? ""))), a;
7667
- }, Ka = (e, t) => {
7682
+ return n.length > 0 && (a.inputEntry = n.map((o) => on(e, o ?? ""))), i.length > 0 && (a.outputEntry = i.map((o) => pn(e, o ?? ""))), a;
7683
+ }, Ja = (e, t) => {
7668
7684
  const r = e.rule ?? [], n = r.filter((i) => i.id !== t);
7669
7685
  if (n.length === r.length)
7670
7686
  throw new Error(`Rule not found: ${t}`);
7671
7687
  e.rule = n;
7672
- }, Ja = (e) => ({
7688
+ }, Ya = (e) => ({
7673
7689
  name: "add_decision_table_rule",
7674
7690
  displayName: "Adding decision table rule",
7675
7691
  description: "Adds a rule to a DMN decision table.",
@@ -7702,7 +7718,7 @@ const pi = (e) => ({
7702
7718
  decisionId: n,
7703
7719
  inputEntries: i = [],
7704
7720
  outputEntries: a = []
7705
- } = t, o = await e.diagram.exportXml(), s = e.dmn.createModdle(), { definitions: p } = await se(s, o), l = we(p, n), c = ve(l), u = Ha(s, c, i, a), d = await Ce(p), { error: f } = await e.diagram.importContent(d);
7721
+ } = t, o = await e.diagram.exportXml(), s = e.dmn.createModdle(), { definitions: p } = await se(s, o), l = we(p, n), c = ve(l), u = Wa(s, c, i, a), d = await Ce(p), { error: f } = await e.diagram.importContent(d);
7706
7722
  if (f)
7707
7723
  throw new Error(`Failed to import DMN: ${String(f)}`);
7708
7724
  return await e.diagram.saveContent(), {
@@ -7714,7 +7730,7 @@ const pi = (e) => ({
7714
7730
  throw r("add_decision_table_rule", n), new Error(`Failed to add decision table rule: ${n.message}`);
7715
7731
  }
7716
7732
  }
7717
- }), Ya = (e) => ({
7733
+ }), Qa = (e) => ({
7718
7734
  name: "delete_decision_table_rule",
7719
7735
  displayName: "Deleting decision table rule",
7720
7736
  description: "Deletes a rule from a DMN decision table.",
@@ -7739,7 +7755,7 @@ const pi = (e) => ({
7739
7755
  handler: async (t, r) => {
7740
7756
  try {
7741
7757
  const { decisionId: n, ruleId: i } = t, a = await e.diagram.exportXml(), o = e.dmn.createModdle(), { definitions: s } = await se(o, a), p = we(s, n), l = ve(p);
7742
- Ka(l, i);
7758
+ Ja(l, i);
7743
7759
  const c = await Ce(s), { error: u } = await e.diagram.importContent(c);
7744
7760
  if (u)
7745
7761
  throw new Error(`Failed to import DMN: ${String(u)}`);
@@ -7752,7 +7768,7 @@ const pi = (e) => ({
7752
7768
  throw r("delete_decision_table_rule", n), new Error(`Failed to delete decision table rule: ${n.message}`);
7753
7769
  }
7754
7770
  }
7755
- }), Qa = (e) => ({
7771
+ }), Za = (e) => ({
7756
7772
  name: "update_decision_table_column",
7757
7773
  displayName: "Updating decision table column",
7758
7774
  description: "Updates an input or output column in a DMN decision table.",
@@ -7788,9 +7804,9 @@ const pi = (e) => ({
7788
7804
  requiredCapabilities: ["DMN_EDITING"],
7789
7805
  handler: async (t, r) => {
7790
7806
  try {
7791
- const { decisionId: n, columnId: i, label: a, expression: o, typeRef: s } = t, p = await e.diagram.exportXml(), l = e.dmn.createModdle(), { definitions: c } = await se(l, p), u = we(c, n), d = ve(u), { type: f } = Va(d, { columnId: i, label: a, expression: o, typeRef: s }), P = await Ce(c), { error: D } = await e.diagram.importContent(P);
7792
- if (D)
7793
- throw new Error(`Failed to import DMN: ${String(D)}`);
7807
+ const { decisionId: n, columnId: i, label: a, expression: o, typeRef: s } = t, p = await e.diagram.exportXml(), l = e.dmn.createModdle(), { definitions: c } = await se(l, p), u = we(c, n), d = ve(u), { type: f } = za(d, { columnId: i, label: a, expression: o, typeRef: s }), M = await Ce(c), { error: P } = await e.diagram.importContent(M);
7808
+ if (P)
7809
+ throw new Error(`Failed to import DMN: ${String(P)}`);
7794
7810
  return await e.diagram.saveContent(), {
7795
7811
  decisionId: u.id,
7796
7812
  tableId: d.id,
@@ -7801,7 +7817,7 @@ const pi = (e) => ({
7801
7817
  throw r("update_decision_table_column", n), new Error(`Failed to update decision table column: ${n.message}`);
7802
7818
  }
7803
7819
  }
7804
- }), Za = (e) => ({
7820
+ }), es = (e) => ({
7805
7821
  name: "update_decision_table_rule",
7806
7822
  displayName: "Updating decision table rule",
7807
7823
  description: "Updates an existing DMN decision table rule.",
@@ -7840,9 +7856,9 @@ const pi = (e) => ({
7840
7856
  ruleId: i,
7841
7857
  inputEntries: a = [],
7842
7858
  outputEntries: o = []
7843
- } = t, s = await e.diagram.exportXml(), p = e.dmn.createModdle(), { definitions: l } = await se(p, s), c = we(l, n), u = ve(c), d = Wa(p, u, i, a, o), f = await Ce(l), { error: P } = await e.diagram.importContent(f);
7844
- if (P)
7845
- throw new Error(`Failed to import DMN: ${String(P)}`);
7859
+ } = t, s = await e.diagram.exportXml(), p = e.dmn.createModdle(), { definitions: l } = await se(p, s), c = we(l, n), u = ve(c), d = Ka(p, u, i, a, o), f = await Ce(l), { error: M } = await e.diagram.importContent(f);
7860
+ if (M)
7861
+ throw new Error(`Failed to import DMN: ${String(M)}`);
7846
7862
  return await e.diagram.saveContent(), {
7847
7863
  decisionId: c.id,
7848
7864
  tableId: u.id,
@@ -7852,7 +7868,7 @@ const pi = (e) => ({
7852
7868
  throw r("update_decision_table_rule", n), new Error(`Failed to update decision table rule: ${n.message}`);
7853
7869
  }
7854
7870
  }
7855
- }), es = (e) => ({
7871
+ }), ts = (e) => ({
7856
7872
  name: "get_form_schema",
7857
7873
  displayName: "Reading form schema",
7858
7874
  description: "Returns the current form schema from the active form editor session.",
@@ -7868,7 +7884,7 @@ const pi = (e) => ({
7868
7884
  throw r("get_form_schema", n), new Error(`Failed to read form schema: ${n.message}`);
7869
7885
  }
7870
7886
  }
7871
- }), ts = (e) => ({
7887
+ }), ns = (e) => ({
7872
7888
  name: "get_form_binding_from_task",
7873
7889
  displayName: "Reading form binding",
7874
7890
  description: "Gets the form binding configuration from a BPMN user task, including formId/formKey and binding details.",
@@ -7908,7 +7924,7 @@ const pi = (e) => ({
7908
7924
  throw r("get_form_binding_from_task", n), new Error(`Failed to get form binding from task: ${n.message}`);
7909
7925
  }
7910
7926
  }
7911
- }), ns = (e) => {
7927
+ }), rs = (e) => {
7912
7928
  if (!e)
7913
7929
  return null;
7914
7930
  const t = Array.isArray(e) ? e[0] : e;
@@ -7921,7 +7937,7 @@ const pi = (e) => ({
7921
7937
  type: typeof r.type == "string" ? r.type : null,
7922
7938
  label: typeof r.label == "string" ? r.label : null
7923
7939
  };
7924
- }, rs = (e) => ({
7940
+ }, is = (e) => ({
7925
7941
  name: "get_selected_form_field",
7926
7942
  displayName: "Reading selected form field",
7927
7943
  description: "Returns details of the currently selected field in the form editor.",
@@ -7932,7 +7948,7 @@ const pi = (e) => ({
7932
7948
  requiredCapabilities: ["FORM_VIEWING"],
7933
7949
  handler: async (t, r) => {
7934
7950
  try {
7935
- const n = e.form.getSelection(), i = ns(n);
7951
+ const n = e.form.getSelection(), i = rs(n);
7936
7952
  return {
7937
7953
  selected: i,
7938
7954
  found: !!i
@@ -7941,7 +7957,7 @@ const pi = (e) => ({
7941
7957
  throw r("get_selected_form_field", n), new Error(`Failed to get selected form field: ${n.message}`);
7942
7958
  }
7943
7959
  }
7944
- }), is = /* @__PURE__ */ new Set([
7960
+ }), as = /* @__PURE__ */ new Set([
7945
7961
  "textfield",
7946
7962
  "textarea",
7947
7963
  "number",
@@ -7961,7 +7977,7 @@ const pi = (e) => ({
7961
7977
  ]), ot = /* @__PURE__ */ new Set(["text", "image", "spacer", "separator", "group", "button", "default"]), V = (e) => e !== null && typeof e == "object" && !Array.isArray(e), bt = (e, t) => !V(e) || !V(t) ? t : Object.entries(t).reduce(
7962
7978
  (r, [n, i]) => V(i) && V(r[n]) ? { ...r, [n]: bt(r[n], i) } : { ...r, [n]: i },
7963
7979
  { ...e }
7964
- ), pn = (e, t) => {
7980
+ ), ln = (e, t) => {
7965
7981
  if (e == null || e === "")
7966
7982
  return null;
7967
7983
  if (typeof e == "string")
@@ -7976,7 +7992,7 @@ const pi = (e) => ({
7976
7992
  if (!V(e))
7977
7993
  throw new Error(`${t} must be a JSON object`);
7978
7994
  return e;
7979
- }, as = (e) => {
7995
+ }, ss = (e) => {
7980
7996
  const t = e.id;
7981
7997
  if (typeof t == "string")
7982
7998
  return t;
@@ -7987,7 +8003,7 @@ const pi = (e) => ({
7987
8003
  return r;
7988
8004
  const n = Array.isArray(r.components) ? { ...r, components: Et(r.components, t) } : { ...r };
7989
8005
  return t(n);
7990
- }).filter((r) => r != null) : [], ss = (e, t) => {
8006
+ }).filter((r) => r != null) : [], os = (e, t) => {
7991
8007
  if (!Array.isArray(t) || t.length === 0)
7992
8008
  return e;
7993
8009
  const r = new Set(
@@ -7999,26 +8015,26 @@ const pi = (e) => ({
7999
8015
  const a = i.id, o = i.key;
8000
8016
  return typeof a == "string" && r.has(a) || typeof o == "string" && n.has(o) ? null : i;
8001
8017
  });
8002
- }, os = (e, t) => !Array.isArray(t) || t.length === 0 ? e : Et(e, (r) => {
8018
+ }, ps = (e, t) => !Array.isArray(t) || t.length === 0 ? e : Et(e, (r) => {
8003
8019
  const n = t.find((i) => V(i) ? i.id !== void 0 && i.id === r.id || i.key !== void 0 && i.key === r.key : !1);
8004
8020
  return n ? bt(r, n) : r;
8005
8021
  }), wt = (e) => {
8006
- const t = pn(e, "formJson");
8022
+ const t = ln(e, "formJson");
8007
8023
  if (!t)
8008
8024
  throw new Error("formJson must not be empty");
8009
8025
  return t;
8010
- }, ps = (e, t) => {
8011
- const r = pn(t, "changes");
8026
+ }, ls = (e, t) => {
8027
+ const r = ln(t, "changes");
8012
8028
  if (!r)
8013
8029
  throw new Error("changes must not be empty");
8014
- const { addComponents: n = [], removeComponents: i = [], components: a = [], ...o } = r, s = bt({ ...e }, o), p = Array.isArray(s.components) ? [...s.components] : [], l = ss(p, i), c = os(l, a), u = Array.isArray(n) && n.length > 0 ? [...c, ...n] : c;
8030
+ const { addComponents: n = [], removeComponents: i = [], components: a = [], ...o } = r, s = bt({ ...e }, o), p = Array.isArray(s.components) ? [...s.components] : [], l = os(p, i), c = ps(l, a), u = Array.isArray(n) && n.length > 0 ? [...c, ...n] : c;
8015
8031
  return { ...s, components: u };
8016
- }, ls = (e) => {
8032
+ }, cs = (e) => {
8017
8033
  const t = {}, r = [], n = { totalFields: 0, requiredFields: 0, optionalFields: 0 }, i = (a) => {
8018
8034
  Array.isArray(a) && a.forEach((o) => {
8019
8035
  if (!V(o))
8020
8036
  return;
8021
- const s = typeof o.type == "string" ? o.type : "default", p = as(o), l = typeof o.key == "string" ? o.key : p, c = o.validate, u = !!(V(c) && c.required || o.required);
8037
+ const s = typeof o.type == "string" ? o.type : "default", p = ss(o), l = typeof o.key == "string" ? o.key : p, c = o.validate, u = !!(V(c) && c.required || o.required);
8022
8038
  ot.has(s) || (n.totalFields += 1, u ? n.requiredFields += 1 : n.optionalFields += 1, t[s] = (t[s] ?? 0) + 1, r.push({
8023
8039
  key: l,
8024
8040
  type: s,
@@ -8036,7 +8052,7 @@ const pi = (e) => ({
8036
8052
  fieldsByType: t,
8037
8053
  fields: r
8038
8054
  };
8039
- }, ln = (e) => {
8055
+ }, cn = (e) => {
8040
8056
  const t = [], r = [], n = /* @__PURE__ */ new Set();
8041
8057
  if (!V(e))
8042
8058
  return { isValid: !1, errors: ["Form schema must be a JSON object"], warnings: r };
@@ -8053,7 +8069,7 @@ const pi = (e) => ({
8053
8069
  return;
8054
8070
  }
8055
8071
  const p = typeof s.type == "string" ? s.type : "default", l = s.id;
8056
- typeof l == "string" && (n.has(l) ? t.push(`Duplicate component id: ${l}`) : n.add(l)), is.has(p) || t.push(`Invalid field type "${p}"`);
8072
+ typeof l == "string" && (n.has(l) ? t.push(`Duplicate component id: ${l}`) : n.add(l)), as.has(p) || t.push(`Invalid field type "${p}"`);
8057
8073
  const c = s.key;
8058
8074
  if (!ot.has(p) && !c && t.push(`Input component of type "${p}" requires a "key" field`), !ot.has(p) && !s.label) {
8059
8075
  const u = typeof c == "string" && c || typeof l == "string" && l || p;
@@ -8068,7 +8084,7 @@ const pi = (e) => ({
8068
8084
  errors: t,
8069
8085
  warnings: r
8070
8086
  };
8071
- }, cs = (e) => ({
8087
+ }, us = (e) => ({
8072
8088
  name: "summarize_form_json",
8073
8089
  displayName: "Summarizing form schema",
8074
8090
  description: "Summarizes a Camunda Form JSON definition with field counts, required field distribution, and field details.",
@@ -8088,12 +8104,12 @@ const pi = (e) => ({
8088
8104
  handler: async (t, r) => {
8089
8105
  try {
8090
8106
  const { formJson: n } = t ?? {}, i = n ? wt(n) : e.form.getSchema();
8091
- return ls(i);
8107
+ return cs(i);
8092
8108
  } catch (n) {
8093
8109
  throw r("summarize_form_json", n), new Error(`Failed to summarize form JSON: ${n.message}`);
8094
8110
  }
8095
8111
  }
8096
- }), us = (e) => ({
8112
+ }), ds = (e) => ({
8097
8113
  name: "update_form_json",
8098
8114
  displayName: "Updating form schema",
8099
8115
  description: "Updates a Camunda Form JSON definition with structured changes such as add, update, and remove operations.",
@@ -8117,7 +8133,7 @@ const pi = (e) => ({
8117
8133
  requiredCapabilities: ["FORM_EDITING"],
8118
8134
  handler: async (t, r) => {
8119
8135
  try {
8120
- const { formJson: n, changes: i } = t, a = n ? wt(n) : e.form.getSchema(), o = ps(a, i), s = ln(o);
8136
+ const { formJson: n, changes: i } = t, a = n ? wt(n) : e.form.getSchema(), o = ls(a, i), s = cn(o);
8121
8137
  return e.form.importSchema(o), await e.form.update(), {
8122
8138
  success: !0,
8123
8139
  message: "Form JSON updated successfully",
@@ -8130,7 +8146,7 @@ const pi = (e) => ({
8130
8146
  throw r("update_form_json", n), new Error(`Failed to update form JSON: ${n.message}`);
8131
8147
  }
8132
8148
  }
8133
- }), ds = (e) => ({
8149
+ }), ms = (e) => ({
8134
8150
  name: "validate_form_json",
8135
8151
  displayName: "Validating form schema",
8136
8152
  description: "Validates a Camunda Form JSON definition for structural correctness, required fields, and duplicate IDs.",
@@ -8150,17 +8166,17 @@ const pi = (e) => ({
8150
8166
  handler: async (t, r) => {
8151
8167
  try {
8152
8168
  const { formJson: n } = t ?? {}, i = n ? wt(n) : e.form.getSchema();
8153
- return ln(i);
8169
+ return cn(i);
8154
8170
  } catch (n) {
8155
8171
  throw r("validate_form_json", n), new Error(`Failed to validate form JSON: ${n.message}`);
8156
8172
  }
8157
8173
  }
8158
- }), ms = (e) => {
8174
+ }), fs = (e) => {
8159
8175
  if (typeof e != "string")
8160
8176
  return "";
8161
8177
  const t = e.trim();
8162
8178
  return t.startsWith("=") ? t.slice(1).trim() : t;
8163
- }, fs = (e) => ({
8179
+ }, ys = (e) => ({
8164
8180
  name: "validate_feel_expression",
8165
8181
  displayName: "Validating FEEL expression",
8166
8182
  description: "Validates a FEEL expression for syntax correctness. Use this before applying FEEL expressions to BPMN or DMN elements.",
@@ -8180,7 +8196,7 @@ const pi = (e) => ({
8180
8196
  requiredCapabilities: ["VALIDATION"],
8181
8197
  handler: async (t, r) => {
8182
8198
  try {
8183
- const { feelExpression: n } = t, i = ms(n);
8199
+ const { feelExpression: n } = t, i = fs(n);
8184
8200
  if (!i)
8185
8201
  return {
8186
8202
  isValid: !1,
@@ -8204,59 +8220,59 @@ const pi = (e) => ({
8204
8220
  throw r("validate_feel_expression", n), new Error(`Failed to validate FEEL expression: ${n.message}`);
8205
8221
  }
8206
8222
  }
8207
- }), ys = (e) => [
8208
- pi(e),
8209
- ci(e),
8210
- di(e),
8223
+ }), gs = (e) => [
8224
+ li(e),
8225
+ ui(e),
8211
8226
  mi(e),
8212
- Ei(e),
8213
- vi(e),
8214
- Ri(e),
8215
- _i(e),
8216
- $i(e, tn),
8217
- ji(e),
8218
- Xi(e),
8227
+ fi(e),
8228
+ wi(e),
8229
+ Ii(e),
8230
+ Ai(e),
8231
+ Bi(e),
8232
+ qi(e, tn),
8233
+ Ui(e),
8219
8234
  Vi(e),
8220
8235
  zi(e),
8221
8236
  Hi(e),
8222
8237
  Wi(e),
8223
8238
  Ki(e),
8224
- ia(e),
8239
+ Ji(e),
8225
8240
  aa(e),
8226
8241
  sa(e),
8227
8242
  oa(e),
8228
- ua(e),
8243
+ pa(e),
8229
8244
  da(e),
8230
8245
  ma(e),
8231
8246
  fa(e),
8232
- ha(e),
8233
- va(e),
8247
+ ya(e),
8248
+ ba(e),
8249
+ Ia(e),
8234
8250
  Na(e),
8235
- xa(e),
8236
8251
  Ra(e),
8237
8252
  Aa(e),
8238
8253
  Ma(e),
8239
- Pa(e),
8254
+ Ca(e),
8240
8255
  _a(e),
8241
- Fa(e),
8242
- $a(e),
8256
+ Ba(e),
8257
+ ka(e),
8243
8258
  qa(e),
8244
- za(e),
8245
- Ja(e),
8259
+ La(e),
8260
+ Ha(e),
8246
8261
  Ya(e),
8247
8262
  Qa(e),
8248
8263
  Za(e),
8249
8264
  es(e),
8250
8265
  ts(e),
8251
- rs(e),
8252
- cs(e),
8266
+ ns(e),
8267
+ is(e),
8253
8268
  us(e),
8254
8269
  ds(e),
8255
- fs(e)
8256
- ], bs = (e, t) => {
8257
- for (const r of ys(e))
8270
+ ms(e),
8271
+ ys(e)
8272
+ ], Es = (e, t) => {
8273
+ for (const r of gs(e))
8258
8274
  t.registerTool(r);
8259
- }, Es = ({ getModeler: e, is: t, getBusinessObject: r }) => ({
8275
+ }, ws = ({ getModeler: e, is: t, getBusinessObject: r }) => ({
8260
8276
  getModeler: e,
8261
8277
  getCanvas: () => e().get("canvas"),
8262
8278
  getElementRegistry: () => e().get("elementRegistry"),
@@ -8274,7 +8290,7 @@ const pi = (e) => ({
8274
8290
  is: t,
8275
8291
  getBusinessObject: r,
8276
8292
  getBpmnRules: () => e().get("bpmnRules")
8277
- }), gs = /* @__PURE__ */ new Set(["external-resources/validate"]), hs = /* @__PURE__ */ new Set([
8293
+ }), hs = /* @__PURE__ */ new Set(["external-resources/validate"]), bs = /* @__PURE__ */ new Set([
8278
8294
  "superfluous-gateway",
8279
8295
  "fake-join",
8280
8296
  "no-implicit-split",
@@ -8285,21 +8301,21 @@ const pi = (e) => ({
8285
8301
  "no-gateway-join-fork",
8286
8302
  "end-event-required",
8287
8303
  "start-event-required"
8288
- ]), ws = (e) => e.filter((t) => !gs.has(t.rule)).map((t) => ({
8304
+ ]), vs = (e) => e.filter((t) => !hs.has(t.rule)).map((t) => ({
8289
8305
  elementId: t.id,
8290
8306
  elementName: t.name ?? "",
8291
8307
  message: t.message,
8292
- category: hs.has(t.rule) ? "error" : t.category,
8308
+ category: bs.has(t.rule) ? "error" : t.category,
8293
8309
  rule: t.rule,
8294
8310
  documentationUrl: t.meta?.documentation?.url
8295
8311
  }));
8296
8312
  export {
8297
- Si as E,
8313
+ sn as G,
8298
8314
  rn as L,
8299
- an as X,
8300
8315
  ws as a,
8301
- ys as e,
8316
+ vs as d,
8302
8317
  tn as l,
8303
- bs as o,
8304
- Es as s
8318
+ Es as s,
8319
+ gs as t,
8320
+ Oi as w
8305
8321
  };