@perses-dev/timeseries-chart-plugin 0.9.1 → 0.10.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.
- package/__mf/js/TimeSeriesChart.2f8b193b.js +6 -0
- package/__mf/js/async/109.604f6c41.js +73 -0
- package/__mf/js/async/133.c48c8cc8.js +110 -0
- package/__mf/js/async/{879.24def15a.js.LICENSE.txt → 133.c48c8cc8.js.LICENSE.txt} +28 -0
- package/__mf/js/async/173.58a1dc61.js +2 -0
- package/__mf/js/async/214.37696543.js +1 -0
- package/__mf/js/async/224.2d3ce51f.js +1 -0
- package/__mf/js/async/238.767e5398.js +1 -0
- package/__mf/js/async/292.9efc6a73.js +1 -0
- package/__mf/js/async/409.97dde548.js +1 -0
- package/__mf/js/async/476.23a59a72.js +1 -0
- package/__mf/js/async/488.031fc875.js +1 -0
- package/__mf/js/async/53.8edfe937.js +2 -0
- package/__mf/js/async/547.bb4f1e58.js +7 -0
- package/__mf/js/async/580.5f4b0dbd.js +38 -0
- package/__mf/js/async/613.20f15bb7.js +1 -0
- package/__mf/js/async/62.f24fce0a.js +1 -0
- package/__mf/js/async/651.e0c9e225.js +1 -0
- package/__mf/js/async/686.0cd9a75c.js +1 -0
- package/__mf/js/async/694.ebf24a00.js +1 -0
- package/__mf/js/async/738.c37f7bca.js +1 -0
- package/__mf/js/async/740.f0e8d499.js +1 -0
- package/__mf/js/async/75.26ec5bee.js +1 -0
- package/__mf/js/async/770.e129dd07.js +1 -0
- package/__mf/js/async/797.72ff552e.js +2 -0
- package/__mf/js/async/863.f147d2ba.js +2 -0
- package/__mf/js/async/960.cd399075.js +2 -0
- package/__mf/js/async/964.719c530c.js +2 -0
- package/__mf/js/async/981.e360e7df.js +2 -0
- package/__mf/js/async/__federation_expose_TimeSeriesChart.f20a0aca.js +3 -0
- package/__mf/js/async/lib-router.25a1f509.js +2 -0
- package/__mf/js/main.42f3cc3e.js +6 -0
- package/lib/CSVExportUtils.d.ts +39 -0
- package/lib/CSVExportUtils.d.ts.map +1 -0
- package/lib/CSVExportUtils.js +212 -0
- package/lib/CSVExportUtils.js.map +1 -0
- package/lib/TimeSeriesChart.d.ts +0 -3
- package/lib/TimeSeriesChart.d.ts.map +1 -1
- package/lib/TimeSeriesChart.js +9 -4
- package/lib/TimeSeriesChart.js.map +1 -1
- package/lib/TimeSeriesChartOptionsEditorSettings.js +1 -0
- package/lib/TimeSeriesChartOptionsEditorSettings.js.map +1 -1
- package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/TimeSeriesExportAction.d.ts +4 -0
- package/lib/TimeSeriesExportAction.d.ts.map +1 -0
- package/lib/TimeSeriesExportAction.js +69 -0
- package/lib/TimeSeriesExportAction.js.map +1 -0
- package/lib/cjs/CSVExportUtils.js +246 -0
- package/lib/cjs/TimeSeriesChart.js +8 -1
- package/lib/cjs/TimeSeriesChartOptionsEditorSettings.js +1 -0
- package/lib/cjs/TimeSeriesExportAction.js +123 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/utils/data-transform.js +0 -49
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/data-transform.d.ts +1 -5
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +1 -49
- package/lib/utils/data-transform.js.map +1 -1
- package/mf-manifest.json +41 -90
- package/mf-stats.json +41 -90
- package/package.json +12 -4
- package/__mf/js/983.9bbeba19.js +0 -5
- package/__mf/js/TimeSeriesChart.63488d0a.js +0 -5
- package/__mf/js/async/171.598de6a9.js +0 -7
- package/__mf/js/async/173.f6f7e45b.js +0 -2
- package/__mf/js/async/214.2d4431c6.js +0 -1
- package/__mf/js/async/223.def4d0a9.js +0 -1
- package/__mf/js/async/224.ce414ffb.js +0 -1
- package/__mf/js/async/238.625b8a48.js +0 -1
- package/__mf/js/async/281.a2a87c37.js +0 -2
- package/__mf/js/async/292.311e6eb0.js +0 -1
- package/__mf/js/async/359.18a264e7.js +0 -2
- package/__mf/js/async/409.2808c63e.js +0 -1
- package/__mf/js/async/476.45fca8d3.js +0 -1
- package/__mf/js/async/488.0d0b1a91.js +0 -1
- package/__mf/js/async/620.d6f96402.js +0 -2
- package/__mf/js/async/651.80087530.js +0 -1
- package/__mf/js/async/656.d43503a5.js +0 -1
- package/__mf/js/async/694.27c70ab1.js +0 -1
- package/__mf/js/async/738.0a12bb44.js +0 -1
- package/__mf/js/async/740.67107c3c.js +0 -1
- package/__mf/js/async/75.5952779d.js +0 -1
- package/__mf/js/async/755.f76e3538.js +0 -38
- package/__mf/js/async/770.78a741ab.js +0 -1
- package/__mf/js/async/780.3fa36115.js +0 -110
- package/__mf/js/async/780.3fa36115.js.LICENSE.txt +0 -27
- package/__mf/js/async/845.6d99c354.js +0 -73
- package/__mf/js/async/879.24def15a.js +0 -2
- package/__mf/js/async/960.3047096d.js +0 -2
- package/__mf/js/async/964.6dfbf211.js +0 -2
- package/__mf/js/async/981.77f901c0.js +0 -2
- package/__mf/js/async/__federation_expose_TimeSeriesChart.cb3d3f05.js +0 -1
- package/__mf/js/async/lib-router.098fc614.js +0 -2
- package/__mf/js/main.cca17449.js +0 -1
- /package/__mf/js/async/{845.6d99c354.js.LICENSE.txt → 109.604f6c41.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{173.f6f7e45b.js.LICENSE.txt → 173.58a1dc61.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{359.18a264e7.js.LICENSE.txt → 53.8edfe937.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{171.598de6a9.js.LICENSE.txt → 547.bb4f1e58.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{281.a2a87c37.js.LICENSE.txt → 797.72ff552e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{620.d6f96402.js.LICENSE.txt → 863.f147d2ba.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{960.3047096d.js.LICENSE.txt → 960.cd399075.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{964.6dfbf211.js.LICENSE.txt → 964.719c530c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{981.77f901c0.js.LICENSE.txt → 981.e360e7df.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.098fc614.js.LICENSE.txt → lib-router.25a1f509.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 53.8edfe937.js.LICENSE.txt */
|
|
2
|
+
(self.chunk_TimeSeriesChart=self.chunk_TimeSeriesChart||[]).push([["53"],{14046:function(t,r,e){"use strict";e.d(r,{Dc:()=>s,FB:()=>a,K2:()=>n,c7:()=>i,gO:()=>o});let n="last",i={first:function(t){return a(t,"first")},last:function(t){return a(t,"last")},"first-number":function(t){return a(t,"first-number")},"last-number":function(t){return a(t,"last-number")},mean:function(t){return a(t,"mean")},sum:function(t){return a(t,"sum")},min:function(t){return a(t,"min")},max:function(t){return a(t,"max")}},o={first:{label:"First",description:"First value"},last:{label:"Last",description:"Last value"},"first-number":{label:"First *",description:"First numeric value"},"last-number":{label:"Last *",description:"Last numeric value"},mean:{label:"Avg",description:"Average value excluding nulls"},sum:{label:"Sum",description:"The sum of all values"},min:{label:"Min",description:"Minimum value"},max:{label:"Max",description:"Maximum value"}};function s(t,r){let e=r.reduce((t,r)=>(t[r]=void 0,t),{}),n=0,i=0;return t.forEach((r,o)=>{let s=r[1];0===o&&"first"in e&&(e.first=s),o===t.length-1&&"last"in e&&(e.last=s),"number"==typeof s&&(n+=1,i+=s,"first-number"in e&&void 0===e["first-number"]&&(e["first-number"]=s),"last-number"in e&&(e["last-number"]=s),"min"in e&&("number"!=typeof e.min?e.min=s:e.min=Math.min(e.min,s)),"max"in e&&("number"!=typeof e.max?e.max=s:e.max=Math.max(e.max,s)))}),n>0&&"sum"in e&&(e.sum=i),n>0&&"mean"in e&&(e.mean=i/n),e}function a(t,r){return s(t,[r])[r]}},69481:function(t,r,e){"use strict";e.d(r,{C5:()=>ek,m6:()=>eD,Rj:()=>ej});var n=e(70252);function i(t){return"number"==typeof t}function o(t){return!!t&&"object"==typeof t&&"function"==typeof t.constructor&&(!0===t.isBigNumber&&"object"==typeof t.constructor.prototype&&!0===t.constructor.prototype.isBigNumber||"function"==typeof t.constructor.isDecimal&&!0===t.constructor.isDecimal(t))}function s(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isComplex||!1}function a(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isFraction||!1}function u(t){return t&&!0===t.constructor.prototype.isUnit||!1}function f(t){return"string"==typeof t}var c=Array.isArray;function h(t){return t&&!0===t.constructor.prototype.isMatrix||!1}function p(t){return Array.isArray(t)||h(t)}function l(t){return t&&t.isDenseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function d(t){return t&&t.isSparseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function m(t){return t&&!0===t.constructor.prototype.isRange||!1}function g(t){return t&&!0===t.constructor.prototype.isIndex||!1}function v(t){return"boolean"==typeof t}function y(t){return t&&!0===t.constructor.prototype.isResultSet||!1}function w(t){return t&&!0===t.constructor.prototype.isHelp||!1}function x(t){return"function"==typeof t}function b(t){return t instanceof Date}function N(t){return t instanceof RegExp}function _(t){return!!(t&&"object"==typeof t&&t.constructor===Object&&!s(t)&&!a(t))}function M(t){return null===t}function E(t){return void 0===t}function O(t){return t&&!0===t.isAccessorNode&&!0===t.constructor.prototype.isNode||!1}function A(t){return t&&!0===t.isArrayNode&&!0===t.constructor.prototype.isNode||!1}function z(t){return t&&!0===t.isAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function S(t){return t&&!0===t.isBlockNode&&!0===t.constructor.prototype.isNode||!1}function F(t){return t&&!0===t.isConditionalNode&&!0===t.constructor.prototype.isNode||!1}function C(t){return t&&!0===t.isConstantNode&&!0===t.constructor.prototype.isNode||!1}function I(t){return t&&!0===t.isFunctionAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function T(t){return t&&!0===t.isFunctionNode&&!0===t.constructor.prototype.isNode||!1}function j(t){return t&&!0===t.isIndexNode&&!0===t.constructor.prototype.isNode||!1}function D(t){return t&&!0===t.isNode&&!0===t.constructor.prototype.isNode||!1}function k(t){return t&&!0===t.isObjectNode&&!0===t.constructor.prototype.isNode||!1}function P(t){return t&&!0===t.isOperatorNode&&!0===t.constructor.prototype.isNode||!1}function R(t){return t&&!0===t.isParenthesisNode&&!0===t.constructor.prototype.isNode||!1}function B(t){return t&&!0===t.isRangeNode&&!0===t.constructor.prototype.isNode||!1}function q(t){return t&&!0===t.isSymbolNode&&!0===t.constructor.prototype.isNode||!1}function U(t){return t&&!0===t.constructor.prototype.isChain||!1}function L(t){var r=typeof t;return"object"===r?null===t?"null":Array.isArray(t)?"Array":t instanceof Date?"Date":t instanceof RegExp?"RegExp":o(t)?"BigNumber":s(t)?"Complex":a(t)?"Fraction":h(t)?"Matrix":u(t)?"Unit":g(t)?"Index":m(t)?"Range":y(t)?"ResultSet":D(t)?t.type:U(t)?"Chain":w(t)?"Help":"Object":"function"===r?"Function":r}function Z(t){var r=typeof t;if("number"===r||"string"===r||"boolean"===r||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return Z(t)});if(t instanceof Date)return new Date(t.valueOf());if(o(t))return t;if(t instanceof RegExp)throw TypeError("Cannot clone "+t);return J(t,Z)}function J(t,r){var e={};for(var n in t)V(t,n)&&(e[n]=r(t[n]));return e}function W(t,r){var e,n,i;if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(n=0,i=t.length;n<i;n++)if(!W(t[n],r[n]))return!1;return!0}if("function"==typeof t)return t===r;if(!(t instanceof Object))return t===r;if(Array.isArray(r)||!(r instanceof Object))return!1;for(e in t)if(!(e in r)||!W(t[e],r[e]))return!1;for(e in r)if(!(e in t))return!1;return!0}function H(t,r,e){var n,i=!0;Object.defineProperty(t,r,{get:function(){return i&&(n=e(),i=!1),n},set:function(t){n=t,i=!1},configurable:!0,enumerable:!0})}function V(t,r){return t&&Object.hasOwnProperty.call(t,r)}function $(t){return Object.keys(t).map(r=>t[r])}var Y=e(8317);function G(t,r,e,n){function i(n){var i=function(t,r){for(var e={},n=0;n<r.length;n++){var i=r[n],o=t[i];void 0!==o&&(e[i]=o)}return e}(n,r.map(K));return function(t,r,e){if(!r.filter(t=>{var r;return!((r=t)&&"?"===r[0])}).every(t=>void 0!==e[t])){var n=r.filter(t=>void 0===e[t]);throw Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(n.map(t=>'"'.concat(t,'"')).join(", "),"."))}}(t,r,n),e(i)}return i.isFactory=!0,i.fn=t,i.dependencies=r.slice().sort(),n&&(i.meta=n),i}function X(t){return"function"==typeof t&&"string"==typeof t.fn&&Array.isArray(t.dependencies)}function K(t){return t&&"?"===t[0]?t.slice(1):t}function Q(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)}function tt(t,r,e){var n="";if(e){if(e<1)throw Error("size must be in greater than 0");if(!Q(e))throw Error("size must be an integer");if(t>2**(e-1)-1||t<-(2**(e-1)))throw Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!Q(t))throw Error("Value must be an integer");t<0&&(t+=2**e),n="i".concat(e)}var i="";return t<0&&(t=-t,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[r]).concat(t.toString(r)).concat(n)}function tr(t,r){if("function"==typeof r)return r(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var e,n,o="auto";if(r&&(r.notation&&(o=r.notation),i(r)?e=r:i(r.precision)&&(e=r.precision),r.wordSize)&&"number"!=typeof(n=r.wordSize))throw Error('Option "wordSize" must be a number');switch(o){case"fixed":return function(t,r){if(isNaN(t)||!isFinite(t))return String(t);var e=te(t),n="number"==typeof r?ti(e,e.exponent+1+r):e,i=n.coefficients,o=n.exponent+1,s=o+(r||0);return i.length<s&&(i=i.concat(to(s-i.length))),o<0&&(i=to(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(t,e);case"exponential":return tn(t,e);case"engineering":return function(t,r){if(isNaN(t)||!isFinite(t))return String(t);var e=ti(te(t),r),n=e.exponent,o=e.coefficients,s=n%3==0?n:n<0?n-3-n%3:n-n%3;if(i(r))for(;r>o.length||n-s+1>o.length;)o.push(0);else for(var a=Math.abs(n-s)-(o.length-1),u=0;u<a;u++)o.push(0);for(var f=Math.abs(n-s),c=1;f>0;)c++,f--;var h=o.slice(c).join(""),p=i(r)&&h.length||h.match(/[1-9]/)?"."+h:"",l=o.slice(0,c).join("")+p+"e"+(n>=0?"+":"")+s.toString();return e.sign+l}(t,e);case"bin":return tt(t,2,n);case"oct":return tt(t,8,n);case"hex":return tt(t,16,n);case"auto":return(function(t,r,e){if(isNaN(t)||!isFinite(t))return String(t);var n=e&&void 0!==e.lowerExp?e.lowerExp:-3,i=e&&void 0!==e.upperExp?e.upperExp:5,o=te(t),s=r?ti(o,r):o;if(s.exponent<n||s.exponent>=i)return tn(t,r);var a=s.coefficients,u=s.exponent;a.length<r&&(a=a.concat(to(r-a.length))),a=a.concat(to(u-a.length+1+(a.length<r?r-a.length:0))),a=to(-u).concat(a);var f=u>0?u:0;return f<a.length-1&&a.splice(f+1,0,"."),s.sign+a.join("")})(t,e,r&&r).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],r=arguments[4];return"."!==t?t+r:r});default:throw Error('Unknown notation "'+o+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function te(t){var r=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw SyntaxError("Invalid number "+t);var e=r[1],n=r[2],i=parseFloat(r[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(t){return i-=t.length,""}).replace(/0*$/,"").split("").map(function(t){return parseInt(t)});return 0===s.length&&(s.push(0),i++),{sign:e,coefficients:s,exponent:i}}function tn(t,r){if(isNaN(t)||!isFinite(t))return String(t);var e=te(t),n=r?ti(e,r):e,i=n.coefficients,o=n.exponent;i.length<r&&(i=i.concat(to(r-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function ti(t,r){for(var e={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=e.coefficients;r<=0;)n.unshift(0),e.exponent++,r++;if(n.length>r&&n.splice(r,n.length-r)[0]>=5){var i=r-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),e.exponent++,i++),i--,n[i]++}return e}function to(t){for(var r=[],e=0;e<t;e++)r.push(0);return r}var ts=Number.EPSILON||2220446049250313e-31;function ta(t,r,e){if(null==e)return t===r;if(t===r)return!0;if(isNaN(t)||isNaN(r))return!1;if(isFinite(t)&&isFinite(r)){var n=Math.abs(t-r);return n<ts||n<=Math.max(Math.abs(t),Math.abs(r))*e}return!1}function tu(t,r,e){var n=new t.constructor(2),i="";if(e){if(e<1)throw Error("size must be in greater than 0");if(!Q(e))throw Error("size must be an integer");if(t.greaterThan(n.pow(e-1).sub(1))||t.lessThan(n.pow(e-1).mul(-1)))throw Error("Value must be in range [-2^".concat(e-1,", 2^").concat(e-1,"-1]"));if(!t.isInteger())throw Error("Value must be an integer");t.lessThan(0)&&(t=t.add(n.pow(e))),i="i".concat(e)}switch(r){case 2:return"".concat(t.toBinary()).concat(i);case 8:return"".concat(t.toOctal()).concat(i);case 16:return"".concat(t.toHexadecimal()).concat(i);default:throw Error("Base ".concat(r," not supported "))}}function tf(t,r){return void 0!==r?t.toExponential(r-1):t.toExponential()}function tc(t,r){var e=function(t,r){var e;if("number"==typeof t)return tr(t,r);if(o(t))return function(t,r){if("function"==typeof r)return r(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var e="auto";if(void 0!==r&&(r.notation&&(e=r.notation),"number"==typeof r?h=r:r.precision&&(h=r.precision),r.wordSize)&&"number"!=typeof(p=r.wordSize))throw Error('Option "wordSize" must be a number');switch(e){case"fixed":return n=t,i=h,n.toFixed(i);case"exponential":return tf(t,h);case"engineering":return o=t,s=h,u=(a=o.e)%3==0?a:a<0?a-3-a%3:a-a%3,-1!==(c=(f=o.mul(Math.pow(10,-u))).toPrecision(s)).indexOf("e")&&(c=f.toString()),c+"e"+(a>=0?"+":"")+u.toString();case"bin":return tu(t,2,p);case"oct":return tu(t,8,p);case"hex":return tu(t,16,p);case"auto":var n,i,o,s,a,u,f,c,h,p,l=r&&void 0!==r.lowerExp?r.lowerExp:-3,d=r&&void 0!==r.upperExp?r.upperExp:5;if(t.isZero())return"0";var m=t.toSignificantDigits(h),g=m.e;return(g>=l&&g<d?m.toFixed():tf(t,h)).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],r=arguments[4];return"."!==t?t+r:r});default:throw Error('Unknown notation "'+e+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(t,r);if((e=t)&&"object"==typeof e&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d)if(!r||"decimal"!==r.fraction)return t.s*t.n+"/"+t.d;else return t.toString();if(Array.isArray(t))return function t(r,e){if(!Array.isArray(r))return tc(r,e);for(var n="[",i=r.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=t(r[o],e);return n+"]"}(t,r);if(f(t))return'"'+t+'"';if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"==typeof t)if("function"==typeof t.format)return t.format(r);else return t&&t.toString(r)!==({}).toString()?t.toString(r):"{"+Object.keys(t).map(e=>'"'+e+'": '+tc(t[e],r)).join(", ")+"}";return String(t)}(t,r);return r&&"object"==typeof r&&"truncate"in r&&e.length>r.truncate?e.substring(0,r.truncate-3)+"...":e}function th(t,r,e){if(!(this instanceof th))throw SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=r,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=Error().stack}function tp(t,r,e){if(!(this instanceof tp))throw SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=e),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function tl(t){for(var r=[];Array.isArray(t);)r.push(t.length),t=t[0];return r}function td(t,r){if(0===r.length){if(Array.isArray(t))throw new th(t.length,0)}else!function t(r,e,n){var i,o=r.length;if(o!==e[n])throw new th(o,e[n]);if(n<e.length-1){var s=n+1;for(i=0;i<o;i++){if(!Array.isArray(r[i]))throw new th(e.length-1,e.length,"<");t(r[i],e,s)}}else for(i=0;i<o;i++)if(Array.isArray(r[i]))throw new th(e.length+1,e.length,">")}(t,r,0)}function tm(t,r){if(!i(t)||!Q(t))throw TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof r&&t>=r)throw new tp(t,r)}function tg(t,r,e){if(!Array.isArray(t)||!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw Error("Resizing to scalar is not supported");return r.forEach(function(t){if(!i(t)||!Q(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+tc(r)+")")}),function t(r,e,n,i){var o,s,a=r.length,u=e[n],f=Math.min(a,u);if(r.length=u,n<e.length-1){var c=n+1;for(o=0;o<f;o++)Array.isArray(s=r[o])||(s=[s],r[o]=s),t(s,e,c,i);for(o=f;o<u;o++)s=[],r[o]=s,t(s,e,c,i)}else{for(o=0;o<f;o++)for(;Array.isArray(r[o]);)r[o]=r[o][0];for(o=f;o<u;o++)r[o]=i}}(t,r,0,void 0!==e?e:0),t}function tv(t,r){var e=ty(t),n=t.slice(),i=t.indexOf(-1);if(t.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(r%e==0)n[i]=-r/e;else throw Error("Could not replace wildcard, since "+r+" is no multiple of "+-e);return n}function ty(t){return t.reduce((t,r)=>t*r,1)}function tw(t,r,e,n){var i=n||tl(t);if(e)for(var o=0;o<e;o++)t=[t],i.unshift(1);for(t=function t(r,e,n){var i,o;if(Array.isArray(r)){var s=n+1;for(i=0,o=r.length;i<o;i++)r[i]=t(r[i],e,s)}else for(var a=n;a<e;a++)r=[r];return r}(t,r,0);i.length<r;)i.push(1);return t}function tx(t,r){for(var e,n=0,i=0;i<t.length;i++){var o=t[i],s=Array.isArray(o);if(0===i&&s&&(n=o.length),s&&o.length!==n)return;var a=s?tx(o,r):r(o);if(void 0===e)e=a;else if(e!==a)return"mixed"}return e}function tb(t,r){return -1!==t.indexOf(r)}function tN(t,r,e,n){if(!(this instanceof tN))throw SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=r,this.min=e,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+r+" provided, "+e+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}th.prototype=RangeError(),th.prototype.constructor=RangeError,th.prototype.name="DimensionError",th.prototype.isDimensionError=!0,tp.prototype=RangeError(),tp.prototype.constructor=RangeError,tp.prototype.name="IndexError",tp.prototype.isIndexError=!0,tN.prototype=Error(),tN.prototype.constructor=Error,tN.prototype.name="ArgumentsError",tN.prototype.isArgumentsError=!0;var t_={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},tM=["Matrix","Array"],tE=["number","BigNumber","Fraction"];function tO(t,r,e){var n;void 0!==t[r]&&(n=t[r],-1===e.indexOf(n))&&console.warn('Warning: Unknown value "'+t[r]+'" for configuration option "'+r+'". Available options: '+e.map(t=>JSON.stringify(t)).join(", ")+".")}var tA,tz,tS="0123456789abcdef",tF="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",tC="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tI={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},tT=!0,tj="[DecimalError] ",tD=tj+"Invalid argument: ",tk=tj+"Precision limit exceeded",tP=tj+"crypto unavailable",tR="[object Decimal]",tB=Math.floor,tq=Math.pow,tU=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,tL=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,tZ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,tJ=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,tW=tF.length-1,tH=tC.length-1,tV={toStringTag:tR};function t$(t){var r,e,n,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,r=1;r<i;r++)(e=7-(n=t[r]+"").length)&&(o+=t5(e)),o+=n;(e=7-(n=(s=t[r])+"").length)&&(o+=t5(e))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function tY(t,r,e){if(t!==~~t||t<r||t>e)throw Error(tD+t)}function tG(t,r,e,n){var i,o,s,a;for(o=t[0];o>=10;o/=10)--r;return--r<0?(r+=7,i=0):(i=Math.ceil((r+1)/7),r%=7),o=tq(10,7-r),a=t[i]%o|0,null==n?r<3?(0==r?a=a/100|0:1==r&&(a=a/10|0),s=e<4&&99999==a||e>3&&49999==a||5e4==a||0==a):s=(e<4&&a+1==o||e>3&&a+1==o/2)&&(t[i+1]/o/100|0)==tq(10,r-2)-1||(a==o/2||0==a)&&(t[i+1]/o/100|0)==0:r<4?(0==r?a=a/1e3|0:1==r?a=a/100|0:2==r&&(a=a/10|0),s=(n||e<4)&&9999==a||!n&&e>3&&4999==a):s=((n||e<4)&&a+1==o||!n&&e>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==tq(10,r-3)-1,s}function tX(t,r,e){for(var n,i,o=[0],s=0,a=t.length;s<a;){for(i=o.length;i--;)o[i]*=r;for(o[0]+=tS.indexOf(t.charAt(s++)),n=0;n<o.length;n++)o[n]>e-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/e|0,o[n]%=e)}return o.reverse()}tV.absoluteValue=tV.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),tQ(t)},tV.ceil=function(){return tQ(new this.constructor(this),this.e+1,2)},tV.clampedTo=tV.clamp=function(t,r){var e=this.constructor;if(t=new e(t),r=new e(r),!t.s||!r.s)return new e(NaN);if(t.gt(r))throw Error(tD+r);return 0>this.cmp(t)?t:this.cmp(r)>0?r:new e(this)},tV.comparedTo=tV.cmp=function(t){var r,e,n,i,o=this.d,s=(t=new this.constructor(t)).d,a=this.s,u=t.s;if(!o||!s)return a&&u?a!==u?a:o===s?0:!o^a<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?a:s[0]?-u:0;if(a!==u)return a;if(this.e!==t.e)return this.e>t.e^a<0?1:-1;for(r=0,e=(n=o.length)<(i=s.length)?n:i;r<e;++r)if(o[r]!==s[r])return o[r]>s[r]^a<0?1:-1;return n===i?0:n>i^a<0?1:-1},tV.cosine=tV.cos=function(){var t,r,e=this,n=e.constructor;return e.d?e.d[0]?(t=n.precision,r=n.rounding,n.precision=t+Math.max(e.e,e.sd())+7,n.rounding=1,e=function(t,r){var e,n,i;if(r.isZero())return r;(n=r.d.length)<32?i=(1/ri(4,e=Math.ceil(n/3))).toString():(e=16,i="2.3283064365386962890625e-10"),t.precision+=e,r=rn(t,1,r.times(i),new t(1));for(var o=e;o--;){var s=r.times(r);r=s.times(s).minus(s).times(8).plus(1)}return t.precision-=e,r}(n,ro(n,e)),n.precision=t,n.rounding=r,tQ(2==tz||3==tz?e.neg():e,t,r,!0)):new n(1):new n(NaN)},tV.cubeRoot=tV.cbrt=function(){var t,r,e,n,i,o,s,a,u,f,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(tT=!1,(o=this.s*tq(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new c(o.toString()):(e=t$(this.d),(o=((t=this.e)-e.length+1)%3)&&(e+=1==o||-2==o?"0":"00"),o=tq(e,1/3),t=tB((t+1)/3)-(t%3==(t<0?-1:2)),(n=new c(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)).s=this.s),s=(t=c.precision)+3;;)if(n=tK((f=(u=(a=n).times(a).times(a)).plus(this)).plus(this).times(a),f.plus(u),s+2,1),t$(a.d).slice(0,s)===(e=t$(n.d)).slice(0,s)){if("9999"!=(e=e.slice(s-3,s+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(tQ(n,t+1,1),r=!n.times(n).times(n).eq(this));break}if(!i&&(tQ(a,t+1,0),a.times(a).times(a).eq(this))){n=a;break}s+=4,i=1}return tT=!0,tQ(n,t,c.rounding,r)},tV.decimalPlaces=tV.dp=function(){var t,r=this.d,e=NaN;if(r){if(e=((t=r.length-1)-tB(this.e/7))*7,t=r[t])for(;t%10==0;t/=10)e--;e<0&&(e=0)}return e},tV.dividedBy=tV.div=function(t){return tK(this,new this.constructor(t))},tV.dividedToIntegerBy=tV.divToInt=function(t){var r=this.constructor;return tQ(tK(this,new r(t),0,1,1),r.precision,r.rounding)},tV.equals=tV.eq=function(t){return 0===this.cmp(t)},tV.floor=function(){return tQ(new this.constructor(this),this.e+1,3)},tV.greaterThan=tV.gt=function(t){return this.cmp(t)>0},tV.greaterThanOrEqualTo=tV.gte=function(t){var r=this.cmp(t);return 1==r||0===r},tV.hyperbolicCosine=tV.cosh=function(){var t,r,e,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;e=s.precision,n=s.rounding,s.precision=e+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?r=(1/ri(4,t=Math.ceil(i/3))).toString():(t=16,r="2.3283064365386962890625e-10"),o=rn(s,1,o.times(r),new s(1),!0);for(var u,f=t,c=new s(8);f--;)u=o.times(o),o=a.minus(u.times(c.minus(u.times(c))));return tQ(o,s.precision=e,s.rounding=n,!0)},tV.hyperbolicSine=tV.sinh=function(){var t,r,e,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(r=o.precision,e=o.rounding,o.precision=r+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=rn(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=rn(o,2,i=i.times(1/ri(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),f=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(f))))}return o.precision=r,o.rounding=e,tQ(i,r,e,!0)},tV.hyperbolicTangent=tV.tanh=function(){var t,r,e=this.constructor;return this.isFinite()?this.isZero()?new e(this):(t=e.precision,r=e.rounding,e.precision=t+7,e.rounding=1,tK(this.sinh(),this.cosh(),e.precision=t,e.rounding=r)):new e(this.s)},tV.inverseCosine=tV.acos=function(){var t=this,r=t.constructor,e=t.abs().cmp(1),n=r.precision,i=r.rounding;return -1!==e?0===e?t.isNeg()?t7(r,n,i):new r(0):new r(NaN):t.isZero()?t7(r,n+4,i).times(.5):(r.precision=n+6,r.rounding=1,t=new r(1).minus(t).div(t.plus(1)).sqrt().atan(),r.precision=n,r.rounding=i,t.times(2))},tV.inverseHyperbolicCosine=tV.acosh=function(){var t,r,e=this,n=e.constructor;return e.lte(1)?new n(e.eq(1)?0:NaN):e.isFinite()?(t=n.precision,r=n.rounding,n.precision=t+Math.max(Math.abs(e.e),e.sd())+4,n.rounding=1,tT=!1,e=e.times(e).minus(1).sqrt().plus(e),tT=!0,n.precision=t,n.rounding=r,e.ln()):new n(e)},tV.inverseHyperbolicSine=tV.asinh=function(){var t,r,e=this,n=e.constructor;return!e.isFinite()||e.isZero()?new n(e):(t=n.precision,r=n.rounding,n.precision=t+2*Math.max(Math.abs(e.e),e.sd())+6,n.rounding=1,tT=!1,e=e.times(e).plus(1).sqrt().plus(e),tT=!0,n.precision=t,n.rounding=r,e.ln())},tV.inverseHyperbolicTangent=tV.atanh=function(){var t,r,e,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,r=o.rounding,Math.max(n=i.sd(),t)<-(2*i.e)-1)?tQ(new o(i),t,r,!0):(o.precision=e=n-i.e,i=tK(i.plus(1),new o(1).minus(i),e+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=r,i.times(.5)):new o(NaN)},tV.inverseSine=tV.asin=function(){var t,r,e,n,i=this,o=i.constructor;return i.isZero()?new o(i):(r=i.abs().cmp(1),e=o.precision,n=o.rounding,-1!==r)?0===r?((t=t7(o,e+4,n).times(.5)).s=i.s,t):new o(NaN):(o.precision=e+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=e,o.rounding=n,i.times(2))},tV.inverseTangent=tV.atan=function(){var t,r,e,n,i,o,s,a,u,f=this,c=f.constructor,h=c.precision,p=c.rounding;if(f.isFinite()){if(f.isZero())return new c(f);else if(f.abs().eq(1)&&h+4<=tH)return(s=t7(c,h+4,p).times(.25)).s=f.s,s}else{if(!f.s)return new c(NaN);if(h+4<=tH)return(s=t7(c,h+4,p).times(.5)).s=f.s,s}for(c.precision=a=h+10,c.rounding=1,t=e=Math.min(28,a/7+2|0);t;--t)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(tT=!1,r=Math.ceil(a/7),n=1,u=f.times(f),s=new c(f),i=f;-1!==t;)if(i=i.times(u),o=s.minus(i.div(n+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(n+=2))).d[r])for(t=r;s.d[t]===o.d[t]&&t--;);return e&&(s=s.times(2<<e-1)),tT=!0,tQ(s,c.precision=h,c.rounding=p,!0)},tV.isFinite=function(){return!!this.d},tV.isInteger=tV.isInt=function(){return!!this.d&&tB(this.e/7)>this.d.length-2},tV.isNaN=function(){return!this.s},tV.isNegative=tV.isNeg=function(){return this.s<0},tV.isPositive=tV.isPos=function(){return this.s>0},tV.isZero=function(){return!!this.d&&0===this.d[0]},tV.lessThan=tV.lt=function(t){return 0>this.cmp(t)},tV.lessThanOrEqualTo=tV.lte=function(t){return 1>this.cmp(t)},tV.logarithm=tV.log=function(t){var r,e,n,i,o,s,a,u=this.constructor,f=u.precision,c=u.rounding;if(null==t)t=new u(10),r=!0;else{if(e=(t=new u(t)).d,t.s<0||!e||!e[0]||t.eq(1))return new u(NaN);r=t.eq(10)}if(e=this.d,this.s<0||!e||!e[0]||this.eq(1))return new u(e&&!e[0]?-1/0:1!=this.s?NaN:e?0:1/0);if(r)if(e.length>1)i=!0;else{for(n=e[0];n%10==0;)n/=10;i=1!==n}if(tT=!1,tG((a=tK(o=rt(this,s=f+5),r?t2(u,s+10):rt(t,s),s,1)).d,n=f,c))do if(s+=10,a=tK(o=rt(this,s),r?t2(u,s+10):rt(t,s),s,1),!i){+t$(a.d).slice(n+1,n+15)+1==1e14&&(a=tQ(a,f+1,0));break}while(tG(a.d,n+=10,c));return tT=!0,tQ(a,f,c)},tV.minus=tV.sub=function(t){var r,e,n,i,o,s,a,u,f,c,h,p,l=this.constructor;if(t=new l(t),!this.d||!t.d)return this.s&&t.s?this.d?t.s=-t.s:t=new l(t.d||this.s!==t.s?this:NaN):t=new l(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.plus(t);if(f=this.d,p=t.d,a=l.precision,u=l.rounding,!f[0]||!p[0]){if(p[0])t.s=-t.s;else{if(!f[0])return new l(3===u?-0:0);t=new l(this)}return tT?tQ(t,a,u):t}if(e=tB(t.e/7),c=tB(this.e/7),f=f.slice(),o=c-e){for((h=o<0)?(r=f,o=-o,s=p.length):(r=p,e=c,s=f.length),o>(n=Math.max(Math.ceil(a/7),s)+2)&&(o=n,r.length=1),r.reverse(),n=o;n--;)r.push(0);r.reverse()}else{for((h=(n=f.length)<(s=p.length))&&(s=n),n=0;n<s;n++)if(f[n]!=p[n]){h=f[n]<p[n];break}o=0}for(h&&(r=f,f=p,p=r,t.s=-t.s),s=f.length,n=p.length-s;n>0;--n)f[s++]=0;for(n=p.length;n>o;){if(f[--n]<p[n]){for(i=n;i&&0===f[--i];)f[i]=1e7-1;--f[i],f[n]+=1e7}f[n]-=p[n]}for(;0===f[--s];)f.pop();for(;0===f[0];f.shift())--e;return f[0]?(t.d=f,t.e=t1(f,e),tT?tQ(t,a,u):t):new l(3===u?-0:0)},tV.modulo=tV.mod=function(t){var r,e=this.constructor;return(t=new e(t),this.d&&t.s&&(!t.d||t.d[0]))?t.d&&(!this.d||this.d[0])?(tT=!1,9==e.modulo?(r=tK(this,t.abs(),0,3,1),r.s*=t.s):r=tK(this,t,0,e.modulo,1),r=r.times(t),tT=!0,this.minus(r)):tQ(new e(this),e.precision,e.rounding):new e(NaN)},tV.naturalExponential=tV.exp=function(){return t6(this)},tV.naturalLogarithm=tV.ln=function(){return rt(this)},tV.negated=tV.neg=function(){var t=new this.constructor(this);return t.s=-t.s,tQ(t)},tV.plus=tV.add=function(t){var r,e,n,i,o,s,a,u,f,c,h=this.constructor;if(t=new h(t),!this.d||!t.d)return this.s&&t.s?this.d||(t=new h(t.d||this.s===t.s?this:NaN)):t=new h(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.minus(t);if(f=this.d,c=t.d,a=h.precision,u=h.rounding,!f[0]||!c[0])return c[0]||(t=new h(this)),tT?tQ(t,a,u):t;if(o=tB(this.e/7),n=tB(t.e/7),f=f.slice(),i=o-n){for(i<0?(e=f,i=-i,s=c.length):(e=c,n=o,s=f.length),i>(s=(o=Math.ceil(a/7))>s?o+1:s+1)&&(i=s,e.length=1),e.reverse();i--;)e.push(0);e.reverse()}for((s=f.length)-(i=c.length)<0&&(i=s,e=c,c=f,f=e),r=0;i;)r=(f[--i]=f[i]+c[i]+r)/1e7|0,f[i]%=1e7;for(r&&(f.unshift(r),++n),s=f.length;0==f[--s];)f.pop();return t.d=f,t.e=t1(f,n),tT?tQ(t,a,u):t},tV.precision=tV.sd=function(t){var r;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(tD+t);return this.d?(r=t4(this.d),t&&this.e+1>r&&(r=this.e+1)):r=NaN,r},tV.round=function(){var t=this.constructor;return tQ(new t(this),this.e+1,t.rounding)},tV.sine=tV.sin=function(){var t,r,e=this,n=e.constructor;return e.isFinite()?e.isZero()?new n(e):(t=n.precision,r=n.rounding,n.precision=t+Math.max(e.e,e.sd())+7,n.rounding=1,e=function(t,r){var e,n=r.d.length;if(n<3)return r.isZero()?r:rn(t,2,r,r);e=(e=1.4*Math.sqrt(n))>16?16:0|e,r=rn(t,2,r=r.times(1/ri(5,e)),r);for(var i,o=new t(5),s=new t(16),a=new t(20);e--;)i=r.times(r),r=r.times(o.plus(i.times(s.times(i).minus(a))));return r}(n,ro(n,e)),n.precision=t,n.rounding=r,tQ(tz>2?e.neg():e,t,r,!0)):new n(NaN)},tV.squareRoot=tV.sqrt=function(){var t,r,e,n,i,o,s=this.d,a=this.e,u=this.s,f=this.constructor;if(1!==u||!s||!s[0])return new f(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(tT=!1,0==(u=Math.sqrt(+this))||u==1/0?(((r=t$(s)).length+a)%2==0&&(r+="0"),u=Math.sqrt(r),a=tB((a+1)/2)-(a<0||a%2),n=new f(r=u==1/0?"5e"+a:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+a)):n=new f(u.toString()),e=(a=f.precision)+3;;)if(n=(o=n).plus(tK(this,o,e+2,1)).times(.5),t$(o.d).slice(0,e)===(r=t$(n.d)).slice(0,e)){if("9999"!=(r=r.slice(e-3,e+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(tQ(n,a+1,1),t=!n.times(n).eq(this));break}if(!i&&(tQ(o,a+1,0),o.times(o).eq(this))){n=o;break}e+=4,i=1}return tT=!0,tQ(n,a,f.rounding,t)},tV.tangent=tV.tan=function(){var t,r,e=this,n=e.constructor;return e.isFinite()?e.isZero()?new n(e):(t=n.precision,r=n.rounding,n.precision=t+10,n.rounding=1,(e=e.sin()).s=1,e=tK(e,new n(1).minus(e.times(e)).sqrt(),t+10,0),n.precision=t,n.rounding=r,tQ(2==tz||4==tz?e.neg():e,t,r,!0)):new n(NaN)},tV.times=tV.mul=function(t){var r,e,n,i,o,s,a,u,f,c=this.constructor,h=this.d,p=(t=new c(t)).d;if(t.s*=this.s,!h||!h[0]||!p||!p[0])return new c(!t.s||h&&!h[0]&&!p||p&&!p[0]&&!h?NaN:!h||!p?t.s/0:0*t.s);for(e=tB(this.e/7)+tB(t.e/7),(u=h.length)<(f=p.length)&&(o=h,h=p,p=o,s=u,u=f,f=s),o=[],n=s=u+f;n--;)o.push(0);for(n=f;--n>=0;){for(r=0,i=u+n;i>n;)a=o[i]+p[n]*h[i-n-1]+r,o[i--]=a%1e7|0,r=a/1e7|0;o[i]=(o[i]+r)%1e7|0}for(;!o[--s];)o.pop();return r?++e:o.shift(),t.d=o,t.e=t1(o,e),tT?tQ(t,c.precision,c.rounding):t},tV.toBinary=function(t,r){return rs(this,2,t,r)},tV.toDecimalPlaces=tV.toDP=function(t,r){var e=this,n=e.constructor;return(e=new n(e),void 0===t)?e:(tY(t,0,1e9),void 0===r?r=n.rounding:tY(r,0,8),tQ(e,t+e.e+1,r))},tV.toExponential=function(t,r){var e,n=this,i=n.constructor;return void 0===t?e=t0(n,!0):(tY(t,0,1e9),void 0===r?r=i.rounding:tY(r,0,8),e=t0(n=tQ(new i(n),t+1,r),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+e:e},tV.toFixed=function(t,r){var e,n,i=this.constructor;return void 0===t?e=t0(this):(tY(t,0,1e9),void 0===r?r=i.rounding:tY(r,0,8),e=t0(n=tQ(new i(this),t+this.e+1,r),!1,t+n.e+1)),this.isNeg()&&!this.isZero()?"-"+e:e},tV.toFraction=function(t){var r,e,n,i,o,s,a,u,f,c,h,p,l=this.d,d=this.constructor;if(!l)return new d(this);if(f=e=new d(1),n=u=new d(0),s=(o=(r=new d(n)).e=t4(l)-this.e-1)%7,r.d[0]=tq(10,s<0?7+s:s),null==t)t=o>0?r:f;else{if(!(a=new d(t)).isInt()||a.lt(f))throw Error(tD+a);t=a.gt(r)?o>0?r:f:a}for(tT=!1,a=new d(t$(l)),c=d.precision,d.precision=o=7*l.length*2;h=tK(a,r,0,1,1),1!=(i=e.plus(h.times(n))).cmp(t);)e=n,n=i,i=f,f=u.plus(h.times(i)),u=i,i=r,r=a.minus(h.times(i)),a=i;return i=tK(t.minus(e),n,0,1,1),u=u.plus(i.times(f)),e=e.plus(i.times(n)),u.s=f.s=this.s,p=1>tK(f,n,o,1).minus(this).abs().cmp(tK(u,e,o,1).minus(this).abs())?[f,n]:[u,e],d.precision=c,tT=!0,p},tV.toHexadecimal=tV.toHex=function(t,r){return rs(this,16,t,r)},tV.toNearest=function(t,r){var e=this,n=e.constructor;if(e=new n(e),null==t){if(!e.d)return e;t=new n(1),r=n.rounding}else{if(t=new n(t),void 0===r?r=n.rounding:tY(r,0,8),!e.d)return t.s?e:t;if(!t.d)return t.s&&(t.s=e.s),t}return t.d[0]?(tT=!1,e=tK(e,t,0,r,1).times(t),tT=!0,tQ(e)):(t.s=e.s,e=t),e},tV.toNumber=function(){return+this},tV.toOctal=function(t,r){return rs(this,8,t,r)},tV.toPower=tV.pow=function(t){var r,e,n,i,o,s,a=this,u=a.constructor,f=+(t=new u(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new u(tq(+a,f));if((a=new u(a)).eq(1))return a;if(n=u.precision,o=u.rounding,t.eq(1))return tQ(a,n,o);if((r=tB(t.e/7))>=t.d.length-1&&(e=f<0?-f:f)<=0x1fffffffffffff)return i=t3(u,a,e,n),t.s<0?new u(1).div(i):tQ(i,n,o);if((s=a.s)<0){if(r<t.d.length-1)return new u(NaN);if((1&t.d[r])==0&&(s=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=s,a}return(r=0!=(e=tq(+a,f))&&isFinite(e)?new u(e+"").e:tB(f*(Math.log("0."+t$(a.d))/Math.LN10+a.e+1)))>u.maxE+1||r<u.minE-1?new u(r>0?s/0:0):(tT=!1,u.rounding=a.s=1,e=Math.min(12,(r+"").length),(i=t6(t.times(rt(a,n+e)),n)).d&&tG((i=tQ(i,n+5,1)).d,n,o)&&(r=n+10,+t$((i=tQ(t6(t.times(rt(a,r+e)),r),r+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=tQ(i,n+1,0))),i.s=s,tT=!0,u.rounding=o,tQ(i,n,o))},tV.toPrecision=function(t,r){var e,n=this,i=n.constructor;return void 0===t?e=t0(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(tY(t,1,1e9),void 0===r?r=i.rounding:tY(r,0,8),e=t0(n=tQ(new i(n),t,r),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+e:e},tV.toSignificantDigits=tV.toSD=function(t,r){var e=this.constructor;return void 0===t?(t=e.precision,r=e.rounding):(tY(t,1,1e9),void 0===r?r=e.rounding:tY(r,0,8)),tQ(new e(this),t,r)},tV.toString=function(){var t=this.constructor,r=t0(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()&&!this.isZero()?"-"+r:r},tV.truncated=tV.trunc=function(){return tQ(new this.constructor(this),this.e+1,1)},tV.valueOf=tV.toJSON=function(){var t=this.constructor,r=t0(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()?"-"+r:r};var tK=function(){function t(t,r,e){var n,i=0,o=t.length;for(t=t.slice();o--;)n=t[o]*r+i,t[o]=n%e|0,i=n/e|0;return i&&t.unshift(i),t}function r(t,r,e,n){var i,o;if(e!=n)o=e>n?1:-1;else for(i=o=0;i<e;i++)if(t[i]!=r[i]){o=t[i]>r[i]?1:-1;break}return o}function e(t,r,e,n){for(var i=0;e--;)t[e]-=i,i=+(t[e]<r[e]),t[e]=i*n+t[e]-r[e];for(;!t[0]&&t.length>1;)t.shift()}return function(n,i,o,s,a,u){var f,c,h,p,l,d,m,g,v,y,w,x,b,N,_,M,E,O,A,z,S=n.constructor,F=n.s==i.s?1:-1,C=n.d,I=i.d;if(!C||!C[0]||!I||!I[0])return new S(!n.s||!i.s||(C?I&&C[0]==I[0]:!I)?NaN:C&&0==C[0]||!I?0*F:F/0);for(u?(l=1,c=n.e-i.e):(u=1e7,l=7,c=tB(n.e/l)-tB(i.e/l)),A=I.length,E=C.length,y=(v=new S(F)).d=[],h=0;I[h]==(C[h]||0);h++);if(I[h]>(C[h]||0)&&c--,null==o?(N=o=S.precision,s=S.rounding):N=a?o+(n.e-i.e)+1:o,N<0)y.push(1),d=!0;else{if(N=N/l+2|0,h=0,1==A){for(p=0,I=I[0],N++;(h<E||p)&&N--;h++)_=p*u+(C[h]||0),y[h]=_/I|0,p=_%I|0;d=p||h<E}else{for((p=u/(I[0]+1)|0)>1&&(I=t(I,p,u),C=t(C,p,u),A=I.length,E=C.length),M=A,x=(w=C.slice(0,A)).length;x<A;)w[x++]=0;(z=I.slice()).unshift(0),O=I[0],I[1]>=u/2&&++O;do p=0,(f=r(I,w,A,x))<0?(b=w[0],A!=x&&(b=b*u+(w[1]||0)),(p=b/O|0)>1?(p>=u&&(p=u-1),g=(m=t(I,p,u)).length,x=w.length,1==(f=r(m,w,g,x))&&(p--,e(m,A<g?z:I,g,u))):(0==p&&(f=p=1),m=I.slice()),(g=m.length)<x&&m.unshift(0),e(w,m,x,u),-1==f&&(x=w.length,(f=r(I,w,A,x))<1&&(p++,e(w,A<x?z:I,x,u))),x=w.length):0===f&&(p++,w=[0]),y[h++]=p,f&&w[0]?w[x++]=C[M]||0:(w=[C[M]],x=1);while((M++<E||void 0!==w[0])&&N--);d=void 0!==w[0]}y[0]||y.shift()}if(1==l)v.e=c,tA=d;else{for(h=1,p=y[0];p>=10;p/=10)h++;v.e=h+c*l-1,tQ(v,a?o+v.e+1:o,s,d)}return v}}();function tQ(t,r,e,n){var i,o,s,a,u,f,c,h,p,l=t.constructor;t:if(null!=r){if(!(h=t.d))return t;for(i=1,a=h[0];a>=10;a/=10)i++;if((o=r-i)<0)o+=7,s=r,u=(c=h[p=0])/tq(10,i-s-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(a=h.length))if(n){for(;a++<=p;)h.push(0);c=u=0,i=1,o%=7,s=o-7+1}else break t;else{for(i=1,c=a=h[p];a>=10;a/=10)i++;o%=7,u=(s=o-7+i)<0?0:c/tq(10,i-s-1)%10|0}if(n=n||r<0||void 0!==h[p+1]||(s<0?c:c%tq(10,i-s-1)),f=e<4?(u||n)&&(0==e||e==(t.s<0?3:2)):u>5||5==u&&(4==e||n||6==e&&(o>0?s>0?c/tq(10,i-s):0:h[p-1])%10&1||e==(t.s<0?8:7)),r<1||!h[0])return h.length=0,f?(r-=t.e+1,h[0]=tq(10,(7-r%7)%7),t.e=-r||0):h[0]=t.e=0,t;if(0==o?(h.length=p,a=1,p--):(h.length=p+1,a=tq(10,7-o),h[p]=s>0?(c/tq(10,i-s)%tq(10,s)|0)*a:0),f)for(;;)if(0==p){for(o=1,s=h[0];s>=10;s/=10)o++;for(s=h[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,1e7==h[0]&&(h[0]=1));break}else{if(h[p]+=a,1e7!=h[p])break;h[p--]=0,a=1}for(o=h.length;0===h[--o];)h.pop()}return tT&&(t.e>l.maxE?(t.d=null,t.e=NaN):t.e<l.minE&&(t.e=0,t.d=[0])),t}function t0(t,r,e){if(!t.isFinite())return rr(t);var n,i=t.e,o=t$(t.d),s=o.length;return r?(e&&(n=e-s)>0?o=o.charAt(0)+"."+o.slice(1)+t5(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+t5(-i-1)+o,e&&(n=e-s)>0&&(o+=t5(n))):i>=s?(o+=t5(i+1-s),e&&(n=e-i-1)>0&&(o=o+"."+t5(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),e&&(n=e-s)>0&&(i+1===s&&(o+="."),o+=t5(n))),o}function t1(t,r){var e=t[0];for(r*=7;e>=10;e/=10)r++;return r}function t2(t,r,e){if(r>tW)throw tT=!0,e&&(t.precision=e),Error(tk);return tQ(new t(tF),r,1,!0)}function t7(t,r,e){if(r>tH)throw Error(tk);return tQ(new t(tC),r,e,!0)}function t4(t){var r=t.length-1,e=7*r+1;if(r=t[r]){for(;r%10==0;r/=10)e--;for(r=t[0];r>=10;r/=10)e++}return e}function t5(t){for(var r="";t--;)r+="0";return r}function t3(t,r,e,n){var i,o=new t(1),s=Math.ceil(n/7+4);for(tT=!1;;){if(e%2&&ra((o=o.times(r)).d,s)&&(i=!0),0===(e=tB(e/2))){e=o.d.length-1,i&&0===o.d[e]&&++o.d[e];break}ra((r=r.times(r)).d,s)}return tT=!0,o}function t9(t){return 1&t.d[t.d.length-1]}function t8(t,r,e){for(var n,i,o=new t(r[0]),s=0;++s<r.length;){if(!(i=new t(r[s])).s){o=i;break}((n=o.cmp(i))===e||0===n&&o.s===e)&&(o=i)}return o}function t6(t,r){var e,n,i,o,s,a,u,f=0,c=0,h=0,p=t.constructor,l=p.rounding,d=p.precision;if(!t.d||!t.d[0]||t.e>17)return new p(t.d?!t.d[0]?1:t.s<0?0:1/0:t.s?t.s<0?0:t:0/0);for(null==r?(tT=!1,u=d):u=r,a=new p(.03125);t.e>-2;)t=t.times(a),h+=5;for(u+=n=Math.log(tq(2,h))/Math.LN10*2+5|0,e=o=s=new p(1),p.precision=u;;){if(o=tQ(o.times(t),u,1),e=e.times(++c),t$((a=s.plus(tK(o,e,u,1))).d).slice(0,u)===t$(s.d).slice(0,u)){for(i=h;i--;)s=tQ(s.times(s),u,1);if(null!=r)return p.precision=d,s;if(!(f<3&&tG(s.d,u-n,l,f)))return tQ(s,p.precision=d,l,tT=!0);p.precision=u+=10,e=o=a=new p(1),c=0,f++}s=a}}function rt(t,r){var e,n,i,o,s,a,u,f,c,h,p,l=1,d=t,m=d.d,g=d.constructor,v=g.rounding,y=g.precision;if(d.s<0||!m||!m[0]||!d.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=d.s?NaN:m?0:d);if(null==r?(tT=!1,c=y):c=r,g.precision=c+=10,n=(e=t$(m)).charAt(0),!(15e14>Math.abs(o=d.e)))return f=t2(g,c+2,y).times(o+""),d=rt(new g(n+"."+e.slice(1)),c-10).plus(f),g.precision=y,null==r?tQ(d,y,v,tT=!0):d;for(;n<7&&1!=n||1==n&&e.charAt(1)>3;)n=(e=t$((d=d.times(t)).d)).charAt(0),l++;for(o=d.e,n>1?(d=new g("0."+e),o++):d=new g(n+"."+e.slice(1)),h=d,u=s=d=tK(d.minus(1),d.plus(1),c,1),p=tQ(d.times(d),c,1),i=3;;){if(s=tQ(s.times(p),c,1),t$((f=u.plus(tK(s,new g(i),c,1))).d).slice(0,c)===t$(u.d).slice(0,c)){if(u=u.times(2),0!==o&&(u=u.plus(t2(g,c+2,y).times(o+""))),u=tK(u,new g(l),c,1),null!=r)return g.precision=y,u;if(!tG(u.d,c-10,v,a))return tQ(u,g.precision=y,v,tT=!0);g.precision=c+=10,f=s=d=tK(h.minus(1),h.plus(1),c,1),p=tQ(d.times(d),c,1),i=a=1}u=f,i+=2}}function rr(t){return String(t.s*t.s/0)}function re(t,r){var e,n,i;for((e=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(e<0&&(e=n),e+=+r.slice(n+1),r=r.substring(0,n)):e<0&&(e=r.length),n=0;48===r.charCodeAt(n);n++);for(i=r.length;48===r.charCodeAt(i-1);--i);if(r=r.slice(n,i)){if(i-=n,t.e=e=e-n-1,t.d=[],n=(e+1)%7,e<0&&(n+=7),n<i){for(n&&t.d.push(+r.slice(0,n)),i-=7;n<i;)t.d.push(+r.slice(n,n+=7));n=7-(r=r.slice(n)).length}else n-=i;for(;n--;)r+="0";t.d.push(+r),tT&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function rn(t,r,e,n,i){var o,s,a,u,f=t.precision,c=Math.ceil(f/7);for(tT=!1,u=e.times(e),a=new t(n);;){if(s=tK(a.times(u),new t(r++*r++),f,1),a=i?n.plus(s):n.minus(s),n=tK(s.times(u),new t(r++*r++),f,1),void 0!==(s=a.plus(n)).d[c]){for(o=c;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=n,n=s,s=o}return tT=!0,s.d.length=c+1,s}function ri(t,r){for(var e=t;--r;)e*=t;return e}function ro(t,r){var e,n=r.s<0,i=t7(t,t.precision,1),o=i.times(.5);if((r=r.abs()).lte(o))return tz=n?4:1,r;if((e=r.divToInt(i)).isZero())tz=n?3:2;else{if((r=r.minus(e.times(i))).lte(o))return tz=t9(e)?n?2:3:n?4:1,r;tz=t9(e)?n?1:4:n?3:2}return r.minus(i).abs()}function rs(t,r,e,n){var i,o,s,a,u,f,c,h,p,l=t.constructor,d=void 0!==e;if(d?(tY(e,1,1e9),void 0===n?n=l.rounding:tY(n,0,8)):(e=l.precision,n=l.rounding),t.isFinite()){for(s=(c=t0(t)).indexOf("."),d?(i=2,16==r?e=4*e-3:8==r&&(e=3*e-2)):i=r,s>=0&&(c=c.replace(".",""),(p=new l(1)).e=c.length-s,p.d=tX(t0(p),10,i),p.e=p.d.length),o=u=(h=tX(c,10,i)).length;0==h[--u];)h.pop();if(h[0]){if(s<0?o--:((t=new l(t)).d=h,t.e=o,h=(t=tK(t,p,e,n,0,i)).d,o=t.e,f=tA),s=h[e],a=i/2,f=f||void 0!==h[e+1],f=n<4?(void 0!==s||f)&&(0===n||n===(t.s<0?3:2)):s>a||s===a&&(4===n||f||6===n&&1&h[e-1]||n===(t.s<0?8:7)),h.length=e,f)for(;++h[--e]>i-1;)h[e]=0,e||(++o,h.unshift(1));for(u=h.length;!h[u-1];--u);for(s=0,c="";s<u;s++)c+=tS.charAt(h[s]);if(d){if(u>1)if(16==r||8==r){for(s=16==r?4:3,--u;u%s;u++)c+="0";for(u=(h=tX(c,i,r)).length;!h[u-1];--u);for(s=1,c="1.";s<u;s++)c+=tS.charAt(h[s])}else c=c.charAt(0)+"."+c.slice(1);c=c+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)c="0"+c;c="0."+c}else if(++o>u)for(o-=u;o--;)c+="0";else o<u&&(c=c.slice(0,o)+"."+c.slice(o))}else c=d?"0p+0":"0";c=(16==r?"0x":2==r?"0b":8==r?"0o":"")+c}else c=rr(t);return t.s<0?"-"+c:c}function ra(t,r){if(t.length>r)return t.length=r,!0}function ru(t){return new this(t).abs()}function rf(t){return new this(t).acos()}function rc(t){return new this(t).acosh()}function rh(t,r){return new this(t).plus(r)}function rp(t){return new this(t).asin()}function rl(t){return new this(t).asinh()}function rd(t){return new this(t).atan()}function rm(t){return new this(t).atanh()}function rg(t,r){t=new this(t),r=new this(r);var e,n=this.precision,i=this.rounding,o=n+4;return t.s&&r.s?t.d||r.d?!r.d||t.isZero()?(e=r.s<0?t7(this,n,i):new this(0)).s=t.s:!t.d||r.isZero()?(e=t7(this,o,1).times(.5)).s=t.s:r.s<0?(this.precision=o,this.rounding=1,e=this.atan(tK(t,r,o,1)),r=t7(this,o,1),this.precision=n,this.rounding=i,e=t.s<0?e.minus(r):e.plus(r)):e=this.atan(tK(t,r,o,1)):(e=t7(this,o,1).times(r.s>0?.25:.75)).s=t.s:e=new this(NaN),e}function rv(t){return new this(t).cbrt()}function ry(t){return tQ(t=new this(t),t.e+1,2)}function rw(t,r,e){return new this(t).clamp(r,e)}function rx(t){if(!t||"object"!=typeof t)throw Error(tj+"Object expected");var r,e,n,i=!0===t.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(r=0;r<o.length;r+=3)if(e=o[r],i&&(this[e]=tI[e]),void 0!==(n=t[e]))if(tB(n)===n&&n>=o[r+1]&&n<=o[r+2])this[e]=n;else throw Error(tD+e+": "+n);if(e="crypto",i&&(this[e]=tI[e]),void 0!==(n=t[e]))if(!0===n||!1===n||0===n||1===n)if(n)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[e]=!0;else throw Error(tP);else this[e]=!1;else throw Error(tD+e+": "+n);return this}function rb(t){return new this(t).cos()}function rN(t){return new this(t).cosh()}function r_(t,r){return new this(t).div(r)}function rM(t){return new this(t).exp()}function rE(t){return tQ(t=new this(t),t.e+1,3)}function rO(){var t,r,e=new this(0);for(t=0,tT=!1;t<arguments.length;)if(r=new this(arguments[t++]),r.d)e.d&&(e=e.plus(r.times(r)));else{if(r.s)return tT=!0,new this(1/0);e=r}return tT=!0,e.sqrt()}function rA(t){return t instanceof r$||t&&t.toStringTag===tR||!1}function rz(t){return new this(t).ln()}function rS(t,r){return new this(t).log(r)}function rF(t){return new this(t).log(2)}function rC(t){return new this(t).log(10)}function rI(){return t8(this,arguments,-1)}function rT(){return t8(this,arguments,1)}function rj(t,r){return new this(t).mod(r)}function rD(t,r){return new this(t).mul(r)}function rk(t,r){return new this(t).pow(r)}function rP(t){var r,e,n,i,o=0,s=new this(1),a=[];if(void 0===t?t=this.precision:tY(t,1,1e9),n=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=r[o])>=429e7?r[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(n*=4);o<n;)(i=r[o]+(r[o+1]<<8)+(r[o+2]<<16)+((127&r[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(r,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(tP);else for(;o<n;)a[o++]=1e7*Math.random()|0;for(n=a[--o],t%=7,n&&t&&(i=tq(10,7-t),a[o]=(n/i|0)*i);0===a[o];o--)a.pop();if(o<0)e=0,a=[0];else{for(e=-1;0===a[0];e-=7)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<7&&(e-=7-n)}return s.e=e,s.d=a,s}function rR(t){return tQ(t=new this(t),t.e+1,this.rounding)}function rB(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function rq(t){return new this(t).sin()}function rU(t){return new this(t).sinh()}function rL(t){return new this(t).sqrt()}function rZ(t,r){return new this(t).sub(r)}function rJ(){var t=0,r=arguments,e=new this(r[0]);for(tT=!1;e.s&&++t<r.length;)e=e.plus(r[t]);return tT=!0,tQ(e,this.precision,this.rounding)}function rW(t){return new this(t).tan()}function rH(t){return new this(t).tanh()}function rV(t){return tQ(t=new this(t),t.e+1,1)}tV[Symbol.for("nodejs.util.inspect.custom")]=tV.toString,tV[Symbol.toStringTag]="Decimal";var r$=tV.constructor=function t(r){var e,n,i;function o(t){var r,e,n;if(!(this instanceof o))return new o(t);if(this.constructor=o,rA(t)){this.s=t.s,tT?!t.d||t.e>o.maxE?(this.e=NaN,this.d=null):t.e<o.minE?(this.e=0,this.d=[0]):(this.e=t.e,this.d=t.d.slice()):(this.e=t.e,this.d=t.d?t.d.slice():t.d);return}if("number"==(n=typeof t)){if(0===t){this.s=1/t<0?-1:1,this.e=0,this.d=[0];return}if(t<0?(t=-t,this.s=-1):this.s=1,t===~~t&&t<1e7){for(r=0,e=t;e>=10;e/=10)r++;tT?r>o.maxE?(this.e=NaN,this.d=null):r<o.minE?(this.e=0,this.d=[0]):(this.e=r,this.d=[t]):(this.e=r,this.d=[t]);return}if(0*t!=0){t||(this.s=NaN),this.e=NaN,this.d=null;return}return re(this,t.toString())}if("string"===n)return 45===(e=t.charCodeAt(0))?(t=t.slice(1),this.s=-1):(43===e&&(t=t.slice(1)),this.s=1),tJ.test(t)?re(this,t):function(t,r){var e,n,i,o,s,a,u,f,c;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),tJ.test(r))return re(t,r)}else if("Infinity"===r||"NaN"===r)return+r||(t.s=NaN),t.e=NaN,t.d=null,t;if(tL.test(r))e=16,r=r.toLowerCase();else if(tU.test(r))e=2;else if(tZ.test(r))e=8;else throw Error(tD+r);for((o=r.search(/p/i))>0?(u=+r.slice(o+1),r=r.substring(2,o)):r=r.slice(2),s=(o=r.indexOf("."))>=0,n=t.constructor,s&&(o=(a=(r=r.replace(".","")).length)-o,i=t3(n,new n(e),o,2*o)),o=c=(f=tX(r,e,1e7)).length-1;0===f[o];--o)f.pop();return o<0?new n(0*t.s):(t.e=t1(f,c),t.d=f,tT=!1,s&&(t=tK(t,i,4*a)),u&&(t=t.times(54>Math.abs(u)?tq(2,u):r$.pow(2,u))),tT=!0,t)}(this,t);if("bigint"===n)return t<0?(t=-t,this.s=-1):this.s=1,re(this,t.toString());throw Error(tD+t)}if(o.prototype=tV,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=rx,o.clone=t,o.isDecimal=rA,o.abs=ru,o.acos=rf,o.acosh=rc,o.add=rh,o.asin=rp,o.asinh=rl,o.atan=rd,o.atanh=rm,o.atan2=rg,o.cbrt=rv,o.ceil=ry,o.clamp=rw,o.cos=rb,o.cosh=rN,o.div=r_,o.exp=rM,o.floor=rE,o.hypot=rO,o.ln=rz,o.log=rS,o.log10=rC,o.log2=rF,o.max=rI,o.min=rT,o.mod=rj,o.mul=rD,o.pow=rk,o.random=rP,o.round=rR,o.sign=rB,o.sin=rq,o.sinh=rU,o.sqrt=rL,o.sub=rZ,o.sum=rJ,o.tan=rW,o.tanh=rH,o.trunc=rV,void 0===r&&(r={}),r&&!0!==r.defaults)for(e=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];e<i.length;)r.hasOwnProperty(n=i[e++])||(r[n]=this[n]);return o.config(r),o}(tI);tF=new r$(tF),tC=new r$(tC);var rY={createBigNumberClass:G("BigNumber",["?on","config"],t=>{var{on:r,config:e}=t,n=r$.clone({precision:e.precision,modulo:r$.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(t){return new n(t.value)},r&&r("config",function(t,r){t.precision!==r.precision&&n.config({precision:t.precision})}),n},{isClass:!0})},rG={createMatrixClass:G("Matrix",[],()=>{function t(){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(t,r){throw Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,r,e){throw Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(t){throw Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(t,r,e){throw Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,r){throw Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,r){throw Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(t,r){throw Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(t){throw Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(t){throw Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0})},rX={MatrixDependencies:rG,createDenseMatrixClass:G("DenseMatrix",["Matrix"],t=>{var{Matrix:r}=t;function e(t,r){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator");if(r&&!f(r))throw Error("Invalid datatype: "+r);if(h(t))"DenseMatrix"===t.type?(this._data=Z(t._data),this._size=Z(t._size)):(this._data=t.toArray(),this._size=t.size()),this._datatype=r||t._datatype;else if(t&&c(t.data)&&c(t.size))this._data=t.data,this._size=t.size,td(this._data,this._size),this._datatype=r||t.datatype;else if(c(t))this._data=function t(r){for(var e=0,n=r.length;e<n;e++){var i=r[e];c(i)?r[e]=t(i):i&&!0===i.isMatrix&&(r[e]=t(i.valueOf()))}return r}(t),this._size=tl(this._data),td(this._data,this._size),this._datatype=r;else if(t)throw TypeError("Unsupported type of data ("+L(t)+")");else this._data=[],this._size=[0],this._datatype=r}function n(t,r,e){if(0===r.length){for(var n=t._data;c(n);)n=n[0];return n}return t._size=r.slice(0),t._data=tg(t._data,t._size,e),t}function s(t,r,e){for(var i=t._size.slice(0),o=!1;i.length<r.length;)i.push(0),o=!0;for(var s=0,a=r.length;s<a;s++)r[s]>i[s]&&(i[s]=r[s],o=!0);o&&n(t,i,e)}return e.prototype=new r,e.prototype.createDenseMatrix=function(t,r){return new e(t,r)},e.prototype.type="DenseMatrix",e.prototype.isDenseMatrix=!0,e.prototype.getDataType=function(){return tx(this._data,L)},e.prototype.storage=function(){return"dense"},e.prototype.datatype=function(){return this._datatype},e.prototype.create=function(t,r){return new e(t,r)},e.prototype.subset=function(t,r,n){switch(arguments.length){case 1:return function(t,r){if(!g(r))throw TypeError("Invalid index");if(r.isScalar())return t.get(r.min());var n=r.size();if(n.length!==t._size.length)throw new th(n.length,t._size.length);for(var i=r.min(),o=r.max(),s=0,a=t._size.length;s<a;s++)tm(i[s],t._size[s]),tm(o[s],t._size[s]);return new e(function t(r,e,n,i){var o=i===n-1,s=e.dimension(i);return o?s.map(function(t){return tm(t,r.length),r[t]}).valueOf():s.map(function(o){return tm(o,r.length),t(r[o],e,n,i+1)}).valueOf()}(t._data,r,n.length,0),t._datatype)}(this,t);case 2:case 3:return function(t,r,e,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var i,o=r.size(),a=r.isScalar();if(h(e)?(i=e.size(),e=e.valueOf()):i=tl(e),a){if(0!==i.length)throw TypeError("Scalar expected");t.set(r.min(),e,n)}else{if(o.length<t._size.length)throw new th(o.length,t._size.length,"<");if(i.length<o.length){for(var u=0,f=0;1===o[u]&&1===i[u];)u++;for(;1===o[u];)f++,u++;e=tw(e,o.length,f,i)}if(!W(o,i))throw new th(o,i,">");s(t,r.max().map(function(t){return t+1}),n);var c=o.length;!function t(r,e,n,i,o){var s=o===i-1,a=e.dimension(o);s?a.forEach(function(t,e){tm(t),r[t]=n[e[0]]}):a.forEach(function(s,a){tm(s),t(r[s],e,n[a[0]],i,o+1)})}(t._data,r,e,c,0)}return t}(this,t,r,n);default:throw SyntaxError("Wrong number of arguments")}},e.prototype.get=function(t){if(!c(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new th(t.length,this._size.length);for(var r=0;r<t.length;r++)tm(t[r],this._size[r]);for(var e=this._data,n=0,i=t.length;n<i;n++){var o=t[n];tm(o,e.length),e=e[o]}return e},e.prototype.set=function(t,r,e){if(!c(t))throw TypeError("Array expected");if(t.length<this._size.length)throw new th(t.length,this._size.length,"<");s(this,t.map(function(t){return t+1}),e);var n,i,o,a=this._data;for(n=0,i=t.length-1;n<i;n++)tm(o=t[n],a.length),a=a[o];return tm(o=t[t.length-1],a.length),a[o]=r,this},e.prototype.resize=function(t,r,e){if(!p(t))throw TypeError("Array or Matrix expected");var i=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);return n(e?this.clone():this,i,r)},e.prototype.reshape=function(t,r){var e=r?this.clone():this;e._data=function(t,r){var e=function(t){if(!Array.isArray(t))return t;var r=[];return t.forEach(function t(e){Array.isArray(e)?e.forEach(t):r.push(e)}),r}(t),n=e.length;if(!Array.isArray(t)||!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw new th(0,n,"!=");var i=ty(r=tv(r,n));if(n!==i)throw new th(i,n,"!=");try{return function(t,r){for(var e,n=t,i=r.length-1;i>0;i--){var o=r[i];e=[];for(var s=n.length/o,a=0;a<s;a++)e.push(n.slice(a*o,(a+1)*o));n=e}return n}(e,r)}catch(t){if(t instanceof th)throw new th(i,n,"!=");throw t}}(e._data,t);var n=e._size.reduce((t,r)=>t*r);return e._size=tv(t,n),e},e.prototype.clone=function(){return new e({data:Z(this._data),size:Z(this._size),datatype:this._datatype})},e.prototype.size=function(){return this._size.slice(0)},e.prototype.map=function(t){var r=this,n=function e(n,i){return c(n)?n.map(function(t,r){return e(t,i.concat(r))}):t(n,i,r)}(this._data,[]),i=void 0!==this._datatype?tx(n,L):void 0;return new e(n,i)},e.prototype.forEach=function(t){var r=this;!function e(n,i){c(n)?n.forEach(function(t,r){e(t,i.concat(r))}):t(n,i,r)}(this._data,[])},e.prototype[Symbol.iterator]=function*(){var t=function* t(r,e){if(c(r))for(var n=0;n<r.length;n++)yield*t(r[n],e.concat(n));else yield{value:r,index:e}};yield*t(this._data,[])},e.prototype.rows=function(){var t=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var r of this._data)t.push(new e([r],this._datatype));return t},e.prototype.columns=function(){var t=this,r=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(t=>[t[n]]);r.push(new e(o,t._datatype))},s=0;s<n[1];s++)o(s);return r},e.prototype.toArray=function(){return Z(this._data)},e.prototype.valueOf=function(){return this._data},e.prototype.format=function(t){return tc(this._data,t)},e.prototype.toString=function(){return tc(this._data)},e.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},e.prototype.diagonal=function(t){if(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t))throw TypeError("The parameter k must be an integer number")}else t=0;for(var r=t>0?t:0,n=t<0?-t:0,s=Math.min(this._size[0]-n,this._size[1]-r),a=[],u=0;u<s;u++)a[u]=this._data[u+n][u+r];return new e({data:a,size:[s],datatype:this._datatype})},e.diagonal=function(t,r,n,s){if(!c(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t)||t<1)throw Error("Size values must be positive integers");return t}),n){if(o(n)&&(n=n.toNumber()),!i(n)||!Q(n))throw TypeError("The parameter k must be an integer number")}else n=0;var a,u=n>0?n:0,f=n<0?-n:0,p=t[0],l=t[1],d=Math.min(p-f,l-u);if(c(r)){if(r.length!==d)throw Error("Invalid value array length");a=function(t){return r[t]}}else if(h(r)){var m=r.size();if(1!==m.length||m[0]!==d)throw Error("Invalid matrix length");a=function(t){return r.get([t])}}else a=function(){return r};s||(s=o(a(0))?a(0).mul(0):0);var g=[];if(t.length>0){g=tg(g,t,s);for(var v=0;v<d;v++)g[v+f][v+u]=a(v)}return new e({data:g,size:[p,l]})},e.fromJSON=function(t){return new e(t)},e.prototype.swapRows=function(t,r){if(!i(t)||!Q(t)||!i(r)||!Q(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tm(t,this._size[0]),tm(r,this._size[0]),e._swapRows(t,r,this._data),this},e._swapRows=function(t,r,e){var n=e[t];e[t]=e[r],e[r]=n},e},{isClass:!0})};let rK=Math.cosh||function(t){return 1e-9>Math.abs(t)?1-t:(Math.exp(t)+Math.exp(-t))*.5},rQ=Math.sinh||function(t){return 1e-9>Math.abs(t)?t:(Math.exp(t)-Math.exp(-t))*.5},r0=function(t){let r=Math.PI/4;if(-r>t||t>r)return Math.cos(t)-1;let e=t*t;return e*(e*(e*(e*(e*(e*(e*(e/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},r1=function(t,r){return((t=Math.abs(t))<(r=Math.abs(r))&&([t,r]=[r,t]),t<1e8)?Math.sqrt(t*t+r*r):(r/=t,t*Math.sqrt(1+r*r))},r2=function(){throw SyntaxError("Invalid Param")};function r7(t,r){let e=Math.abs(t),n=Math.abs(r);return 0===t?Math.log(n):0===r?Math.log(e):e<3e3&&n<3e3?.5*Math.log(t*t+r*r):.5*Math.log((t*=.5)*t+(r*=.5)*r)+Math.LN2}let r4={re:0,im:0},r5=function(t,r){if(null==t)r4.re=r4.im=0;else if(void 0!==r)r4.re=t,r4.im=r;else switch(typeof t){case"object":if("im"in t&&"re"in t)r4.re=t.re,r4.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return r3.INFINITY;r4.re=t.abs*Math.cos(t.arg),r4.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return r3.INFINITY;r4.re=t.r*Math.cos(t.phi),r4.im=t.r*Math.sin(t.phi)}else 2===t.length?(r4.re=t[0],r4.im=t[1]):r2();break;case"string":r4.im=r4.re=0;let e=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===e&&r2();for(let t=0;t<e.length;t++){let r=e[t];" "===r||" "===r||"\n"===r||("+"===r?n++:"-"===r?i++:("i"===r||"I"===r?(n+i===0&&r2()," "===e[t+1]||isNaN(e[t+1])?r4.im+=parseFloat((i%2?"-":"")+"1"):(r4.im+=parseFloat((i%2?"-":"")+e[t+1]),t++)):((n+i===0||isNaN(r))&&r2(),"i"===e[t+1]||"I"===e[t+1]?(r4.im+=parseFloat((i%2?"-":"")+r),t++):r4.re+=parseFloat((i%2?"-":"")+r)),n=i=0))}n+i>0&&r2();break;case"number":r4.im=0,r4.re=t;break;default:r2()}return isNaN(r4.re)||isNaN(r4.im),r4};function r3(t,r){if(!(this instanceof r3))return new r3(t,r);let e=r5(t,r);this.re=e.re,this.im=e.im}r3.prototype={re:0,im:0,sign:function(){let t=r1(this.re,this.im);return new r3(this.re/t,this.im/t)},add:function(t,r){let e=r5(t,r),n=this.isInfinite(),i=!(isFinite(e.re)&&isFinite(e.im));return n||i?n&&i?r3.NAN:r3.INFINITY:new r3(this.re+e.re,this.im+e.im)},sub:function(t,r){let e=r5(t,r),n=this.isInfinite(),i=!(isFinite(e.re)&&isFinite(e.im));return n||i?n&&i?r3.NAN:r3.INFINITY:new r3(this.re-e.re,this.im-e.im)},mul:function(t,r){let e=r5(t,r),n=this.isInfinite(),i=!(isFinite(e.re)&&isFinite(e.im)),o=0===this.re&&0===this.im,s=0===e.re&&0===e.im;return n&&s||i&&o?r3.NAN:n||i?r3.INFINITY:0===e.im&&0===this.im?new r3(this.re*e.re,0):new r3(this.re*e.re-this.im*e.im,this.re*e.im+this.im*e.re)},div:function(t,r){let e=r5(t,r),n=this.isInfinite(),i=!(isFinite(e.re)&&isFinite(e.im)),o=0===this.re&&0===this.im,s=0===e.re&&0===e.im;if(o&&s||n&&i)return r3.NAN;if(s||n)return r3.INFINITY;if(o||i)return r3.ZERO;if(0===e.im)return new r3(this.re/e.re,this.im/e.re);if(Math.abs(e.re)<Math.abs(e.im)){let t=e.re/e.im,r=e.re*t+e.im;return new r3((this.re*t+this.im)/r,(this.im*t-this.re)/r)}{let t=e.im/e.re,r=e.im*t+e.re;return new r3((this.re+this.im*t)/r,(this.im-this.re*t)/r)}},pow:function(t,r){let e=r5(t,r),n=0===this.re&&0===this.im;if(0===e.re&&0===e.im)return r3.ONE;if(0===e.im){if(0===this.im&&this.re>0)return new r3(Math.pow(this.re,e.re),0);else if(0===this.re)switch((e.re%4+4)%4){case 0:return new r3(Math.pow(this.im,e.re),0);case 1:return new r3(0,Math.pow(this.im,e.re));case 2:return new r3(-Math.pow(this.im,e.re),0);case 3:return new r3(0,-Math.pow(this.im,e.re))}}if(n&&e.re>0)return r3.ZERO;let i=Math.atan2(this.im,this.re),o=r7(this.re,this.im),s=Math.exp(e.re*o-e.im*i),a=e.im*o+e.re*i;return new r3(s*Math.cos(a),s*Math.sin(a))},sqrt:function(){let t=this.re,r=this.im;if(0===r)if(t>=0)return new r3(Math.sqrt(t),0);else return new r3(0,Math.sqrt(-t));let e=Math.sqrt(.5*(r1(t,r)+Math.abs(t))),n=Math.abs(r)/(2*e);return t>=0?new r3(e,r<0?-n:n):new r3(n,r<0?-e:e)},exp:function(){let t=Math.exp(this.re);return 0===this.im?new r3(t,0):new r3(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,r=this.im;return new r3(Math.expm1(t)*Math.cos(r)+r0(r),Math.exp(t)*Math.sin(r))},log:function(){let t=this.re,r=this.im;return 0===r&&t>0?new r3(Math.log(t),0):new r3(r7(t,r),Math.atan2(r,t))},abs:function(){return r1(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,r=this.im;return new r3(Math.sin(t)*rK(r),Math.cos(t)*rQ(r))},cos:function(){let t=this.re,r=this.im;return new r3(Math.cos(t)*rK(r),-Math.sin(t)*rQ(r))},tan:function(){let t=2*this.re,r=2*this.im,e=Math.cos(t)+rK(r);return new r3(Math.sin(t)/e,rQ(r)/e)},cot:function(){let t=2*this.re,r=2*this.im,e=Math.cos(t)-rK(r);return new r3(-Math.sin(t)/e,rQ(r)/e)},sec:function(){let t=this.re,r=this.im,e=.5*rK(2*r)+.5*Math.cos(2*t);return new r3(Math.cos(t)*rK(r)/e,Math.sin(t)*rQ(r)/e)},csc:function(){let t=this.re,r=this.im,e=.5*rK(2*r)-.5*Math.cos(2*t);return new r3(Math.sin(t)*rK(r)/e,-Math.cos(t)*rQ(r)/e)},asin:function(){let t=this.re,r=this.im,e=new r3(r*r-t*t+1,-2*t*r).sqrt(),n=new r3(e.re-r,e.im+t).log();return new r3(n.im,-n.re)},acos:function(){let t=this.re,r=this.im,e=new r3(r*r-t*t+1,-2*t*r).sqrt(),n=new r3(e.re-r,e.im+t).log();return new r3(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,r=this.im;if(0===t){if(1===r)return new r3(0,1/0);if(-1===r)return new r3(0,-1/0)}let e=t*t+(1-r)*(1-r),n=new r3((1-r*r-t*t)/e,-2*t/e).log();return new r3(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,r=this.im;if(0===r)return new r3(Math.atan2(1,t),0);let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).atan():new r3(0!==t?t/0:0,0!==r?-r/0:0).atan()},asec:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new r3(0,1/0);let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).acos():new r3(0!==t?t/0:0,0!==r?-r/0:0).acos()},acsc:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new r3(Math.PI/2,1/0);let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).asin():new r3(0!==t?t/0:0,0!==r?-r/0:0).asin()},sinh:function(){let t=this.re,r=this.im;return new r3(rQ(t)*Math.cos(r),rK(t)*Math.sin(r))},cosh:function(){let t=this.re,r=this.im;return new r3(rK(t)*Math.cos(r),rQ(t)*Math.sin(r))},tanh:function(){let t=2*this.re,r=2*this.im,e=rK(t)+Math.cos(r);return new r3(rQ(t)/e,Math.sin(r)/e)},coth:function(){let t=2*this.re,r=2*this.im,e=rK(t)-Math.cos(r);return new r3(rQ(t)/e,-Math.sin(r)/e)},csch:function(){let t=this.re,r=this.im,e=Math.cos(2*r)-rK(2*t);return new r3(-2*rQ(t)*Math.cos(r)/e,2*rK(t)*Math.sin(r)/e)},sech:function(){let t=this.re,r=this.im,e=Math.cos(2*r)+rK(2*t);return new r3(2*rK(t)*Math.cos(r)/e,-2*rQ(t)*Math.sin(r)/e)},asinh:function(){let t=this.im;this.im=-this.re,this.re=t;let r=this.asin();return this.re=-this.im,this.im=t,t=r.re,r.re=-r.im,r.im=t,r},acosh:function(){let t=this.acos();if(t.im<=0){let r=t.re;t.re=-t.im,t.im=r}else{let r=t.im;t.im=-t.re,t.re=r}return t},atanh:function(){let t=this.re,r=this.im,e=1-t,n=1+t,i=e*e+r*r,o=0!==i?new r3((n*e-r*r)/i,(r*e+n*r)/i):new r3(-1!==t?t/0:0,0!==r?r/0:0),s=o.re;return o.re=r7(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,t>1&&0===r&&(o.im=-o.im),o},acoth:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new r3(0,Math.PI/2);let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).atanh():new r3(0!==t?t/0:0,0!==r?-r/0:0).atanh()},acsch:function(){let t=this.re,r=this.im;if(0===r)return new r3(0!==t?Math.log(t+Math.sqrt(t*t+1)):1/0,0);let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).asinh():new r3(0!==t?t/0:0,0!==r?-r/0:0).asinh()},asech:function(){let t=this.re,r=this.im;if(this.isZero())return r3.INFINITY;let e=t*t+r*r;return 0!==e?new r3(t/e,-r/e).acosh():new r3(0!==t?t/0:0,0!==r?-r/0:0).acosh()},inverse:function(){if(this.isZero())return r3.INFINITY;if(this.isInfinite())return r3.ZERO;let t=this.re,r=this.im,e=t*t+r*r;return new r3(t/e,-r/e)},conjugate:function(){return new r3(this.re,-this.im)},neg:function(){return new r3(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new r3(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new r3(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new r3(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,r){let e=r5(t,r);return Math.abs(e.re-this.re)<=r3.EPSILON&&Math.abs(e.im-this.im)<=r3.EPSILON},clone:function(){return new r3(this.re,this.im)},toString:function(){let t=this.re,r=this.im,e="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<r3.EPSILON&&(t=0),Math.abs(r)<r3.EPSILON&&(r=0),0===r)?e+t:(0!==t?(e+=t,e+=" ",r<0?(r=-r,e+="-"):e+="+",e+=" "):r<0&&(r=-r,e+="-"),1!==r&&(e+=r),e+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},r3.ZERO=new r3(0,0),r3.ONE=new r3(1,0),r3.I=new r3(0,1),r3.PI=new r3(Math.PI,0),r3.E=new r3(Math.E,0),r3.INFINITY=new r3(1/0,1/0),r3.NAN=new r3(NaN,NaN),r3.EPSILON=1e-15;var r9=G("Complex",[],()=>(r3.prototype.type="Complex",r3.prototype.isComplex=!0,r3.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},r3.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},r3.prototype.format=function(t){var r=this.im,e=this.re,n=tr(this.re,t),o=tr(this.im,t),s=i(t)?t:t?t.precision:null;if(null!==s){var a=Math.pow(10,-s);Math.abs(e/r)<a&&(e=0),Math.abs(r/e)<a&&(r=0)}return 0===r?n:0===e?1===r?"i":-1===r?"-i":o+"i":r<0?-1===r?n+" - i":n+" - "+o.substring(1)+"i":1===r?n+" + i":n+" + "+o+"i"},r3.fromPolar=function(t){switch(arguments.length){case 1:var r=arguments[0];if("object"==typeof r)return r3(r);throw TypeError("Input has to be an object with r and phi keys.");case 2:var e=arguments[0],n=arguments[1];if(i(e)){if(u(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),i(n))return new r3({r:e,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},r3.prototype.valueOf=r3.prototype.toString,r3.fromJSON=function(t){return new r3(t)},r3.compare=function(t,r){return t.re>r.re?1:t.re<r.re?-1:t.im>r.im?1:t.im<r.im?-1:0},r3),{isClass:!0}),r8={s:1,n:0,d:1};function r6(t,r){if(isNaN(t=parseInt(t,10)))throw es();return t*r}function et(t,r){if(0===r)throw eo();var e=Object.create(ei.prototype);e.s=t<0?-1:1;var n=en(t=t<0?-t:t,r);return e.n=t/n,e.d=r/n,e}function er(t){for(var r={},e=t,n=2,i=4;i<=e;){for(;e%n==0;)e/=n,r[n]=(r[n]||0)+1;i+=1+2*n++}return e!==t?e>1&&(r[e]=(r[e]||0)+1):r[t]=(r[t]||0)+1,r}var ee=function(t,r){var e,n=0,i=1,o=1,s=0,a=0,u=0,f=1,c=1,h=0,p=1,l=1,d=1;if(null==t);else if(void 0!==r){if(o=(n=t)*(i=r),n%1!=0||i%1!=0)throw ea()}else switch(typeof t){case"object":if("d"in t&&"n"in t)n=t.n,i=t.d,"s"in t&&(n*=t.s);else if(0 in t)n=t[0],1 in t&&(i=t[1]);else throw es();o=n*i;break;case"number":if(t<0&&(o=t,t=-t),t%1==0)n=t;else if(t>0){for(t>=1&&(c=Math.pow(10,Math.floor(1+Math.log(t)/Math.LN10)),t/=c);p<=1e7&&d<=1e7;){if(t===(e=(h+l)/(p+d))){p+d<=1e7?(n=h+l,i=p+d):d>p?(n=l,i=d):(n=h,i=p);break}t>e?(h+=l,p+=d):(l+=h,d+=p),p>1e7?(n=l,i=d):(n=h,i=p)}n*=c}else(isNaN(t)||isNaN(r))&&(i=n=NaN);break;case"string":if(null===(p=t.match(/\d+|./g)))throw es();if("-"===p[h]?(o=-1,h++):"+"===p[h]&&h++,p.length===h+1?a=r6(p[h++],o):"."===p[h+1]||"."===p[h]?("."!==p[h]&&(s=r6(p[h++],o)),(++h+1===p.length||"("===p[h+1]&&")"===p[h+3]||"'"===p[h+1]&&"'"===p[h+3])&&(a=r6(p[h],o),f=Math.pow(10,p[h].length),h++),("("===p[h]&&")"===p[h+2]||"'"===p[h]&&"'"===p[h+2])&&(u=r6(p[h+1],o),c=Math.pow(10,p[h+1].length)-1,h+=3)):"/"===p[h+1]||":"===p[h+1]?(a=r6(p[h],o),f=r6(p[h+2],1),h+=3):"/"===p[h+3]&&" "===p[h+1]&&(s=r6(p[h],o),a=r6(p[h+2],o),f=r6(p[h+4],1),h+=5),p.length<=h){o=n=u+(i=f*c)*s+c*a;break}default:throw es()}if(0===i)throw eo();r8.s=o<0?-1:1,r8.n=Math.abs(n),r8.d=Math.abs(i)};function en(t,r){if(!t)return r;if(!r)return t;for(;;){if(!(t%=r))return r;if(!(r%=t))return t}}function ei(t,r){if(ee(t,r),!(this instanceof ei))return et(r8.s*r8.n,r8.d);t=en(r8.d,r8.n),this.s=r8.s,this.n=r8.n/t,this.d=r8.d/t}var eo=function(){return Error("Division by Zero")},es=function(){return Error("Invalid argument")},ea=function(){return Error("Parameters must be integer")};ei.prototype={s:1,n:0,d:1,abs:function(){return et(this.n,this.d)},neg:function(){return et(-this.s*this.n,this.d)},add:function(t,r){return ee(t,r),et(this.s*this.n*r8.d+r8.s*this.d*r8.n,this.d*r8.d)},sub:function(t,r){return ee(t,r),et(this.s*this.n*r8.d-r8.s*this.d*r8.n,this.d*r8.d)},mul:function(t,r){return ee(t,r),et(this.s*r8.s*this.n*r8.n,this.d*r8.d)},div:function(t,r){return ee(t,r),et(this.s*r8.s*this.n*r8.d,this.d*r8.n)},clone:function(){return et(this.s*this.n,this.d)},mod:function(t,r){if(isNaN(this.n)||isNaN(this.d))return new ei(NaN);if(void 0===t)return et(this.s*this.n%this.d,1);if(ee(t,r),0===r8.n&&0===this.d)throw eo();return et(this.s*(r8.d*this.n)%(r8.n*this.d),r8.d*this.d)},gcd:function(t,r){return ee(t,r),et(en(r8.n,this.n)*en(r8.d,this.d),r8.d*this.d)},lcm:function(t,r){return(ee(t,r),0===r8.n&&0===this.n)?et(0,1):et(r8.n*this.n,en(r8.n,this.n)*en(r8.d,this.d))},ceil:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ei(NaN):et(Math.ceil(t*this.s*this.n/this.d),t)},floor:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ei(NaN):et(Math.floor(t*this.s*this.n/this.d),t)},round:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ei(NaN):et(Math.round(t*this.s*this.n/this.d),t)},roundTo:function(t,r){return ee(t,r),et(this.s*Math.round(this.n*r8.d/(this.d*r8.n))*r8.n,r8.d)},inverse:function(){return et(this.s*this.d,this.n)},pow:function(t,r){if(ee(t,r),1===r8.d)if(r8.s<0)return et(Math.pow(this.s*this.d,r8.n),Math.pow(this.n,r8.n));else return et(Math.pow(this.s*this.n,r8.n),Math.pow(this.d,r8.n));if(this.s<0)return null;var e=er(this.n),n=er(this.d),i=1,o=1;for(var s in e)if("1"!==s){if("0"===s){i=0;break}if(e[s]*=r8.n,e[s]%r8.d!=0)return null;e[s]/=r8.d,i*=Math.pow(s,e[s])}for(var s in n)if("1"!==s){if(n[s]*=r8.n,n[s]%r8.d!=0)return null;n[s]/=r8.d,o*=Math.pow(s,n[s])}return r8.s<0?et(o,i):et(i,o)},equals:function(t,r){return ee(t,r),this.s*this.n*r8.d==r8.s*r8.n*this.d},compare:function(t,r){ee(t,r);var e=this.s*this.n*r8.d-r8.s*r8.n*this.d;return(0<e)-(e<0)},simplify:function(t){if(isNaN(this.n)||isNaN(this.d))return this;t=t||.001;for(var r=this.abs(),e=r.toContinued(),n=1;n<e.length;n++){for(var i=et(e[n-1],1),o=n-2;o>=0;o--)i=i.inverse().add(e[o]);if(Math.abs(i.sub(r).valueOf())<t)return i.mul(this.s)}return this},divisible:function(t,r){return ee(t,r),!(!(r8.n*this.d)||this.n*r8.d%(r8.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(t){var r,e="",n=this.n,i=this.d;return this.s<0&&(e+="-"),1===i?e+=n:(t&&(r=Math.floor(n/i))>0&&(e+=r,e+=" ",n%=i),e+=n,e+="/",e+=i),e},toLatex:function(t){var r,e="",n=this.n,i=this.d;return this.s<0&&(e+="-"),1===i?e+=n:(t&&(r=Math.floor(n/i))>0&&(e+=r,n%=i),e+="\\frac{",e+=n,e+="}{",e+=i,e+="}"),e},toContinued:function(){var t,r=this.n,e=this.d,n=[];if(isNaN(r)||isNaN(e))return n;do n.push(Math.floor(r/e)),t=r%e,r=e,e=t;while(1!==r);return n},toString:function(t){var r=this.n,e=this.d;if(isNaN(r)||isNaN(e))return"NaN";t=t||15;var n=function(t,r){for(;r%2==0;r/=2);for(;r%5==0;r/=5);if(1===r)return 0;for(var e=10%r,n=1;1!==e;n++)if(e=10*e%r,n>2e3)return 0;return n}(0,e),i=function(t,r,e){for(var n=1,i=function(t,r,e){for(var n=1;r>0;t=t*t%e,r>>=1)1&r&&(n=n*t%e);return n}(10,e,r),o=0;o<300;o++){if(n===i)return o;n=10*n%r,i=10*i%r}return 0}(0,e,n),o=this.s<0?"-":"";if(o+=r/e|0,r%=e,(r*=10)&&(o+="."),n){for(var s=i;s--;)o+=r/e|0,r%=e,r*=10;o+="(";for(var s=n;s--;)o+=r/e|0,r%=e,r*=10;o+=")"}else for(var s=t;r&&s--;)o+=r/e|0,r%=e,r*=10;return o}};var eu=G("Fraction",[],()=>(ei.prototype.type="Fraction",ei.prototype.isFraction=!0,ei.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ei.fromJSON=function(t){return new ei(t)},ei),{isClass:!0}),ef=e(27554);function ec(t,r){return!!t&&"object"==typeof t&&(!!V(ep,r)||!(r in Object.prototype)&&!(r in Function.prototype))}function eh(t){return"object"==typeof t&&t&&t.constructor===Object}var ep={length:!0,name:!0},el={toString:!0,valueOf:!0,toLocaleString:!0};class ed{constructor(t){this.wrappedObject=t}keys(){return Object.keys(this.wrappedObject)}get(t){var r,e,n=this.wrappedObject;if(eh(n)&&ec(n,t))return n[t];if("function"==typeof n[t]&&(r=n,e=t,!(null==r||"function"!=typeof r[e]||V(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r))&&(V(el,e)||!(e in Object.prototype)&&!(e in Function.prototype))))throw Error('Cannot access method "'+t+'" as a property');throw Error('No access to property "'+t+'"')}set(t,r){return!function(t,r,e){if(eh(t)&&ec(t,r))return t[r]=e;throw Error('No access to property "'+r+'"')}(this.wrappedObject,t,r),this}has(t){return t in this.wrappedObject}}function em(t){return!!t&&(t instanceof Map||t instanceof ed||"function"==typeof t.set&&"function"==typeof t.get&&"function"==typeof t.keys&&"function"==typeof t.has)}var eg=function(){return eg=ef.create,ef};function ev(t){throw Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function ey(t){throw Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function ew(t){throw Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var ex={BigNumberDependencies:rY,ComplexDependencies:{createComplexClass:r9},DenseMatrixDependencies:rX,FractionDependencies:{createFractionClass:eu},createTyped:G("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(t){var{BigNumber:r,Complex:e,DenseMatrix:n,Fraction:p}=t,L=eg();return L.types=[{name:"number",test:i},{name:"Complex",test:s},{name:"BigNumber",test:o},{name:"Fraction",test:a},{name:"Unit",test:u},{name:"string",test:f},{name:"Chain",test:U},{name:"Array",test:c},{name:"Matrix",test:h},{name:"DenseMatrix",test:l},{name:"SparseMatrix",test:d},{name:"Range",test:m},{name:"Index",test:g},{name:"boolean",test:v},{name:"ResultSet",test:y},{name:"Help",test:w},{name:"function",test:x},{name:"Date",test:b},{name:"RegExp",test:N},{name:"null",test:M},{name:"undefined",test:E},{name:"AccessorNode",test:O},{name:"ArrayNode",test:A},{name:"AssignmentNode",test:z},{name:"BlockNode",test:S},{name:"ConditionalNode",test:F},{name:"ConstantNode",test:C},{name:"FunctionNode",test:T},{name:"FunctionAssignmentNode",test:I},{name:"IndexNode",test:j},{name:"Node",test:D},{name:"ObjectNode",test:k},{name:"OperatorNode",test:P},{name:"ParenthesisNode",test:R},{name:"RangeNode",test:B},{name:"SymbolNode",test:q},{name:"Map",test:em},{name:"Object",test:_}],L.conversions=[{from:"number",to:"BigNumber",convert:function(t){if(r||ev(t),t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new r(t)}},{from:"number",to:"Complex",convert:function(t){return e||ey(t),new e(t,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(t){return e||ey(t),new e(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return e||ey(t),new e(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){p||ew(t);var r=new p(t);if(r.valueOf()!==t)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return r}},{from:"string",to:"number",convert:function(t){var r=Number(t);if(isNaN(r))throw Error('Cannot convert "'+t+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(t){r||ev(t);try{return new r(t)}catch(r){throw Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){p||ew(t);try{return new p(t)}catch(r){throw Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){e||ey(t);try{return new e(t)}catch(r){throw Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return r||ev(t),new r(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return p||ew(t),new p(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],L})},eb="equalScalar",eN=G(eb,["typed","config"],t=>{var{typed:r,config:e}=t;return r(eb,{"boolean, boolean":function(t,r){return t===r},"number, number":function(t,r){return ta(t,r,e.epsilon)},"BigNumber, BigNumber":function(t,r){return t.eq(r)||function(t,r,e){if(null==e)return t.eq(r);if(t.eq(r))return!0;if(t.isNaN()||r.isNaN())return!1;if(t.isFinite()&&r.isFinite()){var n=t.minus(r).abs();if(n.isZero())return!0;var i=t.constructor.max(t.abs(),r.abs());return n.lte(i.times(e))}return!1}(t,r,e.epsilon)},"Fraction, Fraction":function(t,r){return t.equals(r)},"Complex, Complex":function(t,r){var n;return n=e.epsilon,ta(t.re,r.re,n)&&ta(t.im,r.im,n)},"Unit, Unit":function(t,r){if(!t.equalBase(r))throw Error("Cannot compare units with different base");return this(t.value,r.value)}})});G(eb,["typed","config"],t=>{var{typed:r,config:e}=t;return r(eb,{"number, number":function(t,r){return ta(t,r,e.epsilon)}})});var e_={typedDependencies:ex,createEqualScalar:eN},eM=G("SparseMatrix",["typed","equalScalar","Matrix"],t=>{var{typed:r,equalScalar:e,Matrix:n}=t;function s(t,r){if(!(this instanceof s))throw SyntaxError("Constructor must be called with the new operator");if(r&&!f(r))throw Error("Invalid datatype: "+r);if(h(t)){var e,n,i;e=this,n=t,i=r,"SparseMatrix"===n.type?(e._values=n._values?Z(n._values):void 0,e._index=Z(n._index),e._ptr=Z(n._ptr),e._size=Z(n._size),e._datatype=i||n._datatype):a(e,n.valueOf(),i||n._datatype)}else if(t&&c(t.index)&&c(t.ptr)&&c(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=r||t.datatype;else if(c(t))a(this,t,r);else if(t)throw TypeError("Unsupported type of data ("+L(t)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}function a(t,n,i){t._values=[],t._index=[],t._ptr=[],t._datatype=i;var o=n.length,s=0,a=e,u=0;if(f(i)&&(a=r.find(e,[i,i])||e,u=r.convert(0,i)),o>0){var h=0;do{t._ptr.push(t._index.length);for(var p=0;p<o;p++){var l=n[p];if(c(l)){if(0===h&&s<l.length&&(s=l.length),h<l.length){var d=l[h];a(d,u)||(t._values.push(d),t._index.push(p))}}else 0===h&&s<1&&(s=1),a(l,u)||(t._values.push(l),t._index.push(p))}h++}while(h<s)}t._ptr.push(t._index.length),t._size=[o,s]}function u(t,r,e,n){if(e-r==0)return e;for(var i=r;i<e;i++)if(n[i]===t)return i;return r}function l(t,r,e,n,i,o,s){i.splice(t,0,n),o.splice(t,0,r);for(var a=e+1;a<s.length;a++)s[a]++}function d(t,n,i,o){var s,a,u,c=o||0,h=e,p=0;f(t._datatype)&&(h=r.find(e,[t._datatype,t._datatype])||e,p=r.convert(0,t._datatype),c=r.convert(c,t._datatype));var l=!h(c,p),d=t._size[0],m=t._size[1];if(i>m){for(a=m;a<i;a++)if(t._ptr[a]=t._values.length,l)for(s=0;s<d;s++)t._values.push(c),t._index.push(s);t._ptr[i]=t._values.length}else i<m&&(t._ptr.splice(i+1,m-i),t._values.splice(t._ptr[i],t._values.length),t._index.splice(t._ptr[i],t._index.length));if(m=i,n>d){if(l){var g=0;for(a=0;a<m;a++){t._ptr[a]=t._ptr[a]+g,u=t._ptr[a+1]+g;var v=0;for(s=d;s<n;s++,v++)t._values.splice(u+v,0,c),t._index.splice(u+v,0,s),g++}t._ptr[m]=t._values.length}}else if(n<d){var y=0;for(a=0;a<m;a++){t._ptr[a]=t._ptr[a]-y;var w=t._ptr[a],x=t._ptr[a+1]-y;for(u=w;u<x;u++)(s=t._index[u])>n-1&&(t._values.splice(u,1),t._index.splice(u,1),y++)}t._ptr[a]=t._values.length}return t._size[0]=n,t._size[1]=i,t}function m(t,r,e,n,i){var o,s,a=n[0],u=n[1],f=[];for(o=0;o<a;o++)for(s=0,f[o]=[];s<u;s++)f[o][s]=0;for(s=0;s<u;s++)for(var c=e[s],h=e[s+1],p=c;p<h;p++)f[o=r[p]][s]=t?i?Z(t[p]):t[p]:1;return f}return s.prototype=new n,s.prototype.createSparseMatrix=function(t,r){return new s(t,r)},s.prototype.type="SparseMatrix",s.prototype.isSparseMatrix=!0,s.prototype.getDataType=function(){return tx(this._values,L)},s.prototype.storage=function(){return"sparse"},s.prototype.datatype=function(){return this._datatype},s.prototype.create=function(t,r){return new s(t,r)},s.prototype.density=function(){var t=this._size[0],r=this._size[1];return 0!==t&&0!==r?this._index.length/(t*r):0},s.prototype.subset=function(t,r,e){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(t,r){if(!g(r))throw TypeError("Invalid index");if(r.isScalar())return t.get(r.min());var e,n,i,o,a=r.size();if(a.length!==t._size.length)throw new th(a.length,t._size.length);var u=r.min(),f=r.max();for(e=0,n=t._size.length;e<n;e++)tm(u[e],t._size[e]),tm(f[e],t._size[e]);var c=t._values,h=t._index,p=t._ptr,l=r.dimension(0),d=r.dimension(1),m=[],v=[];l.forEach(function(t,r){v[t]=r[0],m[t]=!0});var y=c?[]:void 0,w=[],x=[];return d.forEach(function(t){for(x.push(w.length),i=p[t],o=p[t+1];i<o;i++)!0===m[e=h[i]]&&(w.push(v[e]),y&&y.push(c[i]))}),x.push(w.length),new s({values:y,index:w,ptr:x,size:a,datatype:t._datatype})}(this,t);case 2:case 3:return function(t,r,e,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var i,o=r.size(),s=r.isScalar();if(h(e)?(i=e.size(),e=e.toArray()):i=tl(e),s){if(0!==i.length)throw TypeError("Scalar expected");t.set(r.min(),e,n)}else{if(1!==o.length&&2!==o.length)throw new th(o.length,t._size.length,"<");if(i.length<o.length){for(var a=0,u=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)u++,a++;e=tw(e,o.length,u,i)}if(!W(o,i))throw new th(o,i,">");if(1===o.length)r.dimension(0).forEach(function(r,i){tm(r),t.set([r,0],e[i[0]],n)});else{var f=r.dimension(0),c=r.dimension(1);f.forEach(function(r,i){tm(r),c.forEach(function(o,s){tm(o),t.set([r,o],e[i[0]][s[0]],n)})})}}return t}(this,t,r,e);default:throw SyntaxError("Wrong number of arguments")}},s.prototype.get=function(t){if(!c(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new th(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var r=t[0],e=t[1];tm(r,this._size[0]),tm(e,this._size[1]);var n=u(r,this._ptr[e],this._ptr[e+1],this._index);return n<this._ptr[e+1]&&this._index[n]===r?this._values[n]:0},s.prototype.set=function(t,n,i){if(!c(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new th(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=t[0],s=t[1],a=this._size[0],h=this._size[1],p=e,m=0;f(this._datatype)&&(p=r.find(e,[this._datatype,this._datatype])||e,m=r.convert(0,this._datatype)),(o>a-1||s>h-1)&&(d(this,Math.max(o+1,a),Math.max(s+1,h),i),a=this._size[0],h=this._size[1]),tm(o,a),tm(s,h);var g=u(o,this._ptr[s],this._ptr[s+1],this._index);return g<this._ptr[s+1]&&this._index[g]===o?p(n,m)?function(t,r,e,n,i){e.splice(t,1),n.splice(t,1);for(var o=r+1;o<i.length;o++)i[o]--}(g,s,this._values,this._index,this._ptr):this._values[g]=n:l(g,o,s,n,this._values,this._index,this._ptr),this},s.prototype.resize=function(t,r,e){if(!p(t))throw TypeError("Array or Matrix expected");var n=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(t){if(!i(t)||!Q(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+tc(n)+")")}),d(e?this.clone():this,n[0],n[1],r)},s.prototype.reshape=function(t,r){if(!c(t))throw TypeError("Array expected");if(2!==t.length)throw Error("Sparse matrices can only be reshaped in two dimensions");t.forEach(function(r){if(!i(r)||!Q(r)||r<=-2||0===r)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+tc(t)+")")});var e=this._size[0]*this._size[1],n=(t=tv(t,e))[0]*t[1];if(e!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var o=r?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return o;for(var s=[],a=0;a<o._ptr.length;a++)for(var f=0;f<o._ptr[a+1]-o._ptr[a];f++)s.push(a);for(var h=o._values.slice(),p=o._index.slice(),d=0;d<o._index.length;d++){var m=p[d],g=s[d],v=m*o._size[1]+g;s[d]=v%t[1],p[d]=Math.floor(v/t[1])}o._values.length=0,o._index.length=0,o._ptr.length=t[1]+1,o._size=t.slice();for(var y=0;y<o._ptr.length;y++)o._ptr[y]=0;for(var w=0;w<h.length;w++){var x=p[w],b=s[w],N=h[w];l(u(x,o._ptr[b],o._ptr[b+1],o._index),x,b,N,o._values,o._index,o._ptr)}return o},s.prototype.clone=function(){return new s({values:this._values?Z(this._values):void 0,index:Z(this._index),ptr:Z(this._ptr),size:Z(this._size),datatype:this._datatype})},s.prototype.size=function(){return this._size.slice(0)},s.prototype.map=function(t,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var i=this;return function(t,n,i,o,a,u,c){var h=[],p=[],l=[],d=e,m=0;f(t._datatype)&&(d=r.find(e,[t._datatype,t._datatype])||e,m=r.convert(0,t._datatype));for(var g=function(t,r,e){t=u(t,r,e),d(t,m)||(h.push(t),p.push(r))},v=0;v<=a;v++){l.push(h.length);var y=t._ptr[v],w=t._ptr[v+1];if(c)for(var x=y;x<w;x++){var b=t._index[x];b>=0&&b<=i&&g(t._values[x],b-n,v-o)}else{for(var N={},_=y;_<w;_++)N[t._index[_]]=t._values[_];for(var M=n;M<=i;M++)g(M in N?N[M]:0,M-n,v-o)}}return l.push(h.length),new s({values:h,index:p,ptr:l,size:[i-n+1,a-o+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(r,e,n){return t(r,[e,n],i)},n)},s.prototype.forEach=function(t,r){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var e=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],s=this._ptr[i+1];if(r)for(var a=o;a<s;a++){var u=this._index[a];t(this._values[a],[u,i],this)}else{for(var f={},c=o;c<s;c++)f[this._index[c]]=this._values[c];for(var h=0;h<e;h++)t(h in f?f[h]:0,[h,i],this)}}},s.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var t=this._size[1],r=0;r<t;r++)for(var e=this._ptr[r],n=this._ptr[r+1],i=e;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,r]}}},s.prototype.toArray=function(){return m(this._values,this._index,this._ptr,this._size,!0)},s.prototype.valueOf=function(){return m(this._values,this._index,this._ptr,this._size,!1)},s.prototype.format=function(t){for(var r=this._size[0],e=this._size[1],n=this.density(),i="Sparse Matrix ["+tc(r,t)+" x "+tc(e,t)+"] density: "+tc(n,t)+"\n",o=0;o<e;o++)for(var s=this._ptr[o],a=this._ptr[o+1],u=s;u<a;u++)i+="\n ("+tc(this._index[u],t)+", "+tc(o,t)+") ==> "+(this._values?tc(this._values[u],t):"X");return i},s.prototype.toString=function(){return tc(this.toArray())},s.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},s.prototype.diagonal=function(t){if(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t))throw TypeError("The parameter k must be an integer number")}else t=0;var r=t>0?t:0,e=t<0?-t:0,n=this._size[0],a=this._size[1],u=Math.min(n-e,a-r),f=[],c=[],h=[];h[0]=0;for(var p=r;p<a&&f.length<u;p++)for(var l=this._ptr[p],d=this._ptr[p+1],m=l;m<d;m++){var g=this._index[m];if(g===p-r+e){f.push(this._values[m]),c[f.length-1]=g-e;break}}return h.push(f.length),new s({values:f,index:c,ptr:h,size:[u,1]})},s.fromJSON=function(t){return new s(t)},s.diagonal=function(t,n,a,u,p){if(!c(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t)||t<1)throw Error("Size values must be positive integers");return t}),a){if(o(a)&&(a=a.toNumber()),!i(a)||!Q(a))throw TypeError("The parameter k must be an integer number")}else a=0;var l,d=e,m=0;f(p)&&(d=r.find(e,[p,p])||e,m=r.convert(0,p));var g=a>0?a:0,v=a<0?-a:0,y=t[0],w=t[1],x=Math.min(y-v,w-g);if(c(n)){if(n.length!==x)throw Error("Invalid value array length");l=function(t){return n[t]}}else if(h(n)){var b=n.size();if(1!==b.length||b[0]!==x)throw Error("Invalid matrix length");l=function(t){return n.get([t])}}else l=function(){return n};for(var N=[],_=[],M=[],E=0;E<w;E++){M.push(N.length);var O=E-g;if(O>=0&&O<x){var A=l(O);d(A,m)||(_.push(O+v),N.push(A))}}return M.push(N.length),new s({values:N,index:_,ptr:M,size:[y,w]})},s.prototype.swapRows=function(t,r){if(!i(t)||!Q(t)||!i(r)||!Q(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tm(t,this._size[0]),tm(r,this._size[0]),s._swapRows(t,r,this._size[1],this._values,this._index,this._ptr),this},s._forEachRow=function(t,r,e,n,i){for(var o=n[t],s=n[t+1],a=o;a<s;a++)i(e[a],r[a])},s._swapRows=function(t,r,e,n,i,o){for(var s=0;s<e;s++){var a=o[s],f=o[s+1],c=u(t,a,f,i),h=u(r,a,f,i);if(c<f&&h<f&&i[c]===t&&i[h]===r){if(n){var p=n[c];n[c]=n[h],n[h]=p}continue}if(c<f&&i[c]===t&&(h>=f||i[h]!==r)){var l=n?n[c]:void 0;i.splice(h,0,r),n&&n.splice(h,0,l),i.splice(h<=c?c+1:c,1),n&&n.splice(h<=c?c+1:c,1);continue}if(h<f&&i[h]===r&&(c>=f||i[c]!==t)){var d=n?n[h]:void 0;i.splice(c,0,t),n&&n.splice(c,0,d),i.splice(c<=h?h+1:h,1),n&&n.splice(c<=h?h+1:h,1)}}},s},{isClass:!0}),eE="matrix",eO=G(eE,["typed","Matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:r,Matrix:e,DenseMatrix:n,SparseMatrix:i}=t;return r(eE,{"":function(){return o([])},string:function(t){return o([],t)},"string, string":function(t,r){return o([],t,r)},Array:function(t){return o(t)},Matrix:function(t){return o(t,t.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(t,r,e){if("dense"===r||"default"===r||void 0===r)return new n(t,e);if("sparse"===r)return new i(t,e);throw TypeError("Unknown matrix type "+JSON.stringify(r)+".")}}),eA=G("algorithm01",["typed"],t=>{var{typed:r}=t;return function(t,e,n,i){var o,s,a=t._data,u=t._size,f=t._datatype,c=e._values,h=e._index,p=e._ptr,l=e._size,d=e._datatype;if(u.length!==l.length)throw new th(u.length,l.length);if(u[0]!==l[0]||u[1]!==l[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+l+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],v="string"==typeof f&&f===d?f:void 0,y=v?r.find(n,[v,v]):n,w=[];for(o=0;o<m;o++)w[o]=[];var x=[],b=[];for(s=0;s<g;s++){for(var N=s+1,_=p[s],M=p[s+1],E=_;E<M;E++)x[o=h[E]]=i?y(c[E],a[o][s]):y(a[o][s],c[E]),b[o]=N;for(o=0;o<m;o++)b[o]===N?w[o][s]=x[o]:w[o][s]=a[o][s]}return t.createDenseMatrix({data:w,size:[m,g],datatype:v})}}),ez=G("algorithm04",["typed","equalScalar"],t=>{var{typed:r,equalScalar:e}=t;return function(t,n,i){var o,s,a,u,f,c,h=t._values,p=t._index,l=t._ptr,d=t._size,m=t._datatype,g=n._values,v=n._index,y=n._ptr,w=n._size,x=n._datatype;if(d.length!==w.length)throw new th(d.length,w.length);if(d[0]!==w[0]||d[1]!==w[1])throw RangeError("Dimension mismatch. Matrix A ("+d+") must match Matrix B ("+w+")");var b=d[0],N=d[1],_=e,M=0,E=i;"string"==typeof m&&m===x&&(o=m,_=r.find(e,[o,o]),M=r.convert(0,o),E=r.find(i,[o,o]));var O=h&&g?[]:void 0,A=[],z=[],S=h&&g?[]:void 0,F=h&&g?[]:void 0,C=[],I=[];for(a=0;a<N;a++){z[a]=A.length;var T=a+1;for(f=l[a],c=l[a+1],u=f;u<c;u++)s=p[u],A.push(s),C[s]=T,S&&(S[s]=h[u]);for(f=y[a],c=y[a+1],u=f;u<c;u++)if(C[s=v[u]]===T){if(S){var j=E(S[s],g[u]);_(j,M)?C[s]=null:S[s]=j}}else A.push(s),I[s]=T,F&&(F[s]=g[u]);if(S&&F)for(u=z[a];u<A.length;)C[s=A[u]]===T?(O[u]=S[s],u++):I[s]===T?(O[u]=F[s],u++):A.splice(u,1)}return z[N]=A.length,t.createSparseMatrix({values:O,index:A,ptr:z,size:[b,N],datatype:o})}}),eS=G("algorithm10",["typed","DenseMatrix"],t=>{var{typed:r,DenseMatrix:e}=t;return function(t,n,i,o){var s,a=t._values,u=t._index,f=t._ptr,c=t._size,h=t._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=c[0],l=c[1],d=i;"string"==typeof h&&(s=h,n=r.convert(n,s),d=r.find(i,[s,s]));for(var m=[],g=[],v=[],y=0;y<l;y++){for(var w=y+1,x=f[y],b=f[y+1],N=x;N<b;N++){var _=u[N];g[_]=a[N],v[_]=w}for(var M=0;M<p;M++)0===y&&(m[M]=[]),v[M]===w?m[M][y]=o?d(n,g[M]):d(g[M],n):m[M][y]=n}return new e({data:m,size:[p,l],datatype:s})}}),eF=G("algorithm13",["typed"],t=>{var{typed:r}=t;return function(t,e,n){var i,o=t._data,s=t._size,a=t._datatype,u=e._data,f=e._size,c=e._datatype,h=[];if(s.length!==f.length)throw new th(s.length,f.length);for(var p=0;p<s.length;p++){if(s[p]!==f[p])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+f+")");h[p]=s[p]}var l=n;"string"==typeof a&&a===c&&(i=a,l=r.find(n,[i,i]));var d=h.length>0?function t(r,e,n,i,o,s){var a=[];if(e===n.length-1)for(var u=0;u<i;u++)a[u]=r(o[u],s[u]);else for(var f=0;f<i;f++)a[f]=t(r,e+1,n,n[e+1],o[f],s[f]);return a}(l,0,h,h[0],o,u):[];return t.createDenseMatrix({data:d,size:h,datatype:i})}}),eC=G("algorithm14",["typed"],t=>{var{typed:r}=t;return function(t,e,n,i){var o,s=t._data,a=t._size,u=t._datatype,f=n;"string"==typeof u&&(o=u,e=r.convert(e,o),f=r.find(n,[o,o]));var c=a.length>0?function t(r,e,n,i,o,s,a){var u=[];if(e===n.length-1)for(var f=0;f<i;f++)u[f]=a?r(s,o[f]):r(o[f],s);else for(var c=0;c<i;c++)u[c]=t(r,e+1,n,n[e+1],o[c],s,a);return u}(f,0,a,a[0],s,e,i):[];return t.createDenseMatrix({data:c,size:Z(a),datatype:o})}});function eI(t,r){var e;if(!Q(t)||!Q(r))throw Error("Parameters in function gcd must be integer numbers");for(;0!==r;)e=t%r,t=r,r=e;return t<0?-t:t}eI.signature="number, number";let{gcd:eT}=function t(r,e){var L,W,Q,tt=(0,n.Z)({},t_,e);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var tr=((L={isNumber:i,isComplex:s,isBigNumber:o,isFraction:a,isUnit:u,isString:f,isArray:c,isMatrix:h,isCollection:p,isDenseMatrix:l,isSparseMatrix:d,isRange:m,isIndex:g,isBoolean:v,isResultSet:y,isHelp:w,isFunction:x,isDate:b,isRegExp:N,isObject:_,isNull:M,isUndefined:E,isAccessorNode:O,isArrayNode:A,isAssignmentNode:z,isBlockNode:S,isConditionalNode:F,isConstantNode:C,isFunctionAssignmentNode:I,isFunctionNode:T,isIndexNode:j,isNode:D,isObjectNode:k,isOperatorNode:P,isParenthesisNode:R,isRangeNode:B,isSymbolNode:q,isChain:U}).on=(W=new Y).on.bind(W),L.off=W.off.bind(W),L.once=W.once.bind(W),L.emit=W.emit.bind(W),L);tr.config=function(t,r){function e(e){if(!e)return J(t,Z);var n=J(t,Z);tO(e,"matrix",tM),tO(e,"number",tE),function t(r,e){if(Array.isArray(e))throw TypeError("Arrays are not supported by deepExtend");for(var n in e)if(V(e,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(e[n]&&e[n].constructor===Object)void 0===r[n]&&(r[n]={}),r[n]&&r[n].constructor===Object?t(r[n],e[n]):r[n]=e[n];else if(Array.isArray(e[n]))throw TypeError("Arrays are not supported by deepExtend");else r[n]=e[n];return r}(t,e);var i=J(t,Z);return r("config",i,n,J(e,Z)),i}return e.MATRIX_OPTIONS=tM,e.NUMBER_OPTIONS=tE,Object.keys(t_).forEach(r=>{Object.defineProperty(e,r,{get:()=>t[r],enumerable:!0,configurable:!0})}),e}(tt,tr.emit),tr.expression={transform:{},mathWithTransform:{config:tr.config}};var te={},tn=function(t,r,e,n){function i(t,r){r&&"function"==typeof r.transform?(e.expression.transform[t]=r.transform,V(p,t)||(e.expression.mathWithTransform[t]=r.transform)):(delete e.expression.transform[t],V(p,t)||(e.expression.mathWithTransform[t]=r))}function f(t){return"function"==typeof t&&"object"==typeof t.signatures}function c(t){return void 0!==t&&void 0!==t.meta&&!0===t.meta.isTransformFunction}var p={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(r,l){var d=arguments.length;if(1!==d&&2!==d)throw new tN("import",d,1,2);l||(l={});var m={};for(var g in!function t(r,e,n){if(Array.isArray(e))e.forEach(e=>t(r,e));else if("object"==typeof e)for(var i in e)V(e,i)&&t(r,e[i],i);else if(X(e)||void 0!==n){var o=X(e)?c(e)?e.fn+".transform":e.fn:n;if(V(r,o)&&r[o]!==e&&!l.silent)throw Error('Cannot import "'+o+'" twice');r[o]=e}else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}(m,r),m)if(V(m,g)){var v,y=m[g];if(X(y))!function(r,i){var o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.fn;if(tb(s,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(s));var a=c(r)?e.expression.transform:e,u=s in e.expression.transform,h=V(a,s)?a[s]:void 0,l=function(){var n={};r.dependencies.map(K).forEach(t=>{if(tb(t,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(t));"math"===t?n.math=e:"mathWithTransform"===t?n.mathWithTransform=e.expression.mathWithTransform:"classes"===t?n.classes=e:n[t]=e[t]});var o=r(n);if(o&&"function"==typeof o.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===h||i.override)return o;if(f(h)&&f(o))return t(h,o);if(i.silent)return h;throw Error('Cannot import "'+s+'": already exists')};r.meta&&!1===r.meta.lazy?a[s]=l():H(a,s,l),h&&u?function(t){delete e.expression.transform[t],V(p,t)?delete e.expression.mathWithTransform[t]:e.expression.mathWithTransform[t]=e[t]}(s):!c(r)&&(-1!==(o=r).fn.indexOf(".")||V(p,o.fn)||o.meta&&o.meta.isClass)||H(e.expression.mathWithTransform,s,()=>a[s]),n[s]=r,e.emit("import",s,l)}(y,l);else{if("function"==typeof(v=y)||"number"==typeof v||"string"==typeof v||"boolean"==typeof v||null===v||u(v)||s(v)||o(v)||a(v)||h(v)||Array.isArray(v))!function(r,o,s){var a;if(s.wrap&&"function"==typeof o&&(o=function(t){var r=function(){for(var r=[],n=0,i=arguments.length;n<i;n++){var o=arguments[n];r[n]=o&&o.valueOf()}return t.apply(e,r)};return t.transform&&(r.transform=t.transform),r}(o)),"function"==typeof(a=o)&&"string"==typeof a.signature&&(o=t(r,{[o.signature]:o})),f(e[r])&&f(o)){o=s.override?t(r,o.signatures):t(e[r],o),e[r]=o,delete n[r],i(r,o),e.emit("import",r,function(){return o});return}if(void 0===e[r]||s.override){e[r]=o,delete n[r],i(r,o),e.emit("import",r,function(){return o});return}if(!s.silent)throw Error('Cannot import "'+r+'": already exists')}(g,y,l);else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var t=arguments.length,r=Array(t),e=0;e<t;e++)r[e]=arguments[e];return tr.typed.apply(tr.typed,r)},0,tr,te);return tr.import=tn,tr.on("config",()=>{$(te).forEach(t=>{t&&t.meta&&t.meta.recreateOnConfigChange&&tn(t,{override:!0})})}),tr.create=t.bind(null,r),tr.factory=G,tr.import($((function t(r,e){for(var n in r)if(V(r,n)){var i=r[n];"object"==typeof i&&null!==i?t(i,e):e[n]=i}}(r,Q={}),Q))),tr.ArgumentsError=tN,tr.DimensionError=th,tr.IndexError=tp,tr}({gcdDependencies:{BigNumberDependencies:rY,DenseMatrixDependencies:rX,equalScalarDependencies:e_,matrixDependencies:{DenseMatrixDependencies:rX,MatrixDependencies:rG,SparseMatrixDependencies:{MatrixDependencies:rG,equalScalarDependencies:e_,typedDependencies:ex,createSparseMatrixClass:eM},typedDependencies:ex,createMatrix:eO},typedDependencies:ex,createGcd:G("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],t=>{var{typed:r,matrix:e,equalScalar:n,BigNumber:i,DenseMatrix:o}=t,s=eA({typed:r}),a=ez({typed:r,equalScalar:n}),u=eS({typed:r,DenseMatrix:o}),f=eF({typed:r}),c=eC({typed:r});return r("gcd",{"number, number":eI,"BigNumber, BigNumber":function(t,r){if(!t.isInt()||!r.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var e=new i(0);!r.isZero();){var n=t.mod(r);t=r,r=n}return t.lt(e)?t.neg():t},"Fraction, Fraction":function(t,r){return t.gcd(r)},"SparseMatrix, SparseMatrix":function(t,r){return a(t,r,this)},"SparseMatrix, DenseMatrix":function(t,r){return s(r,t,this,!0)},"DenseMatrix, SparseMatrix":function(t,r){return s(t,r,this,!1)},"DenseMatrix, DenseMatrix":function(t,r){return f(t,r,this)},"Array, Array":function(t,r){return this(e(t),e(r)).valueOf()},"Array, Matrix":function(t,r){return this(e(t),r)},"Matrix, Array":function(t,r){return this(t,e(r))},"SparseMatrix, number | BigNumber":function(t,r){return u(t,r,this,!1)},"DenseMatrix, number | BigNumber":function(t,r){return c(t,r,this,!1)},"number | BigNumber, SparseMatrix":function(t,r){return u(r,t,this,!0)},"number | BigNumber, DenseMatrix":function(t,r){return c(r,t,this,!0)},"Array, number | BigNumber":function(t,r){return c(e(t),r,this,!1).valueOf()},"number | BigNumber, Array":function(t,r){return c(e(r),t,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(t,r,e){for(var n=this(t,r),i=0;i<e.length;i++)n=this(n,e[i]);return n}})})}}),ej=10;function eD(t,r){let e=r.startMs,n=t.values,i=[];for(let t of n){for(;e<t[0];)i.push([e,null]),e+=r.stepMs;i.push([e,t[1]]),e+=r.stepMs}for(;e<=r.endMs;)i.push([e,null]),e+=r.stepMs;return i}function ek(t){let r,e,n=[];for(let r of t)if(r&&"timeRange"in r){if(void 0===r||void 0===r.timeRange||void 0===r.stepMs)continue;if(n.push(r.stepMs),void 0===e){e=r.timeRange;continue}r.timeRange.start<e.start&&(e.start=r.timeRange.start),r.timeRange.end>e.end&&(e.end=r.timeRange.end)}else if(r&&"values"in r){for(let t=0;t<r.values.length;t++){let n=r.values[t];if(void 0===n)continue;let[i]=n,o=new Date(i),s=new Date(i);if(void 0===e){e={start:o,end:s};continue}o<e.start&&(e.start=o),s>e.end&&(e.end=s)}if(void 0===e)return;let t=e.start.valueOf(),n=e.end.valueOf(),i=n-t;return{startMs:t,endMs:n,rangeMs:i,stepMs:ej}}if(void 0===e)return;if(1===n.length)r=n[0];else{let t=eT(...n);r=t<ej?ej:t}let i=e.start.valueOf(),o=e.end.valueOf();return{startMs:i,endMs:o,stepMs:r,rangeMs:o-i}}},8317:function(t){function r(){}r.prototype={on:function(t,r,e){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:r,ctx:e}),this},once:function(t,r,e){var n=this;function i(){n.off(t,i),r.apply(e,arguments)}return i._=r,this.on(t,i,e)},emit:function(t){for(var r=[].slice.call(arguments,1),e=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=e.length;n<i;n++)e[n].fn.apply(e[n].ctx,r);return this},off:function(t,r){var e=this.e||(this.e={}),n=e[t],i=[];if(n&&r)for(var o=0,s=n.length;o<s;o++)n[o].fn!==r&&n[o].fn._!==r&&i.push(n[o]);return i.length?e[t]=i:delete e[t],this}},t.exports=r,t.exports.TinyEmitter=r},27554:function(t){"use strict";var r;r=function(){function t(){return!0}function r(){return!1}function e(){}return function n(){var i=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:function(t){return"object"==typeof t&&null!==t&&t.constructor===Object}},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],o={name:"any",test:t},s=[],a=[],u={types:i,conversions:a,ignore:s};function f(t){var r=k(u.types,function(r){return r.name===t});if(r)return r;if("any"===t)return o;var e=k(u.types,function(r){return r.name.toLowerCase()===t.toLowerCase()});throw TypeError('Unknown type "'+t+'"'+(e?'. Did you mean "'+e.name+'"?':""))}function c(t){return t===o?999:u.types.indexOf(t)}function h(t){var r=k(u.types,function(r){return r.test(t)});if(r)return r.name;throw TypeError("Value has unknown type. Value: "+t)}function p(t){return t.map(function(t){var r=t.types.map(y);return(t.restParam?"...":"")+r.join("|")}).join(",")}function l(t){var r=j(t);return!!r&&r.restParam}function d(t){return t.types.some(function(t){return null!=t.conversion})}function m(r){if(!r||0===r.types.length)return t;if(1===r.types.length)return f(r.types[0].name).test;if(2===r.types.length){var e=f(r.types[0].name).test,n=f(r.types[1].name).test;return function(t){return e(t)||n(t)}}var i=r.types.map(function(t){return f(t.name).test});return function(t){for(var r=0;r<i.length;r++)if(i[r](t))return!0;return!1}}function g(t,r){return r<t.params.length?t.params[r]:l(t.params)?j(t.params):null}function v(t,r,e){var n=g(t,r);return(n?e?n.types.filter(w):n.types:[]).map(y)}function y(t){return t.name}function w(t){return null===t.conversion||void 0===t.conversion}function x(t,r){var e=function(t){for(var r={},e=0;e<t.length;e++)r[t[e]]=!0;return Object.keys(r)}(P(t,function(t){return v(t,r,!1)}));return -1!==e.indexOf("any")?["any"]:e}function b(t,r,e){var n,i,o,s=t||"unnamed",a=e;for(o=0;o<r.length;o++){var u=a.filter(function(t){var e=m(g(t,o));return(o<t.params.length||l(t.params))&&e(r[o])});if(0===u.length){if((i=x(a,o)).length>0){var f=h(r[o]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+f+", index: "+o+")")).data={category:"wrongType",fn:s,index:o,actual:f,expected:i},n}}else a=u}var c=a.map(function(t){return l(t.params)?1/0:t.params.length});if(r.length<Math.min.apply(null,c))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(i=x(a,o)).join(" or ")+", index: "+r.length+")")).data={category:"tooFewArgs",fn:s,index:r.length,expected:i},n;var p=Math.max.apply(null,c);return r.length>p?(n=TypeError("Too many arguments in function "+s+" (expected: "+p+", actual: "+r.length+")")).data={category:"tooManyArgs",fn:s,index:r.length,expectedLength:p}:(n=TypeError('Arguments of type "'+r.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:r.map(h)},n}function N(t){for(var r=999,e=0;e<t.types.length;e++)w(t.types[e])&&(r=Math.min(r,t.types[e].typeIndex));return r}function _(t){for(var r=999,e=0;e<t.types.length;e++)w(t.types[e])||(r=Math.min(r,t.types[e].conversionIndex));return r}function M(t,r){var e,n,i=Math.min(t.params.length,r.params.length);if(0!=(n=t.params.some(d)-r.params.some(d)))return n;for(e=0;e<i;e++)if(0!=(n=d(t.params[e])-d(r.params[e])))return n;for(e=0;e<i;e++)if(0!==(n=function(t,r){var e;return 0!=(e=t.restParam-r.restParam)||0!=(e=d(t)-d(r))||0!=(e=N(t)-N(r))?e:_(t)-_(r)}(t.params[e],r.params[e])))return n;return t.params.length-r.params.length}function E(t){var r,e,n,i,o=[],s=[];switch(t.types.forEach(function(t){t.conversion&&(o.push(f(t.conversion.from).test),s.push(t.conversion.convert))}),s.length){case 0:return function(t){return t};case 1:return r=o[0],n=s[0],function(t){return r(t)?n(t):t};case 2:return r=o[0],e=o[1],n=s[0],i=s[1],function(t){return r(t)?n(t):e(t)?i(t):t};default:return function(t){for(var r=0;r<s.length;r++)if(o[r](t))return s[r](t);return t}}}function O(t,r){return function t(e,n,i){if(!(n<e.length))return[i.map(function(t,r){return{types:t,restParam:r===e.length-1&&l(e)}})];var o,s=e[n],a=r?s.types.filter(w):s.types;if(s.restParam){var u=a.filter(w);o=u.length<a.length?[u,a]:[a]}else o=a.map(function(t){return[t]});return P(o,function(r){return t(e,n+1,i.concat([r]))})}(t,0,[])}function A(t,n){if(0===Object.keys(n).length)throw SyntaxError("No signatures provided");var i,o=[];Object.keys(n).map(function(t){var r,e,i;return r=n[t],e=u.conversions,i=[],(""!==t.trim()&&(i=t.split(",").map(F).map(function(t,r,n){var i,o,s,a,u,h,p,l,d=(i=e,o=u=((a=0===t.indexOf("..."))?t.length>3?t.slice(3):"any":t).split("|").map(F).filter(C).filter(S),s={},i.forEach(function(t){-1!==o.indexOf(t.from)||-1===o.indexOf(t.to)||s[t.from]||(s[t.from]=t)}),h=Object.keys(s).map(function(t){return s[t]}),p=u.map(function(t){var r=f(t);return{name:t,typeIndex:c(r),test:r.test,conversion:null,conversionIndex:-1}}),l=h.map(function(t){var r=f(t.from);return{name:t.from,typeIndex:c(r),test:r.test,conversion:t,conversionIndex:e.indexOf(t)}}),{types:p.concat(l),restParam:a});if(d.restParam&&r!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+t+'": only allowed for the last parameter');return d})),i.some(T))?null:{params:i,fn:r}}).filter(I).forEach(function(t){var r=k(o,function(r){return function(t,r){for(var e=Math.max(t.params.length,r.params.length),n=0;n<e;n++)if(!function(t,r){for(var e,n=0;n<t.length;n++)if(e=t[n],-1!==r.indexOf(e))return!0;return!1}(v(t,n,!0),v(r,n,!0)))return!1;var i=t.params.length,o=r.params.length,s=l(t.params),a=l(r.params);return s?a?i===o:o>=i:a?i>=o:i===o}(r,t)});if(r)throw TypeError('Conflicting signatures "'+p(r.params)+'" and "'+p(t.params)+'".');o.push(t)});var s=P(o,function(t){return(t?O(t.params,!1):[]).map(function(r){return{params:r,fn:t.fn}})}).filter(I);s.sort(M);var a=s[0]&&s[0].params.length<=2&&!l(s[0].params),h=s[1]&&s[1].params.length<=2&&!l(s[1].params),g=s[2]&&s[2].params.length<=2&&!l(s[2].params),y=s[3]&&s[3].params.length<=2&&!l(s[3].params),w=s[4]&&s[4].params.length<=2&&!l(s[4].params),x=s[5]&&s[5].params.length<=2&&!l(s[5].params),b=s.map(function(t){return function(t){var r,e,n;if(l(t)){var i,o=(r=(i=t).slice(0,i.length-1).map(m)).length,s=m(j(t)),a=function(t){for(var r=o;r<t.length;r++)if(!s(t[r]))return!1;return!0};return function(t){for(var e=0;e<r.length;e++)if(!r[e](t[e]))return!1;return a(t)&&t.length>=o+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(e=m(t[0]),function(t){return e(t[0])&&1===t.length}):2===t.length?(e=m(t[0]),n=m(t[1]),function(t){return e(t[0])&&n(t[1])&&2===t.length}):(r=t.map(m),function(t){for(var e=0;e<r.length;e++)if(!r[e](t[e]))return!1;return t.length===r.length})}(t.params)}),N=a?m(s[0].params[0]):r,_=h?m(s[1].params[0]):r,A=g?m(s[2].params[0]):r,z=y?m(s[3].params[0]):r,R=w?m(s[4].params[0]):r,B=x?m(s[5].params[0]):r,q=a?m(s[0].params[1]):r,U=h?m(s[1].params[1]):r,L=g?m(s[2].params[1]):r,Z=y?m(s[3].params[1]):r,J=w?m(s[4].params[1]):r,W=x?m(s[5].params[1]):r,H=s.map(function(t){return function(t,r){var e=r;if(t.some(d)){var n=l(t),i=t.map(E);e=function(){for(var t=[],e=n?arguments.length-1:arguments.length,o=0;o<e;o++)t[o]=i[o](arguments[o]);return n&&(t[e]=arguments[e].map(i[e])),r.apply(this,t)}}var o=e;if(l(t)){var s=t.length-1;o=function(){return e.apply(this,D(arguments,0,s).concat([D(arguments,s)]))}}return o}(t.params,t.fn)}),V=a?H[0]:e,$=h?H[1]:e,Y=g?H[2]:e,G=y?H[3]:e,X=w?H[4]:e,K=x?H[5]:e,Q=a?s[0].params.length:-1,tt=h?s[1].params.length:-1,tr=g?s[2].params.length:-1,te=y?s[3].params.length:-1,tn=w?s[4].params.length:-1,ti=x?s[5].params.length:-1,to=6*!!(a&&h&&g&&y&&w&&x),ts=s.length,ta=function(){for(var r=to;r<ts;r++)if(b[r](arguments))return H[r].apply(this,arguments);return u.onMismatch(t,arguments,s)},tu=function t(r,e){return arguments.length===Q&&N(r)&&q(e)?V.apply(t,arguments):arguments.length===tt&&_(r)&&U(e)?$.apply(t,arguments):arguments.length===tr&&A(r)&&L(e)?Y.apply(t,arguments):arguments.length===te&&z(r)&&Z(e)?G.apply(t,arguments):arguments.length===tn&&R(r)&&J(e)?X.apply(t,arguments):arguments.length===ti&&B(r)&&W(e)?K.apply(t,arguments):ta.apply(t,arguments)};try{Object.defineProperty(tu,"name",{value:t})}catch(t){}return i={},s.forEach(function(t){t.params.some(d)||O(t.params,!0).forEach(function(r){i[p(r)]=t.fn})}),tu.signatures=i,tu}function z(t,r,e){throw b(t,r,e)}function S(t){return -1===u.ignore.indexOf(t)}function F(t){return t.trim()}function C(t){return!!t}function I(t){return null!==t}function T(t){return 0===t.types.length}function j(t){return t[t.length-1]}function D(t,r,e){return Array.prototype.slice.call(t,r,e)}function k(t,r){for(var e=0;e<t.length;e++)if(r(t[e]))return t[e]}function P(t,r){return Array.prototype.concat.apply([],t.map(r))}function R(t){for(var r="",e=0;e<t.length;e++){var n=t[e];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===r)r=n.name;else if(r!==n.name){var i=Error("Function names do not match (expected: "+r+", actual: "+n.name+")");throw i.data={actual:n.name,expected:r},i}}}return r}function B(t){var r,e={};function n(t,n){if(e.hasOwnProperty(t)&&n!==e[t])throw(r=Error('Signature "'+t+'" is defined twice')).data={signature:t},r}for(var i=0;i<t.length;i++){var o=t[i];if("object"==typeof o.signatures)for(var s in o.signatures)o.signatures.hasOwnProperty(s)&&(n(s,o.signatures[s]),e[s]=o.signatures[s]);else if("string"==typeof o.signature)n(o.signature,o),e[o.signature]=o;else throw(r=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},r}return e}return(u=A("typed",{"string, Object":A,Object:function(t){var r=[];for(var e in t)t.hasOwnProperty(e)&&r.push(t[e]);return A(R(r),t)},"...Function":function(t){return A(R(t),B(t))},"string, ...Function":function(t,r){return A(t,B(r))}})).create=n,u.types=i,u.conversions=a,u.ignore=s,u.onMismatch=z,u.throwMismatchError=z,u.createError=b,u.convert=function(t,r){var e=h(t);if(r===e)return t;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===e&&i.to===r)return i.convert(t)}throw Error("Cannot convert from "+e+" to "+r)},u.find=function(t,r){if(!t.signatures)throw TypeError("Function is no typed-function");if("string"==typeof r){e=r.split(",");for(var e,n=0;n<e.length;n++)e[n]=e[n].trim()}else if(Array.isArray(r))e=r;else throw TypeError("String array or a comma separated string expected");var i=e.join(","),o=t.signatures[i];if(o)return o;throw TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+e.join(", ")+"))")},u.addType=function(t,r){if(!t||"string"!=typeof t.name||"function"!=typeof t.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==r){for(var e=0;e<u.types.length;e++)if("Object"===u.types[e].name)return void u.types.splice(e,0,t)}u.types.push(t)},u.addConversion=function(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(t)},u}()},"function"==typeof define&&define.amd?define([],r):t.exports=r()}}]);
|