@bpmn-io/form-js-playground 2.0.0-alpha.0 → 2.0.1

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.
@@ -75,13 +75,13 @@
75
75
  i = [],
76
76
  r = [],
77
77
  o = m$2({}, u);
78
- o.__v = u.__v + 1, l$2.vnode && l$2.vnode(o), q$3(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? $$2(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, D$3(i, o, r), u.__e = u.__ = null, o.__e != t && P$3(o);
78
+ o.__v = u.__v + 1, l$2.vnode && l$2.vnode(o), q$3(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? $$2(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, D$3(i, o, r), u.__e = u.__ = null, o.__e != t && P$4(o);
79
79
  }
80
80
  }
81
- function P$3(n) {
81
+ function P$4(n) {
82
82
  if (null != (n = n.__) && null != n.__c) return n.__e = n.__c.base = null, n.__k.some(function (l) {
83
83
  if (null != l && null != l.__e) return n.__e = n.__c.base = l.__e;
84
- }), P$3(n);
84
+ }), P$4(n);
85
85
  }
86
86
  function A$3(n) {
87
87
  (!n.__d && (n.__d = true) && i$2.push(n) && !H$2.__r++ || r$1 != l$2.debounceRendering) && ((r$1 = l$2.debounceRendering) || o$1)(H$2);
@@ -1045,6 +1045,18 @@
1045
1045
  ClassList.prototype.has = ClassList.prototype.contains = function (name) {
1046
1046
  return this.list.contains(name);
1047
1047
  };
1048
+
1049
+ /**
1050
+ * Closest
1051
+ *
1052
+ * @param {Element} el
1053
+ * @param {string} selector
1054
+ * @param {boolean} checkYourSelf (optional)
1055
+ */
1056
+ function closest(element, selector, checkYourSelf) {
1057
+ var actualElement = checkYourSelf ? element : element.parentNode;
1058
+ return actualElement && typeof actualElement.closest === 'function' && actualElement.closest(selector) || null;
1059
+ }
1048
1060
  function getDefaultExportFromCjs$2(x) {
1049
1061
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1050
1062
  }
@@ -1915,7 +1927,7 @@
1915
1927
  * The maximum number of decimal places (DP) of the results of operations involving division:
1916
1928
  * div and sqrt, and pow with negative exponents.
1917
1929
  */
1918
- var DP = 20,
1930
+ var DP$1 = 20,
1919
1931
  // 0 to MAX_DP
1920
1932
 
1921
1933
  /*
@@ -1926,15 +1938,15 @@
1926
1938
  * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
1927
1939
  * 3 Away from zero. (ROUND_UP)
1928
1940
  */
1929
- RM = 1,
1941
+ RM$1 = 1,
1930
1942
  // 0, 1, 2 or 3
1931
1943
 
1932
1944
  // The maximum value of DP and Big.DP.
1933
- MAX_DP = 1E6,
1945
+ MAX_DP$1 = 1E6,
1934
1946
  // 0 to 1000000
1935
1947
 
1936
1948
  // The maximum magnitude of the exponent argument to the pow method.
1937
- MAX_POWER = 1E6,
1949
+ MAX_POWER$1 = 1E6,
1938
1950
  // 1 to 1000000
1939
1951
 
1940
1952
  /*
@@ -1942,7 +1954,7 @@
1942
1954
  * (JavaScript numbers: -7)
1943
1955
  * -1000000 is the minimum recommended exponent value of a Big.
1944
1956
  */
1945
- NE = -7,
1957
+ NE$1 = -7,
1946
1958
  // 0 to -1000000
1947
1959
 
1948
1960
  /*
@@ -1950,7 +1962,7 @@
1950
1962
  * (JavaScript numbers: 21)
1951
1963
  * 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
1952
1964
  */
1953
- PE = 21,
1965
+ PE$1 = 21,
1954
1966
  // 0 to 1000000
1955
1967
 
1956
1968
  /*
@@ -1958,26 +1970,26 @@
1958
1970
  * or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
1959
1971
  * primitive number without a loss of precision.
1960
1972
  */
1961
- STRICT = false,
1973
+ STRICT$1 = false,
1962
1974
  // true or false
1963
1975
 
1964
1976
  /**************************************************************************************************/
1965
1977
 
1966
1978
  // Error messages.
1967
- NAME = '[big.js] ',
1968
- INVALID$3 = NAME + 'Invalid ',
1969
- INVALID_DP = INVALID$3 + 'decimal places',
1970
- INVALID_RM = INVALID$3 + 'rounding mode',
1971
- DIV_BY_ZERO = NAME + 'Division by zero',
1979
+ NAME$1 = '[big.js] ',
1980
+ INVALID$4 = NAME$1 + 'Invalid ',
1981
+ INVALID_DP$1 = INVALID$4 + 'decimal places',
1982
+ INVALID_RM$1 = INVALID$4 + 'rounding mode',
1983
+ DIV_BY_ZERO$1 = NAME$1 + 'Division by zero',
1972
1984
  // The shared prototype object.
1973
- P$2 = {},
1974
- UNDEFINED = void 0,
1975
- NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
1985
+ P$3 = {},
1986
+ UNDEFINED$1 = void 0,
1987
+ NUMERIC$1 = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
1976
1988
 
1977
1989
  /*
1978
1990
  * Create and return a Big constructor.
1979
1991
  */
1980
- function _Big_() {
1992
+ function _Big_$1() {
1981
1993
  /*
1982
1994
  * The Big constructor and exported function.
1983
1995
  * Create and return a new instance of a Big number object.
@@ -1989,7 +2001,7 @@
1989
2001
 
1990
2002
  // Enable constructor usage without new.
1991
2003
  if (!(x instanceof Big)) {
1992
- return n === UNDEFINED && arguments.length === 0 ? _Big_() : new Big(n);
2004
+ return n === UNDEFINED$1 && arguments.length === 0 ? _Big_$1() : new Big(n);
1993
2005
  }
1994
2006
 
1995
2007
  // Duplicate.
@@ -2000,25 +2012,25 @@
2000
2012
  } else {
2001
2013
  if (typeof n !== 'string') {
2002
2014
  if (Big.strict === true && typeof n !== 'bigint') {
2003
- throw TypeError(INVALID$3 + 'value');
2015
+ throw TypeError(INVALID$4 + 'value');
2004
2016
  }
2005
2017
 
2006
2018
  // Minus zero?
2007
2019
  n = n === 0 && 1 / n < 0 ? '-0' : String(n);
2008
2020
  }
2009
- parse$1(x, n);
2021
+ parse$2(x, n);
2010
2022
  }
2011
2023
 
2012
2024
  // Retain a reference to this Big constructor.
2013
2025
  // Shadow Big.prototype.constructor which points to Object.
2014
2026
  x.constructor = Big;
2015
2027
  }
2016
- Big.prototype = P$2;
2017
- Big.DP = DP;
2018
- Big.RM = RM;
2019
- Big.NE = NE;
2020
- Big.PE = PE;
2021
- Big.strict = STRICT;
2028
+ Big.prototype = P$3;
2029
+ Big.DP = DP$1;
2030
+ Big.RM = RM$1;
2031
+ Big.NE = NE$1;
2032
+ Big.PE = PE$1;
2033
+ Big.strict = STRICT$1;
2022
2034
  Big.roundDown = 0;
2023
2035
  Big.roundHalfUp = 1;
2024
2036
  Big.roundHalfEven = 2;
@@ -2032,10 +2044,10 @@
2032
2044
  * x {Big} A Big number instance.
2033
2045
  * n {number|string} A numeric value.
2034
2046
  */
2035
- function parse$1(x, n) {
2047
+ function parse$2(x, n) {
2036
2048
  var e, i, nl;
2037
- if (!NUMERIC.test(n)) {
2038
- throw Error(INVALID$3 + 'number');
2049
+ if (!NUMERIC$1.test(n)) {
2050
+ throw Error(INVALID$4 + 'number');
2039
2051
  }
2040
2052
 
2041
2053
  // Determine sign.
@@ -2081,14 +2093,14 @@
2081
2093
  * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
2082
2094
  * [more] {boolean} Whether the result of division was truncated.
2083
2095
  */
2084
- function round(x, sd, rm, more) {
2096
+ function round$1(x, sd, rm, more) {
2085
2097
  var xc = x.c;
2086
- if (rm === UNDEFINED) rm = x.constructor.RM;
2098
+ if (rm === UNDEFINED$1) rm = x.constructor.RM;
2087
2099
  if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
2088
- throw Error(INVALID_RM);
2100
+ throw Error(INVALID_RM$1);
2089
2101
  }
2090
2102
  if (sd < 1) {
2091
- more = rm === 3 && (more || !!xc[0]) || sd === 0 && (rm === 1 && xc[0] >= 5 || rm === 2 && (xc[0] > 5 || xc[0] === 5 && (more || xc[1] !== UNDEFINED)));
2103
+ more = rm === 3 && (more || !!xc[0]) || sd === 0 && (rm === 1 && xc[0] >= 5 || rm === 2 && (xc[0] > 5 || xc[0] === 5 && (more || xc[1] !== UNDEFINED$1)));
2092
2104
  xc.length = 1;
2093
2105
  if (more) {
2094
2106
  // 1, 0.1, 0.01, 0.001, 0.0001 etc.
@@ -2100,7 +2112,7 @@
2100
2112
  }
2101
2113
  } else if (sd < xc.length) {
2102
2114
  // xc[sd] is the digit after the digit that may be rounded up.
2103
- more = rm === 1 && xc[sd] >= 5 || rm === 2 && (xc[sd] > 5 || xc[sd] === 5 && (more || xc[sd + 1] !== UNDEFINED || xc[sd - 1] & 1)) || rm === 3 && (more || !!xc[0]);
2115
+ more = rm === 1 && xc[sd] >= 5 || rm === 2 && (xc[sd] > 5 || xc[sd] === 5 && (more || xc[sd + 1] !== UNDEFINED$1 || xc[sd - 1] & 1)) || rm === 3 && (more || !!xc[0]);
2104
2116
 
2105
2117
  // Remove any digits after the required precision.
2106
2118
  xc.length = sd;
@@ -2128,7 +2140,7 @@
2128
2140
  * Return a string representing the value of Big x in normal or exponential notation.
2129
2141
  * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
2130
2142
  */
2131
- function stringify(x, doExponential, isNonzero) {
2143
+ function stringify$1(x, doExponential, isNonzero) {
2132
2144
  var e = x.e,
2133
2145
  s = x.c.join(''),
2134
2146
  n = s.length;
@@ -2158,7 +2170,7 @@
2158
2170
  /*
2159
2171
  * Return a new Big whose value is the absolute value of this Big.
2160
2172
  */
2161
- P$2.abs = function () {
2173
+ P$3.abs = function () {
2162
2174
  var x = new this.constructor(this);
2163
2175
  x.s = 1;
2164
2176
  return x;
@@ -2169,7 +2181,7 @@
2169
2181
  * -1 if the value of this Big is less than the value of Big y, or
2170
2182
  * 0 if they have the same value.
2171
2183
  */
2172
- P$2.cmp = function (y) {
2184
+ P$3.cmp = function (y) {
2173
2185
  var isneg,
2174
2186
  x = this,
2175
2187
  xc = x.c,
@@ -2203,7 +2215,7 @@
2203
2215
  * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
2204
2216
  * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
2205
2217
  */
2206
- P$2.div = function (y) {
2218
+ P$3.div = function (y) {
2207
2219
  var x = this,
2208
2220
  Big = x.constructor,
2209
2221
  a = x.c,
@@ -2212,13 +2224,13 @@
2212
2224
  // divisor
2213
2225
  k = x.s == y.s ? 1 : -1,
2214
2226
  dp = Big.DP;
2215
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
2216
- throw Error(INVALID_DP);
2227
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
2228
+ throw Error(INVALID_DP$1);
2217
2229
  }
2218
2230
 
2219
2231
  // Divisor is zero?
2220
2232
  if (!b[0]) {
2221
- throw Error(DIV_BY_ZERO);
2233
+ throw Error(DIV_BY_ZERO$1);
2222
2234
  }
2223
2235
 
2224
2236
  // Dividend is 0? Return +-0.
@@ -2291,7 +2303,7 @@
2291
2303
 
2292
2304
  // Update the remainder.
2293
2305
  if (r[0] && cmp) r[rl] = a[ai] || 0;else r = [a[ai]];
2294
- } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
2306
+ } while ((ai++ < al || r[0] !== UNDEFINED$1) && k--);
2295
2307
 
2296
2308
  // Leading zero? Do not remove if result is simply zero (qi == 1).
2297
2309
  if (!qc[0] && qi != 1) {
@@ -2302,14 +2314,14 @@
2302
2314
  }
2303
2315
 
2304
2316
  // Round?
2305
- if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
2317
+ if (qi > p) round$1(q, p, Big.RM, r[0] !== UNDEFINED$1);
2306
2318
  return q;
2307
2319
  };
2308
2320
 
2309
2321
  /*
2310
2322
  * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
2311
2323
  */
2312
- P$2.eq = function (y) {
2324
+ P$3.eq = function (y) {
2313
2325
  return this.cmp(y) === 0;
2314
2326
  };
2315
2327
 
@@ -2317,7 +2329,7 @@
2317
2329
  * Return true if the value of this Big is greater than the value of Big y, otherwise return
2318
2330
  * false.
2319
2331
  */
2320
- P$2.gt = function (y) {
2332
+ P$3.gt = function (y) {
2321
2333
  return this.cmp(y) > 0;
2322
2334
  };
2323
2335
 
@@ -2325,14 +2337,14 @@
2325
2337
  * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
2326
2338
  * return false.
2327
2339
  */
2328
- P$2.gte = function (y) {
2340
+ P$3.gte = function (y) {
2329
2341
  return this.cmp(y) > -1;
2330
2342
  };
2331
2343
 
2332
2344
  /*
2333
2345
  * Return true if the value of this Big is less than the value of Big y, otherwise return false.
2334
2346
  */
2335
- P$2.lt = function (y) {
2347
+ P$3.lt = function (y) {
2336
2348
  return this.cmp(y) < 0;
2337
2349
  };
2338
2350
 
@@ -2340,14 +2352,14 @@
2340
2352
  * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
2341
2353
  * return false.
2342
2354
  */
2343
- P$2.lte = function (y) {
2355
+ P$3.lte = function (y) {
2344
2356
  return this.cmp(y) < 1;
2345
2357
  };
2346
2358
 
2347
2359
  /*
2348
2360
  * Return a new Big whose value is the value of this Big minus the value of Big y.
2349
2361
  */
2350
- P$2.minus = P$2.sub = function (y) {
2362
+ P$3.minus = P$3.sub = function (y) {
2351
2363
  var i,
2352
2364
  j,
2353
2365
  t,
@@ -2449,14 +2461,14 @@
2449
2461
  /*
2450
2462
  * Return a new Big whose value is the value of this Big modulo the value of Big y.
2451
2463
  */
2452
- P$2.mod = function (y) {
2464
+ P$3.mod = function (y) {
2453
2465
  var ygtx,
2454
2466
  x = this,
2455
2467
  Big = x.constructor,
2456
2468
  a = x.s,
2457
2469
  b = (y = new Big(y)).s;
2458
2470
  if (!y.c[0]) {
2459
- throw Error(DIV_BY_ZERO);
2471
+ throw Error(DIV_BY_ZERO$1);
2460
2472
  }
2461
2473
  x.s = y.s = 1;
2462
2474
  ygtx = y.cmp(x) == 1;
@@ -2475,7 +2487,7 @@
2475
2487
  /*
2476
2488
  * Return a new Big whose value is the value of this Big negated.
2477
2489
  */
2478
- P$2.neg = function () {
2490
+ P$3.neg = function () {
2479
2491
  var x = new this.constructor(this);
2480
2492
  x.s = -x.s;
2481
2493
  return x;
@@ -2484,7 +2496,7 @@
2484
2496
  /*
2485
2497
  * Return a new Big whose value is the value of this Big plus the value of Big y.
2486
2498
  */
2487
- P$2.plus = P$2.add = function (y) {
2499
+ P$3.plus = P$3.add = function (y) {
2488
2500
  var e,
2489
2501
  k,
2490
2502
  t,
@@ -2562,13 +2574,13 @@
2562
2574
  *
2563
2575
  * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
2564
2576
  */
2565
- P$2.pow = function (n) {
2577
+ P$3.pow = function (n) {
2566
2578
  var x = this,
2567
2579
  one = new x.constructor('1'),
2568
2580
  y = one,
2569
2581
  isneg = n < 0;
2570
- if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
2571
- throw Error(INVALID$3 + 'exponent');
2582
+ if (n !== ~~n || n < -MAX_POWER$1 || n > MAX_POWER$1) {
2583
+ throw Error(INVALID$4 + 'exponent');
2572
2584
  }
2573
2585
  if (isneg) n = -n;
2574
2586
  for (;;) {
@@ -2587,11 +2599,11 @@
2587
2599
  * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
2588
2600
  * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
2589
2601
  */
2590
- P$2.prec = function (sd, rm) {
2591
- if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
2592
- throw Error(INVALID$3 + 'precision');
2602
+ P$3.prec = function (sd, rm) {
2603
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
2604
+ throw Error(INVALID$4 + 'precision');
2593
2605
  }
2594
- return round(new this.constructor(this), sd, rm);
2606
+ return round$1(new this.constructor(this), sd, rm);
2595
2607
  };
2596
2608
 
2597
2609
  /*
@@ -2603,18 +2615,18 @@
2603
2615
  * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
2604
2616
  * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
2605
2617
  */
2606
- P$2.round = function (dp, rm) {
2607
- if (dp === UNDEFINED) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
2608
- throw Error(INVALID_DP);
2618
+ P$3.round = function (dp, rm) {
2619
+ if (dp === UNDEFINED$1) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP$1 || dp > MAX_DP$1) {
2620
+ throw Error(INVALID_DP$1);
2609
2621
  }
2610
- return round(new this.constructor(this), dp + this.e + 1, rm);
2622
+ return round$1(new this.constructor(this), dp + this.e + 1, rm);
2611
2623
  };
2612
2624
 
2613
2625
  /*
2614
2626
  * Return a new Big whose value is the square root of the value of this Big, rounded, if
2615
2627
  * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
2616
2628
  */
2617
- P$2.sqrt = function () {
2629
+ P$3.sqrt = function () {
2618
2630
  var r,
2619
2631
  c,
2620
2632
  t,
@@ -2629,11 +2641,11 @@
2629
2641
 
2630
2642
  // Negative?
2631
2643
  if (s < 0) {
2632
- throw Error(NAME + 'No square root');
2644
+ throw Error(NAME$1 + 'No square root');
2633
2645
  }
2634
2646
 
2635
2647
  // Estimate.
2636
- s = Math.sqrt(+stringify(x, true, true));
2648
+ s = Math.sqrt(+stringify$1(x, true, true));
2637
2649
 
2638
2650
  // Math.sqrt underflow/overflow?
2639
2651
  // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
@@ -2653,13 +2665,13 @@
2653
2665
  t = r;
2654
2666
  r = half.times(t.plus(x.div(t)));
2655
2667
  } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
2656
- return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
2668
+ return round$1(r, (Big.DP -= 4) + r.e + 1, Big.RM);
2657
2669
  };
2658
2670
 
2659
2671
  /*
2660
2672
  * Return a new Big whose value is the value of this Big times the value of Big y.
2661
2673
  */
2662
- P$2.times = P$2.mul = function (y) {
2674
+ P$3.times = P$3.mul = function (y) {
2663
2675
  var c,
2664
2676
  x = this,
2665
2677
  Big = x.constructor,
@@ -2729,17 +2741,17 @@
2729
2741
  * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
2730
2742
  * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
2731
2743
  */
2732
- P$2.toExponential = function (dp, rm) {
2744
+ P$3.toExponential = function (dp, rm) {
2733
2745
  var x = this,
2734
2746
  n = x.c[0];
2735
- if (dp !== UNDEFINED) {
2736
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
2737
- throw Error(INVALID_DP);
2747
+ if (dp !== UNDEFINED$1) {
2748
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
2749
+ throw Error(INVALID_DP$1);
2738
2750
  }
2739
- x = round(new x.constructor(x), ++dp, rm);
2751
+ x = round$1(new x.constructor(x), ++dp, rm);
2740
2752
  for (; x.c.length < dp;) x.c.push(0);
2741
2753
  }
2742
- return stringify(x, true, !!n);
2754
+ return stringify$1(x, true, !!n);
2743
2755
  };
2744
2756
 
2745
2757
  /*
@@ -2752,19 +2764,19 @@
2752
2764
  * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
2753
2765
  * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
2754
2766
  */
2755
- P$2.toFixed = function (dp, rm) {
2767
+ P$3.toFixed = function (dp, rm) {
2756
2768
  var x = this,
2757
2769
  n = x.c[0];
2758
- if (dp !== UNDEFINED) {
2759
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
2760
- throw Error(INVALID_DP);
2770
+ if (dp !== UNDEFINED$1) {
2771
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
2772
+ throw Error(INVALID_DP$1);
2761
2773
  }
2762
- x = round(new x.constructor(x), dp + x.e + 1, rm);
2774
+ x = round$1(new x.constructor(x), dp + x.e + 1, rm);
2763
2775
 
2764
2776
  // x.e may have changed if the value is rounded up.
2765
2777
  for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
2766
2778
  }
2767
- return stringify(x, false, !!n);
2779
+ return stringify$1(x, false, !!n);
2768
2780
  };
2769
2781
 
2770
2782
  /*
@@ -2773,22 +2785,22 @@
2773
2785
  * Big.PE, or a negative exponent equal to or less than Big.NE.
2774
2786
  * Omit the sign for negative zero.
2775
2787
  */
2776
- P$2.toJSON = P$2.toString = function () {
2788
+ P$3.toJSON = P$3.toString = function () {
2777
2789
  var x = this,
2778
2790
  Big = x.constructor;
2779
- return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
2791
+ return stringify$1(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
2780
2792
  };
2781
2793
  if (typeof Symbol !== "undefined") {
2782
- P$2[Symbol.for('nodejs.util.inspect.custom')] = P$2.toJSON;
2794
+ P$3[Symbol.for('nodejs.util.inspect.custom')] = P$3.toJSON;
2783
2795
  }
2784
2796
 
2785
2797
  /*
2786
2798
  * Return the value of this Big as a primitive number.
2787
2799
  */
2788
- P$2.toNumber = function () {
2789
- var n = +stringify(this, true, true);
2800
+ P$3.toNumber = function () {
2801
+ var n = +stringify$1(this, true, true);
2790
2802
  if (this.constructor.strict === true && !this.eq(n.toString())) {
2791
- throw Error(NAME + 'Imprecise conversion');
2803
+ throw Error(NAME$1 + 'Imprecise conversion');
2792
2804
  }
2793
2805
  return n;
2794
2806
  };
@@ -2802,18 +2814,18 @@
2802
2814
  * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
2803
2815
  * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
2804
2816
  */
2805
- P$2.toPrecision = function (sd, rm) {
2817
+ P$3.toPrecision = function (sd, rm) {
2806
2818
  var x = this,
2807
2819
  Big = x.constructor,
2808
2820
  n = x.c[0];
2809
- if (sd !== UNDEFINED) {
2810
- if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
2811
- throw Error(INVALID$3 + 'precision');
2821
+ if (sd !== UNDEFINED$1) {
2822
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
2823
+ throw Error(INVALID$4 + 'precision');
2812
2824
  }
2813
- x = round(new Big(x), sd, rm);
2825
+ x = round$1(new Big(x), sd, rm);
2814
2826
  for (; x.c.length < sd;) x.c.push(0);
2815
2827
  }
2816
- return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
2828
+ return stringify$1(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
2817
2829
  };
2818
2830
 
2819
2831
  /*
@@ -2822,18 +2834,18 @@
2822
2834
  * Big.PE, or a negative exponent equal to or less than Big.NE.
2823
2835
  * Include the sign for negative zero.
2824
2836
  */
2825
- P$2.valueOf = function () {
2837
+ P$3.valueOf = function () {
2826
2838
  var x = this,
2827
2839
  Big = x.constructor;
2828
2840
  if (Big.strict === true) {
2829
- throw Error(NAME + 'valueOf disallowed');
2841
+ throw Error(NAME$1 + 'valueOf disallowed');
2830
2842
  }
2831
- return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
2843
+ return stringify$1(x, x.e <= Big.NE || x.e >= Big.PE, true);
2832
2844
  };
2833
2845
 
2834
2846
  // Export
2835
2847
 
2836
- var Big = _Big_();
2848
+ var Big$1 = _Big_$1();
2837
2849
 
2838
2850
  var f = 0;
2839
2851
  function u(e, t, n, o, i, u) {
@@ -8503,7 +8515,7 @@
8503
8515
  }, zone || mergedZone, next];
8504
8516
  }, [{}, null, 1]).slice(0, 2);
8505
8517
  }
8506
- function parse(s, ...patterns) {
8518
+ function parse$1(s, ...patterns) {
8507
8519
  if (s == null) {
8508
8520
  return [null, null];
8509
8521
  }
@@ -8674,26 +8686,26 @@
8674
8686
  */
8675
8687
 
8676
8688
  function parseISODate(s) {
8677
- return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
8689
+ return parse$1(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
8678
8690
  }
8679
8691
  function parseRFC2822Date(s) {
8680
- return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
8692
+ return parse$1(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
8681
8693
  }
8682
8694
  function parseHTTPDate(s) {
8683
- return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
8695
+ return parse$1(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
8684
8696
  }
8685
8697
  function parseISODuration(s) {
8686
- return parse(s, [isoDuration, extractISODuration]);
8698
+ return parse$1(s, [isoDuration, extractISODuration]);
8687
8699
  }
8688
8700
  const extractISOTimeOnly = combineExtractors(extractISOTime);
8689
8701
  function parseISOTimeOnly(s) {
8690
- return parse(s, [isoTimeOnly, extractISOTimeOnly]);
8702
+ return parse$1(s, [isoTimeOnly, extractISOTimeOnly]);
8691
8703
  }
8692
8704
  const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
8693
8705
  const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
8694
8706
  const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
8695
8707
  function parseSQL(s) {
8696
- return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
8708
+ return parse$1(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
8697
8709
  }
8698
8710
  const INVALID$2 = "Invalid Duration";
8699
8711
 
@@ -11093,7 +11105,7 @@
11093
11105
  const resolvedOpts = df.resolvedOptions();
11094
11106
  return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts));
11095
11107
  }
11096
- const INVALID = "Invalid DateTime";
11108
+ const INVALID$3 = "Invalid DateTime";
11097
11109
  const MAX_DATE = 8.64e15;
11098
11110
  function unsupportedZone(zone) {
11099
11111
  return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
@@ -12805,7 +12817,7 @@
12805
12817
  * @return {string}
12806
12818
  */
12807
12819
  toFormat(fmt, opts = {}) {
12808
- return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
12820
+ return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$3;
12809
12821
  }
12810
12822
 
12811
12823
  /**
@@ -12828,7 +12840,7 @@
12828
12840
  * @return {string}
12829
12841
  */
12830
12842
  toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
12831
- return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
12843
+ return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID$3;
12832
12844
  }
12833
12845
 
12834
12846
  /**
@@ -13036,7 +13048,7 @@
13036
13048
  * @return {string}
13037
13049
  */
13038
13050
  toString() {
13039
- return this.isValid ? this.toISO() : INVALID;
13051
+ return this.isValid ? this.toISO() : INVALID$3;
13040
13052
  }
13041
13053
 
13042
13054
  /**
@@ -15764,7 +15776,7 @@
15764
15776
  return W$1(n, t, e);
15765
15777
  }), n.__c && n.__c.__P === t && (n.__e && e.appendChild(n.__e), n.__c.__e = true, n.__c.__P = e)), n;
15766
15778
  }
15767
- function P$1() {
15779
+ function P$2() {
15768
15780
  this.__u = 0, this.o = null, this.__b = null;
15769
15781
  }
15770
15782
  function j$1(n) {
@@ -15777,7 +15789,7 @@
15777
15789
  l$2.unmount = function (n) {
15778
15790
  var t = n.__c;
15779
15791
  t && (t.__z = true), t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), U$1 && U$1(n);
15780
- }, (P$1.prototype = new C$2()).__c = function (n, t) {
15792
+ }, (P$2.prototype = new C$2()).__c = function (n, t) {
15781
15793
  var e = t.__c,
15782
15794
  r = this;
15783
15795
  null == r.o && (r.o = []), r.o.push(e);
@@ -15804,9 +15816,9 @@
15804
15816
  r.__u++ || 32 & t.__u || r.setState({
15805
15817
  __a: r.__b = r.__v.__k[0]
15806
15818
  }), n.then(i, i);
15807
- }, P$1.prototype.componentWillUnmount = function () {
15819
+ }, P$2.prototype.componentWillUnmount = function () {
15808
15820
  this.o = [];
15809
- }, P$1.prototype.render = function (n, e) {
15821
+ }, P$2.prototype.render = function (n, e) {
15810
15822
  if (this.__b) {
15811
15823
  if (this.__v.__k) {
15812
15824
  var r = document.createElement("div"),
@@ -28835,7 +28847,7 @@ ${e}</tr>
28835
28847
  return n;
28836
28848
  }
28837
28849
  };
28838
- var P = class {
28850
+ var P$1 = class P {
28839
28851
  options;
28840
28852
  block;
28841
28853
  constructor(e) {
@@ -28872,7 +28884,7 @@ ${e}</tr>
28872
28884
  TextRenderer = L$1;
28873
28885
  Lexer = x;
28874
28886
  Tokenizer = w;
28875
- Hooks = P;
28887
+ Hooks = P$1;
28876
28888
  constructor(...e) {
28877
28889
  this.use(...e);
28878
28890
  }
@@ -28958,15 +28970,15 @@ ${e}</tr>
28958
28970
  s.tokenizer = r;
28959
28971
  }
28960
28972
  if (n.hooks) {
28961
- let r = this.defaults.hooks || new P();
28973
+ let r = this.defaults.hooks || new P$1();
28962
28974
  for (let i in n.hooks) {
28963
28975
  if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
28964
28976
  if (["options", "block"].includes(i)) continue;
28965
28977
  let o = i,
28966
28978
  u = n.hooks[o],
28967
28979
  a = r[o];
28968
- P.passThroughHooks.has(i) ? r[o] = c => {
28969
- if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
28980
+ P$1.passThroughHooks.has(i) ? r[o] = c => {
28981
+ if (this.defaults.async && P$1.passThroughHooksRespectAsync.has(i)) return (async () => {
28970
28982
  let k = await u.call(r, c);
28971
28983
  return a.call(r, k);
28972
28984
  })();
@@ -29076,7 +29088,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
29076
29088
  g.Lexer = x;
29077
29089
  g.lexer = x.lex;
29078
29090
  g.Tokenizer = w;
29079
- g.Hooks = P;
29091
+ g.Hooks = P$1;
29080
29092
  g.parse = g;
29081
29093
  g.options;
29082
29094
  g.setOptions;
@@ -29739,7 +29751,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
29739
29751
  */
29740
29752
  function createFormContainer(prefix = 'fjs') {
29741
29753
  const container = document.createElement('div');
29742
- container.classList.add(`${prefix}-container`);
29754
+ container.classList.add(`${prefix}-container`, 'bio-theme-parent');
29743
29755
  return container;
29744
29756
  }
29745
29757
  function formFieldClasses(type, {
@@ -30307,7 +30319,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30307
30319
  function scopeSelector(selector, prefix) {
30308
30320
  return selector.split(',').map(sel => `${prefix} ${sel.trim()}`).join(', ');
30309
30321
  }
30310
- function getScrollContainer(el) {
30322
+ function getScrollContainer$1(el) {
30311
30323
  while (el && el !== document.body && el !== document.documentElement) {
30312
30324
  if (_isElementScrollable(el)) {
30313
30325
  return el;
@@ -30353,7 +30365,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30353
30365
  _flagRefs[i].current = false;
30354
30366
  }
30355
30367
  const itemToBeScrolled = scrolledElementRef.current;
30356
- const scrollContainer = getScrollContainer(itemToBeScrolled);
30368
+ const scrollContainer = getScrollContainer$1(itemToBeScrolled);
30357
30369
  if (!scrollContainer) {
30358
30370
  return;
30359
30371
  }
@@ -33092,7 +33104,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33092
33104
  })));
33093
33105
  };
33094
33106
  function countDecimals$1(number) {
33095
- const num = Big(number);
33107
+ const num = Big$1(number);
33096
33108
  if (num.toString() === num.toFixed(0)) return 0;
33097
33109
  return num.toFixed().split('.')[1].length || 0;
33098
33110
  }
@@ -33212,15 +33224,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33212
33224
 
33213
33225
  // caches the value an increment/decrement operation will be based on
33214
33226
  const incrementAmount = T$3(() => {
33215
- if (incrementValue) return Big(incrementValue);
33216
- if (decimalDigits) return Big(`1e-${decimalDigits}`);
33217
- return Big('1');
33227
+ if (incrementValue) return Big$1(incrementValue);
33228
+ if (decimalDigits) return Big$1(`1e-${decimalDigits}`);
33229
+ return Big$1('1');
33218
33230
  }, [decimalDigits, incrementValue]);
33219
33231
  const increment = () => {
33220
33232
  if (readonly) {
33221
33233
  return;
33222
33234
  }
33223
- const base = isValidNumber$1(cachedValue) ? Big(cachedValue) : Big(0);
33235
+ const base = isValidNumber$1(cachedValue) ? Big$1(cachedValue) : Big$1(0);
33224
33236
  const stepFlooredValue = base.minus(base.mod(incrementAmount));
33225
33237
 
33226
33238
  // note: toFixed() behaves differently in big.js
@@ -33230,7 +33242,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33230
33242
  if (readonly) {
33231
33243
  return;
33232
33244
  }
33233
- const base = isValidNumber$1(cachedValue) ? Big(cachedValue) : Big(0);
33245
+ const base = isValidNumber$1(cachedValue) ? Big$1(cachedValue) : Big$1(0);
33234
33246
  const offset = base.mod(incrementAmount);
33235
33247
  if (offset.cmp(0) === 0) {
33236
33248
  // if we're already on a valid step, decrement
@@ -35849,7 +35861,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35849
35861
  href: "https://bpmn.io",
35850
35862
  target: "_blank",
35851
35863
  rel: "noopener noreferrer",
35852
- style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
35864
+ style: "margin: 15px 20px 15px 10px; align-self: center; color: #404040",
35853
35865
  children: u(Logo, {})
35854
35866
  }), u("span", {
35855
35867
  children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', u("a", {
@@ -35872,7 +35884,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35872
35884
  rel: "noopener noreferrer",
35873
35885
  class: "fjs-powered-by-link",
35874
35886
  title: "Powered by bpmn.io",
35875
- style: "color: var(--cds-text-primary, #404040)",
35887
+ style: "color: #404040",
35876
35888
  onClick: props.onClick,
35877
35889
  children: u(Logo, {})
35878
35890
  })
@@ -37268,7 +37280,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37268
37280
  repeatRenderManager: ['type', RepeatRenderManager]
37269
37281
  };
37270
37282
  var FN_REF$1 = '__fn';
37271
- var DEFAULT_PRIORITY$5 = 1000;
37283
+ var DEFAULT_PRIORITY$6 = 1000;
37272
37284
  var slice$1 = Array.prototype.slice;
37273
37285
 
37274
37286
  /**
@@ -37436,7 +37448,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37436
37448
  if (isFunction(priority)) {
37437
37449
  that = callback;
37438
37450
  callback = priority;
37439
- priority = DEFAULT_PRIORITY$5;
37451
+ priority = DEFAULT_PRIORITY$6;
37440
37452
  }
37441
37453
  if (!isNumber$2(priority)) {
37442
37454
  throw new Error('priority must be a number');
@@ -37487,7 +37499,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37487
37499
  if (isFunction(priority)) {
37488
37500
  that = callback;
37489
37501
  callback = priority;
37490
- priority = DEFAULT_PRIORITY$5;
37502
+ priority = DEFAULT_PRIORITY$6;
37491
37503
  }
37492
37504
  if (!isNumber$2(priority)) {
37493
37505
  throw new Error('priority must be a number');
@@ -37898,8 +37910,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37898
37910
  }
37899
37911
  }
37900
37912
  if (increment) {
37901
- const bigValue = Big(value);
37902
- const bigIncrement = Big(increment);
37913
+ const bigValue = Big$1(value);
37914
+ const bigIncrement = Big$1(increment);
37903
37915
  const offset = bigValue.mod(bigIncrement);
37904
37916
  if (offset.cmp(0) !== 0) {
37905
37917
  const previousValue = bigValue.minus(offset);
@@ -37932,7 +37944,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37932
37944
  // stringify: `translate` falls back to the raw placeholder for a falsy replacement, so 0 must not be passed as a number
37933
37945
  if ('min' in validation && (value || value === 0)) {
37934
37946
  try {
37935
- if (Big(value).lt(Big(validation.min))) {
37947
+ if (Big$1(value).lt(Big$1(validation.min))) {
37936
37948
  errors.push(translate('Field must have minimum value of {value}.', {
37937
37949
  value: validation.min.toString()
37938
37950
  }));
@@ -37943,7 +37955,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37943
37955
  }
37944
37956
  if ('max' in validation && (value || value === 0)) {
37945
37957
  try {
37946
- if (Big(value).gt(Big(validation.max))) {
37958
+ if (Big$1(value).gt(Big$1(validation.max))) {
37947
37959
  errors.push(translate('Field must have maximum value of {value}.', {
37948
37960
  value: validation.max.toString()
37949
37961
  }));
@@ -76402,301 +76414,1236 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76402
76414
  }
76403
76415
  }
76404
76416
 
76405
- /**
76406
- * @typedef { {
76407
- * [key: string]: string;
76408
- * } } TranslateReplacements
76417
+ /*
76418
+ * big.js v7.0.1
76419
+ * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
76420
+ * Copyright (c) 2025 Michael Mclaughlin
76421
+ * https://github.com/MikeMcl/big.js/LICENCE.md
76409
76422
  */
76410
76423
 
76411
- /**
76412
- * A simple translation stub to be used for multi-language support
76413
- * in diagrams. Can be easily replaced with a more sophisticated
76414
- * solution.
76415
- *
76416
- * @example
76417
- *
76418
- * ```javascript
76419
- * // use it inside any diagram component by injecting `translate`.
76420
- *
76421
- * function MyService(translate) {
76422
- * alert(translate('HELLO {you}', { you: 'You!' }));
76423
- * }
76424
- * ```
76425
- *
76426
- * @param {string} template to interpolate
76427
- * @param {TranslateReplacements} [replacements] a map with substitutes
76428
- *
76429
- * @return {string} the translated string
76430
- */
76431
- function translate(template, replacements) {
76432
- replacements = replacements || {};
76433
- return template.replace(/{([^}]+)}/g, function (_, key) {
76434
- return replacements[key] || '{' + key + '}';
76435
- });
76436
- }
76424
+ /************************************** EDITABLE DEFAULTS *****************************************/
76437
76425
 
76438
- /**
76439
- * @type { import('didi').ModuleDeclaration }
76440
- */
76441
- var TranslateModule = {
76442
- translate: ['value', translate]
76443
- };
76444
- var FN_REF = '__fn';
76445
- var DEFAULT_PRIORITY$4 = 1000;
76446
- var slice = Array.prototype.slice;
76426
+ // The default values below must be integers within the stated ranges.
76447
76427
 
76448
- /**
76449
- * @typedef { {
76450
- * stopPropagation(): void;
76451
- * preventDefault(): void;
76452
- * cancelBubble: boolean;
76453
- * defaultPrevented: boolean;
76454
- * returnValue: any;
76455
- * } } Event
76428
+ /*
76429
+ * The maximum number of decimal places (DP) of the results of operations involving division:
76430
+ * div and sqrt, and pow with negative exponents.
76456
76431
  */
76432
+ var DP = 20,
76433
+ // 0 to MAX_DP
76457
76434
 
76458
- /**
76459
- * @template E
76460
- *
76461
- * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
76462
- */
76435
+ /*
76436
+ * The rounding mode (RM) used when rounding to the above decimal places.
76437
+ *
76438
+ * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
76439
+ * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
76440
+ * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
76441
+ * 3 Away from zero. (ROUND_UP)
76442
+ */
76443
+ RM = 1,
76444
+ // 0, 1, 2 or 3
76463
76445
 
76464
- /**
76465
- * @typedef { {
76466
- * priority: number;
76467
- * next: EventBusListener | null;
76468
- * callback: EventBusEventCallback<any>;
76469
- * } } EventBusListener
76470
- */
76446
+ // The maximum value of DP and Big.DP.
76447
+ MAX_DP = 1E6,
76448
+ // 0 to 1000000
76471
76449
 
76472
- /**
76473
- * A general purpose event bus.
76474
- *
76475
- * This component is used to communicate across a diagram instance.
76476
- * Other parts of a diagram can use it to listen to and broadcast events.
76477
- *
76478
- *
76479
- * ## Registering for Events
76480
- *
76481
- * The event bus provides the {@link EventBus#on} and {@link EventBus#once}
76482
- * methods to register for events. {@link EventBus#off} can be used to
76483
- * remove event registrations. Listeners receive an instance of {@link Event}
76484
- * as the first argument. It allows them to hook into the event execution.
76485
- *
76486
- * ```javascript
76487
- *
76488
- * // listen for event
76489
- * eventBus.on('foo', function(event) {
76490
- *
76491
- * // access event type
76492
- * event.type; // 'foo'
76493
- *
76494
- * // stop propagation to other listeners
76495
- * event.stopPropagation();
76496
- *
76497
- * // prevent event default
76498
- * event.preventDefault();
76499
- * });
76500
- *
76501
- * // listen for event with custom payload
76502
- * eventBus.on('bar', function(event, payload) {
76503
- * console.log(payload);
76504
- * });
76505
- *
76506
- * // listen for event returning value
76507
- * eventBus.on('foobar', function(event) {
76508
- *
76509
- * // stop event propagation + prevent default
76510
- * return false;
76511
- *
76512
- * // stop event propagation + return custom result
76513
- * return {
76514
- * complex: 'listening result'
76515
- * };
76516
- * });
76517
- *
76518
- *
76519
- * // listen with custom priority (default=1000, higher is better)
76520
- * eventBus.on('priorityfoo', 1500, function(event) {
76521
- * console.log('invoked first!');
76522
- * });
76523
- *
76524
- *
76525
- * // listen for event and pass the context (`this`)
76526
- * eventBus.on('foobar', function(event) {
76527
- * this.foo();
76528
- * }, this);
76529
- * ```
76530
- *
76531
- *
76532
- * ## Emitting Events
76533
- *
76534
- * Events can be emitted via the event bus using {@link EventBus#fire}.
76535
- *
76536
- * ```javascript
76537
- *
76538
- * // false indicates that the default action
76539
- * // was prevented by listeners
76540
- * if (eventBus.fire('foo') === false) {
76541
- * console.log('default has been prevented!');
76542
- * };
76543
- *
76544
- *
76545
- * // custom args + return value listener
76546
- * eventBus.on('sum', function(event, a, b) {
76547
- * return a + b;
76548
- * });
76549
- *
76550
- * // you can pass custom arguments + retrieve result values.
76551
- * var sum = eventBus.fire('sum', 1, 2);
76552
- * console.log(sum); // 3
76553
- * ```
76554
- *
76555
- * @template [EventMap=null]
76450
+ // The maximum magnitude of the exponent argument to the pow method.
76451
+ MAX_POWER = 1E6,
76452
+ // 1 to 1000000
76453
+
76454
+ /*
76455
+ * The negative exponent (NE) at and beneath which toString returns exponential notation.
76456
+ * (JavaScript numbers: -7)
76457
+ * -1000000 is the minimum recommended exponent value of a Big.
76458
+ */
76459
+ NE = -7,
76460
+ // 0 to -1000000
76461
+
76462
+ /*
76463
+ * The positive exponent (PE) at and above which toString returns exponential notation.
76464
+ * (JavaScript numbers: 21)
76465
+ * 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
76466
+ */
76467
+ PE = 21,
76468
+ // 0 to 1000000
76469
+
76470
+ /*
76471
+ * When true, an error will be thrown if a primitive number is passed to the Big constructor,
76472
+ * or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
76473
+ * primitive number without a loss of precision.
76474
+ */
76475
+ STRICT = false,
76476
+ // true or false
76477
+
76478
+ /**************************************************************************************************/
76479
+
76480
+ // Error messages.
76481
+ NAME = '[big.js] ',
76482
+ INVALID = NAME + 'Invalid ',
76483
+ INVALID_DP = INVALID + 'decimal places',
76484
+ INVALID_RM = INVALID + 'rounding mode',
76485
+ DIV_BY_ZERO = NAME + 'Division by zero',
76486
+ // The shared prototype object.
76487
+ P = {},
76488
+ UNDEFINED = void 0,
76489
+ NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
76490
+
76491
+ /*
76492
+ * Create and return a Big constructor.
76556
76493
  */
76557
- function EventBus() {
76558
- /**
76559
- * @type { Record<string, EventBusListener> }
76494
+ function _Big_() {
76495
+ /*
76496
+ * The Big constructor and exported function.
76497
+ * Create and return a new instance of a Big number object.
76498
+ *
76499
+ * n {number|string|Big} A numeric value.
76560
76500
  */
76561
- this._listeners = {};
76501
+ function Big(n) {
76502
+ var x = this;
76562
76503
 
76563
- // cleanup on destroy on lowest priority to allow
76564
- // message passing until the bitter end
76565
- this.on('diagram.destroy', 1, this._destroy, this);
76504
+ // Enable constructor usage without new.
76505
+ if (!(x instanceof Big)) {
76506
+ return n === UNDEFINED && arguments.length === 0 ? _Big_() : new Big(n);
76507
+ }
76508
+
76509
+ // Duplicate.
76510
+ if (n instanceof Big) {
76511
+ x.s = n.s;
76512
+ x.e = n.e;
76513
+ x.c = n.c.slice();
76514
+ } else {
76515
+ if (typeof n !== 'string') {
76516
+ if (Big.strict === true && typeof n !== 'bigint') {
76517
+ throw TypeError(INVALID + 'value');
76518
+ }
76519
+
76520
+ // Minus zero?
76521
+ n = n === 0 && 1 / n < 0 ? '-0' : String(n);
76522
+ }
76523
+ parse(x, n);
76524
+ }
76525
+
76526
+ // Retain a reference to this Big constructor.
76527
+ // Shadow Big.prototype.constructor which points to Object.
76528
+ x.constructor = Big;
76529
+ }
76530
+ Big.prototype = P;
76531
+ Big.DP = DP;
76532
+ Big.RM = RM;
76533
+ Big.NE = NE;
76534
+ Big.PE = PE;
76535
+ Big.strict = STRICT;
76536
+ Big.roundDown = 0;
76537
+ Big.roundHalfUp = 1;
76538
+ Big.roundHalfEven = 2;
76539
+ Big.roundUp = 3;
76540
+ return Big;
76566
76541
  }
76567
76542
 
76568
- /**
76569
- * @overlord
76570
- *
76571
- * Register an event listener for events with the given name.
76572
- *
76573
- * The callback will be invoked with `event, ...additionalArguments`
76574
- * that have been passed to {@link EventBus#fire}.
76575
- *
76576
- * Returning false from a listener will prevent the events default action
76577
- * (if any is specified). To stop an event from being processed further in
76578
- * other listeners execute {@link Event#stopPropagation}.
76579
- *
76580
- * Returning anything but `undefined` from a listener will stop the listener propagation.
76581
- *
76582
- * @template {keyof EventMap} EventName
76583
- *
76584
- * @param {EventName} events to subscribe to
76585
- * @param {number} [priority=1000] listen priority
76586
- * @param {EventBusEventCallback<EventMap[EventName]>} callback
76587
- * @param {any} [that] callback context
76588
- */
76589
- /**
76590
- * Register an event listener for events with the given name.
76591
- *
76592
- * The callback will be invoked with `event, ...additionalArguments`
76593
- * that have been passed to {@link EventBus#fire}.
76594
- *
76595
- * Returning false from a listener will prevent the events default action
76596
- * (if any is specified). To stop an event from being processed further in
76597
- * other listeners execute {@link Event#stopPropagation}.
76598
- *
76599
- * Returning anything but `undefined` from a listener will stop the listener propagation.
76600
- *
76601
- * @template T
76602
- *
76603
- * @param {string|string[]} events to subscribe to
76604
- * @param {number} [priority=1000] listen priority
76605
- * @param {EventBusEventCallback<T>} callback
76606
- * @param {any} [that] callback context
76543
+ /*
76544
+ * Parse the number or string value passed to a Big constructor.
76545
+ *
76546
+ * x {Big} A Big number instance.
76547
+ * n {number|string} A numeric value.
76607
76548
  */
76608
- EventBus.prototype.on = function (events, priority, callback, that) {
76609
- events = isArray$2(events) ? events : [events];
76610
- if (isFunction(priority)) {
76611
- that = callback;
76612
- callback = priority;
76613
- priority = DEFAULT_PRIORITY$4;
76549
+ function parse(x, n) {
76550
+ var e, i, nl;
76551
+ if (!NUMERIC.test(n)) {
76552
+ throw Error(INVALID + 'number');
76614
76553
  }
76615
- if (!isNumber$2(priority)) {
76616
- throw new Error('priority must be a number');
76554
+
76555
+ // Determine sign.
76556
+ x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
76557
+
76558
+ // Decimal point?
76559
+ if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
76560
+
76561
+ // Exponential form?
76562
+ if ((i = n.search(/e/i)) > 0) {
76563
+ // Determine exponent.
76564
+ if (e < 0) e = i;
76565
+ e += +n.slice(i + 1);
76566
+ n = n.substring(0, i);
76567
+ } else if (e < 0) {
76568
+ // Integer.
76569
+ e = n.length;
76617
76570
  }
76618
- var actualCallback = callback;
76619
- if (that) {
76620
- actualCallback = bind(callback, that);
76571
+ nl = n.length;
76621
76572
 
76622
- // make sure we remember and are able to remove
76623
- // bound callbacks via {@link #off} using the original
76624
- // callback
76625
- actualCallback[FN_REF] = callback[FN_REF] || callback;
76573
+ // Determine leading zeros.
76574
+ for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
76575
+ if (i == nl) {
76576
+ // Zero.
76577
+ x.c = [x.e = 0];
76578
+ } else {
76579
+ // Determine trailing zeros.
76580
+ for (; nl > 0 && n.charAt(--nl) == '0';);
76581
+ x.e = e - i - 1;
76582
+ x.c = [];
76583
+
76584
+ // Convert string to array of digits without leading/trailing zeros.
76585
+ for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
76626
76586
  }
76627
- var self = this;
76628
- events.forEach(function (e) {
76629
- self._addListener(e, {
76630
- priority: priority,
76631
- callback: actualCallback,
76632
- next: null
76633
- });
76634
- });
76635
- };
76587
+ return x;
76588
+ }
76636
76589
 
76637
- /**
76638
- * @overlord
76639
- *
76640
- * Register an event listener that is called only once.
76641
- *
76642
- * @template {keyof EventMap} EventName
76643
- *
76644
- * @param {EventName} events to subscribe to
76645
- * @param {number} [priority=1000] listen priority
76646
- * @param {EventBusEventCallback<EventMap[EventName]>} callback
76647
- * @param {any} [that] callback context
76648
- */
76649
- /**
76650
- * Register an event listener that is called only once.
76651
- *
76652
- * @template T
76653
- *
76654
- * @param {string|string[]} events to subscribe to
76655
- * @param {number} [priority=1000] the listen priority
76656
- * @param {EventBusEventCallback<T>} callback
76657
- * @param {any} [that] callback context
76590
+ /*
76591
+ * Round Big x to a maximum of sd significant digits using rounding mode rm.
76592
+ *
76593
+ * x {Big} The Big to round.
76594
+ * sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
76595
+ * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
76596
+ * [more] {boolean} Whether the result of division was truncated.
76658
76597
  */
76659
- EventBus.prototype.once = function (events, priority, callback, that) {
76660
- var self = this;
76661
- if (isFunction(priority)) {
76662
- that = callback;
76663
- callback = priority;
76664
- priority = DEFAULT_PRIORITY$4;
76665
- }
76666
- if (!isNumber$2(priority)) {
76667
- throw new Error('priority must be a number');
76668
- }
76669
- function wrappedCallback() {
76670
- wrappedCallback.__isTomb = true;
76671
- var result = callback.apply(that, arguments);
76672
- self.off(events, wrappedCallback);
76673
- return result;
76598
+ function round(x, sd, rm, more) {
76599
+ var xc = x.c;
76600
+ if (rm === UNDEFINED) rm = x.constructor.RM;
76601
+ if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
76602
+ throw Error(INVALID_RM);
76674
76603
  }
76604
+ if (sd < 1) {
76605
+ more = rm === 3 && (more || !!xc[0]) || sd === 0 && (rm === 1 && xc[0] >= 5 || rm === 2 && (xc[0] > 5 || xc[0] === 5 && (more || xc[1] !== UNDEFINED)));
76606
+ xc.length = 1;
76607
+ if (more) {
76608
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
76609
+ x.e = x.e - sd + 1;
76610
+ xc[0] = 1;
76611
+ } else {
76612
+ // Zero.
76613
+ xc[0] = x.e = 0;
76614
+ }
76615
+ } else if (sd < xc.length) {
76616
+ // xc[sd] is the digit after the digit that may be rounded up.
76617
+ more = rm === 1 && xc[sd] >= 5 || rm === 2 && (xc[sd] > 5 || xc[sd] === 5 && (more || xc[sd + 1] !== UNDEFINED || xc[sd - 1] & 1)) || rm === 3 && (more || !!xc[0]);
76675
76618
 
76676
- // make sure we remember and are able to remove
76677
- // bound callbacks via {@link #off} using the original
76678
- // callback
76679
- wrappedCallback[FN_REF] = callback;
76680
- this.on(events, priority, wrappedCallback);
76681
- };
76682
-
76683
- /**
76684
- * Removes event listeners by event and callback.
76685
- *
76686
- * If no callback is given, all listeners for a given event name are being removed.
76687
- *
76688
- * @param {string|string[]} events
76689
- * @param {EventBusEventCallback<unknown>} [callback]
76690
- */
76691
- EventBus.prototype.off = function (events, callback) {
76692
- events = isArray$2(events) ? events : [events];
76693
- var self = this;
76694
- events.forEach(function (event) {
76695
- self._removeListener(event, callback);
76696
- });
76697
- };
76619
+ // Remove any digits after the required precision.
76620
+ xc.length = sd;
76698
76621
 
76699
- /**
76622
+ // Round up?
76623
+ if (more) {
76624
+ // Rounding up may mean the previous digit has to be rounded up.
76625
+ for (; ++xc[--sd] > 9;) {
76626
+ xc[sd] = 0;
76627
+ if (sd === 0) {
76628
+ ++x.e;
76629
+ xc.unshift(1);
76630
+ break;
76631
+ }
76632
+ }
76633
+ }
76634
+
76635
+ // Remove trailing zeros.
76636
+ for (sd = xc.length; !xc[--sd];) xc.pop();
76637
+ }
76638
+ return x;
76639
+ }
76640
+
76641
+ /*
76642
+ * Return a string representing the value of Big x in normal or exponential notation.
76643
+ * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
76644
+ */
76645
+ function stringify(x, doExponential, isNonzero) {
76646
+ var e = x.e,
76647
+ s = x.c.join(''),
76648
+ n = s.length;
76649
+
76650
+ // Exponential notation?
76651
+ if (doExponential) {
76652
+ s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
76653
+
76654
+ // Normal notation.
76655
+ } else if (e < 0) {
76656
+ for (; ++e;) s = '0' + s;
76657
+ s = '0.' + s;
76658
+ } else if (e > 0) {
76659
+ if (++e > n) {
76660
+ for (e -= n; e--;) s += '0';
76661
+ } else if (e < n) {
76662
+ s = s.slice(0, e) + '.' + s.slice(e);
76663
+ }
76664
+ } else if (n > 1) {
76665
+ s = s.charAt(0) + '.' + s.slice(1);
76666
+ }
76667
+ return x.s < 0 && isNonzero ? '-' + s : s;
76668
+ }
76669
+
76670
+ // Prototype/instance methods
76671
+
76672
+ /*
76673
+ * Return a new Big whose value is the absolute value of this Big.
76674
+ */
76675
+ P.abs = function () {
76676
+ var x = new this.constructor(this);
76677
+ x.s = 1;
76678
+ return x;
76679
+ };
76680
+
76681
+ /*
76682
+ * Return 1 if the value of this Big is greater than the value of Big y,
76683
+ * -1 if the value of this Big is less than the value of Big y, or
76684
+ * 0 if they have the same value.
76685
+ */
76686
+ P.cmp = function (y) {
76687
+ var isneg,
76688
+ x = this,
76689
+ xc = x.c,
76690
+ yc = (y = new x.constructor(y)).c,
76691
+ i = x.s,
76692
+ j = y.s,
76693
+ k = x.e,
76694
+ l = y.e;
76695
+
76696
+ // Either zero?
76697
+ if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
76698
+
76699
+ // Signs differ?
76700
+ if (i != j) return i;
76701
+ isneg = i < 0;
76702
+
76703
+ // Compare exponents.
76704
+ if (k != l) return k > l ^ isneg ? 1 : -1;
76705
+ j = (k = xc.length) < (l = yc.length) ? k : l;
76706
+
76707
+ // Compare digit by digit.
76708
+ for (i = -1; ++i < j;) {
76709
+ if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
76710
+ }
76711
+
76712
+ // Compare lengths.
76713
+ return k == l ? 0 : k > l ^ isneg ? 1 : -1;
76714
+ };
76715
+
76716
+ /*
76717
+ * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
76718
+ * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
76719
+ */
76720
+ P.div = function (y) {
76721
+ var x = this,
76722
+ Big = x.constructor,
76723
+ a = x.c,
76724
+ // dividend
76725
+ b = (y = new Big(y)).c,
76726
+ // divisor
76727
+ k = x.s == y.s ? 1 : -1,
76728
+ dp = Big.DP;
76729
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
76730
+ throw Error(INVALID_DP);
76731
+ }
76732
+
76733
+ // Divisor is zero?
76734
+ if (!b[0]) {
76735
+ throw Error(DIV_BY_ZERO);
76736
+ }
76737
+
76738
+ // Dividend is 0? Return +-0.
76739
+ if (!a[0]) {
76740
+ y.s = k;
76741
+ y.c = [y.e = 0];
76742
+ return y;
76743
+ }
76744
+ var bl,
76745
+ bt,
76746
+ n,
76747
+ cmp,
76748
+ ri,
76749
+ bz = b.slice(),
76750
+ ai = bl = b.length,
76751
+ al = a.length,
76752
+ r = a.slice(0, bl),
76753
+ // remainder
76754
+ rl = r.length,
76755
+ q = y,
76756
+ // quotient
76757
+ qc = q.c = [],
76758
+ qi = 0,
76759
+ p = dp + (q.e = x.e - y.e) + 1; // precision of the result
76760
+
76761
+ q.s = k;
76762
+ k = p < 0 ? 0 : p;
76763
+
76764
+ // Create version of divisor with leading zero.
76765
+ bz.unshift(0);
76766
+
76767
+ // Add zeros to make remainder as long as divisor.
76768
+ for (; rl++ < bl;) r.push(0);
76769
+ do {
76770
+ // n is how many times the divisor goes into current remainder.
76771
+ for (n = 0; n < 10; n++) {
76772
+ // Compare divisor and remainder.
76773
+ if (bl != (rl = r.length)) {
76774
+ cmp = bl > rl ? 1 : -1;
76775
+ } else {
76776
+ for (ri = -1, cmp = 0; ++ri < bl;) {
76777
+ if (b[ri] != r[ri]) {
76778
+ cmp = b[ri] > r[ri] ? 1 : -1;
76779
+ break;
76780
+ }
76781
+ }
76782
+ }
76783
+
76784
+ // If divisor < remainder, subtract divisor from remainder.
76785
+ if (cmp < 0) {
76786
+ // Remainder can't be more than 1 digit longer than divisor.
76787
+ // Equalise lengths using divisor with extra leading zero?
76788
+ for (bt = rl == bl ? b : bz; rl;) {
76789
+ if (r[--rl] < bt[rl]) {
76790
+ ri = rl;
76791
+ for (; ri && !r[--ri];) r[ri] = 9;
76792
+ --r[ri];
76793
+ r[rl] += 10;
76794
+ }
76795
+ r[rl] -= bt[rl];
76796
+ }
76797
+ for (; !r[0];) r.shift();
76798
+ } else {
76799
+ break;
76800
+ }
76801
+ }
76802
+
76803
+ // Add the digit n to the result array.
76804
+ qc[qi++] = cmp ? n : ++n;
76805
+
76806
+ // Update the remainder.
76807
+ if (r[0] && cmp) r[rl] = a[ai] || 0;else r = [a[ai]];
76808
+ } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
76809
+
76810
+ // Leading zero? Do not remove if result is simply zero (qi == 1).
76811
+ if (!qc[0] && qi != 1) {
76812
+ // There can't be more than one zero.
76813
+ qc.shift();
76814
+ q.e--;
76815
+ p--;
76816
+ }
76817
+
76818
+ // Round?
76819
+ if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
76820
+ return q;
76821
+ };
76822
+
76823
+ /*
76824
+ * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
76825
+ */
76826
+ P.eq = function (y) {
76827
+ return this.cmp(y) === 0;
76828
+ };
76829
+
76830
+ /*
76831
+ * Return true if the value of this Big is greater than the value of Big y, otherwise return
76832
+ * false.
76833
+ */
76834
+ P.gt = function (y) {
76835
+ return this.cmp(y) > 0;
76836
+ };
76837
+
76838
+ /*
76839
+ * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
76840
+ * return false.
76841
+ */
76842
+ P.gte = function (y) {
76843
+ return this.cmp(y) > -1;
76844
+ };
76845
+
76846
+ /*
76847
+ * Return true if the value of this Big is less than the value of Big y, otherwise return false.
76848
+ */
76849
+ P.lt = function (y) {
76850
+ return this.cmp(y) < 0;
76851
+ };
76852
+
76853
+ /*
76854
+ * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
76855
+ * return false.
76856
+ */
76857
+ P.lte = function (y) {
76858
+ return this.cmp(y) < 1;
76859
+ };
76860
+
76861
+ /*
76862
+ * Return a new Big whose value is the value of this Big minus the value of Big y.
76863
+ */
76864
+ P.minus = P.sub = function (y) {
76865
+ var i,
76866
+ j,
76867
+ t,
76868
+ xlty,
76869
+ x = this,
76870
+ Big = x.constructor,
76871
+ a = x.s,
76872
+ b = (y = new Big(y)).s;
76873
+
76874
+ // Signs differ?
76875
+ if (a != b) {
76876
+ y.s = -b;
76877
+ return x.plus(y);
76878
+ }
76879
+ var xc = x.c.slice(),
76880
+ xe = x.e,
76881
+ yc = y.c,
76882
+ ye = y.e;
76883
+
76884
+ // Either zero?
76885
+ if (!xc[0] || !yc[0]) {
76886
+ if (yc[0]) {
76887
+ y.s = -b;
76888
+ } else if (xc[0]) {
76889
+ y = new Big(x);
76890
+ } else {
76891
+ y.s = 1;
76892
+ }
76893
+ return y;
76894
+ }
76895
+
76896
+ // Determine which is the bigger number. Prepend zeros to equalise exponents.
76897
+ if (a = xe - ye) {
76898
+ if (xlty = a < 0) {
76899
+ a = -a;
76900
+ t = xc;
76901
+ } else {
76902
+ ye = xe;
76903
+ t = yc;
76904
+ }
76905
+ t.reverse();
76906
+ for (b = a; b--;) t.push(0);
76907
+ t.reverse();
76908
+ } else {
76909
+ // Exponents equal. Check digit by digit.
76910
+ j = ((xlty = xc.length < yc.length) ? xc : yc).length;
76911
+ for (a = b = 0; b < j; b++) {
76912
+ if (xc[b] != yc[b]) {
76913
+ xlty = xc[b] < yc[b];
76914
+ break;
76915
+ }
76916
+ }
76917
+ }
76918
+
76919
+ // x < y? Point xc to the array of the bigger number.
76920
+ if (xlty) {
76921
+ t = xc;
76922
+ xc = yc;
76923
+ yc = t;
76924
+ y.s = -y.s;
76925
+ }
76926
+
76927
+ /*
76928
+ * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
76929
+ * needs to start at yc.length.
76930
+ */
76931
+ if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
76932
+
76933
+ // Subtract yc from xc.
76934
+ for (b = i; j > a;) {
76935
+ if (xc[--j] < yc[j]) {
76936
+ for (i = j; i && !xc[--i];) xc[i] = 9;
76937
+ --xc[i];
76938
+ xc[j] += 10;
76939
+ }
76940
+ xc[j] -= yc[j];
76941
+ }
76942
+
76943
+ // Remove trailing zeros.
76944
+ for (; xc[--b] === 0;) xc.pop();
76945
+
76946
+ // Remove leading zeros and adjust exponent accordingly.
76947
+ for (; xc[0] === 0;) {
76948
+ xc.shift();
76949
+ --ye;
76950
+ }
76951
+ if (!xc[0]) {
76952
+ // n - n = +0
76953
+ y.s = 1;
76954
+
76955
+ // Result must be zero.
76956
+ xc = [ye = 0];
76957
+ }
76958
+ y.c = xc;
76959
+ y.e = ye;
76960
+ return y;
76961
+ };
76962
+
76963
+ /*
76964
+ * Return a new Big whose value is the value of this Big modulo the value of Big y.
76965
+ */
76966
+ P.mod = function (y) {
76967
+ var ygtx,
76968
+ x = this,
76969
+ Big = x.constructor,
76970
+ a = x.s,
76971
+ b = (y = new Big(y)).s;
76972
+ if (!y.c[0]) {
76973
+ throw Error(DIV_BY_ZERO);
76974
+ }
76975
+ x.s = y.s = 1;
76976
+ ygtx = y.cmp(x) == 1;
76977
+ x.s = a;
76978
+ y.s = b;
76979
+ if (ygtx) return new Big(x);
76980
+ a = Big.DP;
76981
+ b = Big.RM;
76982
+ Big.DP = Big.RM = 0;
76983
+ x = x.div(y);
76984
+ Big.DP = a;
76985
+ Big.RM = b;
76986
+ return this.minus(x.times(y));
76987
+ };
76988
+
76989
+ /*
76990
+ * Return a new Big whose value is the value of this Big negated.
76991
+ */
76992
+ P.neg = function () {
76993
+ var x = new this.constructor(this);
76994
+ x.s = -x.s;
76995
+ return x;
76996
+ };
76997
+
76998
+ /*
76999
+ * Return a new Big whose value is the value of this Big plus the value of Big y.
77000
+ */
77001
+ P.plus = P.add = function (y) {
77002
+ var e,
77003
+ k,
77004
+ t,
77005
+ x = this,
77006
+ Big = x.constructor;
77007
+ y = new Big(y);
77008
+
77009
+ // Signs differ?
77010
+ if (x.s != y.s) {
77011
+ y.s = -y.s;
77012
+ return x.minus(y);
77013
+ }
77014
+ var xe = x.e,
77015
+ xc = x.c,
77016
+ ye = y.e,
77017
+ yc = y.c;
77018
+
77019
+ // Either zero?
77020
+ if (!xc[0] || !yc[0]) {
77021
+ if (!yc[0]) {
77022
+ if (xc[0]) {
77023
+ y = new Big(x);
77024
+ } else {
77025
+ y.s = x.s;
77026
+ }
77027
+ }
77028
+ return y;
77029
+ }
77030
+ xc = xc.slice();
77031
+
77032
+ // Prepend zeros to equalise exponents.
77033
+ // Note: reverse faster than unshifts.
77034
+ if (e = xe - ye) {
77035
+ if (e > 0) {
77036
+ ye = xe;
77037
+ t = yc;
77038
+ } else {
77039
+ e = -e;
77040
+ t = xc;
77041
+ }
77042
+ t.reverse();
77043
+ for (; e--;) t.push(0);
77044
+ t.reverse();
77045
+ }
77046
+
77047
+ // Point xc to the longer array.
77048
+ if (xc.length - yc.length < 0) {
77049
+ t = yc;
77050
+ yc = xc;
77051
+ xc = t;
77052
+ }
77053
+ e = yc.length;
77054
+
77055
+ // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
77056
+ for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
77057
+
77058
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
77059
+
77060
+ if (k) {
77061
+ xc.unshift(k);
77062
+ ++ye;
77063
+ }
77064
+
77065
+ // Remove trailing zeros.
77066
+ for (e = xc.length; xc[--e] === 0;) xc.pop();
77067
+ y.c = xc;
77068
+ y.e = ye;
77069
+ return y;
77070
+ };
77071
+
77072
+ /*
77073
+ * Return a Big whose value is the value of this Big raised to the power n.
77074
+ * If n is negative, round to a maximum of Big.DP decimal places using rounding
77075
+ * mode Big.RM.
77076
+ *
77077
+ * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
77078
+ */
77079
+ P.pow = function (n) {
77080
+ var x = this,
77081
+ one = new x.constructor('1'),
77082
+ y = one,
77083
+ isneg = n < 0;
77084
+ if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
77085
+ throw Error(INVALID + 'exponent');
77086
+ }
77087
+ if (isneg) n = -n;
77088
+ for (;;) {
77089
+ if (n & 1) y = y.times(x);
77090
+ n >>= 1;
77091
+ if (!n) break;
77092
+ x = x.times(x);
77093
+ }
77094
+ return isneg ? one.div(y) : y;
77095
+ };
77096
+
77097
+ /*
77098
+ * Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
77099
+ * significant digits using rounding mode rm, or Big.RM if rm is not specified.
77100
+ *
77101
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
77102
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
77103
+ */
77104
+ P.prec = function (sd, rm) {
77105
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
77106
+ throw Error(INVALID + 'precision');
77107
+ }
77108
+ return round(new this.constructor(this), sd, rm);
77109
+ };
77110
+
77111
+ /*
77112
+ * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
77113
+ * using rounding mode rm, or Big.RM if rm is not specified.
77114
+ * If dp is negative, round to an integer which is a multiple of 10**-dp.
77115
+ * If dp is not specified, round to 0 decimal places.
77116
+ *
77117
+ * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
77118
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
77119
+ */
77120
+ P.round = function (dp, rm) {
77121
+ if (dp === UNDEFINED) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
77122
+ throw Error(INVALID_DP);
77123
+ }
77124
+ return round(new this.constructor(this), dp + this.e + 1, rm);
77125
+ };
77126
+
77127
+ /*
77128
+ * Return a new Big whose value is the square root of the value of this Big, rounded, if
77129
+ * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
77130
+ */
77131
+ P.sqrt = function () {
77132
+ var r,
77133
+ c,
77134
+ t,
77135
+ x = this,
77136
+ Big = x.constructor,
77137
+ s = x.s,
77138
+ e = x.e,
77139
+ half = new Big('0.5');
77140
+
77141
+ // Zero?
77142
+ if (!x.c[0]) return new Big(x);
77143
+
77144
+ // Negative?
77145
+ if (s < 0) {
77146
+ throw Error(NAME + 'No square root');
77147
+ }
77148
+
77149
+ // Estimate.
77150
+ s = Math.sqrt(+stringify(x, true, true));
77151
+
77152
+ // Math.sqrt underflow/overflow?
77153
+ // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
77154
+ if (s === 0 || s === 1 / 0) {
77155
+ c = x.c.join('');
77156
+ if (!(c.length + e & 1)) c += '0';
77157
+ s = Math.sqrt(c);
77158
+ e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
77159
+ r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
77160
+ } else {
77161
+ r = new Big(s + '');
77162
+ }
77163
+ e = r.e + (Big.DP += 4);
77164
+
77165
+ // Newton-Raphson iteration.
77166
+ do {
77167
+ t = r;
77168
+ r = half.times(t.plus(x.div(t)));
77169
+ } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
77170
+ return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
77171
+ };
77172
+
77173
+ /*
77174
+ * Return a new Big whose value is the value of this Big times the value of Big y.
77175
+ */
77176
+ P.times = P.mul = function (y) {
77177
+ var c,
77178
+ x = this,
77179
+ Big = x.constructor,
77180
+ xc = x.c,
77181
+ yc = (y = new Big(y)).c,
77182
+ a = xc.length,
77183
+ b = yc.length,
77184
+ i = x.e,
77185
+ j = y.e;
77186
+
77187
+ // Determine sign of result.
77188
+ y.s = x.s == y.s ? 1 : -1;
77189
+
77190
+ // Return signed 0 if either 0.
77191
+ if (!xc[0] || !yc[0]) {
77192
+ y.c = [y.e = 0];
77193
+ return y;
77194
+ }
77195
+
77196
+ // Initialise exponent of result as x.e + y.e.
77197
+ y.e = i + j;
77198
+
77199
+ // If array xc has fewer digits than yc, swap xc and yc, and lengths.
77200
+ if (a < b) {
77201
+ c = xc;
77202
+ xc = yc;
77203
+ yc = c;
77204
+ j = a;
77205
+ a = b;
77206
+ b = j;
77207
+ }
77208
+
77209
+ // Initialise coefficient array of result with zeros.
77210
+ for (c = new Array(j = a + b); j--;) c[j] = 0;
77211
+
77212
+ // Multiply.
77213
+
77214
+ // i is initially xc.length.
77215
+ for (i = b; i--;) {
77216
+ b = 0;
77217
+
77218
+ // a is yc.length.
77219
+ for (j = a + i; j > i;) {
77220
+ // Current sum of products at this digit position, plus carry.
77221
+ b = c[j] + yc[i] * xc[j - i - 1] + b;
77222
+ c[j--] = b % 10;
77223
+
77224
+ // carry
77225
+ b = b / 10 | 0;
77226
+ }
77227
+ c[j] = b;
77228
+ }
77229
+
77230
+ // Increment result exponent if there is a final carry, otherwise remove leading zero.
77231
+ if (b) ++y.e;else c.shift();
77232
+
77233
+ // Remove trailing zeros.
77234
+ for (i = c.length; !c[--i];) c.pop();
77235
+ y.c = c;
77236
+ return y;
77237
+ };
77238
+
77239
+ /*
77240
+ * Return a string representing the value of this Big in exponential notation rounded to dp fixed
77241
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
77242
+ *
77243
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
77244
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
77245
+ */
77246
+ P.toExponential = function (dp, rm) {
77247
+ var x = this,
77248
+ n = x.c[0];
77249
+ if (dp !== UNDEFINED) {
77250
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
77251
+ throw Error(INVALID_DP);
77252
+ }
77253
+ x = round(new x.constructor(x), ++dp, rm);
77254
+ for (; x.c.length < dp;) x.c.push(0);
77255
+ }
77256
+ return stringify(x, true, !!n);
77257
+ };
77258
+
77259
+ /*
77260
+ * Return a string representing the value of this Big in normal notation rounded to dp fixed
77261
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
77262
+ *
77263
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
77264
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
77265
+ *
77266
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
77267
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
77268
+ */
77269
+ P.toFixed = function (dp, rm) {
77270
+ var x = this,
77271
+ n = x.c[0];
77272
+ if (dp !== UNDEFINED) {
77273
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
77274
+ throw Error(INVALID_DP);
77275
+ }
77276
+ x = round(new x.constructor(x), dp + x.e + 1, rm);
77277
+
77278
+ // x.e may have changed if the value is rounded up.
77279
+ for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
77280
+ }
77281
+ return stringify(x, false, !!n);
77282
+ };
77283
+
77284
+ /*
77285
+ * Return a string representing the value of this Big.
77286
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
77287
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
77288
+ * Omit the sign for negative zero.
77289
+ */
77290
+ P.toJSON = P.toString = function () {
77291
+ var x = this,
77292
+ Big = x.constructor;
77293
+ return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
77294
+ };
77295
+ if (typeof Symbol !== "undefined") {
77296
+ P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON;
77297
+ }
77298
+
77299
+ /*
77300
+ * Return the value of this Big as a primitive number.
77301
+ */
77302
+ P.toNumber = function () {
77303
+ var n = +stringify(this, true, true);
77304
+ if (this.constructor.strict === true && !this.eq(n.toString())) {
77305
+ throw Error(NAME + 'Imprecise conversion');
77306
+ }
77307
+ return n;
77308
+ };
77309
+
77310
+ /*
77311
+ * Return a string representing the value of this Big rounded to sd significant digits using
77312
+ * rounding mode rm, or Big.RM if rm is not specified.
77313
+ * Use exponential notation if sd is less than the number of digits necessary to represent
77314
+ * the integer part of the value in normal notation.
77315
+ *
77316
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
77317
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
77318
+ */
77319
+ P.toPrecision = function (sd, rm) {
77320
+ var x = this,
77321
+ Big = x.constructor,
77322
+ n = x.c[0];
77323
+ if (sd !== UNDEFINED) {
77324
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
77325
+ throw Error(INVALID + 'precision');
77326
+ }
77327
+ x = round(new Big(x), sd, rm);
77328
+ for (; x.c.length < sd;) x.c.push(0);
77329
+ }
77330
+ return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
77331
+ };
77332
+
77333
+ /*
77334
+ * Return a string representing the value of this Big.
77335
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
77336
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
77337
+ * Include the sign for negative zero.
77338
+ */
77339
+ P.valueOf = function () {
77340
+ var x = this,
77341
+ Big = x.constructor;
77342
+ if (Big.strict === true) {
77343
+ throw Error(NAME + 'valueOf disallowed');
77344
+ }
77345
+ return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
77346
+ };
77347
+
77348
+ // Export
77349
+
77350
+ var Big = _Big_();
77351
+
77352
+ /**
77353
+ * @typedef { {
77354
+ * [key: string]: string;
77355
+ * } } TranslateReplacements
77356
+ */
77357
+
77358
+ /**
77359
+ * A simple translation stub to be used for multi-language support
77360
+ * in diagrams. Can be easily replaced with a more sophisticated
77361
+ * solution.
77362
+ *
77363
+ * @example
77364
+ *
77365
+ * ```javascript
77366
+ * // use it inside any diagram component by injecting `translate`.
77367
+ *
77368
+ * function MyService(translate) {
77369
+ * alert(translate('HELLO {you}', { you: 'You!' }));
77370
+ * }
77371
+ * ```
77372
+ *
77373
+ * @param {string} template to interpolate
77374
+ * @param {TranslateReplacements} [replacements] a map with substitutes
77375
+ *
77376
+ * @return {string} the translated string
77377
+ */
77378
+ function translate(template, replacements) {
77379
+ replacements = replacements || {};
77380
+ return template.replace(/{([^}]+)}/g, function (_, key) {
77381
+ return replacements[key] || '{' + key + '}';
77382
+ });
77383
+ }
77384
+
77385
+ /**
77386
+ * @type { import('didi').ModuleDeclaration }
77387
+ */
77388
+ var TranslateModule = {
77389
+ translate: ['value', translate]
77390
+ };
77391
+ var FN_REF = '__fn';
77392
+ var DEFAULT_PRIORITY$5 = 1000;
77393
+ var slice = Array.prototype.slice;
77394
+
77395
+ /**
77396
+ * @typedef { {
77397
+ * stopPropagation(): void;
77398
+ * preventDefault(): void;
77399
+ * cancelBubble: boolean;
77400
+ * defaultPrevented: boolean;
77401
+ * returnValue: any;
77402
+ * } } Event
77403
+ */
77404
+
77405
+ /**
77406
+ * @template E
77407
+ *
77408
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
77409
+ */
77410
+
77411
+ /**
77412
+ * @typedef { {
77413
+ * priority: number;
77414
+ * next: EventBusListener | null;
77415
+ * callback: EventBusEventCallback<any>;
77416
+ * } } EventBusListener
77417
+ */
77418
+
77419
+ /**
77420
+ * A general purpose event bus.
77421
+ *
77422
+ * This component is used to communicate across a diagram instance.
77423
+ * Other parts of a diagram can use it to listen to and broadcast events.
77424
+ *
77425
+ *
77426
+ * ## Registering for Events
77427
+ *
77428
+ * The event bus provides the {@link EventBus#on} and {@link EventBus#once}
77429
+ * methods to register for events. {@link EventBus#off} can be used to
77430
+ * remove event registrations. Listeners receive an instance of {@link Event}
77431
+ * as the first argument. It allows them to hook into the event execution.
77432
+ *
77433
+ * ```javascript
77434
+ *
77435
+ * // listen for event
77436
+ * eventBus.on('foo', function(event) {
77437
+ *
77438
+ * // access event type
77439
+ * event.type; // 'foo'
77440
+ *
77441
+ * // stop propagation to other listeners
77442
+ * event.stopPropagation();
77443
+ *
77444
+ * // prevent event default
77445
+ * event.preventDefault();
77446
+ * });
77447
+ *
77448
+ * // listen for event with custom payload
77449
+ * eventBus.on('bar', function(event, payload) {
77450
+ * console.log(payload);
77451
+ * });
77452
+ *
77453
+ * // listen for event returning value
77454
+ * eventBus.on('foobar', function(event) {
77455
+ *
77456
+ * // stop event propagation + prevent default
77457
+ * return false;
77458
+ *
77459
+ * // stop event propagation + return custom result
77460
+ * return {
77461
+ * complex: 'listening result'
77462
+ * };
77463
+ * });
77464
+ *
77465
+ *
77466
+ * // listen with custom priority (default=1000, higher is better)
77467
+ * eventBus.on('priorityfoo', 1500, function(event) {
77468
+ * console.log('invoked first!');
77469
+ * });
77470
+ *
77471
+ *
77472
+ * // listen for event and pass the context (`this`)
77473
+ * eventBus.on('foobar', function(event) {
77474
+ * this.foo();
77475
+ * }, this);
77476
+ * ```
77477
+ *
77478
+ *
77479
+ * ## Emitting Events
77480
+ *
77481
+ * Events can be emitted via the event bus using {@link EventBus#fire}.
77482
+ *
77483
+ * ```javascript
77484
+ *
77485
+ * // false indicates that the default action
77486
+ * // was prevented by listeners
77487
+ * if (eventBus.fire('foo') === false) {
77488
+ * console.log('default has been prevented!');
77489
+ * };
77490
+ *
77491
+ *
77492
+ * // custom args + return value listener
77493
+ * eventBus.on('sum', function(event, a, b) {
77494
+ * return a + b;
77495
+ * });
77496
+ *
77497
+ * // you can pass custom arguments + retrieve result values.
77498
+ * var sum = eventBus.fire('sum', 1, 2);
77499
+ * console.log(sum); // 3
77500
+ * ```
77501
+ *
77502
+ * @template [EventMap=null]
77503
+ */
77504
+ function EventBus() {
77505
+ /**
77506
+ * @type { Record<string, EventBusListener> }
77507
+ */
77508
+ this._listeners = {};
77509
+
77510
+ // cleanup on destroy on lowest priority to allow
77511
+ // message passing until the bitter end
77512
+ this.on('diagram.destroy', 1, this._destroy, this);
77513
+ }
77514
+
77515
+ /**
77516
+ * @overlord
77517
+ *
77518
+ * Register an event listener for events with the given name.
77519
+ *
77520
+ * The callback will be invoked with `event, ...additionalArguments`
77521
+ * that have been passed to {@link EventBus#fire}.
77522
+ *
77523
+ * Returning false from a listener will prevent the events default action
77524
+ * (if any is specified). To stop an event from being processed further in
77525
+ * other listeners execute {@link Event#stopPropagation}.
77526
+ *
77527
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
77528
+ *
77529
+ * @template {keyof EventMap} EventName
77530
+ *
77531
+ * @param {EventName} events to subscribe to
77532
+ * @param {number} [priority=1000] listen priority
77533
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
77534
+ * @param {any} [that] callback context
77535
+ */
77536
+ /**
77537
+ * Register an event listener for events with the given name.
77538
+ *
77539
+ * The callback will be invoked with `event, ...additionalArguments`
77540
+ * that have been passed to {@link EventBus#fire}.
77541
+ *
77542
+ * Returning false from a listener will prevent the events default action
77543
+ * (if any is specified). To stop an event from being processed further in
77544
+ * other listeners execute {@link Event#stopPropagation}.
77545
+ *
77546
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
77547
+ *
77548
+ * @template T
77549
+ *
77550
+ * @param {string|string[]} events to subscribe to
77551
+ * @param {number} [priority=1000] listen priority
77552
+ * @param {EventBusEventCallback<T>} callback
77553
+ * @param {any} [that] callback context
77554
+ */
77555
+ EventBus.prototype.on = function (events, priority, callback, that) {
77556
+ events = isArray$2(events) ? events : [events];
77557
+ if (isFunction(priority)) {
77558
+ that = callback;
77559
+ callback = priority;
77560
+ priority = DEFAULT_PRIORITY$5;
77561
+ }
77562
+ if (!isNumber$2(priority)) {
77563
+ throw new Error('priority must be a number');
77564
+ }
77565
+ var actualCallback = callback;
77566
+ if (that) {
77567
+ actualCallback = bind(callback, that);
77568
+
77569
+ // make sure we remember and are able to remove
77570
+ // bound callbacks via {@link #off} using the original
77571
+ // callback
77572
+ actualCallback[FN_REF] = callback[FN_REF] || callback;
77573
+ }
77574
+ var self = this;
77575
+ events.forEach(function (e) {
77576
+ self._addListener(e, {
77577
+ priority: priority,
77578
+ callback: actualCallback,
77579
+ next: null
77580
+ });
77581
+ });
77582
+ };
77583
+
77584
+ /**
77585
+ * @overlord
77586
+ *
77587
+ * Register an event listener that is called only once.
77588
+ *
77589
+ * @template {keyof EventMap} EventName
77590
+ *
77591
+ * @param {EventName} events to subscribe to
77592
+ * @param {number} [priority=1000] listen priority
77593
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
77594
+ * @param {any} [that] callback context
77595
+ */
77596
+ /**
77597
+ * Register an event listener that is called only once.
77598
+ *
77599
+ * @template T
77600
+ *
77601
+ * @param {string|string[]} events to subscribe to
77602
+ * @param {number} [priority=1000] the listen priority
77603
+ * @param {EventBusEventCallback<T>} callback
77604
+ * @param {any} [that] callback context
77605
+ */
77606
+ EventBus.prototype.once = function (events, priority, callback, that) {
77607
+ var self = this;
77608
+ if (isFunction(priority)) {
77609
+ that = callback;
77610
+ callback = priority;
77611
+ priority = DEFAULT_PRIORITY$5;
77612
+ }
77613
+ if (!isNumber$2(priority)) {
77614
+ throw new Error('priority must be a number');
77615
+ }
77616
+ function wrappedCallback() {
77617
+ wrappedCallback.__isTomb = true;
77618
+ var result = callback.apply(that, arguments);
77619
+ self.off(events, wrappedCallback);
77620
+ return result;
77621
+ }
77622
+
77623
+ // make sure we remember and are able to remove
77624
+ // bound callbacks via {@link #off} using the original
77625
+ // callback
77626
+ wrappedCallback[FN_REF] = callback;
77627
+ this.on(events, priority, wrappedCallback);
77628
+ };
77629
+
77630
+ /**
77631
+ * Removes event listeners by event and callback.
77632
+ *
77633
+ * If no callback is given, all listeners for a given event name are being removed.
77634
+ *
77635
+ * @param {string|string[]} events
77636
+ * @param {EventBusEventCallback<unknown>} [callback]
77637
+ */
77638
+ EventBus.prototype.off = function (events, callback) {
77639
+ events = isArray$2(events) ? events : [events];
77640
+ var self = this;
77641
+ events.forEach(function (event) {
77642
+ self._removeListener(event, callback);
77643
+ });
77644
+ };
77645
+
77646
+ /**
76700
77647
  * Create an event recognized be the event bus.
76701
77648
  *
76702
77649
  * @param {Object} data Event data.
@@ -77741,7 +78688,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77741
78688
  }) => RootElement ? u(RootElement, {
77742
78689
  children: children
77743
78690
  }) : u("div", {
77744
- className: rootClass,
78691
+ className: classNames(rootClass, 'bio-theme-parent'),
77745
78692
  children: children
77746
78693
  }), [rootClass, RootElement]);
77747
78694
  return shouldRender ? parent ? $$1(u(Root, {
@@ -78443,7 +79390,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78443
79390
  * @typedef { {
78444
79391
  * parserDialect?: import('@bpmn-io/feel-editor').ParserDialect,
78445
79392
  * builtins?: import('@bpmn-io/feel-editor').Variable[],
78446
- * dialect?: import('@bpmn-io/feel-editor').Dialect
79393
+ * dialect?: import('@bpmn-io/feel-editor').Dialect,
79394
+ * engines?: Record<string, string>
78447
79395
  * } } FeelLanguageContextType
78448
79396
  */
78449
79397
 
@@ -78645,7 +79593,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78645
79593
  const tooltipStyle = position || (tooltipPosition ? `right: ${tooltipPosition.right}; top: ${tooltipPosition.top}px;` : undefined);
78646
79594
  const arrowStyle = arrowOffset != null ? `margin-top: ${arrowOffset}px;` : undefined;
78647
79595
  return u("div", {
78648
- class: `bio-properties-panel-tooltip ${direction}`,
79596
+ class: `bio-properties-panel-tooltip bio-theme-parent ${direction}`,
78649
79597
  role: "tooltip",
78650
79598
  id: "bio-properties-panel-tooltip",
78651
79599
  "aria-labelledby": forId,
@@ -78883,24 +79831,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78883
79831
  * @param {boolean} value
78884
79832
  */
78885
79833
 
79834
+ /**
79835
+ * Resolve scroll container closest to the referenced element.
79836
+ */
79837
+ function getScrollContainer(ref, scrollContainerSelector) {
79838
+ return ref.current ? closest(ref.current, scrollContainerSelector, true) : null;
79839
+ }
79840
+
78886
79841
  /**
78887
79842
  * Use IntersectionObserver to identify when DOM element is in sticky mode.
79843
+ *
78888
79844
  * If sticky is observered setSticky(true) will be called.
78889
79845
  * If sticky mode is left, setSticky(false) will be called.
78890
79846
  *
78891
- *
78892
79847
  * @param {Object} ref
78893
79848
  * @param {string} scrollContainerSelector
78894
79849
  * @param {setSticky} setSticky
78895
79850
  */
78896
79851
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
78897
- const [scrollContainer, setScrollContainer] = d$1(query(scrollContainerSelector));
79852
+ // resolved from the observed element after mount (see effect below)
79853
+ const [scrollContainer, setScrollContainer] = d$1(null);
78898
79854
  const updateScrollContainer = q$2(() => {
78899
- const newScrollContainer = query(scrollContainerSelector);
79855
+ const newScrollContainer = getScrollContainer(ref, scrollContainerSelector);
78900
79856
  if (newScrollContainer !== scrollContainer) {
78901
79857
  setScrollContainer(newScrollContainer);
78902
79858
  }
78903
- }, [scrollContainerSelector, scrollContainer]);
79859
+ }, [ref, scrollContainerSelector, scrollContainer]);
78904
79860
  h(() => {
78905
79861
  updateScrollContainer();
78906
79862
  }, [updateScrollContainer]);
@@ -78913,9 +79869,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78913
79869
  if (!Observer) {
78914
79870
  return;
78915
79871
  }
78916
-
78917
- // TODO(@barmac): test this
78918
- if (!ref.current || !scrollContainer) {
79872
+ const element = ref.current;
79873
+ if (!element || !scrollContainer) {
78919
79874
  return;
78920
79875
  }
78921
79876
  const observer = new Observer(entries => {
@@ -78936,13 +79891,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78936
79891
  // Use bottom margin to avoid stickyness when scrolling out to bottom
78937
79892
  threshold: [1]
78938
79893
  });
78939
- observer.observe(ref.current);
79894
+ observer.observe(element);
78940
79895
 
78941
79896
  // Unobserve if unmounted
78942
79897
  return () => {
78943
- observer.unobserve(ref.current);
79898
+ observer.unobserve(element);
78944
79899
  };
78945
- }, [ref.current, scrollContainer, setSticky]);
79900
+ }, [ref, scrollContainer, setSticky]);
78946
79901
  }
78947
79902
 
78948
79903
  /**
@@ -78969,23 +79924,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78969
79924
  });
78970
79925
  return q$2((...args) => callbackRef.current(...args), []);
78971
79926
  }
78972
- function useElementVisible(element) {
78973
- const [visible, setVisible] = d$1(!!element && !!element.clientHeight);
78974
- _$1(() => {
78975
- if (!element) return;
78976
- const resizeObserver = new ResizeObserver(([entry]) => {
78977
- requestAnimationFrame(() => {
78978
- const newVisible = !!entry.contentRect.height;
78979
- if (newVisible !== visible) {
78980
- setVisible(newVisible);
78981
- }
78982
- });
78983
- });
78984
- resizeObserver.observe(element);
78985
- return () => resizeObserver.disconnect();
78986
- }, [element, visible]);
78987
- return visible;
78988
- }
78989
79927
 
78990
79928
  /**
78991
79929
  * @param {import('../PropertiesPanel').GroupDefinition} props
@@ -79337,7 +80275,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
79337
80275
  children: u(EventContext.Provider, {
79338
80276
  value: eventContext,
79339
80277
  children: u("div", {
79340
- class: "bio-properties-panel",
80278
+ class: "bio-properties-panel bio-theme-parent",
79341
80279
  children: [headerProvider ? u(Header, {
79342
80280
  element: element,
79343
80281
  headerProvider: headerProvider
@@ -79428,16 +80366,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
79428
80366
  }, [onShow, setOpen])
79429
80367
  };
79430
80368
  const placeholderLabel = translate('<empty>');
80369
+ const hasEntries = entries.length > 0;
79431
80370
  return u("div", {
79432
80371
  "data-entry-id": id,
79433
80372
  class: classNames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
79434
80373
  children: [u("div", {
79435
80374
  class: "bio-properties-panel-collapsible-entry-header",
79436
- onClick: toggleOpen,
80375
+ onClick: hasEntries ? toggleOpen : null,
79437
80376
  children: [u("div", {
79438
80377
  class: classNames('bio-properties-panel-collapsible-entry-header-title', !label && 'empty'),
79439
80378
  children: label || placeholderLabel
79440
- }), u("button", {
80379
+ }), hasEntries && u("button", {
79441
80380
  type: "button",
79442
80381
  title: translate('Toggle list item'),
79443
80382
  class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",
@@ -79951,7 +80890,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
79951
80890
  const {
79952
80891
  builtins,
79953
80892
  dialect,
79954
- parserDialect
80893
+ parserDialect,
80894
+ engines
79955
80895
  } = feelLanguageContext || {};
79956
80896
  useBufferedFocus(editor, ref);
79957
80897
  const handleInput = useStaticCallback(newValue => {
@@ -79994,6 +80934,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
79994
80934
  builtins,
79995
80935
  dialect,
79996
80936
  parserDialect,
80937
+ engines,
79997
80938
  extensions: [...(enableGutters ? [lineNumbers()] : []), EditorView.lineWrapping, EditorView.domEventHandlers({
79998
80939
  blur: handleBlur
79999
80940
  })],
@@ -80028,6 +80969,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
80028
80969
  }
80029
80970
  editor.setPlaceholder(placeholder);
80030
80971
  }, [placeholder]);
80972
+ h(() => {
80973
+ if (!editor) {
80974
+ return;
80975
+ }
80976
+ editor.setEngines(engines);
80977
+ }, [engines]);
80031
80978
  const handleClick = () => {
80032
80979
  ref.current.focus();
80033
80980
  };
@@ -81349,16 +82296,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81349
82296
  function prefixId$4(id) {
81350
82297
  return `bio-properties-panel-${id}`;
81351
82298
  }
81352
- function resizeToContents(element) {
81353
- element.style.height = 'auto';
81354
-
81355
- // a 2px pixel offset is required to prevent scrollbar from
81356
- // appearing on OS with a full length scroll bar (Windows/Linux)
81357
- element.style.height = `${element.scrollHeight + 2}px`;
81358
- }
81359
82299
  function TextArea(props) {
81360
82300
  const {
81361
82301
  id,
82302
+ element,
81362
82303
  label,
81363
82304
  debounce,
81364
82305
  onInput: commitValue,
@@ -81371,22 +82312,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81371
82312
  autoResize = true,
81372
82313
  placeholder,
81373
82314
  rows = autoResize ? 1 : 2,
81374
- tooltip
82315
+ tooltip,
82316
+ translate = translateFallback
81375
82317
  } = props;
81376
82318
  const [localValue, setLocalValue] = d$1(value);
81377
82319
  const ref = useShowEntryEvent(id);
82320
+ const containerRef = A$2();
82321
+
82322
+ // keep a live reference to the current value so callbacks captured by the
82323
+ // popup (frozen at open time) can compare against the latest value
82324
+ const localValueRef = A$2(localValue);
82325
+ localValueRef.current = localValue;
82326
+ const {
82327
+ eventBus
82328
+ } = x$1(EventContext);
82329
+ const [isPopupOpen, setIsPopupOpen] = d$1(false);
81378
82330
  const onInput = q$2(newValue => {
81379
82331
  const newModelValue = newValue === '' ? undefined : newValue;
81380
82332
  commitValue(newModelValue);
81381
82333
  }, [commitValue]);
81382
- const visible = useElementVisible(ref.current);
81383
82334
 
81384
82335
  /**
81385
82336
  * @type { import('min-dash').DebouncedFunction }
81386
82337
  */
81387
82338
  const handleInput = useDebounce(onInput, debounce);
81388
82339
  const handleLocalInput = e => {
81389
- autoResize && resizeToContents(e.target);
81390
82340
  if (e.target.value === localValue) {
81391
82341
  return;
81392
82342
  }
@@ -81431,12 +82381,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81431
82381
  handleInput.flush?.();
81432
82382
  }
81433
82383
  };
81434
- _$1(() => {
81435
- autoResize && resizeToContents(ref.current);
82384
+ const handlePopupInput = newValue => {
82385
+ if (newValue === localValueRef.current) {
82386
+ return;
82387
+ }
82388
+ setLocalValue(newValue);
82389
+ handleInput(newValue);
82390
+ };
82391
+ const handleOpenPopup = () => {
82392
+ const isOpen = eventBus.fire('propertiesPanel.openPopup', {
82393
+ element,
82394
+ entryId: id,
82395
+ label,
82396
+ onInput: handlePopupInput,
82397
+ sourceElement: ref.current,
82398
+ value: localValue
82399
+ });
82400
+ if (isOpen) {
82401
+ eventBus.once('propertiesPanelPopup.close', () => {
82402
+ handleInput.flush?.();
82403
+ setIsPopupOpen(false);
82404
+ });
82405
+ }
82406
+ setIsPopupOpen(isOpen === true);
82407
+ };
82408
+ h(() => {
82409
+ return () => {
82410
+ eventBus && eventBus.fire('propertiesPanel.closePopup');
82411
+ };
81436
82412
  }, []);
81437
- _$1(() => {
81438
- visible && autoResize && resizeToContents(ref.current);
81439
- }, [visible]);
81440
82413
  h(() => {
81441
82414
  if (value === localValue) {
81442
82415
  return;
@@ -81451,25 +82424,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81451
82424
  children: u(TooltipWrapper, {
81452
82425
  value: tooltip,
81453
82426
  forId: id,
81454
- element: props.element,
82427
+ element: element,
81455
82428
  children: label
81456
82429
  })
81457
- }), u("textarea", {
81458
- ref: ref,
81459
- id: prefixId$2(id),
81460
- name: id,
81461
- spellCheck: "false",
81462
- class: classNames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
81463
- onInput: handleLocalInput,
81464
- onFocus: onFocus,
81465
- onKeyDown: handleOnKeyDown,
81466
- onBlur: handleOnBlur,
81467
- onPaste: handleOnPaste,
81468
- placeholder: placeholder,
81469
- rows: rows,
81470
- value: localValue,
81471
- disabled: disabled,
81472
- "data-gramm": "false"
82430
+ }), u("div", {
82431
+ class: classNames('bio-properties-panel-textarea-container', isPopupOpen ? 'popupOpen' : null),
82432
+ ref: containerRef,
82433
+ children: [isPopupOpen && u("div", {
82434
+ class: "bio-properties-panel-textarea__open-popup-placeholder",
82435
+ children: translate('Opened in editor')
82436
+ }), u("textarea", {
82437
+ ref: ref,
82438
+ id: prefixId$2(id),
82439
+ name: id,
82440
+ spellCheck: "false",
82441
+ class: classNames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
82442
+ onInput: handleLocalInput,
82443
+ onFocus: onFocus,
82444
+ onKeyDown: handleOnKeyDown,
82445
+ onBlur: handleOnBlur,
82446
+ onPaste: handleOnPaste,
82447
+ placeholder: placeholder,
82448
+ rows: rows,
82449
+ value: localValue,
82450
+ disabled: disabled,
82451
+ "data-gramm": "false"
82452
+ }), eventBus && !disabled && u(OpenPopupButton, {
82453
+ onClick: handleOpenPopup,
82454
+ translate: translate
82455
+ })]
81473
82456
  })]
81474
82457
  });
81475
82458
  }
@@ -81490,6 +82473,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81490
82473
  * @param {boolean} props.monospace
81491
82474
  * @param {Function} [props.validate]
81492
82475
  * @param {boolean} [props.disabled]
82476
+ * @param {Function} [props.translate]
81493
82477
  */
81494
82478
  function TextAreaEntry(props) {
81495
82479
  const {
@@ -81509,7 +82493,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81509
82493
  onPaste,
81510
82494
  placeholder,
81511
82495
  autoResize,
81512
- tooltip
82496
+ tooltip,
82497
+ translate
81513
82498
  } = props;
81514
82499
  const globalError = useError(id);
81515
82500
  const [localError, setLocalError] = d$1(null);
@@ -81550,6 +82535,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81550
82535
  placeholder: placeholder,
81551
82536
  autoResize: autoResize,
81552
82537
  tooltip: tooltip,
82538
+ translate: translate,
81553
82539
  element: element
81554
82540
  }, element), error && u("div", {
81555
82541
  class: "bio-properties-panel-error",
@@ -81765,6 +82751,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81765
82751
  function prefixId$1(id) {
81766
82752
  return `bio-properties-panel-${id}`;
81767
82753
  }
82754
+ function getPopupTitle({
82755
+ element,
82756
+ label
82757
+ }) {
82758
+ let popupTitle = '';
82759
+ if (element && element.type) {
82760
+ popupTitle = `${element.type} / `;
82761
+ }
82762
+ return `${popupTitle}${label}`;
82763
+ }
81768
82764
 
81769
82765
  /**
81770
82766
  * Add a dragger that calls back the passed function with
@@ -81849,6 +82845,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81849
82845
  * @param {Function} [props.onPostDeactivate]
81850
82846
  * @param {boolean} [props.returnFocus]
81851
82847
  * @param {boolean} [props.closeOnEscape]
82848
+ * @param {(event: KeyboardEvent) => boolean} [props.allowFocusMove] -
82849
+ * Whether a Tab keypress may move focus. Return false to leave the keypress
82850
+ * to the focused element, e.g. an editor navigating snippet placeholders.
81852
82851
  * @param {string} props.title
81853
82852
  * @param {Ref} [ref]
81854
82853
  */
@@ -81864,6 +82863,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81864
82863
  onPostDeactivate = noop,
81865
82864
  returnFocus = true,
81866
82865
  closeOnEscape = true,
82866
+ allowFocusMove = () => true,
81867
82867
  title
81868
82868
  } = props;
81869
82869
  const focusTrapRef = A$2(null);
@@ -81883,13 +82883,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81883
82883
  focusTrapRef.current.activate();
81884
82884
  }
81885
82885
  };
81886
- let style = {};
81887
- if (position) {
81888
- style = {
81889
- ...style,
81890
- top: position.top + 'px',
81891
- left: position.left + 'px'
81892
- };
82886
+ const {
82887
+ top,
82888
+ left
82889
+ } = position || getCenterPosition(width, height);
82890
+ const style = {};
82891
+ if (isDefined(top) && isDefined(left)) {
82892
+ style.top = top + 'px';
82893
+ style.left = left + 'px';
81893
82894
  }
81894
82895
  if (width) {
81895
82896
  style.width = width + 'px';
@@ -81913,6 +82914,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81913
82914
  clickOutsideDeactivates: true,
81914
82915
  delayInitialFocus,
81915
82916
  fallbackFocus: popupRef.current,
82917
+ isKeyForward: event => isTab(event) && !event.shiftKey && allowFocusMove(event),
82918
+ isKeyBackward: event => isTab(event) && event.shiftKey && allowFocusMove(event),
81916
82919
  onPostActivate,
81917
82920
  onPostDeactivate,
81918
82921
  returnFocusOnDeactivate: returnFocus
@@ -81927,21 +82930,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
81927
82930
  ref: popupRef,
81928
82931
  onKeyDown: handleKeydown,
81929
82932
  role: "dialog",
81930
- class: classNames('bio-properties-panel-popup', className),
82933
+ class: classNames('bio-properties-panel-popup', 'bio-theme-parent', className),
81931
82934
  style: style,
81932
82935
  children: props.children
81933
82936
  });
81934
82937
  }
81935
- const Popup = D$1(PopupComponent);
81936
- Popup.Title = Title;
81937
- Popup.Body = Body;
81938
- Popup.Footer = Footer;
82938
+ const Popup$1 = D$1(PopupComponent);
82939
+ Popup$1.Title = Title;
82940
+ Popup$1.Body = Body;
82941
+ Popup$1.Footer = Footer;
81939
82942
  function Title(props) {
82943
+ const {
82944
+ eventBus
82945
+ } = x$1(EventContext);
81940
82946
  const {
81941
82947
  children,
81942
82948
  className,
81943
82949
  draggable,
81944
- eventBus,
81945
82950
  title,
81946
82951
  showCloseButton = false,
81947
82952
  closeButtonTooltip = 'Close popup',
@@ -82046,6 +83051,26 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82046
83051
 
82047
83052
  // helpers //////////////////////
82048
83053
 
83054
+ /**
83055
+ * Center the popup in the viewport, based on its own dimensions.
83056
+ *
83057
+ * @param {number} [width]
83058
+ * @param {number} [height]
83059
+ */
83060
+ function getCenterPosition(width, height) {
83061
+ if (!width || !height) {
83062
+ return {};
83063
+ }
83064
+ const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
83065
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
83066
+ return {
83067
+ left: Math.max(0, (viewportWidth - width) / 2),
83068
+ top: Math.max(0, (viewportHeight - height) / 2)
83069
+ };
83070
+ }
83071
+ function isTab(event) {
83072
+ return event.key === 'Tab';
83073
+ }
82049
83074
  function getPopupParent(node) {
82050
83075
  return node.closest('.bio-properties-panel-popup');
82051
83076
  }
@@ -82064,22 +83089,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82064
83089
  * @property {string} value
82065
83090
  * @property {Array} [links]
82066
83091
  * @property {Array|Object} [variables]
82067
- * @property {Object} [position]
82068
83092
  * @property {string} [hostLanguage]
82069
83093
  * @property {boolean} [singleLine]
82070
83094
  * @property {HTMLElement} [sourceElement]
82071
83095
  * @property {HTMLElement|string} [tooltipContainer]
82072
- * @property {Object} [eventBus]
82073
83096
  */
82074
83097
 
82075
83098
  const FEEL_POPUP_WIDTH = 700;
82076
- const FEEL_POPUP_HEIGHT = 250;
83099
+ const FEEL_POPUP_HEIGHT = 400;
82077
83100
 
82078
83101
  /**
82079
83102
  * FEEL expression editor popup component
82080
83103
  * @param {FeelPopupProps} props
82081
83104
  */
82082
- function FeelPopup$1(props) {
83105
+ function FeelPopup(props) {
82083
83106
  const {
82084
83107
  entryId,
82085
83108
  onInput,
@@ -82089,12 +83112,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82089
83112
  value,
82090
83113
  links,
82091
83114
  variables,
82092
- position,
82093
83115
  hostLanguage,
82094
83116
  singleLine,
82095
83117
  sourceElement,
82096
83118
  tooltipContainer,
82097
- eventBus,
82098
83119
  feelLanguageContext
82099
83120
  } = props;
82100
83121
  const editorRef = A$2();
@@ -82124,20 +83145,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82124
83145
  editorRef.current.focus();
82125
83146
  }
82126
83147
  }, [editorRef]);
82127
- return u(Popup, {
83148
+ return u(Popup$1, {
82128
83149
  className: "bio-properties-panel-feel-popup",
82129
- position: position,
82130
83150
  title: title,
82131
83151
  returnFocus: false,
82132
83152
  closeOnEscape: false,
82133
83153
  delayInitialFocus: false,
83154
+ allowFocusMove: event => !isSnippetNavigation(event),
82134
83155
  onPostDeactivate: handleSetReturnFocus,
82135
83156
  height: FEEL_POPUP_HEIGHT,
82136
83157
  width: FEEL_POPUP_WIDTH,
82137
83158
  ref: popupRef,
82138
- children: [u(Popup.Title, {
83159
+ children: [u(Popup$1.Title, {
82139
83160
  title: title,
82140
- eventBus: eventBus,
82141
83161
  showCloseButton: true,
82142
83162
  closeButtonTooltip: "Save and close",
82143
83163
  onClose: onClose,
@@ -82153,14 +83173,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82153
83173
  }, index);
82154
83174
  })
82155
83175
  })
82156
- }), u(Popup.Body, {
83176
+ }), u(Popup$1.Body, {
82157
83177
  children: u("div", {
82158
83178
  onKeyDownCapture: onKeyDownCapture,
82159
83179
  onKeyDown: onKeyDown,
82160
83180
  class: "bio-properties-panel-feel-popup__body",
82161
83181
  children: [type === 'feel' && u(FeelEditor, {
82162
83182
  enableGutters: true,
82163
- id: prefixId(entryId),
82164
83183
  name: entryId,
82165
83184
  onInput: onInput,
82166
83185
  value: value,
@@ -82169,7 +83188,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82169
83188
  ref: editorRef,
82170
83189
  tooltipContainer: tooltipContainer
82171
83190
  }), type === 'feelers' && u(TemplatingEditor, {
82172
- id: prefixId(entryId),
82173
83191
  contentAttributes: {
82174
83192
  'aria-label': title
82175
83193
  },
@@ -82186,34 +83204,107 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82186
83204
  })]
82187
83205
  });
82188
83206
  }
82189
- function prefixId(id) {
82190
- return `bio-properties-panel-${id}`;
82191
- }
82192
83207
  function autoCompletionOpen(element) {
82193
83208
  const editor = element.closest('.cm-editor');
82194
83209
  return editor ? editor.querySelector('.cm-tooltip-autocomplete') : null;
82195
83210
  }
82196
- function getPopupTitle({
82197
- element,
82198
- label
82199
- }) {
82200
- let popupTitle = '';
82201
- if (element && element.type) {
82202
- popupTitle = `${element.type} / `;
82203
- }
82204
- return `${popupTitle}${label}`;
83211
+
83212
+ // while a snippet is active, Tab navigates its placeholders inside the editor
83213
+ function isSnippetNavigation(event) {
83214
+ const editor = event.target.closest('.cm-editor');
83215
+ return !!(editor && editor.querySelector('.cm-snippetField'));
82205
83216
  }
82206
- function getPopupPosition() {
82207
- const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
82208
- const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
82209
- return {
82210
- left: Math.max(0, (viewportWidth - FEEL_POPUP_WIDTH) / 2),
82211
- top: Math.max(0, (viewportHeight - FEEL_POPUP_HEIGHT) / 2)
83217
+
83218
+ /**
83219
+ * @typedef {Object} TextPopupProps
83220
+ * @property {string} entryId
83221
+ * @property {Function} onInput
83222
+ * @property {Function} onClose
83223
+ * @property {string} title
83224
+ * @property {string} value
83225
+ * @property {HTMLElement} [sourceElement]
83226
+ */
83227
+
83228
+ const TEXT_POPUP_WIDTH = 700;
83229
+ const TEXT_POPUP_HEIGHT = 400;
83230
+
83231
+ /**
83232
+ * Plain text editor popup component.
83233
+ *
83234
+ * Intentionally kept separate from the FEEL popup: the two are expected to
83235
+ * diverge as we add FEEL-specific capabilities that do not apply to plain text.
83236
+ *
83237
+ * @param {TextPopupProps} props
83238
+ */
83239
+ function TextPopup(props) {
83240
+ const {
83241
+ entryId,
83242
+ onInput,
83243
+ onClose,
83244
+ title,
83245
+ value,
83246
+ sourceElement
83247
+ } = props;
83248
+ const editorRef = A$2();
83249
+ const popupRef = A$2();
83250
+ const handleSetReturnFocus = () => {
83251
+ sourceElement && sourceElement.focus();
82212
83252
  };
83253
+ h(() => {
83254
+ // set focus on editor when popup is opened
83255
+ if (editorRef.current) {
83256
+ editorRef.current.focus();
83257
+ }
83258
+ }, [editorRef]);
83259
+ return u(Popup$1, {
83260
+ className: "bio-properties-panel-text-popup",
83261
+ title: title,
83262
+ returnFocus: false,
83263
+ closeOnEscape: true,
83264
+ delayInitialFocus: false,
83265
+ onClose: onClose,
83266
+ onPostDeactivate: handleSetReturnFocus,
83267
+ height: TEXT_POPUP_HEIGHT,
83268
+ width: TEXT_POPUP_WIDTH,
83269
+ ref: popupRef,
83270
+ children: [u(Popup$1.Title, {
83271
+ title: title,
83272
+ showCloseButton: true,
83273
+ closeButtonTooltip: "Save and close",
83274
+ onClose: onClose,
83275
+ draggable: true
83276
+ }), u(Popup$1.Body, {
83277
+ children: u("textarea", {
83278
+ id: prefixId(entryId),
83279
+ name: entryId,
83280
+ class: "bio-properties-panel-input",
83281
+ ref: editorRef,
83282
+ onInput: e => onInput(e.target.value),
83283
+ value: value || '',
83284
+ spellCheck: "false",
83285
+ autoComplete: "off",
83286
+ "aria-label": title,
83287
+ "data-gramm": "false"
83288
+ })
83289
+ })]
83290
+ });
82213
83291
  }
82214
83292
 
83293
+ // The in-panel field stays mounted (hidden) while the popup is open, so we
83294
+ // scope the popup editor id to keep it unique in the DOM.
83295
+ function prefixId(id) {
83296
+ return `bio-properties-panel-popup-${id}`;
83297
+ }
83298
+ const DEFAULT_POPUP_TYPE = 'text';
83299
+
83300
+ // consumers registering via #registerProvider default to DEFAULT_PRIORITY,
83301
+ // so their providers take precedence over the LOW_PRIORITY built-ins.
83302
+ const DEFAULT_PRIORITY$4 = 1000;
83303
+ const LOW_PRIORITY$2 = 500;
83304
+
82215
83305
  /**
82216
- * FEEL popup component, built as a singleton.
83306
+ * Popup manager, built as a singleton. Renders the registered provider for a
83307
+ * given popup type; consumers may plug in their own via #registerProvider.
82217
83308
  *
82218
83309
  * In order to implement a custom replacement, handle the following events:
82219
83310
  * - `propertiesPanel.openPopup`
@@ -82226,16 +83317,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82226
83317
  * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup as `domNode`
82227
83318
  * - `feelPopup.closed` - fired after the popup is unmounted
82228
83319
  */
82229
- class FeelPopup {
83320
+ class Popup {
82230
83321
  constructor(eventBus, config = {}) {
82231
83322
  this._eventBus = eventBus;
82232
83323
  this._config = config;
82233
83324
  this._isOpen = false;
82234
- eventBus.on('propertiesPanel.openPopup', (_, context) => {
82235
- this.open(context.entryId, context, context.sourceElement);
82236
83325
 
82237
- // return true to indicate that popup was opened
82238
- return true;
83326
+ // built-in providers, registered at LOW_PRIORITY so consumers can
83327
+ // override them via #registerProvider using the default priority
83328
+ this.registerProvider('feel', LOW_PRIORITY$2, FeelPopup);
83329
+ this.registerProvider('feelers', LOW_PRIORITY$2, FeelPopup);
83330
+ this.registerProvider('text', LOW_PRIORITY$2, TextPopup);
83331
+ eventBus.on('propertiesPanel.openPopup', (_, context) => {
83332
+ return this.open(context.entryId, context, context.sourceElement);
82239
83333
  });
82240
83334
  eventBus.on(['propertiesPanel.closePopup', 'propertiesPanel.detach'], () => {
82241
83335
  this.close();
@@ -82243,7 +83337,43 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82243
83337
  }
82244
83338
 
82245
83339
  /**
82246
- * Check if the FEEL popup is open.
83340
+ * Register a popup provider (component) for a given type.
83341
+ *
83342
+ * A higher `priority` wins when multiple providers are registered for the
83343
+ * same type; the built-in providers use a low priority so consumers override
83344
+ * them by default.
83345
+ *
83346
+ * @param {string} type
83347
+ * @param {number} [priority=DEFAULT_PRIORITY]
83348
+ * @param {Function|import('preact').Component} provider
83349
+ */
83350
+ registerProvider(type, priority, provider) {
83351
+ if (!provider) {
83352
+ provider = priority;
83353
+ priority = DEFAULT_PRIORITY$4;
83354
+ }
83355
+ this._eventBus.on('propertiesPanelPopup.getProviders.' + type, priority, function (event) {
83356
+ event.providers.push(provider);
83357
+ });
83358
+ }
83359
+
83360
+ /**
83361
+ * Get the popup providers registered for a type.
83362
+ *
83363
+ * @param {string} type
83364
+ * @return {Array<Function|import('preact').Component>}
83365
+ */
83366
+ _getProviders(type) {
83367
+ const event = this._eventBus.createEvent({
83368
+ type: 'propertiesPanelPopup.getProviders.' + type,
83369
+ providers: []
83370
+ });
83371
+ this._eventBus.fire(event);
83372
+ return event.providers;
83373
+ }
83374
+
83375
+ /**
83376
+ * Check if the popup is open.
82247
83377
  * @return {Boolean}
82248
83378
  */
82249
83379
  isOpen() {
@@ -82251,7 +83381,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82251
83381
  }
82252
83382
 
82253
83383
  /**
82254
- * Open the FEEL popup.
83384
+ * Open the popup.
82255
83385
  *
82256
83386
  * @param {String} entryId
82257
83387
  * @param {Object} popupConfig
@@ -82260,7 +83390,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82260
83390
  open(entryId, popupConfig, sourceElement) {
82261
83391
  // close before opening a new one
82262
83392
  this.close();
82263
- this._openPopup({
83393
+ return this._openPopup({
82264
83394
  ...popupConfig,
82265
83395
  entryId,
82266
83396
  sourceElement
@@ -82268,7 +83398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82268
83398
  }
82269
83399
 
82270
83400
  /**
82271
- * Close the FEEL popup.
83401
+ * Close the popup.
82272
83402
  */
82273
83403
  close() {
82274
83404
  this._closePopup();
@@ -82278,13 +83408,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82278
83408
  element,
82279
83409
  label,
82280
83410
  sourceElement,
82281
- type
83411
+ type = DEFAULT_POPUP_TYPE
82282
83412
  } = context;
83413
+ const component = this._getProviders(type)[0];
83414
+ if (!component) {
83415
+ return false;
83416
+ }
82283
83417
  this._isOpen = true;
82284
83418
  this._eventBus.fire('propertiesPanelPopup.open', {
82285
83419
  container: this._config.feelPopupContainer,
82286
83420
  config: {
82287
83421
  ...context,
83422
+ component,
82288
83423
  links: this._config.getFeelPopupLinks?.(type) || [],
82289
83424
  onClose: () => {
82290
83425
  this._closePopup();
@@ -82294,13 +83429,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82294
83429
  sourceElement && sourceElement.focus();
82295
83430
  }, 0);
82296
83431
  },
82297
- position: getPopupPosition(),
82298
83432
  title: getPopupTitle({
82299
83433
  element,
82300
83434
  label
82301
83435
  })
82302
83436
  }
82303
83437
  });
83438
+ return true;
82304
83439
  }
82305
83440
  _closePopup() {
82306
83441
  if (this._isOpen) {
@@ -82309,8 +83444,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82309
83444
  }
82310
83445
  }
82311
83446
  }
82312
- FeelPopup.$inject = ['eventBus', 'config.propertiesPanel'];
82313
- class FeelPopupRenderer {
83447
+ Popup.$inject = ['eventBus', 'config.propertiesPanel'];
83448
+ class PopupRenderer {
82314
83449
  constructor(eventBus) {
82315
83450
  this._eventBus = eventBus;
82316
83451
  this._container = null;
@@ -82330,15 +83465,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82330
83465
  container = this._container = getContainer(container) || document.body;
82331
83466
  const element = this._element = createElement();
82332
83467
  container.appendChild(element);
82333
-
82334
- // TODO(philippfromme): there is no useService in this context, so we need
82335
- // to pass the event bus as a prop or create a context provider, however,
82336
- // a custom renderer would have to use that context provider as well to have
82337
- // access to the event bus and other services
82338
83468
  this._emit('feelPopup.open');
82339
- R(u(FeelPopup$1, {
82340
- ...config,
82341
- eventBus: this._eventBus
83469
+ const Component = config.component;
83470
+ R(u(EventContext.Provider, {
83471
+ value: {
83472
+ eventBus: this._eventBus
83473
+ },
83474
+ children: u(Component, {
83475
+ ...config,
83476
+ eventBus: this._eventBus
83477
+ })
82342
83478
  }), element);
82343
83479
  this._emit('feelPopup.opened', {
82344
83480
  domNode: element
@@ -82354,13 +83490,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82354
83490
  R(null, this._element);
82355
83491
  this._container.removeChild(this._element);
82356
83492
  this._container = null;
83493
+ this._element = null;
82357
83494
  this._emit('feelPopup.closed');
82358
83495
  }
82359
83496
  _emit(event, context) {
82360
83497
  this._eventBus.fire(event, context);
82361
83498
  }
82362
83499
  }
82363
- FeelPopupRenderer.$inject = ['eventBus'];
83500
+ PopupRenderer.$inject = ['eventBus'];
82364
83501
 
82365
83502
  // helpers /////////////////
82366
83503
 
@@ -82377,8 +83514,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
82377
83514
  }
82378
83515
  var index = {
82379
83516
  __init__: ['feelPopup', 'feelPopupRenderer'],
82380
- feelPopup: ['type', FeelPopup],
82381
- feelPopupRenderer: ['type', FeelPopupRenderer]
83517
+ feelPopup: ['type', Popup],
83518
+ feelPopupRenderer: ['type', PopupRenderer]
82382
83519
  };
82383
83520
  function getPropertiesPanelHeaderProvider(options = {}) {
82384
83521
  const {
@@ -83133,7 +84270,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
83133
84270
  function scrollIntoView({
83134
84271
  selection
83135
84272
  }) {
83136
- const scrollContainer = getScrollContainer(ref.current);
84273
+ const scrollContainer = getScrollContainer$1(ref.current);
83137
84274
  if (!selection || selection.type === 'default' || selection.id !== id || !scrollContainer || !ref.current) {
83138
84275
  return;
83139
84276
  }
@@ -90526,10 +91663,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
90526
91663
  groups.push({
90527
91664
  id,
90528
91665
  label: translate('Static options'),
90529
- component: props => ListGroup({
90530
- ...props,
90531
- translate
90532
- }),
91666
+ component: ListGroup,
91667
+ translate,
90533
91668
  ...StaticOptionsSourceEntry({
90534
91669
  ...context,
90535
91670
  id,
@@ -90611,13 +91746,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
90611
91746
  });
90612
91747
  return {
90613
91748
  add: addEntry,
90614
- component: props => ListGroup({
90615
- ...props,
90616
- translate
90617
- }),
91749
+ component: ListGroup,
90618
91750
  id: 'custom-values',
90619
91751
  items,
90620
91752
  label: translate('Custom properties'),
91753
+ translate,
90621
91754
  tooltip: translate('Add properties directly to the form schema, useful to configure functionality in custom-built task applications and form renderers.')
90622
91755
  };
90623
91756
  }
@@ -90819,10 +91952,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
90819
91952
  groups.push({
90820
91953
  id,
90821
91954
  label: translate('Header items'),
90822
- component: props => ListGroup({
90823
- ...props,
90824
- translate
90825
- }),
91955
+ component: ListGroup,
91956
+ translate,
90826
91957
  ...StaticColumnsSourceEntry({
90827
91958
  field,
90828
91959
  editField,