tags.
*/
@@ -36618,7 +36618,7 @@
text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
return text;
});
-
+
/**
* Turn Markdown image shortcuts into tags.
*/
@@ -36722,7 +36722,7 @@
text = globals.converter._dispatch('images.after', text, options, globals);
return text;
});
-
+
showdown.subParser('italicsAndBold', function (text, options, globals) {
text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
@@ -36792,7 +36792,7 @@
text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
return text;
});
-
+
/**
* Form HTML ordered (numbered) and unordered (bulleted) lists.
*/
@@ -36995,7 +36995,7 @@
text = globals.converter._dispatch('lists.after', text, options, globals);
return text;
});
-
+
/**
* Parse metadata at the top of the document
*/
@@ -37044,7 +37044,7 @@
text = globals.converter._dispatch('metadata.after', text, options, globals);
return text;
});
-
+
/**
* Remove one level of line-leading tabs or spaces
*/
@@ -37061,7 +37061,7 @@
text = globals.converter._dispatch('outdent.after', text, options, globals);
return text;
});
-
+
/**
*
*/
@@ -37131,7 +37131,7 @@
text = text.replace(/\n+$/g, '');
return globals.converter._dispatch('paragraphs.after', text, options, globals);
});
-
+
/**
* Run extension
*/
@@ -37151,7 +37151,7 @@
return text;
});
-
+
/**
* These are all the transformations that occur *within* block-level
* tags like paragraphs, headers, and list items.
@@ -37200,7 +37200,7 @@
text = globals.converter._dispatch('spanGamut.after', text, options, globals);
return text;
});
-
+
showdown.subParser('strikethrough', function (text, options, globals) {
function parseInside (txt) {
@@ -37218,7 +37218,7 @@
return text;
});
-
+
/**
* Strips link definitions from text, stores the URLs and titles in
* hash references.
@@ -37276,7 +37276,7 @@
return text;
});
-
+
showdown.subParser('tables', function (text, options, globals) {
if (!options.tables) {
@@ -37416,7 +37416,7 @@
return text;
});
-
+
showdown.subParser('underline', function (text, options, globals) {
if (!options.underline) {
@@ -37448,7 +37448,7 @@
return text;
});
-
+
/**
* Swap back in all the special characters we've hidden.
*/
@@ -37463,7 +37463,7 @@
text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
return text;
});
-
+
showdown.subParser('makeMarkdown.blockquote', function (node, globals) {
var txt = '';
@@ -37485,19 +37485,19 @@
txt = '> ' + txt.split('\n').join('\n> ');
return txt;
});
-
+
showdown.subParser('makeMarkdown.codeBlock', function (node, globals) {
var lang = node.getAttribute('language'),
num = node.getAttribute('precodenum');
return '```' + lang + '\n' + globals.preList[num] + '\n```';
});
-
+
showdown.subParser('makeMarkdown.codeSpan', function (node) {
return '`' + node.innerHTML + '`';
});
-
+
showdown.subParser('makeMarkdown.emphasis', function (node, globals) {
var txt = '';
@@ -37512,7 +37512,7 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) {
var headerMark = new Array(headerLevel + 1).join('#'),
@@ -37529,12 +37529,12 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.hr', function () {
return '---';
});
-
+
showdown.subParser('makeMarkdown.image', function (node) {
var txt = '';
@@ -37552,7 +37552,7 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.links', function (node, globals) {
var txt = '';
@@ -37572,7 +37572,7 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.list', function (node, globals, type) {
var txt = '';
@@ -37605,7 +37605,7 @@
txt += '\n\n';
return txt.trim();
});
-
+
showdown.subParser('makeMarkdown.listItem', function (node, globals) {
var listItemTxt = '';
@@ -37630,7 +37630,7 @@
return listItemTxt;
});
-
+
showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
@@ -37750,7 +37750,7 @@
return txt;
});
-
+
showdown.subParser('makeMarkdown.paragraph', function (node, globals) {
var txt = '';
@@ -37767,13 +37767,13 @@
return txt;
});
-
+
showdown.subParser('makeMarkdown.pre', function (node, globals) {
var num = node.getAttribute('prenum');
return '' + globals.preList[num] + '
';
});
-
+
showdown.subParser('makeMarkdown.strikethrough', function (node, globals) {
var txt = '';
@@ -37788,7 +37788,7 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.strong', function (node, globals) {
var txt = '';
@@ -37803,7 +37803,7 @@
}
return txt;
});
-
+
showdown.subParser('makeMarkdown.table', function (node, globals) {
var txt = '',
@@ -37873,7 +37873,7 @@
return txt.trim();
});
-
+
showdown.subParser('makeMarkdown.tableCell', function (node, globals) {
var txt = '';
@@ -37888,7 +37888,7 @@
}
return txt.trim();
});
-
+
showdown.subParser('makeMarkdown.txt', function (node) {
var txt = node.nodeValue;
@@ -37931,7 +37931,7 @@
return txt;
});
-
+
var root = this;
// AMD Loader
@@ -37942,1034 +37942,1034 @@
} else {
root.showdown = showdown;
}
- }).call(commonjsGlobal);
+ }).call(commonjsGlobal);
} (showdown));
- /*
- * big.js v6.2.1
- * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
- * Copyright (c) 2022 Michael Mclaughlin
- * https://github.com/MikeMcl/big.js/LICENCE.md
- */
-
-
- /************************************** EDITABLE DEFAULTS *****************************************/
-
-
- // The default values below must be integers within the stated ranges.
-
- /*
- * The maximum number of decimal places (DP) of the results of operations involving division:
- * div and sqrt, and pow with negative exponents.
- */
- var DP = 20, // 0 to MAX_DP
-
- /*
- * The rounding mode (RM) used when rounding to the above decimal places.
- *
- * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
- * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
- * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
- * 3 Away from zero. (ROUND_UP)
- */
- RM = 1, // 0, 1, 2 or 3
-
- // The maximum value of DP and Big.DP.
- MAX_DP = 1E6, // 0 to 1000000
-
- // The maximum magnitude of the exponent argument to the pow method.
- MAX_POWER = 1E6, // 1 to 1000000
-
- /*
- * The negative exponent (NE) at and beneath which toString returns exponential notation.
- * (JavaScript numbers: -7)
- * -1000000 is the minimum recommended exponent value of a Big.
- */
- NE = -7, // 0 to -1000000
-
- /*
- * The positive exponent (PE) at and above which toString returns exponential notation.
- * (JavaScript numbers: 21)
- * 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
- */
- PE = 21, // 0 to 1000000
-
- /*
- * When true, an error will be thrown if a primitive number is passed to the Big constructor,
- * or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
- * primitive number without a loss of precision.
- */
- STRICT = false, // true or false
-
-
- /**************************************************************************************************/
-
-
- // Error messages.
- NAME = '[big.js] ',
- INVALID = NAME + 'Invalid ',
- INVALID_DP = INVALID + 'decimal places',
- INVALID_RM = INVALID + 'rounding mode',
- DIV_BY_ZERO = NAME + 'Division by zero',
-
- // The shared prototype object.
- P$2 = {},
- UNDEFINED = void 0,
- NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
-
-
- /*
- * Create and return a Big constructor.
- */
- function _Big_() {
-
- /*
- * The Big constructor and exported function.
- * Create and return a new instance of a Big number object.
- *
- * n {number|string|Big} A numeric value.
- */
- function Big(n) {
- var x = this;
-
- // Enable constructor usage without new.
- if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
-
- // Duplicate.
- if (n instanceof Big) {
- x.s = n.s;
- x.e = n.e;
- x.c = n.c.slice();
- } else {
- if (typeof n !== 'string') {
- if (Big.strict === true && typeof n !== 'bigint') {
- throw TypeError(INVALID + 'value');
- }
-
- // Minus zero?
- n = n === 0 && 1 / n < 0 ? '-0' : String(n);
- }
-
- parse(x, n);
- }
-
- // Retain a reference to this Big constructor.
- // Shadow Big.prototype.constructor which points to Object.
- x.constructor = Big;
- }
-
- Big.prototype = P$2;
- Big.DP = DP;
- Big.RM = RM;
- Big.NE = NE;
- Big.PE = PE;
- Big.strict = STRICT;
- Big.roundDown = 0;
- Big.roundHalfUp = 1;
- Big.roundHalfEven = 2;
- Big.roundUp = 3;
-
- return Big;
- }
-
-
- /*
- * Parse the number or string value passed to a Big constructor.
- *
- * x {Big} A Big number instance.
- * n {number|string} A numeric value.
- */
- function parse(x, n) {
- var e, i, nl;
-
- if (!NUMERIC.test(n)) {
- throw Error(INVALID + 'number');
- }
-
- // Determine sign.
- x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
-
- // Decimal point?
- if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
-
- // Exponential form?
- if ((i = n.search(/e/i)) > 0) {
-
- // Determine exponent.
- if (e < 0) e = i;
- e += +n.slice(i + 1);
- n = n.substring(0, i);
- } else if (e < 0) {
-
- // Integer.
- e = n.length;
- }
-
- nl = n.length;
-
- // Determine leading zeros.
- for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
-
- if (i == nl) {
-
- // Zero.
- x.c = [x.e = 0];
- } else {
-
- // Determine trailing zeros.
- for (; nl > 0 && n.charAt(--nl) == '0';);
- x.e = e - i - 1;
- x.c = [];
-
- // Convert string to array of digits without leading/trailing zeros.
- for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
- }
-
- return x;
- }
-
-
- /*
- * Round Big x to a maximum of sd significant digits using rounding mode rm.
- *
- * x {Big} The Big to round.
- * sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
- * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- * [more] {boolean} Whether the result of division was truncated.
- */
- function round(x, sd, rm, more) {
- var xc = x.c;
-
- if (rm === UNDEFINED) rm = x.constructor.RM;
- if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
- throw Error(INVALID_RM);
- }
-
- if (sd < 1) {
- 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))
- );
-
- xc.length = 1;
-
- if (more) {
-
- // 1, 0.1, 0.01, 0.001, 0.0001 etc.
- x.e = x.e - sd + 1;
- xc[0] = 1;
- } else {
-
- // Zero.
- xc[0] = x.e = 0;
- }
- } else if (sd < xc.length) {
-
- // xc[sd] is the digit after the digit that may be rounded up.
- 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]);
-
- // Remove any digits after the required precision.
- xc.length = sd;
-
- // Round up?
- if (more) {
-
- // Rounding up may mean the previous digit has to be rounded up.
- for (; ++xc[--sd] > 9;) {
- xc[sd] = 0;
- if (sd === 0) {
- ++x.e;
- xc.unshift(1);
- break;
- }
- }
- }
-
- // Remove trailing zeros.
- for (sd = xc.length; !xc[--sd];) xc.pop();
- }
-
- return x;
- }
-
-
- /*
- * Return a string representing the value of Big x in normal or exponential notation.
- * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
- */
- function stringify(x, doExponential, isNonzero) {
- var e = x.e,
- s = x.c.join(''),
- n = s.length;
-
- // Exponential notation?
- if (doExponential) {
- s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
-
- // Normal notation.
- } else if (e < 0) {
- for (; ++e;) s = '0' + s;
- s = '0.' + s;
- } else if (e > 0) {
- if (++e > n) {
- for (e -= n; e--;) s += '0';
- } else if (e < n) {
- s = s.slice(0, e) + '.' + s.slice(e);
- }
- } else if (n > 1) {
- s = s.charAt(0) + '.' + s.slice(1);
- }
-
- return x.s < 0 && isNonzero ? '-' + s : s;
- }
-
-
- // Prototype/instance methods
-
-
- /*
- * Return a new Big whose value is the absolute value of this Big.
- */
- P$2.abs = function () {
- var x = new this.constructor(this);
- x.s = 1;
- return x;
- };
-
-
- /*
- * Return 1 if the value of this Big is greater than the value of Big y,
- * -1 if the value of this Big is less than the value of Big y, or
- * 0 if they have the same value.
- */
- P$2.cmp = function (y) {
- var isneg,
- x = this,
- xc = x.c,
- yc = (y = new x.constructor(y)).c,
- i = x.s,
- j = y.s,
- k = x.e,
- l = y.e;
-
- // Either zero?
- if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
-
- // Signs differ?
- if (i != j) return i;
-
- isneg = i < 0;
-
- // Compare exponents.
- if (k != l) return k > l ^ isneg ? 1 : -1;
-
- j = (k = xc.length) < (l = yc.length) ? k : l;
-
- // Compare digit by digit.
- for (i = -1; ++i < j;) {
- if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
- }
-
- // Compare lengths.
- return k == l ? 0 : k > l ^ isneg ? 1 : -1;
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
- * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
- */
- P$2.div = function (y) {
- var x = this,
- Big = x.constructor,
- a = x.c, // dividend
- b = (y = new Big(y)).c, // divisor
- k = x.s == y.s ? 1 : -1,
- dp = Big.DP;
-
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
- throw Error(INVALID_DP);
- }
-
- // Divisor is zero?
- if (!b[0]) {
- throw Error(DIV_BY_ZERO);
- }
-
- // Dividend is 0? Return +-0.
- if (!a[0]) {
- y.s = k;
- y.c = [y.e = 0];
- return y;
- }
-
- var bl, bt, n, cmp, ri,
- bz = b.slice(),
- ai = bl = b.length,
- al = a.length,
- r = a.slice(0, bl), // remainder
- rl = r.length,
- q = y, // quotient
- qc = q.c = [],
- qi = 0,
- p = dp + (q.e = x.e - y.e) + 1; // precision of the result
-
- q.s = k;
- k = p < 0 ? 0 : p;
-
- // Create version of divisor with leading zero.
- bz.unshift(0);
-
- // Add zeros to make remainder as long as divisor.
- for (; rl++ < bl;) r.push(0);
-
- do {
-
- // n is how many times the divisor goes into current remainder.
- for (n = 0; n < 10; n++) {
-
- // Compare divisor and remainder.
- if (bl != (rl = r.length)) {
- cmp = bl > rl ? 1 : -1;
- } else {
- for (ri = -1, cmp = 0; ++ri < bl;) {
- if (b[ri] != r[ri]) {
- cmp = b[ri] > r[ri] ? 1 : -1;
- break;
- }
- }
- }
-
- // If divisor < remainder, subtract divisor from remainder.
- if (cmp < 0) {
-
- // Remainder can't be more than 1 digit longer than divisor.
- // Equalise lengths using divisor with extra leading zero?
- for (bt = rl == bl ? b : bz; rl;) {
- if (r[--rl] < bt[rl]) {
- ri = rl;
- for (; ri && !r[--ri];) r[ri] = 9;
- --r[ri];
- r[rl] += 10;
- }
- r[rl] -= bt[rl];
- }
-
- for (; !r[0];) r.shift();
- } else {
- break;
- }
- }
-
- // Add the digit n to the result array.
- qc[qi++] = cmp ? n : ++n;
-
- // Update the remainder.
- if (r[0] && cmp) r[rl] = a[ai] || 0;
- else r = [a[ai]];
-
- } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
-
- // Leading zero? Do not remove if result is simply zero (qi == 1).
- if (!qc[0] && qi != 1) {
-
- // There can't be more than one zero.
- qc.shift();
- q.e--;
- p--;
- }
-
- // Round?
- if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
-
- return q;
- };
-
-
- /*
- * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
- */
- P$2.eq = function (y) {
- return this.cmp(y) === 0;
- };
-
-
- /*
- * Return true if the value of this Big is greater than the value of Big y, otherwise return
- * false.
- */
- P$2.gt = function (y) {
- return this.cmp(y) > 0;
- };
-
-
- /*
- * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
- * return false.
- */
- P$2.gte = function (y) {
- return this.cmp(y) > -1;
- };
-
-
- /*
- * Return true if the value of this Big is less than the value of Big y, otherwise return false.
- */
- P$2.lt = function (y) {
- return this.cmp(y) < 0;
- };
-
-
- /*
- * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
- * return false.
- */
- P$2.lte = function (y) {
- return this.cmp(y) < 1;
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big minus the value of Big y.
- */
- P$2.minus = P$2.sub = function (y) {
- var i, j, t, xlty,
- x = this,
- Big = x.constructor,
- a = x.s,
- b = (y = new Big(y)).s;
-
- // Signs differ?
- if (a != b) {
- y.s = -b;
- return x.plus(y);
- }
-
- var xc = x.c.slice(),
- xe = x.e,
- yc = y.c,
- ye = y.e;
-
- // Either zero?
- if (!xc[0] || !yc[0]) {
- if (yc[0]) {
- y.s = -b;
- } else if (xc[0]) {
- y = new Big(x);
- } else {
- y.s = 1;
- }
- return y;
- }
-
- // Determine which is the bigger number. Prepend zeros to equalise exponents.
- if (a = xe - ye) {
-
- if (xlty = a < 0) {
- a = -a;
- t = xc;
- } else {
- ye = xe;
- t = yc;
- }
-
- t.reverse();
- for (b = a; b--;) t.push(0);
- t.reverse();
- } else {
-
- // Exponents equal. Check digit by digit.
- j = ((xlty = xc.length < yc.length) ? xc : yc).length;
-
- for (a = b = 0; b < j; b++) {
- if (xc[b] != yc[b]) {
- xlty = xc[b] < yc[b];
- break;
- }
- }
- }
-
- // x < y? Point xc to the array of the bigger number.
- if (xlty) {
- t = xc;
- xc = yc;
- yc = t;
- y.s = -y.s;
- }
-
- /*
- * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
- * needs to start at yc.length.
- */
- if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
-
- // Subtract yc from xc.
- for (b = i; j > a;) {
- if (xc[--j] < yc[j]) {
- for (i = j; i && !xc[--i];) xc[i] = 9;
- --xc[i];
- xc[j] += 10;
- }
-
- xc[j] -= yc[j];
- }
-
- // Remove trailing zeros.
- for (; xc[--b] === 0;) xc.pop();
-
- // Remove leading zeros and adjust exponent accordingly.
- for (; xc[0] === 0;) {
- xc.shift();
- --ye;
- }
-
- if (!xc[0]) {
-
- // n - n = +0
- y.s = 1;
-
- // Result must be zero.
- xc = [ye = 0];
- }
-
- y.c = xc;
- y.e = ye;
-
- return y;
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big modulo the value of Big y.
- */
- P$2.mod = function (y) {
- var ygtx,
- x = this,
- Big = x.constructor,
- a = x.s,
- b = (y = new Big(y)).s;
-
- if (!y.c[0]) {
- throw Error(DIV_BY_ZERO);
- }
-
- x.s = y.s = 1;
- ygtx = y.cmp(x) == 1;
- x.s = a;
- y.s = b;
-
- if (ygtx) return new Big(x);
-
- a = Big.DP;
- b = Big.RM;
- Big.DP = Big.RM = 0;
- x = x.div(y);
- Big.DP = a;
- Big.RM = b;
-
- return this.minus(x.times(y));
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big negated.
- */
- P$2.neg = function () {
- var x = new this.constructor(this);
- x.s = -x.s;
- return x;
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big plus the value of Big y.
- */
- P$2.plus = P$2.add = function (y) {
- var e, k, t,
- x = this,
- Big = x.constructor;
-
- y = new Big(y);
-
- // Signs differ?
- if (x.s != y.s) {
- y.s = -y.s;
- return x.minus(y);
- }
-
- var xe = x.e,
- xc = x.c,
- ye = y.e,
- yc = y.c;
-
- // Either zero?
- if (!xc[0] || !yc[0]) {
- if (!yc[0]) {
- if (xc[0]) {
- y = new Big(x);
- } else {
- y.s = x.s;
- }
- }
- return y;
- }
-
- xc = xc.slice();
-
- // Prepend zeros to equalise exponents.
- // Note: reverse faster than unshifts.
- if (e = xe - ye) {
- if (e > 0) {
- ye = xe;
- t = yc;
- } else {
- e = -e;
- t = xc;
- }
-
- t.reverse();
- for (; e--;) t.push(0);
- t.reverse();
- }
-
- // Point xc to the longer array.
- if (xc.length - yc.length < 0) {
- t = yc;
- yc = xc;
- xc = t;
- }
-
- e = yc.length;
-
- // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
- for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
-
- // No need to check for zero, as +x + +y != 0 && -x + -y != 0
-
- if (k) {
- xc.unshift(k);
- ++ye;
- }
-
- // Remove trailing zeros.
- for (e = xc.length; xc[--e] === 0;) xc.pop();
-
- y.c = xc;
- y.e = ye;
-
- return y;
- };
-
-
- /*
- * Return a Big whose value is the value of this Big raised to the power n.
- * If n is negative, round to a maximum of Big.DP decimal places using rounding
- * mode Big.RM.
- *
- * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
- */
- P$2.pow = function (n) {
- var x = this,
- one = new x.constructor('1'),
- y = one,
- isneg = n < 0;
-
- if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
- throw Error(INVALID + 'exponent');
- }
-
- if (isneg) n = -n;
-
- for (;;) {
- if (n & 1) y = y.times(x);
- n >>= 1;
- if (!n) break;
- x = x.times(x);
- }
-
- return isneg ? one.div(y) : y;
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
- * significant digits using rounding mode rm, or Big.RM if rm is not specified.
- *
- * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- */
- P$2.prec = function (sd, rm) {
- if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
- throw Error(INVALID + 'precision');
- }
- return round(new this.constructor(this), sd, rm);
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
- * using rounding mode rm, or Big.RM if rm is not specified.
- * If dp is negative, round to an integer which is a multiple of 10**-dp.
- * If dp is not specified, round to 0 decimal places.
- *
- * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- */
- P$2.round = function (dp, rm) {
- if (dp === UNDEFINED) dp = 0;
- else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
- throw Error(INVALID_DP);
- }
- return round(new this.constructor(this), dp + this.e + 1, rm);
- };
-
-
- /*
- * Return a new Big whose value is the square root of the value of this Big, rounded, if
- * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
- */
- P$2.sqrt = function () {
- var r, c, t,
- x = this,
- Big = x.constructor,
- s = x.s,
- e = x.e,
- half = new Big('0.5');
-
- // Zero?
- if (!x.c[0]) return new Big(x);
-
- // Negative?
- if (s < 0) {
- throw Error(NAME + 'No square root');
- }
-
- // Estimate.
- s = Math.sqrt(x + '');
-
- // Math.sqrt underflow/overflow?
- // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
- if (s === 0 || s === 1 / 0) {
- c = x.c.join('');
- if (!(c.length + e & 1)) c += '0';
- s = Math.sqrt(c);
- e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
- r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
- } else {
- r = new Big(s + '');
- }
-
- e = r.e + (Big.DP += 4);
-
- // Newton-Raphson iteration.
- do {
- t = r;
- r = half.times(t.plus(x.div(t)));
- } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
-
- return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
- };
-
-
- /*
- * Return a new Big whose value is the value of this Big times the value of Big y.
- */
- P$2.times = P$2.mul = function (y) {
- var c,
- x = this,
- Big = x.constructor,
- xc = x.c,
- yc = (y = new Big(y)).c,
- a = xc.length,
- b = yc.length,
- i = x.e,
- j = y.e;
-
- // Determine sign of result.
- y.s = x.s == y.s ? 1 : -1;
-
- // Return signed 0 if either 0.
- if (!xc[0] || !yc[0]) {
- y.c = [y.e = 0];
- return y;
- }
-
- // Initialise exponent of result as x.e + y.e.
- y.e = i + j;
-
- // If array xc has fewer digits than yc, swap xc and yc, and lengths.
- if (a < b) {
- c = xc;
- xc = yc;
- yc = c;
- j = a;
- a = b;
- b = j;
- }
-
- // Initialise coefficient array of result with zeros.
- for (c = new Array(j = a + b); j--;) c[j] = 0;
-
- // Multiply.
-
- // i is initially xc.length.
- for (i = b; i--;) {
- b = 0;
-
- // a is yc.length.
- for (j = a + i; j > i;) {
-
- // Current sum of products at this digit position, plus carry.
- b = c[j] + yc[i] * xc[j - i - 1] + b;
- c[j--] = b % 10;
-
- // carry
- b = b / 10 | 0;
- }
-
- c[j] = b;
- }
-
- // Increment result exponent if there is a final carry, otherwise remove leading zero.
- if (b) ++y.e;
- else c.shift();
-
- // Remove trailing zeros.
- for (i = c.length; !c[--i];) c.pop();
- y.c = c;
-
- return y;
- };
-
-
- /*
- * Return a string representing the value of this Big in exponential notation rounded to dp fixed
- * decimal places using rounding mode rm, or Big.RM if rm is not specified.
- *
- * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- */
- P$2.toExponential = function (dp, rm) {
- var x = this,
- n = x.c[0];
-
- if (dp !== UNDEFINED) {
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
- throw Error(INVALID_DP);
- }
- x = round(new x.constructor(x), ++dp, rm);
- for (; x.c.length < dp;) x.c.push(0);
- }
-
- return stringify(x, true, !!n);
- };
-
-
- /*
- * Return a string representing the value of this Big in normal notation rounded to dp fixed
- * decimal places using rounding mode rm, or Big.RM if rm is not specified.
- *
- * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- *
- * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
- * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
- */
- P$2.toFixed = function (dp, rm) {
- var x = this,
- n = x.c[0];
-
- if (dp !== UNDEFINED) {
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
- throw Error(INVALID_DP);
- }
- x = round(new x.constructor(x), dp + x.e + 1, rm);
-
- // x.e may have changed if the value is rounded up.
- for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
- }
-
- return stringify(x, false, !!n);
- };
-
-
- /*
- * Return a string representing the value of this Big.
- * Return exponential notation if this Big has a positive exponent equal to or greater than
- * Big.PE, or a negative exponent equal to or less than Big.NE.
- * Omit the sign for negative zero.
- */
- P$2[Symbol.for('nodejs.util.inspect.custom')] = P$2.toJSON = P$2.toString = function () {
- var x = this,
- Big = x.constructor;
- return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
- };
-
-
- /*
- * Return the value of this Big as a primitve number.
- */
- P$2.toNumber = function () {
- var n = Number(stringify(this, true, true));
- if (this.constructor.strict === true && !this.eq(n.toString())) {
- throw Error(NAME + 'Imprecise conversion');
- }
- return n;
- };
-
-
- /*
- * Return a string representing the value of this Big rounded to sd significant digits using
- * rounding mode rm, or Big.RM if rm is not specified.
- * Use exponential notation if sd is less than the number of digits necessary to represent
- * the integer part of the value in normal notation.
- *
- * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
- * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
- */
- P$2.toPrecision = function (sd, rm) {
- var x = this,
- Big = x.constructor,
- n = x.c[0];
-
- if (sd !== UNDEFINED) {
- if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
- throw Error(INVALID + 'precision');
- }
- x = round(new Big(x), sd, rm);
- for (; x.c.length < sd;) x.c.push(0);
- }
-
- return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
- };
-
-
- /*
- * Return a string representing the value of this Big.
- * Return exponential notation if this Big has a positive exponent equal to or greater than
- * Big.PE, or a negative exponent equal to or less than Big.NE.
- * Include the sign for negative zero.
- */
- P$2.valueOf = function () {
- var x = this,
- Big = x.constructor;
- if (Big.strict === true) {
- throw Error(NAME + 'valueOf disallowed');
- }
- return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
- };
-
-
- // Export
-
-
+ /*
+ * big.js v6.2.1
+ * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
+ * Copyright (c) 2022 Michael Mclaughlin
+ * https://github.com/MikeMcl/big.js/LICENCE.md
+ */
+
+
+ /************************************** EDITABLE DEFAULTS *****************************************/
+
+
+ // The default values below must be integers within the stated ranges.
+
+ /*
+ * The maximum number of decimal places (DP) of the results of operations involving division:
+ * div and sqrt, and pow with negative exponents.
+ */
+ var DP = 20, // 0 to MAX_DP
+
+ /*
+ * The rounding mode (RM) used when rounding to the above decimal places.
+ *
+ * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
+ * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
+ * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
+ * 3 Away from zero. (ROUND_UP)
+ */
+ RM = 1, // 0, 1, 2 or 3
+
+ // The maximum value of DP and Big.DP.
+ MAX_DP = 1E6, // 0 to 1000000
+
+ // The maximum magnitude of the exponent argument to the pow method.
+ MAX_POWER = 1E6, // 1 to 1000000
+
+ /*
+ * The negative exponent (NE) at and beneath which toString returns exponential notation.
+ * (JavaScript numbers: -7)
+ * -1000000 is the minimum recommended exponent value of a Big.
+ */
+ NE = -7, // 0 to -1000000
+
+ /*
+ * The positive exponent (PE) at and above which toString returns exponential notation.
+ * (JavaScript numbers: 21)
+ * 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
+ */
+ PE = 21, // 0 to 1000000
+
+ /*
+ * When true, an error will be thrown if a primitive number is passed to the Big constructor,
+ * or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
+ * primitive number without a loss of precision.
+ */
+ STRICT = false, // true or false
+
+
+ /**************************************************************************************************/
+
+
+ // Error messages.
+ NAME = '[big.js] ',
+ INVALID = NAME + 'Invalid ',
+ INVALID_DP = INVALID + 'decimal places',
+ INVALID_RM = INVALID + 'rounding mode',
+ DIV_BY_ZERO = NAME + 'Division by zero',
+
+ // The shared prototype object.
+ P$2 = {},
+ UNDEFINED = void 0,
+ NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
+
+
+ /*
+ * Create and return a Big constructor.
+ */
+ function _Big_() {
+
+ /*
+ * The Big constructor and exported function.
+ * Create and return a new instance of a Big number object.
+ *
+ * n {number|string|Big} A numeric value.
+ */
+ function Big(n) {
+ var x = this;
+
+ // Enable constructor usage without new.
+ if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
+
+ // Duplicate.
+ if (n instanceof Big) {
+ x.s = n.s;
+ x.e = n.e;
+ x.c = n.c.slice();
+ } else {
+ if (typeof n !== 'string') {
+ if (Big.strict === true && typeof n !== 'bigint') {
+ throw TypeError(INVALID + 'value');
+ }
+
+ // Minus zero?
+ n = n === 0 && 1 / n < 0 ? '-0' : String(n);
+ }
+
+ parse(x, n);
+ }
+
+ // Retain a reference to this Big constructor.
+ // Shadow Big.prototype.constructor which points to Object.
+ x.constructor = Big;
+ }
+
+ Big.prototype = P$2;
+ Big.DP = DP;
+ Big.RM = RM;
+ Big.NE = NE;
+ Big.PE = PE;
+ Big.strict = STRICT;
+ Big.roundDown = 0;
+ Big.roundHalfUp = 1;
+ Big.roundHalfEven = 2;
+ Big.roundUp = 3;
+
+ return Big;
+ }
+
+
+ /*
+ * Parse the number or string value passed to a Big constructor.
+ *
+ * x {Big} A Big number instance.
+ * n {number|string} A numeric value.
+ */
+ function parse(x, n) {
+ var e, i, nl;
+
+ if (!NUMERIC.test(n)) {
+ throw Error(INVALID + 'number');
+ }
+
+ // Determine sign.
+ x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
+
+ // Decimal point?
+ if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
+
+ // Exponential form?
+ if ((i = n.search(/e/i)) > 0) {
+
+ // Determine exponent.
+ if (e < 0) e = i;
+ e += +n.slice(i + 1);
+ n = n.substring(0, i);
+ } else if (e < 0) {
+
+ // Integer.
+ e = n.length;
+ }
+
+ nl = n.length;
+
+ // Determine leading zeros.
+ for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
+
+ if (i == nl) {
+
+ // Zero.
+ x.c = [x.e = 0];
+ } else {
+
+ // Determine trailing zeros.
+ for (; nl > 0 && n.charAt(--nl) == '0';);
+ x.e = e - i - 1;
+ x.c = [];
+
+ // Convert string to array of digits without leading/trailing zeros.
+ for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
+ }
+
+ return x;
+ }
+
+
+ /*
+ * Round Big x to a maximum of sd significant digits using rounding mode rm.
+ *
+ * x {Big} The Big to round.
+ * sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
+ * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ * [more] {boolean} Whether the result of division was truncated.
+ */
+ function round(x, sd, rm, more) {
+ var xc = x.c;
+
+ if (rm === UNDEFINED) rm = x.constructor.RM;
+ if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
+ throw Error(INVALID_RM);
+ }
+
+ if (sd < 1) {
+ 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))
+ );
+
+ xc.length = 1;
+
+ if (more) {
+
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
+ x.e = x.e - sd + 1;
+ xc[0] = 1;
+ } else {
+
+ // Zero.
+ xc[0] = x.e = 0;
+ }
+ } else if (sd < xc.length) {
+
+ // xc[sd] is the digit after the digit that may be rounded up.
+ 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]);
+
+ // Remove any digits after the required precision.
+ xc.length = sd;
+
+ // Round up?
+ if (more) {
+
+ // Rounding up may mean the previous digit has to be rounded up.
+ for (; ++xc[--sd] > 9;) {
+ xc[sd] = 0;
+ if (sd === 0) {
+ ++x.e;
+ xc.unshift(1);
+ break;
+ }
+ }
+ }
+
+ // Remove trailing zeros.
+ for (sd = xc.length; !xc[--sd];) xc.pop();
+ }
+
+ return x;
+ }
+
+
+ /*
+ * Return a string representing the value of Big x in normal or exponential notation.
+ * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
+ */
+ function stringify(x, doExponential, isNonzero) {
+ var e = x.e,
+ s = x.c.join(''),
+ n = s.length;
+
+ // Exponential notation?
+ if (doExponential) {
+ s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
+
+ // Normal notation.
+ } else if (e < 0) {
+ for (; ++e;) s = '0' + s;
+ s = '0.' + s;
+ } else if (e > 0) {
+ if (++e > n) {
+ for (e -= n; e--;) s += '0';
+ } else if (e < n) {
+ s = s.slice(0, e) + '.' + s.slice(e);
+ }
+ } else if (n > 1) {
+ s = s.charAt(0) + '.' + s.slice(1);
+ }
+
+ return x.s < 0 && isNonzero ? '-' + s : s;
+ }
+
+
+ // Prototype/instance methods
+
+
+ /*
+ * Return a new Big whose value is the absolute value of this Big.
+ */
+ P$2.abs = function () {
+ var x = new this.constructor(this);
+ x.s = 1;
+ return x;
+ };
+
+
+ /*
+ * Return 1 if the value of this Big is greater than the value of Big y,
+ * -1 if the value of this Big is less than the value of Big y, or
+ * 0 if they have the same value.
+ */
+ P$2.cmp = function (y) {
+ var isneg,
+ x = this,
+ xc = x.c,
+ yc = (y = new x.constructor(y)).c,
+ i = x.s,
+ j = y.s,
+ k = x.e,
+ l = y.e;
+
+ // Either zero?
+ if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
+
+ // Signs differ?
+ if (i != j) return i;
+
+ isneg = i < 0;
+
+ // Compare exponents.
+ if (k != l) return k > l ^ isneg ? 1 : -1;
+
+ j = (k = xc.length) < (l = yc.length) ? k : l;
+
+ // Compare digit by digit.
+ for (i = -1; ++i < j;) {
+ if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
+ }
+
+ // Compare lengths.
+ return k == l ? 0 : k > l ^ isneg ? 1 : -1;
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
+ * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
+ */
+ P$2.div = function (y) {
+ var x = this,
+ Big = x.constructor,
+ a = x.c, // dividend
+ b = (y = new Big(y)).c, // divisor
+ k = x.s == y.s ? 1 : -1,
+ dp = Big.DP;
+
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
+ throw Error(INVALID_DP);
+ }
+
+ // Divisor is zero?
+ if (!b[0]) {
+ throw Error(DIV_BY_ZERO);
+ }
+
+ // Dividend is 0? Return +-0.
+ if (!a[0]) {
+ y.s = k;
+ y.c = [y.e = 0];
+ return y;
+ }
+
+ var bl, bt, n, cmp, ri,
+ bz = b.slice(),
+ ai = bl = b.length,
+ al = a.length,
+ r = a.slice(0, bl), // remainder
+ rl = r.length,
+ q = y, // quotient
+ qc = q.c = [],
+ qi = 0,
+ p = dp + (q.e = x.e - y.e) + 1; // precision of the result
+
+ q.s = k;
+ k = p < 0 ? 0 : p;
+
+ // Create version of divisor with leading zero.
+ bz.unshift(0);
+
+ // Add zeros to make remainder as long as divisor.
+ for (; rl++ < bl;) r.push(0);
+
+ do {
+
+ // n is how many times the divisor goes into current remainder.
+ for (n = 0; n < 10; n++) {
+
+ // Compare divisor and remainder.
+ if (bl != (rl = r.length)) {
+ cmp = bl > rl ? 1 : -1;
+ } else {
+ for (ri = -1, cmp = 0; ++ri < bl;) {
+ if (b[ri] != r[ri]) {
+ cmp = b[ri] > r[ri] ? 1 : -1;
+ break;
+ }
+ }
+ }
+
+ // If divisor < remainder, subtract divisor from remainder.
+ if (cmp < 0) {
+
+ // Remainder can't be more than 1 digit longer than divisor.
+ // Equalise lengths using divisor with extra leading zero?
+ for (bt = rl == bl ? b : bz; rl;) {
+ if (r[--rl] < bt[rl]) {
+ ri = rl;
+ for (; ri && !r[--ri];) r[ri] = 9;
+ --r[ri];
+ r[rl] += 10;
+ }
+ r[rl] -= bt[rl];
+ }
+
+ for (; !r[0];) r.shift();
+ } else {
+ break;
+ }
+ }
+
+ // Add the digit n to the result array.
+ qc[qi++] = cmp ? n : ++n;
+
+ // Update the remainder.
+ if (r[0] && cmp) r[rl] = a[ai] || 0;
+ else r = [a[ai]];
+
+ } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
+
+ // Leading zero? Do not remove if result is simply zero (qi == 1).
+ if (!qc[0] && qi != 1) {
+
+ // There can't be more than one zero.
+ qc.shift();
+ q.e--;
+ p--;
+ }
+
+ // Round?
+ if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
+
+ return q;
+ };
+
+
+ /*
+ * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
+ */
+ P$2.eq = function (y) {
+ return this.cmp(y) === 0;
+ };
+
+
+ /*
+ * Return true if the value of this Big is greater than the value of Big y, otherwise return
+ * false.
+ */
+ P$2.gt = function (y) {
+ return this.cmp(y) > 0;
+ };
+
+
+ /*
+ * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
+ * return false.
+ */
+ P$2.gte = function (y) {
+ return this.cmp(y) > -1;
+ };
+
+
+ /*
+ * Return true if the value of this Big is less than the value of Big y, otherwise return false.
+ */
+ P$2.lt = function (y) {
+ return this.cmp(y) < 0;
+ };
+
+
+ /*
+ * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
+ * return false.
+ */
+ P$2.lte = function (y) {
+ return this.cmp(y) < 1;
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big minus the value of Big y.
+ */
+ P$2.minus = P$2.sub = function (y) {
+ var i, j, t, xlty,
+ x = this,
+ Big = x.constructor,
+ a = x.s,
+ b = (y = new Big(y)).s;
+
+ // Signs differ?
+ if (a != b) {
+ y.s = -b;
+ return x.plus(y);
+ }
+
+ var xc = x.c.slice(),
+ xe = x.e,
+ yc = y.c,
+ ye = y.e;
+
+ // Either zero?
+ if (!xc[0] || !yc[0]) {
+ if (yc[0]) {
+ y.s = -b;
+ } else if (xc[0]) {
+ y = new Big(x);
+ } else {
+ y.s = 1;
+ }
+ return y;
+ }
+
+ // Determine which is the bigger number. Prepend zeros to equalise exponents.
+ if (a = xe - ye) {
+
+ if (xlty = a < 0) {
+ a = -a;
+ t = xc;
+ } else {
+ ye = xe;
+ t = yc;
+ }
+
+ t.reverse();
+ for (b = a; b--;) t.push(0);
+ t.reverse();
+ } else {
+
+ // Exponents equal. Check digit by digit.
+ j = ((xlty = xc.length < yc.length) ? xc : yc).length;
+
+ for (a = b = 0; b < j; b++) {
+ if (xc[b] != yc[b]) {
+ xlty = xc[b] < yc[b];
+ break;
+ }
+ }
+ }
+
+ // x < y? Point xc to the array of the bigger number.
+ if (xlty) {
+ t = xc;
+ xc = yc;
+ yc = t;
+ y.s = -y.s;
+ }
+
+ /*
+ * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
+ * needs to start at yc.length.
+ */
+ if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
+
+ // Subtract yc from xc.
+ for (b = i; j > a;) {
+ if (xc[--j] < yc[j]) {
+ for (i = j; i && !xc[--i];) xc[i] = 9;
+ --xc[i];
+ xc[j] += 10;
+ }
+
+ xc[j] -= yc[j];
+ }
+
+ // Remove trailing zeros.
+ for (; xc[--b] === 0;) xc.pop();
+
+ // Remove leading zeros and adjust exponent accordingly.
+ for (; xc[0] === 0;) {
+ xc.shift();
+ --ye;
+ }
+
+ if (!xc[0]) {
+
+ // n - n = +0
+ y.s = 1;
+
+ // Result must be zero.
+ xc = [ye = 0];
+ }
+
+ y.c = xc;
+ y.e = ye;
+
+ return y;
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big modulo the value of Big y.
+ */
+ P$2.mod = function (y) {
+ var ygtx,
+ x = this,
+ Big = x.constructor,
+ a = x.s,
+ b = (y = new Big(y)).s;
+
+ if (!y.c[0]) {
+ throw Error(DIV_BY_ZERO);
+ }
+
+ x.s = y.s = 1;
+ ygtx = y.cmp(x) == 1;
+ x.s = a;
+ y.s = b;
+
+ if (ygtx) return new Big(x);
+
+ a = Big.DP;
+ b = Big.RM;
+ Big.DP = Big.RM = 0;
+ x = x.div(y);
+ Big.DP = a;
+ Big.RM = b;
+
+ return this.minus(x.times(y));
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big negated.
+ */
+ P$2.neg = function () {
+ var x = new this.constructor(this);
+ x.s = -x.s;
+ return x;
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big plus the value of Big y.
+ */
+ P$2.plus = P$2.add = function (y) {
+ var e, k, t,
+ x = this,
+ Big = x.constructor;
+
+ y = new Big(y);
+
+ // Signs differ?
+ if (x.s != y.s) {
+ y.s = -y.s;
+ return x.minus(y);
+ }
+
+ var xe = x.e,
+ xc = x.c,
+ ye = y.e,
+ yc = y.c;
+
+ // Either zero?
+ if (!xc[0] || !yc[0]) {
+ if (!yc[0]) {
+ if (xc[0]) {
+ y = new Big(x);
+ } else {
+ y.s = x.s;
+ }
+ }
+ return y;
+ }
+
+ xc = xc.slice();
+
+ // Prepend zeros to equalise exponents.
+ // Note: reverse faster than unshifts.
+ if (e = xe - ye) {
+ if (e > 0) {
+ ye = xe;
+ t = yc;
+ } else {
+ e = -e;
+ t = xc;
+ }
+
+ t.reverse();
+ for (; e--;) t.push(0);
+ t.reverse();
+ }
+
+ // Point xc to the longer array.
+ if (xc.length - yc.length < 0) {
+ t = yc;
+ yc = xc;
+ xc = t;
+ }
+
+ e = yc.length;
+
+ // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
+ for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
+
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+
+ if (k) {
+ xc.unshift(k);
+ ++ye;
+ }
+
+ // Remove trailing zeros.
+ for (e = xc.length; xc[--e] === 0;) xc.pop();
+
+ y.c = xc;
+ y.e = ye;
+
+ return y;
+ };
+
+
+ /*
+ * Return a Big whose value is the value of this Big raised to the power n.
+ * If n is negative, round to a maximum of Big.DP decimal places using rounding
+ * mode Big.RM.
+ *
+ * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
+ */
+ P$2.pow = function (n) {
+ var x = this,
+ one = new x.constructor('1'),
+ y = one,
+ isneg = n < 0;
+
+ if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
+ throw Error(INVALID + 'exponent');
+ }
+
+ if (isneg) n = -n;
+
+ for (;;) {
+ if (n & 1) y = y.times(x);
+ n >>= 1;
+ if (!n) break;
+ x = x.times(x);
+ }
+
+ return isneg ? one.div(y) : y;
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
+ * significant digits using rounding mode rm, or Big.RM if rm is not specified.
+ *
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ */
+ P$2.prec = function (sd, rm) {
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
+ throw Error(INVALID + 'precision');
+ }
+ return round(new this.constructor(this), sd, rm);
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
+ * using rounding mode rm, or Big.RM if rm is not specified.
+ * If dp is negative, round to an integer which is a multiple of 10**-dp.
+ * If dp is not specified, round to 0 decimal places.
+ *
+ * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ */
+ P$2.round = function (dp, rm) {
+ if (dp === UNDEFINED) dp = 0;
+ else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
+ throw Error(INVALID_DP);
+ }
+ return round(new this.constructor(this), dp + this.e + 1, rm);
+ };
+
+
+ /*
+ * Return a new Big whose value is the square root of the value of this Big, rounded, if
+ * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
+ */
+ P$2.sqrt = function () {
+ var r, c, t,
+ x = this,
+ Big = x.constructor,
+ s = x.s,
+ e = x.e,
+ half = new Big('0.5');
+
+ // Zero?
+ if (!x.c[0]) return new Big(x);
+
+ // Negative?
+ if (s < 0) {
+ throw Error(NAME + 'No square root');
+ }
+
+ // Estimate.
+ s = Math.sqrt(x + '');
+
+ // Math.sqrt underflow/overflow?
+ // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
+ if (s === 0 || s === 1 / 0) {
+ c = x.c.join('');
+ if (!(c.length + e & 1)) c += '0';
+ s = Math.sqrt(c);
+ e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
+ r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
+ } else {
+ r = new Big(s + '');
+ }
+
+ e = r.e + (Big.DP += 4);
+
+ // Newton-Raphson iteration.
+ do {
+ t = r;
+ r = half.times(t.plus(x.div(t)));
+ } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
+
+ return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
+ };
+
+
+ /*
+ * Return a new Big whose value is the value of this Big times the value of Big y.
+ */
+ P$2.times = P$2.mul = function (y) {
+ var c,
+ x = this,
+ Big = x.constructor,
+ xc = x.c,
+ yc = (y = new Big(y)).c,
+ a = xc.length,
+ b = yc.length,
+ i = x.e,
+ j = y.e;
+
+ // Determine sign of result.
+ y.s = x.s == y.s ? 1 : -1;
+
+ // Return signed 0 if either 0.
+ if (!xc[0] || !yc[0]) {
+ y.c = [y.e = 0];
+ return y;
+ }
+
+ // Initialise exponent of result as x.e + y.e.
+ y.e = i + j;
+
+ // If array xc has fewer digits than yc, swap xc and yc, and lengths.
+ if (a < b) {
+ c = xc;
+ xc = yc;
+ yc = c;
+ j = a;
+ a = b;
+ b = j;
+ }
+
+ // Initialise coefficient array of result with zeros.
+ for (c = new Array(j = a + b); j--;) c[j] = 0;
+
+ // Multiply.
+
+ // i is initially xc.length.
+ for (i = b; i--;) {
+ b = 0;
+
+ // a is yc.length.
+ for (j = a + i; j > i;) {
+
+ // Current sum of products at this digit position, plus carry.
+ b = c[j] + yc[i] * xc[j - i - 1] + b;
+ c[j--] = b % 10;
+
+ // carry
+ b = b / 10 | 0;
+ }
+
+ c[j] = b;
+ }
+
+ // Increment result exponent if there is a final carry, otherwise remove leading zero.
+ if (b) ++y.e;
+ else c.shift();
+
+ // Remove trailing zeros.
+ for (i = c.length; !c[--i];) c.pop();
+ y.c = c;
+
+ return y;
+ };
+
+
+ /*
+ * Return a string representing the value of this Big in exponential notation rounded to dp fixed
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
+ *
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ */
+ P$2.toExponential = function (dp, rm) {
+ var x = this,
+ n = x.c[0];
+
+ if (dp !== UNDEFINED) {
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
+ throw Error(INVALID_DP);
+ }
+ x = round(new x.constructor(x), ++dp, rm);
+ for (; x.c.length < dp;) x.c.push(0);
+ }
+
+ return stringify(x, true, !!n);
+ };
+
+
+ /*
+ * Return a string representing the value of this Big in normal notation rounded to dp fixed
+ * decimal places using rounding mode rm, or Big.RM if rm is not specified.
+ *
+ * dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ *
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
+ */
+ P$2.toFixed = function (dp, rm) {
+ var x = this,
+ n = x.c[0];
+
+ if (dp !== UNDEFINED) {
+ if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
+ throw Error(INVALID_DP);
+ }
+ x = round(new x.constructor(x), dp + x.e + 1, rm);
+
+ // x.e may have changed if the value is rounded up.
+ for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
+ }
+
+ return stringify(x, false, !!n);
+ };
+
+
+ /*
+ * Return a string representing the value of this Big.
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
+ * Omit the sign for negative zero.
+ */
+ P$2[Symbol.for('nodejs.util.inspect.custom')] = P$2.toJSON = P$2.toString = function () {
+ var x = this,
+ Big = x.constructor;
+ return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
+ };
+
+
+ /*
+ * Return the value of this Big as a primitve number.
+ */
+ P$2.toNumber = function () {
+ var n = Number(stringify(this, true, true));
+ if (this.constructor.strict === true && !this.eq(n.toString())) {
+ throw Error(NAME + 'Imprecise conversion');
+ }
+ return n;
+ };
+
+
+ /*
+ * Return a string representing the value of this Big rounded to sd significant digits using
+ * rounding mode rm, or Big.RM if rm is not specified.
+ * Use exponential notation if sd is less than the number of digits necessary to represent
+ * the integer part of the value in normal notation.
+ *
+ * sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
+ * rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
+ */
+ P$2.toPrecision = function (sd, rm) {
+ var x = this,
+ Big = x.constructor,
+ n = x.c[0];
+
+ if (sd !== UNDEFINED) {
+ if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
+ throw Error(INVALID + 'precision');
+ }
+ x = round(new Big(x), sd, rm);
+ for (; x.c.length < sd;) x.c.push(0);
+ }
+
+ return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
+ };
+
+
+ /*
+ * Return a string representing the value of this Big.
+ * Return exponential notation if this Big has a positive exponent equal to or greater than
+ * Big.PE, or a negative exponent equal to or less than Big.NE.
+ * Include the sign for negative zero.
+ */
+ P$2.valueOf = function () {
+ var x = this,
+ Big = x.constructor;
+ if (Big.strict === true) {
+ throw Error(NAME + 'valueOf disallowed');
+ }
+ return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
+ };
+
+
+ // Export
+
+
var Big = _Big_();
var classnamesExports = {};
@@ -38979,9 +38979,9 @@
};
/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
+ Copyright (c) 2018 Jed Watson.
+ Licensed under the MIT License (MIT), see
+ http://jedwatson.github.io/classnames
*/
(function (module) {
@@ -39010,14 +39010,15 @@
}
}
} else if (argType === 'object') {
- if (arg.toString === Object.prototype.toString) {
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- } else {
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
+ continue;
+ }
+
+ for (var key in arg) {
+ if (hasOwn.call(arg, key) && arg[key]) {
+ classes.push(key);
+ }
}
}
}
@@ -39036,13 +39037,13 @@
var classNames = classnamesExports;
- var n$1,l$2,u$1,t$1,o$3,r$1,f$1,e$3={},c$1=[],s$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a$2(n,l){for(var u in l)n[u]=l[u];return n}function h$1(n){var l=n.parentNode;l&&l.removeChild(n);}function v$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$1.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y$1(l,f,t,o,null)}function y$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null!=l$2.vnode&&l$2.vnode(f),f}function p$2(){return {current:null}}function d$1(n){return n.children}function _$1(n,l){this.props=n,this.context=l;}function k$2(n,l){if(null==l)return n.__?k$2(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l0?y$1(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v2&&(f.children=arguments.length>3?n$1.call(arguments,2):i),y$1(l.type,f,t||l.key,o||l.ref,null)}function D$1(n,l){var u={__c:l="__cC"+f$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m$1);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n$1=c$1.slice,l$2={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l;}throw n}},u$1=0,_$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a$2({},this.state),"function"==typeof n&&(n=n(a$2({},u),this.props)),n&&a$2(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m$1(this));},_$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m$1(this));},_$1.prototype.render=d$1,t$1=[],o$3="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g$2.__r=0,f$1=0;
+ var n$1,l$2,u$1,t$1,o$3,r$1,f$1,e$3={},c$1=[],s$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a$2(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n);}function v$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$1.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y$1(l,f,t,o,null)}function y$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null!=l$2.vnode&&l$2.vnode(f),f}function d$1(n){return n.children}function _(n,l){this.props=n,this.context=l;}function k$1(n,l){if(null==l)return n.__?k$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l0?y$1(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v=i.__.length&&i.__.push({}),i.__[t]}function l$1(n){return o$1=1,p$1(w$1,n)}function p$1(n,r,o){var i=m(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w$1(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function y(r,o){var i=m(t++,3);!l$2.__s&&k$1(i.__H,o)&&(i.__=r,i.__H=o,u.__H.__h.push(i));}function h(r,o){var i=m(t++,4);!l$2.__s&&k$1(i.__H,o)&&(i.__=r,i.__H=o,u.__h.push(i));}function s(n){return o$1=5,d(function(){return {current:n}},[])}function _(n,t,u){o$1=6,h(function(){"function"==typeof n?n(t()):n&&(n.current=t());},null==u?u:u.concat(n));}function d(n,u){var r=m(t++,7);return k$1(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function A$1(n,t){return o$1=8,d(function(){return n},t)}function F$1(n){var r=u.context[n.__c],o=m(t++,9);return o.c=n,r?(null==o.__&&(o.__=!0,r.sub(u)),r.props.value):n.__}function T$1(t,u){l$2.useDebugValue&&l$2.useDebugValue(u?u(t):t);}function x$1(){i$1.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(g$1),t.__H.__h.forEach(j$1),t.__H.__h=[];}catch(u){t.__H.__h=[],l$2.__e(u,t.__v);}}),i$1=[];}l$2.__b=function(n){u=null,c&&c(n);},l$2.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g$1),r.__h.forEach(j$1),r.__h=[]);},l$2.diffed=function(t){e$1&&e$1(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i$1.push(o)&&r===l$2.requestAnimationFrame||((r=l$2.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x$1)),u=void 0;},l$2.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g$1),t.__h=t.__h.filter(function(n){return !n.__||j$1(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],l$2.__e(r,t.__v);}}),a$1&&a$1(t,u);},l$2.unmount=function(t){v&&v(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(g$1);}catch(t){l$2.__e(t,u.__v);}};var b="function"==typeof requestAnimationFrame;function g$1(n){var t=u;"function"==typeof n.__c&&n.__c(),u=t;}function j$1(n){var t=u;n.__c=n.__(),u=t;}function k$1(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w$1(n,t){return "function"==typeof t?t(n):t}
+ var t,u,r,o$1=0,i$1=[],c=l$2.__b,f=l$2.__r,e$1=l$2.diffed,a$1=l$2.__c,v=l$2.unmount;function m(t,r){l$2.__h&&l$2.__h(u,t,o$1||r),o$1=0;var i=u.__H||(u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function l$1(n){return o$1=1,p$1(w$1,n)}function p$1(n,r,o){var i=m(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w$1(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function y(r,o){var i=m(t++,3);!l$2.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__H.__h.push(i));}function s(n){return o$1=5,d(function(){return {current:n}},[])}function d(n,u){var r=m(t++,7);return k(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function A$1(n,t){return o$1=8,d(function(){return n},t)}function F(n){var r=u.context[n.__c],o=m(t++,9);return o.c=n,r?(null==o.__&&(o.__=!0,r.sub(u)),r.props.value):n.__}function x(){i$1.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(g),t.__H.__h.forEach(j$1),t.__H.__h=[];}catch(u){t.__H.__h=[],l$2.__e(u,t.__v);}}),i$1=[];}l$2.__b=function(n){u=null,c&&c(n);},l$2.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g),r.__h.forEach(j$1),r.__h=[]);},l$2.diffed=function(t){e$1&&e$1(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i$1.push(o)&&r===l$2.requestAnimationFrame||((r=l$2.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x)),u=void 0;},l$2.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g),t.__h=t.__h.filter(function(n){return !n.__||j$1(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],l$2.__e(r,t.__v);}}),a$1&&a$1(t,u);},l$2.unmount=function(t){v&&v(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(g);}catch(t){l$2.__e(t,u.__v);}};var b="function"==typeof requestAnimationFrame;function g(n){var t=u;"function"==typeof n.__c&&n.__c(),u=t;}function j$1(n){var t=u;n.__c=n.__(),u=t;}function k(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w$1(n,t){return "function"==typeof t?t(n):t}
- function S(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function E(n){this.props=n;}function g(n,t){function e(n){var e=this.props.ref,r=e==n.ref;return !r&&e&&(e.call?e(null):e.current=null),t?!t(this.props,n)||!r:C(this.props,n)}function r(t){return this.shouldComponentUpdate=e,v$1(n,t)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(E.prototype=new _$1).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var w=l$2.__b;l$2.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w&&w(n);};var R="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function x(n){function t(t,e){var r=S({},t);return delete r.ref,n(r,(e=t.ref||e)&&("object"!=typeof e||"current"in e)?e:null)}return t.$$typeof=R,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var N=function(n,t){return null==n?null:A$2(A$2(n).map(t))},k={map:N,forEach:N,count:function(n){return n?A$2(n).length:0},only:function(n){var t=A$2(n);if(1!==t.length)throw "Children.only";return t[0]},toArray:A$2},A=l$2.__e;l$2.__e=function(n,t,e){if(n.then)for(var r,u=t;u=u.__;)if((r=u.__c)&&r.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t);A(n,t,e);};var O=l$2.unmount;function L(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function F(n){var t,e,r;function u(u){if(t||(t=n()).then(function(n){e=n.default||n;},function(n){r=n;}),r)throw r;if(!e)throw t;return v$1(e,u)}return u.displayName="Lazy",u.__f=!0,u}function M(){this.u=null,this.o=null;}l$2.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O&&O(n);},(L.prototype=new _$1).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=U(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L.prototype.componentWillUnmount=function(){this.t=[];},L.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=S({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&v$1(d$1,null,n.fallback);return u&&(u.__h=null),[v$1(d$1,null,t.__e?null:n.children),u]};var T=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]>>1,1),t.i.removeChild(n);}}),S$1(v$1(D,{context:t.context},n.__v),t.l)):t.l&&t.componentWillUnmount();}function W(n,t){return v$1(I,{__v:n,i:t})}(M.prototype=new _$1).__e=function(n){var t=this,e=U(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),T(t,n,r)):u();};e?e(o):o();}},M.prototype.render=function(n){this.u=null,this.o=new Map;var t=A$2(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},M.prototype.componentDidUpdate=M.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){T(n,e,t);});};var j="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,V=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};function z(n,t,e){return null==t.__k&&(t.textContent=""),S$1(n,t),"function"==typeof e&&e(),n?n.__c:null}function B(n,t,e){return q$1(n,t),"function"==typeof e&&e(),n?n.__c:null}_$1.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(_$1.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H=l$2.event;function Z(){}function Y(){return this.cancelBubble}function $(){return this.defaultPrevented}l$2.event=function(n){return H&&(n=H(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=$,n.nativeEvent=n};var q,G={configurable:!0,get:function(){return this.class}},J=l$2.vnode;l$2.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){for(var u in r={},e){var o=e[u];"value"===u&&"defaultValue"in e&&null==o||("defaultValue"===u&&"value"in e&&null==e.value?u="value":"download"===u&&!0===o?o="":/ondoubleclick/i.test(u)?u="ondblclick":/^onchange(textarea|input)/i.test(u+t)&&!V(e.type)?u="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(u)?u=u.toLowerCase():P.test(u)?u=u.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===o&&(o=void 0),r[u]=o);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r;}t&&e.class!=e.className&&(G.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",G)),n.$$typeof=j,J&&J(n);};var K=l$2.__r;l$2.__r=function(n){K&&K(n),q=n.__c;};var Q={ReactCurrentDispatcher:{current:{readContext:function(n){return q.__n[n.__c].props.value}}}};function nn(n){return v$1.bind(null,n)}function tn(n){return !!n&&n.$$typeof===j}function en(n){return tn(n)?B$1.apply(null,arguments):n}function rn(n){return !!n.__k&&(S$1(null,n),!0)}function un(n){return n&&(n.base||1===n.nodeType&&n)||null}var on=function(n,t){return n(t)},ln=function(n,t){return n(t)};var React = {useState:l$1,useReducer:p$1,useEffect:y,useLayoutEffect:h,useRef:s,useImperativeHandle:_,useMemo:d,useCallback:A$1,useContext:F$1,useDebugValue:T$1,version:"17.0.2",Children:k,render:z,hydrate:B,unmountComponentAtNode:rn,createPortal:W,createElement:v$1,createContext:D$1,createFactory:nn,cloneElement:en,createRef:p$2,Fragment:d$1,isValidElement:tn,findDOMNode:un,Component:_$1,PureComponent:E,memo:g,forwardRef:x,flushSync:ln,unstable_batchedUpdates:on,StrictMode:d$1,Suspense:L,SuspenseList:M,lazy:F,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Q};
+ function S(n,t){for(var e in t)n[e]=t[e];return n}function C(n,t){for(var e in n)if("__source"!==e&&!(e in t))return !0;for(var r in t)if("__source"!==r&&n[r]!==t[r])return !0;return !1}function E(n){this.props=n;}(E.prototype=new _).isPureReactComponent=!0,E.prototype.shouldComponentUpdate=function(n,t){return C(this.props,n)||C(this.state,t)};var w=l$2.__b;l$2.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),w&&w(n);};var A=l$2.__e;l$2.__e=function(n,t,e){if(n.then)for(var r,u=t;u=u.__;)if((r=u.__c)&&r.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),r.__c(n,t);A(n,t,e);};var O=l$2.unmount;function L(){this.__u=0,this.t=null,this.__b=null;}function U(n){var t=n.__.__c;return t&&t.__e&&t.__e(n)}function M(){this.u=null,this.o=null;}l$2.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&!0===n.__h&&(n.type=null),O&&O(n);},(L.prototype=new _).__c=function(n,t){var e=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(e);var u=U(r.__v),o=!1,i=function(){o||(o=!0,e.__R=null,u?u(l):l());};e.__R=i;var l=function(){if(!--r.__u){if(r.state.__e){var n=r.state.__e;r.__v.__k[0]=function n(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate();}},f=!0===t.__h;r.__u++||f||r.setState({__e:r.__b=r.__v.__k[0]}),n.then(i,i);},L.prototype.componentWillUnmount=function(){this.t=[];},L.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function n(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),t.__c.__H=null),null!=(t=S({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return n(t,e,r)})),t}(this.__b,e,r.__O=r.__P);}this.__b=null;}var u=t.__e&&v$1(d$1,null,n.fallback);return u&&(u.__h=null),[v$1(d$1,null,t.__e?null:n.children),u]};var T=function(n,t,e){if(++e[1]===e[0]&&n.o.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.o.size))for(e=n.u;e;){for(;e.length>3;)e.pop()();if(e[1]>>1,1),t.i.removeChild(n);}}),S$1(v$1(D,{context:t.context},n.__v),t.l)):t.l&&t.componentWillUnmount();}function W(n,t){return v$1(I,{__v:n,i:t})}(M.prototype=new _).__e=function(n){var t=this,e=U(t.__v),r=t.o.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),T(t,n,r)):u();};e?e(o):o();}},M.prototype.render=function(n){this.u=null,this.o=new Map;var t=A$2(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.o.set(t[e],this.u=[1,0,this.u]);return n.children},M.prototype.componentDidUpdate=M.prototype.componentDidMount=function(){var n=this;this.o.forEach(function(t,e){T(n,e,t);});};var j="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,P=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,V=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(n)};_.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(_.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t});}});});var H=l$2.event;function Z(){}function Y(){return this.cancelBubble}function $(){return this.defaultPrevented}l$2.event=function(n){return H&&(n=H(n)),n.persist=Z,n.isPropagationStopped=Y,n.isDefaultPrevented=$,n.nativeEvent=n};var G={configurable:!0,get:function(){return this.class}},J=l$2.vnode;l$2.vnode=function(n){var t=n.type,e=n.props,r=e;if("string"==typeof t){for(var u in r={},e){var o=e[u];"value"===u&&"defaultValue"in e&&null==o||("defaultValue"===u&&"value"in e&&null==e.value?u="value":"download"===u&&!0===o?o="":/ondoubleclick/i.test(u)?u="ondblclick":/^onchange(textarea|input)/i.test(u+t)&&!V(e.type)?u="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(u)?u=u.toLowerCase():P.test(u)?u=u.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===o&&(o=void 0),r[u]=o);}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=-1!=r.value.indexOf(n.props.value);})),"select"==t&&null!=r.defaultValue&&(r.value=A$2(e.children).forEach(function(n){n.props.selected=r.multiple?-1!=r.defaultValue.indexOf(n.props.value):r.defaultValue==n.props.value;})),n.props=r;}t&&e.class!=e.className&&(G.enumerable="className"in e,null!=e.className&&(r.class=e.className),Object.defineProperty(r,"className",G)),n.$$typeof=j,J&&J(n);};var K=l$2.__r;l$2.__r=function(n){K&&K(n),n.__c;};
var HOOKS = [
"onChange",
@@ -41599,7 +41600,7 @@
window.flatpickr = flatpickr;
}
- var e,o={};function n(r,t,e){if(3===r.nodeType){var o="textContent"in r?r.textContent:r.nodeValue||"";if(!1!==n.options.trim){var a=0===t||t===e.length-1;if((!(o=o.match(/^[\s\n]+$/g)&&"all"!==n.options.trim?" ":o.replace(/(^[\s\n]+|[\s\n]+$)/g,"all"===n.options.trim||a?"":" "))||" "===o)&&e.length>1&&a)return null}return o}if(1!==r.nodeType)return null;var p=String(r.nodeName).toLowerCase();if("script"===p&&!n.options.allowScripts)return null;var l,s,u=n.h(p,function(r){var t=r&&r.length;if(!t)return null;for(var e={},o=0;o\n"+r+""):(i="xml",a='\n'+r+"");try{o=(new DOMParser).parseFromString(a,p);}catch(r){n=r;}if(o||"html"!==t||((o=e||(e=function(){if(document.implementation&&document.implementation.createHTMLDocument)return document.implementation.createHTMLDocument("");var r=document.createElement("iframe");return r.style.cssText="position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;",r.setAttribute("sandbox","allow-forms"),document.body.appendChild(r),r.contentWindow.document}())).open(),o.write(a),o.close()),o){var l=o.getElementsByTagName(i)[0],s=l.firstChild;return r&&!s&&(l.error="Document parse failed."),s&&"parsererror"===String(s.nodeName).toLowerCase()&&(s.removeChild(s.firstChild),s.removeChild(s.lastChild),l.error=s.textContent||s.nodeValue||n||"Unknown error",l.removeChild(s)),l}}(r,t);if(u&&u.error)throw new Error(u.error);var c=u&&u.body||u;l.map=i||p;var m=c&&function(r,t,e,a){return n.visitor=t,n.h=e,n.options=a||o,n(r)}(c,l,a,s);return l.map=null,m&&m.props&&m.props.children||null}(c,u,C,this.map,g);}catch(r){f?f({error:r}):"undefined"!=typeof console&&console.error&&console.error("preact-markup: "+r);}if(!1===i)return s||null;var x=w.hasOwnProperty("className")?"className":"class",b=w[x];return b?b.splice?b.splice(0,0,"markup"):"string"==typeof b?w[x]+=" markup":"object"==typeof b&&(b.markup=!0):w[x]="markup",C("div",w,s||null)},i}(_$1));
+ var e,o={};function n(r,t,e){if(3===r.nodeType){var o="textContent"in r?r.textContent:r.nodeValue||"";if(!1!==n.options.trim){var a=0===t||t===e.length-1;if((!(o=o.match(/^[\s\n]+$/g)&&"all"!==n.options.trim?" ":o.replace(/(^[\s\n]+|[\s\n]+$)/g,"all"===n.options.trim||a?"":" "))||" "===o)&&e.length>1&&a)return null}return o}if(1!==r.nodeType)return null;var p=String(r.nodeName).toLowerCase();if("script"===p&&!n.options.allowScripts)return null;var l,s,u=n.h(p,function(r){var t=r&&r.length;if(!t)return null;for(var e={},o=0;o\n"+r+""):(i="xml",a='\n'+r+"");try{o=(new DOMParser).parseFromString(a,p);}catch(r){n=r;}if(o||"html"!==t||((o=e||(e=function(){if(document.implementation&&document.implementation.createHTMLDocument)return document.implementation.createHTMLDocument("");var r=document.createElement("iframe");return r.style.cssText="position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;",r.setAttribute("sandbox","allow-forms"),document.body.appendChild(r),r.contentWindow.document}())).open(),o.write(a),o.close()),o){var l=o.getElementsByTagName(i)[0],s=l.firstChild;return r&&!s&&(l.error="Document parse failed."),s&&"parsererror"===String(s.nodeName).toLowerCase()&&(s.removeChild(s.firstChild),s.removeChild(s.lastChild),l.error=s.textContent||s.nodeValue||n||"Unknown error",l.removeChild(s)),l}}(r,t);if(u&&u.error)throw new Error(u.error);var c=u&&u.body||u;l.map=i||p;var m=c&&function(r,t,e,a){return n.visitor=t,n.h=e,n.options=a||o,n(r)}(c,l,a,s);return l.map=null,m&&m.props&&m.props.children||null}(c,u,C,this.map,g);}catch(r){f?f({error:r}):"undefined"!=typeof console&&console.error&&console.error("preact-markup: "+r);}if(!1===i)return s||null;var x=w.hasOwnProperty("className")?"className":"class",b=w[x];return b?b.splice?b.splice(0,0,"markup"):"string"==typeof b?w[x]+=" markup":"object"==typeof b&&(b.markup=!0):w[x]="markup",C("div",w,s||null)},i}(_));
const CLASS_PATTERN = /^class[ {]/;
@@ -42065,15 +42066,164 @@
return value;
}
+ const getFlavouredFeelVariableNames = (feelString, feelFlavour, options = {}) => {
+ const {
+ depth = 0,
+ specialDepthAccessors = {}
+ } = options;
+ if (!['expression', 'unaryTest'].includes(feelFlavour)) return [];
+ const tree = feelFlavour === 'expression' ? parseExpressions$1(feelString) : parseUnaryTests$1(feelString);
+ const simpleExpressionTree = _buildSimpleFeelStructureTree(tree, feelString);
+ return function _unfoldVariables(node) {
+ if (node.name === 'PathExpression') {
+ if (Object.keys(specialDepthAccessors).length === 0) {
+ return depth === 0 ? [_getVariableNameAtPathIndex(node, 0)] : [];
+ }
+
+ // if using special depth accessors, use a more complex extraction
+ return Array.from(_smartExtractVariableNames(node, depth, specialDepthAccessors));
+ }
+ if (depth === 0 && node.name === 'VariableName') return [node.variableName];
+
+ // for any other kind of node, traverse its children and flatten the result
+ if (node.children) {
+ return node.children.reduce((acc, child) => {
+ return acc.concat(_unfoldVariables(child));
+ }, []);
+ }
+ return [];
+ }(simpleExpressionTree);
+ };
+
+ /**
+ * Get the variable name at the specified index in a given path expression.
+ *
+ * @param {Object} root - The root node of the path expression tree.
+ * @param {number} index - The index of the variable name to retrieve.
+ * @returns {string|null} The variable name at the specified index or null if index is out of bounds.
+ */
+ const _getVariableNameAtPathIndex = (root, index) => {
+ const accessors = _deconstructPathExpression(root);
+ return accessors[index] || null;
+ };
+
+ /**
+ * Extracts the variables which are required of the external context for a given path expression.
+ * This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
+ *
+ * @param {Object} node - The root node of the path expression tree.
+ * @param {number} initialDepth - The depth at which the root node is located in the outer context.
+ * @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
+ * @returns {Set} - A set containing the extracted variable names.
+ */
+ const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) => {
+ // depth info represents the previous (initialised as null) and current depth of the current accessor in the path expression
+ // we track multiple of these to account for the fact that a path expression may be ambiguous due to special keywords
+ let accessorDepthInfos = [{
+ previous: null,
+ current: initialDepth - 1
+ }];
+ const extractedVariables = new Set();
+ const nodeAccessors = _deconstructPathExpression(node);
+ for (let i = 0; i < nodeAccessors.length; i++) {
+ const currentAccessor = nodeAccessors[i];
+ if (currentAccessor in specialDepthAccessors) {
+ const depthOffsets = specialDepthAccessors[currentAccessor];
+
+ // if the current accessor is a special keyword, we need to expand the current depth info set
+ // this is done to account for the ambiguity of keywords like parent, which may be used to access
+ // the parent of the current node, or a child variable of the same name
+ accessorDepthInfos = depthOffsets.reduce((accumulator, offset) => {
+ return [...accumulator, ...accessorDepthInfos.map(depthInfo => ({
+ previous: depthInfo.current,
+ current: depthInfo.current + offset
+ }))];
+ }, []).filter(depthInfo => depthInfo.current >= -1); // discard all depth infos which are out of bounds
+ } else {
+ // if the current accessor is not a special keyword, we know it's simply accessing a child
+ // hence we are now one level deeper in the tree and simply increment
+ accessorDepthInfos = accessorDepthInfos.map(depthInfo => ({
+ previous: depthInfo.current,
+ current: depthInfo.current + 1
+ }));
+ }
+
+ // finally, we check if for the current accessor, there is a scenario where:
+ // previous it was at depth -1 (i.e. the root context), and is now at depth 0 (i.e. a variable)
+ // these are the variables we need to request, so we add them to the set
+ if (accessorDepthInfos.some(depthInfo => depthInfo.previous === -1 && depthInfo.current === 0)) {
+ extractedVariables.add(currentAccessor);
+ }
+ }
+
+ // we return a set to avoid duplicates
+ return new Set(extractedVariables);
+ };
+
+ /**
+ * Deconstructs a path expression tree into an array of components.
+ *
+ * @param {Object} root - The root node of the path expression tree.
+ * @returns {Array} An array of components in the path expression, in the correct order.
+ */
+ const _deconstructPathExpression = root => {
+ let node = root;
+ let parts = [];
+
+ // Traverse the tree and collect path components
+ while (node.name === 'PathExpression') {
+ parts.push(node.children[1].variableName);
+ node = node.children[0];
+ }
+
+ // Add the last component to the array
+ parts.push(node.variableName);
+
+ // Reverse and return the array to get the correct order
+ return parts.reverse();
+ };
+
+ /**
+ * Builds a simplified feel structure tree from the given parse tree and feel string.
+ * The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
+ *
+ * @param {Object} parseTree - The parse tree generated by a parser.
+ * @param {string} feelString - The feel string used for parsing.
+ * @returns {Object} The simplified feel structure tree.
+ */
+ const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
+ const stack = [{
+ children: []
+ }];
+ parseTree.iterate({
+ enter: node => {
+ const nodeRepresentation = {
+ name: node.type.name,
+ children: []
+ };
+ if (node.type.name === 'VariableName') {
+ nodeRepresentation.variableName = feelString.slice(node.from, node.to);
+ }
+ stack.push(nodeRepresentation);
+ },
+ leave: () => {
+ const result = stack.pop();
+ const parent = stack[stack.length - 1];
+ parent.children.push(result);
+ }
+ });
+ return stack[0].children[0];
+ };
+
class FeelExpressionLanguage {
constructor(eventBus) {
this._eventBus = eventBus;
}
/**
- * Determines if the given string is a FEEL expression.
+ * Determines if the given value is a FEEL expression.
*
- * @param {string} value
+ * @param {any} value
* @returns {boolean}
*
*/
@@ -42097,12 +42247,10 @@
if (!this.isExpression(expression)) {
return [];
}
- if (type === 'unaryTest') {
- return this._getUnaryVariableNames(expression);
- } else if (type === 'expression') {
- return this._getExpressionVariableNames(expression);
+ if (!['unaryTest', 'expression'].includes(type)) {
+ throw new Error('Unknown expression type: ' + type);
}
- throw new Error('Unknown expression type: ' + options.type);
+ return getFlavouredFeelVariableNames(expression, type);
}
/**
@@ -42130,37 +42278,52 @@
return null;
}
}
- _getExpressionVariableNames(expression) {
- const tree = parseExpressions$1(expression);
- const cursor = tree.cursor();
- const variables = new Set();
- do {
- const node = cursor.node;
- if (node.type.name === 'VariableName') {
- variables.add(expression.slice(node.from, node.to));
- }
- } while (cursor.next());
- return Array.from(variables);
- }
- _getUnaryVariableNames(unaryTest) {
- const tree = parseUnaryTests$1(unaryTest);
- const cursor = tree.cursor();
- const variables = new Set();
- do {
- const node = cursor.node;
- if (node.type.name === 'VariableName') {
- variables.add(unaryTest.slice(node.from, node.to));
- }
- } while (cursor.next());
- return Array.from(variables);
- }
}
FeelExpressionLanguage.$inject = ['eventBus'];
class FeelersTemplating {
constructor() {}
+
+ /**
+ * Determines if the given value is a feelers template.
+ *
+ * @param {any} value
+ * @returns {boolean}
+ *
+ */
isTemplate(value) {
- return isString$3(value) && (value.startsWith('=') || /{{/.test(value));
+ return isString$3(value) && (value.startsWith('=') || /{{.*?}}/.test(value));
+ }
+
+ /**
+ * Retrieve variable names from a given feelers template.
+ *
+ * @param {string} template
+ *
+ * @returns {string[]}
+ */
+ getVariableNames(template) {
+ if (!this.isTemplate(template)) {
+ return [];
+ }
+ const expressions = this._extractExpressionsWithDepth(template);
+
+ // defines special accessors, and the change(s) in depth they could imply (e.g. parent can be used to access the parent context (depth - 1) or a child variable named parent (depth + 1)
+ const specialDepthAccessors = {
+ parent: [-1, 1],
+ _parent_: [-1],
+ this: [0, 1],
+ _this_: [0]
+ };
+ return expressions.reduce((variables, {
+ expression,
+ depth
+ }) => {
+ return variables.concat(getFlavouredFeelVariableNames(expression, 'expression', {
+ depth,
+ specialDepthAccessors
+ }));
+ }, []);
}
/**
@@ -42187,6 +42350,50 @@
buildDebugString
});
}
+
+ /**
+ * @typedef {Object} ExpressionWithDepth
+ * @property {number} depth - The depth of the expression in the syntax tree.
+ * @property {string} expression - The extracted expression
+ */
+
+ /**
+ * Extracts all feel expressions in the template along with their depth in the syntax tree.
+ * The depth is incremented for child expressions of loops to account for context drilling.
+ * @name extractExpressionsWithDepth
+ * @param {string} template - A feelers template string.
+ * @returns {Array} An array of objects, each containing the depth and the extracted expression.
+ *
+ * @example
+ * const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
+ * const extractedExpressions = _extractExpressionsWithDepth(template);
+ */
+ _extractExpressionsWithDepth(template) {
+ // build simplified feelers syntax tree
+ const parseTree = parser.parse(template);
+ const tree = buildSimpleTree(parseTree, template);
+ return function _traverse(n, depth = 0) {
+ if (['Feel', 'FeelBlock'].includes(n.name)) {
+ return [{
+ depth,
+ expression: n.content
+ }];
+ }
+ if (n.name === 'LoopSpanner') {
+ const loopExpression = n.children[0].content;
+ const childResults = n.children.slice(1).reduce((acc, child) => {
+ return acc.concat(_traverse(child, depth + 1));
+ }, []);
+ return [{
+ depth,
+ expression: loopExpression
+ }, ...childResults];
+ }
+ return n.children.reduce((acc, child) => {
+ return acc.concat(_traverse(child, depth));
+ }, []);
+ }(tree);
+ }
}
FeelersTemplating.$inject = [];
@@ -42320,6 +42527,30 @@
var DEFAULT_PRIORITY = 1000;
var slice = Array.prototype.slice;
+ /**
+ * @typedef { {
+ * stopPropagation(): void;
+ * preventDefault(): void;
+ * cancelBubble: boolean;
+ * defaultPrevented: boolean;
+ * returnValue: any;
+ * } } Event
+ */
+
+ /**
+ * @template E
+ *
+ * @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
+ */
+
+ /**
+ * @typedef { {
+ * priority: number;
+ * next: EventBusListener | null;
+ * callback: EventBusEventCallback;
+ * } } EventBusListener
+ */
+
/**
* A general purpose event bus.
*
@@ -42404,6 +42635,9 @@
* ```
*/
function EventBus() {
+ /**
+ * @type { Record }
+ */
this._listeners = {};
// cleanup on destroy on lowest priority to allow
@@ -42423,10 +42657,12 @@
*
* Returning anything but `undefined` from a listener will stop the listener propagation.
*
- * @param {string|Array} events
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
- * @param {Function} callback
- * @param {Object} [that] Pass context (`this`) to the callback
+ * @template T
+ *
+ * @param {string|string[]} events to subscribe to
+ * @param {number} [priority=1000] listen priority
+ * @param {EventBusEventCallback} callback
+ * @param {any} [that] callback context
*/
EventBus.prototype.on = function (events, priority, callback, that) {
events = isArray$3(events) ? events : [events];
@@ -42458,14 +42694,16 @@
};
/**
- * Register an event listener that is executed only once.
+ * Register an event listener that is called only once.
+ *
+ * @template T
*
- * @param {string} event the event name to register for
- * @param {number} [priority=1000] the priority in which this listener is called, larger is higher
- * @param {Function} callback the callback to execute
- * @param {Object} [that] Pass context (`this`) to the callback
+ * @param {string|string[]} events to subscribe to
+ * @param {number} [priority=1000] the listen priority
+ * @param {EventBusEventCallback} callback
+ * @param {any} [that] callback context
*/
- EventBus.prototype.once = function (event, priority, callback, that) {
+ EventBus.prototype.once = function (events, priority, callback, that) {
var self = this;
if (isFunction(priority)) {
that = callback;
@@ -42478,7 +42716,7 @@
function wrappedCallback() {
wrappedCallback.__isTomb = true;
var result = callback.apply(that, arguments);
- self.off(event, wrappedCallback);
+ self.off(events, wrappedCallback);
return result;
}
@@ -42486,7 +42724,7 @@
// bound callbacks via {@link #off} using the original
// callback
wrappedCallback[FN_REF] = callback;
- this.on(event, priority, wrappedCallback);
+ this.on(events, priority, wrappedCallback);
};
/**
@@ -42494,8 +42732,8 @@
*
* If no callback is given, all listeners for a given event name are being removed.
*
- * @param {string|Array} events
- * @param {Function} [callback]
+ * @param {string|string[]} events
+ * @param {EventBusEventCallback} [callback]
*/
EventBus.prototype.off = function (events, callback) {
events = isArray$3(events) ? events : [events];
@@ -42506,11 +42744,11 @@
};
/**
- * Create an EventBus event.
+ * Create an event recognized be the event bus.
*
- * @param {Object} data
+ * @param {Object} data Event data.
*
- * @return {Object} event, recognized by the eventBus
+ * @return {Event} An event that will be recognized by the event bus.
*/
EventBus.prototype.createEvent = function (data) {
var event = new InternalEvent();
@@ -42519,10 +42757,11 @@
};
/**
- * Fires a named event.
+ * Fires an event.
*
* @example
*
+ * ```javascript
* // fire event by name
* events.fire('foo');
*
@@ -42540,13 +42779,13 @@
* });
*
* events.fire({ type: 'foo' }, 'I am bar!');
+ * ```
*
- * @param {string} [name] the optional event name
- * @param {Object} [event] the event object
- * @param {...Object} additional arguments to be passed to the callback functions
+ * @param {string} [type] event type
+ * @param {Object} [data] event or event data
+ * @param {...any} [args] additional arguments the callback will be called with.
*
- * @return {boolean} the events return value, if specified or false if the
- * default action was prevented by listeners
+ * @return {any} The return value. Will be set to `false` if the default was prevented.
*/
EventBus.prototype.fire = function (type, data) {
var event, firstListener, returnValue, args;
@@ -42598,6 +42837,14 @@
}
return returnValue;
};
+
+ /**
+ * Handle an error by firing an event.
+ *
+ * @param {Error} error The error to be handled.
+ *
+ * @return {boolean} Whether the error was handled.
+ */
EventBus.prototype.handleError = function (error) {
return this.fire('error', {
error: error
@@ -42606,6 +42853,14 @@
EventBus.prototype._destroy = function () {
this._listeners = {};
};
+
+ /**
+ * @param {Event} event
+ * @param {any[]} args
+ * @param {EventBusListener} listener
+ *
+ * @return {any}
+ */
EventBus.prototype._invokeListeners = function (event, args, listener) {
var returnValue;
while (listener) {
@@ -42618,6 +42873,14 @@
}
return returnValue;
};
+
+ /**
+ * @param {Event} event
+ * @param {any[]} args
+ * @param {EventBusListener} listener
+ *
+ * @return {any}
+ */
EventBus.prototype._invokeListener = function (event, args, listener) {
var returnValue;
if (listener.callback.__isTomb) {
@@ -42646,7 +42909,7 @@
return returnValue;
};
- /*
+ /**
* Add new listener with a certain priority to the list
* of listeners (for the given event).
*
@@ -42660,7 +42923,7 @@
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
*
* @param {string} event
- * @param {Object} listener { priority, callback }
+ * @param {EventBusListener} listener
*/
EventBus.prototype._addListener = function (event, newListener) {
var listener = this._getListeners(event),
@@ -42691,9 +42954,20 @@
// add new listener to back
previousListener.next = newListener;
};
+
+ /**
+ * @param {string} name
+ *
+ * @return {EventBusListener}
+ */
EventBus.prototype._getListeners = function (name) {
return this._listeners[name];
};
+
+ /**
+ * @param {string} name
+ * @param {EventBusListener} listener
+ */
EventBus.prototype._setListeners = function (name, listener) {
this._listeners[name] = listener;
};
@@ -42741,9 +43015,9 @@
* Invoke function. Be fast...
*
* @param {Function} fn
- * @param {Array